public bool KillNotSelectedBots() { if (Sandbox.Engine.Utils.MyDebugDrawSettings.DEBUG_DRAW_BOTS) { MyBotCollection bots = MyAIComponent.Static.Bots; foreach (var entry in MyAIComponent.Static.Bots.GetAllBots()) { var localBot = entry.Value; var agent = localBot as MyAgentBot; // return to previous bot memory if (agent != null && !bots.IsBotSelectedForDegugging(agent)) { if (agent.Player.Controller.ControlledEntity is MyCharacter) { Sandbox.ModAPI.MyDamageInformation damageInfo = new Sandbox.ModAPI.MyDamageInformation(false, 1000, MyDamageType.Weapon, MySession.Static.LocalPlayerId); (agent.Player.Controller.ControlledEntity as MyCharacter).Kill(true, damageInfo); } } } } return(true); }
public bool KillNotSelectedBots() { if (Sandbox.Engine.Utils.MyDebugDrawSettings.DEBUG_DRAW_BOTS) { MyBotCollection bots = MyAIComponent.Static.Bots; foreach (var entry in MyAIComponent.Static.Bots.GetAllBots()) { var localBot = entry.Value; var agent = localBot as MyAgentBot; // return to previous bot memory if (agent != null && !bots.IsBotSelectedForDegugging(agent)) { if (agent.Player.Controller.ControlledEntity is MyCharacter) { Sandbox.ModAPI.MyDamageInformation damageInfo = new Sandbox.ModAPI.MyDamageInformation(false, 1000, MyDamageType.Weapon, MySession.Static.LocalPlayerId); (agent.Player.Controller.ControlledEntity as MyCharacter).Kill(true, damageInfo); } } } } return true; }
private void AfterDamageApplied(object target, Sandbox.ModAPI.MyDamageInformation info) { MyCharacter targetCharacter = target as MyCharacter; if (targetCharacter == null || targetCharacter.IsDead) { return; } MyEntity entity = null; MyEntities.TryGetEntityById(info.AttackerId, out entity); MyPlayer attackerPlayer = null; MyStringHash hitCue = MyStringHash.NullOrEmpty; // Because damage system is retarded... if (entity is MyCharacter || entity is MyCubeGrid || entity is MyCubeBlock) { attackerPlayer = Sync.Players.GetControllingPlayer(entity); if (attackerPlayer == null) { return; } } else { var gunBaseUser = entity as IMyGunBaseUser; if (gunBaseUser == null) { return; } if (gunBaseUser.Owner == null) { return; } attackerPlayer = Sync.Players.GetControllingPlayer(gunBaseUser.Owner); if (MyPerGameSettings.Game == GameEnum.ME_GAME) { hitCue = MyStringHash.GetOrCompute("ToolCrossbHitBody"); } } if (attackerPlayer == null || attackerPlayer.Client == null || attackerPlayer.IsBot) { return; } if (targetCharacter.ControllerInfo.Controller != null && targetCharacter.ControllerInfo.Controller.Player == attackerPlayer) { return; } if (MyPerGameSettings.Game == GameEnum.ME_GAME) { MyMultiplayer.RaiseStaticEvent(s => AfterDamageAppliedClient, hitCue, new EndpointId(attackerPlayer.Client.SteamUserId)); } else if (MyPerGameSettings.Game == GameEnum.SE_GAME) { MyMultiplayer.RaiseStaticEvent(s => AfterDamageAppliedClient, hitCue, new EndpointId(attackerPlayer.Client.SteamUserId)); } }