Anmelden
DE
games/doom-jumphp / src / Game / Mobj.php · commit 8e1cb9f
<?phpnamespace App\Game;use App\Engine\Map\Sector;/** A thing of the world: the player's body, a monster, a projectile, an item (mobj_t). */final class Mobj{    public float $x;    public float $y;    public float $z;    /** position at the previous tic (the renderer interpolates) */    public float $px;    public float $py;    public float $pz;    public float $angle;    public float $momx = 0.0;    public float $momy = 0.0;    public float $momz = 0.0;    public float $radius;    public float $height;    public float $floorz = 0.0;    public float $ceilingz = 0.0;    public int $flags;    public int $health;    public array $info;    public string $state = 'NULL';    public int $tics = -1;    public string $sprite = '';    public string $frame = 'A';    public bool $bright = false;    public bool $visible = true;    public ?Sector $sector = null;    public ?Mobj $target = null;    public int $movedir = 8;    public int $movecount = 0;    public int $reactiontime = 8;    public int $threshold = 0;    public bool $removed = false;    public ?Player $player = null;    /** block of the thing block map */    public int $block = -1;    public function __construct(public int $id, public string $type, float $x, float $y, float $z)    {        $this->info = Info::type($type);        $this->x = $this->px = $x;        $this->y = $this->py = $y;        $this->z = $this->pz = $z;        $this->angle = 0.0;        $this->radius = (float)$this->info['radius'];        $this->height = (float)$this->info['height'];        $this->flags = $this->info['flags'];        $this->health = $this->info['health'];        $this->reactiontime = $this->info['reaction'];    }    public function is(int $flag): bool    {        return ($this->flags & $flag) !== 0;    }}