~armagetronad-ap/armagetronad/BattleMania

« back to all changes in this revision

Viewing changes to src/engine/cycle.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:
56
56
        $this->player->cycle = null;
57
57
        $this->player        = null;
58
58
        $this->team          = null;
 
59
        $this->bounty        = null;
59
60
    }
60
61
 
61
62
    //!< returns with the player's log name
88
89
        {
89
90
            foreach (Base::$base->CYCLES as $key => $cycle)
90
91
            {
91
 
                if (isset($cycle) && !is_null($cycle) && $cycle instanceof Cycle && ($cycle == $this))
 
92
                if (isset($cycle) && $cycle instanceof Cycle && ($cycle == $this))
92
93
                {
93
94
                    unset(Base::$base->CYCLES[$key]);
94
95
                    unset($this);
185
186
}
186
187
 
187
188
//!< Spawns a explosion on the grid
 
189
//  Note: Doesn't seem to create the explosions graphics in clients
 
190
//        while it does create the explosion radius in player tails
188
191
function SpawnExplosion(Coord $pos, $radius, Color $color)
189
192
{
190
193
    sendCommand("SPAWN_EXPLOSION", $pos->x." ".$pos->y." ".$radius." ".$color->r." ".$color->g." ".$color->b);
206
209
function CycleCreated()
207
210
{
208
211
    $player = getPlayerByLog(Base::$base->pieces[1]);
209
 
    if (isset($player) && !is_null($player) && $player instanceof Player)
 
212
    if (isset($player) && $player instanceof Player)
210
213
    {
211
214
        $pos = new Coord(floatval(Base::$base->pieces[2]) / Base::$base->ARENA->sizeMultiplier, floatval(Base::$base->pieces[3]) / Base::$base->ARENA->sizeMultiplier);
212
215
        $dir = new Coord(floatval(Base::$base->pieces[4]), floatval(Base::$base->pieces[5]));
228
231
 
229
232
        foreach (Base::$base->players_respawn as $key => $res)
230
233
        {
231
 
            if (isset($res) && !is_null($res) && $res instanceof Player)
 
234
            if (isset($res) && $res instanceof Player)
232
235
            {
233
236
                if ($res == $player)
234
237
                {
255
258
function CycleDestroyed()
256
259
{
257
260
    $player = getPlayerByLog(Base::$base->pieces[1]);
258
 
    if (isset($player) && !is_null($player) && $player instanceof Player)
 
261
    if (isset($player) && $player instanceof Player)
259
262
    {
260
263
        $cycle = $player->cycle;
261
 
        if (isset($cycle) && !is_null($cycle) && $cycle instanceof Cycle)
 
264
        if (isset($cycle) && $cycle instanceof Cycle)
262
265
        {
263
266
            $cycle->alive = false;
264
267
 
291
294
    {
292
295
        foreach (Base::$base->CYCLES as $cycle)
293
296
        {
294
 
            if (isset($cycle) && !is_null($cycle) && $cycle instanceof Cycle)
 
297
            if (isset($cycle) && $cycle instanceof Cycle)
295
298
            {
296
299
                $cycle->Timestep($time);
297
300
            }