Пример #1
0
 public function removeFromGroups($entity)
 {
     $self = $this;
     $oldGroups = array();
     if ($entity && isset($entity->group)) {
         $group = $this->groups[$entity->group];
         if ($entity instanceof Player) {
             $group->players = Utils::reject($group->players, function ($id) use($entity) {
                 return $id == $entity->id;
             });
         }
         $this->map->forEachAdjacentGroup($entity->group, function ($id) use($entity, &$oldGroups, $self) {
             if (isset($self->groups[$id]->entities[$entity->id])) {
                 unset($self->groups[$id]->entities[$entity->id]);
                 $oldGroups[] = $id;
             }
         });
         $entity->group = null;
     }
     return $oldGroups;
 }
Пример #2
0
 public function forgetPlayer($playerId, $duration = 0)
 {
     $this->hatelist = Utils::reject($this->hatelist, function ($obj) use($playerId) {
         return $obj->id == $playerId;
     });
     if (empty($this->hatelist)) {
         $this->returnToSpawningPosition($duration);
     }
 }