public function _createMobInsideArea()
 {
     $k = Types::getKindFromString($this->kind);
     $pos = $this->_getRandomPositionInsideArea();
     $mob = new Mob('1' . $this->id . '' . $k . '' . count($this->entities), $k, $pos['x'], $pos['y']);
     // @todo bind
     $mob->onMove(array($this->world, 'onMobMoveCallback'));
     return $mob;
 }
 public function spawnStaticEntities()
 {
     $count = 0;
     foreach ($this->map->staticEntities as $tid => $kindName) {
         $kind = Types::getKindFromString($kindName);
         $pos = $this->map->titleIndexToGridPosition($tid);
         if (Types::isNpc($kind)) {
             $this->addNpc($kind, $pos['x'] + 1, $pos['y']);
         }
         if (Types::isMob($kind)) {
             $mob = new Mob('7' . $kind . $count++, $kind, $pos['x'] + 1, $pos['y']);
             $self = $this;
             $mob->onRespawn(function () use($mob, $self) {
                 $mob->isDead = false;
                 $self->addMob($mob);
                 if (!empty($mob->area) && $mob->area instanceof ChestArea) {
                     $mob->area->addToArea($mob);
                 }
             });
             // @todo bind
             $mob->onMove(array($self, 'onMobMoveCallback'));
             $this->addMob($mob);
             $this->tryAddingMobToChestArea($mob);
         }
         if (Types::isItem($kind)) {
             $this->addStaticItem($this->createItem($kind, $pos['x'] + 1, $pos['y']));
         }
     }
 }