func (g *Game) internalCreatureSay(_creature pul.ICreature, _speakType int, _message string) bool { list := make(pul.CreatureList) if _speakType == pnet.SPEAK_YELL { position := _creature.GetPosition() // Get position of speaker g.mutexPlayerList.RLock() defer g.mutexPlayerList.RUnlock() for _, player := range g.Players { if player != nil { if position.IsInRange3p(player.GetPosition(), pos.NewPositionFrom(27, 21, 0)) { list[player.GetUID()] = player } } } } else { list = _creature.GetVisibleCreatures() } // Send chat message to all visible players for _, creature := range list { if creature.GetType() == CTYPE_PLAYER { player := creature.(*Player) // player.sendCreatureSay(_creature, _speakType, _message) player.sendToChannel(_creature, _speakType, _message, pnet.CHANNEL_LOCAL, 0) } } return true }
// CanSeeCreature checks if 2 creatures are near each others viewport func CanSeeCreature(_self pul.ICreature, _other pul.ICreature) bool { return CanSeePosition(_self.GetPosition(), _other.GetPosition()) }