func (g *Game) internalCreatureTeleport(_creature pul.ICreature, _from pul.ITile, _to pul.ITile) (ret int) { ret = RET_NOERROR if _from == nil || _to == nil { ret = RET_NOTPOSSIBLE } else { // Move creature object to destination tile if ret = _from.RemoveCreature(_creature, true); ret == RET_NOTPOSSIBLE { return } if ret = _to.AddCreature(_creature, false); ret == RET_NOTPOSSIBLE { _from.AddCreature(_creature, false) // Something went wrong, put creature back on old tile return } _creature.SetTile(_to) // Tell creatures this creature has been teleported g.mutexCreatureList.RLock() defer g.mutexCreatureList.RUnlock() for _, value := range g.Creatures { if value != nil { value.OnCreatureMove(_creature, _from, _to, true) } } } // No error, played succesfully teleported if ret == RET_NOERROR { ret = RET_PLAYERISTELEPORTED } return }