private void ClientRemote_OnWeaponShot( ICharacter whoFires, uint partyId, IProtoItemWeapon protoWeapon, IProtoCharacter fallbackProtoCharacter, Vector2Ushort fallbackPosition) { if (whoFires != null && !whoFires.IsInitialized) { whoFires = null; } WeaponSystemClientDisplay.ClientOnWeaponShot(whoFires, partyId, protoWeapon, fallbackProtoCharacter, fallbackPosition); }
private static void SharedCallOnWeaponShot( ICharacter character, IProtoItemWeapon protoWeapon) { if (IsClient) { // start firing weapon on Client-side WeaponSystemClientDisplay.ClientOnWeaponShot(character, partyId: 0, // not relevant here as it's the current player firing the weapon protoWeapon: protoWeapon, protoCharacter: character.ProtoCharacter, fallbackPosition: character.Position.ToVector2Ushort()); } else // if IsServer { using var observers = Shared.GetTempList <ICharacter>(); var eventNetworkRadius = (byte)Math.Max( 15, Math.Ceiling(protoWeapon.SoundPresetWeaponDistance.max)); Server.World.GetCharactersInRadius(character.TilePosition, observers, radius: eventNetworkRadius, onlyPlayers: true); observers.Remove(character); if (observers.Count > 0) { var partyId = PartySystem.ServerGetParty(character)?.Id ?? 0; Instance.CallClient(observers.AsList(), _ => _.ClientRemote_OnWeaponShot(character, partyId, protoWeapon, character.ProtoCharacter, character.Position.ToVector2Ushort())); } } }