~armagetronad-ap/armagetronad/BattleMania

« back to all changes in this revision

Viewing changes to src/tron/zone.php

  • Committer: zodiacsohma1 at gmail
  • Date: 2014-03-02 08:09:55 UTC
  • Revision ID: zodiacsohma1@gmail.com-20140302080955-r5ot6eipfe0nlpww
Simplified all fields and code in all areas for better as they seem to repeat themselves.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
    {
52
52
        foreach (Base::$base->ZONES as $key => $zone)
53
53
        {
54
 
            if (isset($zone) && !is_null($zone) && $zone instanceof Zone && ($zone == $this))
 
54
            if (isset($zone) && $zone instanceof Zone && ($zone == $this))
55
55
            {
56
56
                unset(Base::$base->ZONES[$key]);
57
57
                unset($this);
101
101
 
102
102
                        //  update the ranking system and save it!
103
103
                        $record = getRecord($target);
104
 
                        if (isset($record) && !is_null($record) && $record instanceof Record)
 
104
                        if (isset($record) && $record instanceof Record)
105
105
                        {
106
106
                            if ($record->bag->survive->time == 0)
107
107
                            {
143
143
                $obj_name = Item::GetItem($log);
144
144
 
145
145
                //  ensure item exists
146
 
                if (isset($obj_name) && !is_null($obj_name) && $obj_name instanceof Item)
 
146
                if (isset($obj_name) && $obj_name instanceof Item)
147
147
                    pickupItem($obj_name, $target);
148
148
 
149
149
                //  destroy the item
161
161
            $attack   = getAttack($attack_name);
162
162
            $attacker = getPlayerByLog($player_name);
163
163
 
164
 
            if (isset($attack) && !is_null($attack) && $attack instanceof Attack && isset($attacker) && !is_null($attacker) && $attacker instanceof Player)
 
164
            if (isset($attack) && $attack instanceof Attack && isset($attacker) && $attacker instanceof Player)
165
165
                AttackHitPlayer($this, $target, $attacker, $attack);
166
166
        }
167
167
 
182
182
            $attack   = getAttack($attack_name);
183
183
            $attacker = getPlayerByLog($player_name);
184
184
 
185
 
            if (isset($attack) && !is_null($attack) && $attack instanceof Attack && isset($attacker) && !is_null($attacker) && $attacker instanceof Player)
 
185
            if (isset($attack) && $attack instanceof Attack && isset($attacker) && $attacker instanceof Player)
186
186
                AttackHitZone($this, $target, $attacker, $attack);
187
187
        }
188
188
 
232
232
    $pPos   = new Coord(floatval(Base::$base->pieces[6]) / Base::$base->ARENA->sizeMultiplier, floatval(Base::$base->pieces[7]) / Base::$base->ARENA->sizeMultiplier);
233
233
    $pDir   = new Coord(floatval(Base::$base->pieces[8]) / Base::$base->ARENA->sizeMultiplier, floatval(Base::$base->pieces[9]) / Base::$base->ARENA->sizeMultiplier);
234
234
 
235
 
    if (isset($player) && !is_null($player) && $player instanceof Player && isset($player->cycle) && !is_null($player->cycle) && $player->cycle instanceof Cycle)
 
235
    if (isset($player) && $player instanceof Player && isset($player->cycle) && $player->cycle instanceof Cycle)
236
236
    {
237
237
        $player->cycle->pos = $pPos;
238
238
        $player->cycle->dir = $pDir;
239
239
 
240
240
        foreach (Base::$base->ZONES as $obj)
241
241
        {
242
 
            if (isset($obj) && !is_null($obj) && $obj instanceof ObjectZoneHack && ($obj->id == $id) && !$obj->destroyed)
 
242
            if (isset($obj) && $obj instanceof ObjectZoneHack && ($obj->id == $id) && !$obj->destroyed)
243
243
            {
244
244
                $obj->pos  = $pos;
245
245
                $obj->name = $name;
272
272
 
273
273
    foreach (Base::$base->ZONES as $obj)
274
274
    {
275
 
        if (isset($obj) && !is_null($obj) && $obj instanceof ObjectZoneHack && ($obj->id == $id) && !$obj->destroyed)
 
275
        if (isset($obj) && $obj instanceof ObjectZoneHack && ($obj->id == $id) && !$obj->destroyed)
276
276
        {
277
277
            $obj->name = $name;
278
278
            $obj->pos  = $pos;
279
279
 
280
280
            foreach (Base::$base->ZONES as $target)
281
281
            {
282
 
                if (isset($target) && !is_null($target) && $target instanceof Zone && ($target->id == $target_id) && !$target->destroyed)
 
282
                if (isset($target) && $target instanceof Zone && ($target->id == $target_id) && !$target->destroyed)
283
283
                {
284
284
                    $target->name = $target_name;
285
285
                    $target->pos  = $target_pos;