コード例 #1
0
        public void ServerPlaySound(ICharacter characterNpc, CharacterSound characterSound)
        {
            using var observers = Api.Shared.GetTempList <ICharacter>();

            if (characterSound != CharacterSound.Aggression)
            {
                ServerWorld.GetScopedByPlayers(characterNpc, observers);
            }
            else
            {
                // this event is propagated on a larger distance and has sound cues
                ServerWorld.GetCharactersInRadius(characterNpc.TilePosition,
                                                  observers,
                                                  radius: this.SoundEventsNetworkRadius,
                                                  onlyPlayers: true);
            }

            this.CallClient(observers.AsList(),
                            _ => _.ClientRemote_PlaySound(characterNpc,
                                                          characterNpc.TilePosition,
                                                          characterSound));
        }