public static void ClientEnableInspectMenu(PlayerCorpse playerCorpse) { if (InspectMenu.Instance != null && !InspectMenu.Instance.Enabled) { InspectMenu.Instance.InspectCorpse(playerCorpse); } }
public void OnPlayerGhostDeath(PlayerGhost ghost, PlayerCorpse corpse) { ((MyRoundLogic)base.Session.RoundLogic).OnPlayerGhostDeath(ghost, corpse); if (this.wasFinalKill && base.Session.CurrentLevel.LivingPlayers == 0) { base.CancelFinalKill(); } else if (base.FFACheckForAllButOneDead()) { int num = -1; List <Entity> players = this.Session.CurrentLevel[GameTags.Player]; for (int i = 0; i < players.Count; i++) { Player item = (Player)players[i]; if (!item.Dead) { num = item.PlayerIndex; break; } } base.Session.CurrentLevel.Ending = true; if (num != -1 && base.Session.Scores [num] >= base.Session.MatchSettings.GoalScore - 1) { this.wasFinalKill = true; base.FinalKill(corpse, num); } } }
public void OnRemotePlayerDied(ref RemotePlayerDied p) { if (p.Index == localPlayerIndex) { return; } RemotePlayer player = remotePlayers[p.Index]; if (player == null) { return; } PlayerCorpse corpse = new PlayerCorpse(); corpse.OnActivated(new ActorActivationDetails { Api = Api, Pos = player.Transform.Pos, Params = new[] { (ushort)player.PlayerType, (ushort)(player.IsFacingLeft ? 1 : 0) } }); AddActor(corpse); player.UpdateFromServer(player.Transform.Pos, AnimState.Idle, -1, player.IsFacingLeft); }
public override void OnPlayerDeath(Player player, PlayerCorpse corpse, int playerIndex, DeathCause cause, Vector2 position, int killerIndex) { base.OnPlayerDeath(player, corpse, playerIndex, cause, position, killerIndex); if (killerIndex == playerIndex || killerIndex == -1) { killCountHUDs[playerIndex].Decrease(); base.AddScore(playerIndex, -1); } else if (killerIndex != -1) { killCountHUDs[killerIndex].Increase(); base.AddScore(killerIndex, 1); } int winner = base.Session.GetWinner(); if (this.wasFinalKill && winner == -1) { this.wasFinalKill = false; base.Session.CurrentLevel.Ending = false; base.CancelFinalKill(); this.endDelay.Set(90); } if (!this.wasFinalKill && winner != -1) { base.Session.CurrentLevel.Ending = true; this.wasFinalKill = true; base.FinalKill(corpse, winner); } this.AfterOnPlayerDeath(player); }
void OnPlayerCorpse(BasePlayer player, PlayerCorpse corpse) { if (!player || !corpse || !delayedItems.ContainsKey(player)) { return; } if (settings.RemoveDefault) { for (int i = 0; i < corpse.containers.Length; i++) { corpse.containers[i].Clear(); } } var list = delayedItems[player]; for (int i = 0; i < list.Count; i++) { var item = list[i]; if (!item.MoveToContainer(corpse.containers[2]) && !item.MoveToContainer(corpse.containers[0])) { ApplyVelocity(DropNearPosition(item, corpse.transform.position + new Vector3(0, 0.3f))); } } Pool.FreeList(ref list); delayedItems.Remove(player); }
public MyPlayerGhost(PlayerCorpse corpse) : base(corpse) { ownerCorpse = (MyPlayerCorpse)corpse; characterIndex = ownerCorpse.PlayerIndex; archerSounds = TowerFall.ArcherData.Archers[characterIndex].SFX; haloProperties.SaveProperties(halo); this.arrowPickupHitbox = new WrapHitbox(22f, 30f, -11f, -16f); }
public void RemovePlayerCorpse() { if (PlayerCorpse == null || !PlayerCorpse.IsValid()) { return; } PlayerCorpse.Delete(); PlayerCorpse = null; }
public PlayerDeathEventArgs(Player player, PlayerCorpse corpse, int playerIndex, DeathCause cause, Vector2 position, int killerIndex) { Player = player; Corpse = corpse; Cause = cause; Position = position; PlayerIndex = playerIndex; KillerIndex = killerIndex; }
public MyPlayerGhost(PlayerCorpse corpse) : base(corpse) { this.corpse = corpse; this.Allegiance = corpse.Allegiance; this.shield = new PlayerGhostShield(this); this.shieldHitbox = new WrapHitbox(16f, 18f, -8f, -10f); base.Add(this.shield); this.shieldRegenCounter = new Counter(240); }
public void OnPlayerGhostDeath(PlayerGhost ghost, PlayerCorpse corpse) { if ( this.miasma && this.FFACheckForAllButOneDead() ) { this.miasma.Dissipate(); } }
public override bool OverrideOwnership(Item item, AttackEntity weapon) { if (item.info.shortname == "skull.human") { PlayerCorpse component = GetComponent <PlayerCorpse>(); if ((bool)component) { item.name = CreateSkullName(component.playerName); return(true); } } return(false); }
public override bool OverrideOwnership(Item item, AttackEntity weapon) { if (item.info.shortname == "skull.human") { PlayerCorpse component = (PlayerCorpse)((Component)this).GetComponent <PlayerCorpse>(); if (Object.op_Implicit((Object)component)) { item.name = "Skull of \"" + component.playerName + "\""; return(true); } } return(false); }
public override bool OverrideOwnership(Item item, AttackEntity weapon) { if (item.info.shortname == "skull.human") { PlayerCorpse component = base.GetComponent <PlayerCorpse>(); if (component) { item.name = string.Concat("Skull of \"", component.playerName, "\""); return(true); } } return(false); }
void MethodThatPutsLootIntoCorpse(BaseNetworkable entity) { if (entity != null) { Item ammo = ItemManager.CreateByItemID(ammoType, Random.Range(0, 60)); PlayerCorpse corpse = entity.GetComponent <PlayerCorpse>(); NextTick(() => { if (ammo != null && corpse != null) { ammo.MoveToContainer(corpse.containers[0]); } }); } }
private void BecomePlayerCorpseOnServer(Vector3 force, int forceBone) { PlayerCorpse = new() { Position = Position, Rotation = Rotation }; PlayerCorpse.CopyFrom(this); PlayerCorpse.ApplyForceToBone(force, forceBone); Credits = 0; } }
// // Constructors // public MyTeamReviver(PlayerCorpse corpse, TeamReviver.Modes mode, bool ghostRevives = false) : base(corpse.BottomCenter) { this.ghostRevives = ghostRevives; this.Mode = mode; this.Corpse = corpse; this.ScreenWrap = true; base.Tag(new GameTags[] { GameTags.LightSource, GameTags.Dummy // Using this tag because it doesn't appear in 8-player }); this.LightRadius = 60f; this.LightAlpha = 1f; base.Collider = (this.normalHitbox = new WrapHitbox(24f, 25f, -12f, -20f)); this.revivingHitbox = new WrapHitbox(40f, 46f, -20f, -30f); this.playerNomralHitbox = new WrapHitbox(8f, 14f, -4f, -6f); this.reviveCounter = (float)this.ReviveTime; base.Add(this.sine = new SineWave(90)); base.Add(this.arrowSine = new SineWave(20)); switch (this.Mode) { case TeamReviver.Modes.TeamDeathmatch: this.arrowColor = (this.colorA = ArcherData.Get(corpse.TeamColor).ColorA); this.colorB = ArcherData.Get(corpse.TeamColor).ColorB; this.PlayerCanRevive = true; break; case TeamReviver.Modes.DarkWorld: { ArcherData archerData = ArcherData.Get(TFGame.Characters [corpse.PlayerIndex], TFGame.AltSelect [corpse.PlayerIndex]); this.arrowColor = (this.colorA = archerData.ColorA); this.colorB = archerData.ColorB; this.PlayerCanRevive = true; break; } case TeamReviver.Modes.Quest: { ArcherData archerData = ArcherData.Get(TFGame.Characters [corpse.PlayerIndex], TFGame.AltSelect [corpse.PlayerIndex]); this.arrowColor = (this.colorA = archerData.ColorA); this.colorB = archerData.ColorB; this.PlayerCanRevive = false; break; } } Alarm.Set(this, 60, delegate { this.canRevive = true; }, Alarm.AlarmMode.Oneshot); this.targetLightAlpha = 1f; }
public new void FinalKillTeams(PlayerCorpse corpse, Allegiance otherSpotlightTeam) { List <LevelEntity> list = new List <LevelEntity> (); for (int i = 0; i < 8; i++) { if (TFGame.Players [i] && this.Session.MatchSettings.Teams [i] == otherSpotlightTeam) { this.Session.MatchStats [i].GotWin = true; LevelEntity playerOrCorpse = this.Session.CurrentLevel.GetPlayerOrCorpse(i); if (playerOrCorpse != null && playerOrCorpse != corpse) { list.Add(playerOrCorpse); } } } this.Session.CurrentLevel.LightingLayer.SetSpotlight(list.ToArray()); this.FinalKillNoSpotlight(); }
public override void OnPlayerDeath(Player player, PlayerCorpse corpse, int playerIndex, DeathCause cause, Vector2 position, int killerIndex) { base.OnPlayerDeath(player, corpse, playerIndex, cause, position, killerIndex); this.Session.CurrentLevel.Add(activeGhosts[playerIndex] = new PlayerGhost(corpse)); if (killerIndex == playerIndex || killerIndex == -1) { if (this.Session.CurrentLevel.LivingPlayers == 0) { var otherPlayers = TFGame.Players.Select((playing, idx) => playing && idx != playerIndex ? (int?)idx : null).Where(idx => idx != null).ToList(); var randomPlayer = new Random().Choose(otherPlayers).Value; RemoveGhostAndRespawn(randomPlayer); } } else { RemoveGhostAndRespawn(killerIndex, position); } }
public void OnPlayerGhostDeath(PlayerGhost ghost, PlayerCorpse corpse) { ((MyRoundLogic)base.Session.RoundLogic).OnPlayerGhostDeath(ghost, corpse); Allegiance allegiance = default(Allegiance); if (this.wasFinalKill && base.Session.CurrentLevel.LivingPlayers == 0) { this.wasFinalKill = false; base.CancelFinalKill(); } else if (((MyRoundLogic)base.Session.RoundLogic).TeamCheckForRoundOver(out allegiance)) { base.Session.CurrentLevel.Ending = true; if (allegiance != Allegiance.Neutral && base.Session.Scores[(int)allegiance] >= base.Session.MatchSettings.GoalScore - 1) { this.wasFinalKill = true; base.FinalKillTeams(corpse, allegiance); } } }
public void OnPlayerGhostDeath(PlayerGhost ghost, PlayerCorpse corpse) { String logicName = this.RoundLogic.GetType().Name; TFGame.Log(new Exception(logicName), false); switch (logicName) { case "TeamDeathmatchRoundLogic": ((MyTeamDeathmatchRoundLogic)this.RoundLogic).OnPlayerGhostDeath(ghost, corpse); break; case "HeadhuntersRoundLogic": ((MyHeadhuntersRoundLogic)this.RoundLogic).OnPlayerGhostDeath(ghost, corpse); break; case "LastManStandingRoundLogic": ((MyLastManStandingRoundLogic)this.RoundLogic).OnPlayerGhostDeath(ghost, corpse); break; } }
public void OnPlayerGhostDeath(PlayerGhost ghost, PlayerCorpse corpse) { ((MyRoundLogic)base.Session.RoundLogic).OnPlayerGhostDeath(ghost, corpse); int winner = base.Session.GetWinner(); if (((MyRoundLogic)base.Session.RoundLogic).FFACheckForAllButOneDead()) { base.Session.CurrentLevel.Ending = true; if (winner != -1 && !this.wasFinalKill) { this.wasFinalKill = true; base.FinalKill(corpse, winner); } } else if (!this.wasFinalKill && winner != -1 && !this.OtherPlayerCouldWin(winner)) { base.Session.CurrentLevel.Ending = true; this.wasFinalKill = true; base.FinalKill(corpse, winner); } }
public override void OnPlayerDeath(Player player, PlayerCorpse corpse, int playerIndex, DeathCause cause, Vector2 position, int killerIndex) { if (this.Session.CurrentLevel.KingIntro) { this.Session.CurrentLevel.KingIntro.Laugh(); } if (this.Session.MatchSettings.Variants.GunnStyle) { GunnStyle gunnStyle = new GunnStyle(corpse); this.Session.CurrentLevel.Layers[gunnStyle.LayerIndex].Add(gunnStyle, false); } if ( this.miasma && killerIndex != -1 && this.FFACheckForAllButOneDead() //!((MyMatchVariants)this.Session.MatchSettings.Variants).GottaBustGhosts ) { this.miasma.Dissipate(); } if (killerIndex != -1 && killerIndex != playerIndex) { this.Kills[killerIndex]++; } if (killerIndex != -1 && !this.Session.CurrentLevel.IsPlayerAlive(killerIndex)) { MatchStats[] expr_F8_cp_0 = this.Session.MatchStats; expr_F8_cp_0[killerIndex].KillsWhileDead = expr_F8_cp_0[killerIndex].KillsWhileDead + 1u; } if (killerIndex != -1 && killerIndex != playerIndex) { this.Session.MatchStats[killerIndex].RegisterFastestKill(this.Time); } DeathType deathType = DeathType.Normal; if (killerIndex == playerIndex) { deathType = DeathType.Self; } else if (killerIndex != -1 && this.Session.MatchSettings.TeamMode && this.Session.MatchSettings.GetPlayerAllegiance(playerIndex) == this.Session.MatchSettings.GetPlayerAllegiance(killerIndex)) { deathType = DeathType.Team; } if (killerIndex != -1) { if (deathType == DeathType.Normal && this.Session.WasWinningAtStartOfRound(playerIndex)) { this.Session.MatchStats [killerIndex].WinnerKills += 1u; } if (!this.Session.MatchSettings.SoloMode) { this.Session.MatchStats [killerIndex].Kills.Add(deathType, cause, TFGame.Characters [playerIndex]); SaveData.Instance.Stats.Kills.Add(deathType, cause, TFGame.Characters [killerIndex]); SaveData.Instance.Stats.TotalVersusKills++; SaveData.Instance.Stats.RegisterVersusKill(killerIndex); } } this.Session.MatchStats [playerIndex].Deaths.Add(deathType, cause, (killerIndex == -1) ? (-1) : TFGame.Characters [killerIndex]); SaveData.Instance.Stats.Deaths.Add(deathType, cause, TFGame.Characters [playerIndex]); if (!this.Session.MatchSettings.SoloMode) { SessionStats.RegisterVersusKill(killerIndex, playerIndex, deathType == DeathType.Team); } }
public MyPlayerGhost(PlayerCorpse corpse) : base(corpse) { this.corpse = corpse; }
public static void ClientConfirmPlayer(Player confirmPlayer, PlayerCorpse playerCorpse, string jsonData, bool covert = false) { ConfirmationData data = PlayerCorpse.GetDezerializedData(jsonData); if (data == null) { return; } Player deadPlayer = data.Player; if (deadPlayer.IsValid()) { deadPlayer.SetRole(Utils.GetObjectByType <Role>(Utils.GetTypeByLibraryName <Role>(data.RoleName)), TeamFunctions.GetTeam(data.TeamName)); if (!covert) { deadPlayer.IsConfirmed = true; deadPlayer.CorpseConfirmer = confirmPlayer; } } if (playerCorpse.IsValid()) { playerCorpse.DeadPlayer = deadPlayer; playerCorpse.Data = data; InspectMenu.Instance.SetPlayerData(playerCorpse); } if (deadPlayer.IsValid()) { Scoreboard.Instance.UpdateClient(deadPlayer.Client); } if (!confirmPlayer.IsValid()) { return; } Client confirmClient = confirmPlayer.Client; // TODO improve if (deadPlayer.IsValid()) { InfoFeed.Current?.AddEntry( confirmClient, deadPlayer.Client, "found the body of", $"({deadPlayer.Role.Name})" ); } else { InfoFeed.Current?.AddEntry( confirmClient, $"found the body of {data.Name}!" ); } if (confirmPlayer == Local.Pawn as Player && data.Credits > 0) { InfoFeed.Current?.AddEntry( confirmClient, $"found $ {data.Credits} credits!" ); } }
public static void Postfix(Player player, PlayerCorpse corpse, int playerIndex, DeathCause cause, Vector2 position, int killerIndex) { EventController.Instance.PlayerDeath(player, corpse, playerIndex, cause, position, killerIndex); }
public void StartDragingCorpse(PlayerCorpse corpse) { Corpse = corpse; _timer?.Destroy(); _timer = _plugin.timer.Every(0.1f, TimerLoop); }
/// <summary> /// Spawns loot inside the corpse /// </summary> /// <param name="entity"></param> private void MethodThatPutsLootIntoCorpse(BaseNetworkable entity) { if (entity != null) { Item weapon = null; if (delayedWeapons.Count > 0 && putGunIntoInv) { weapon = delayedWeapons.Dequeue(); } Item ammo = null; if (dropAmmo && ammoType != 0 && Random.Range(0f, 1f) <= chanceToDropAmmo) //check if it needs to spawn ammunition { int tempAmount = Random.Range(minAmmo, maxAmmo); //amount if (tempAmount > 0) { ammo = ItemManager.CreateByItemID(ammoType, tempAmount); } } Item meds = null; if (dropMeds && Random.Range(0f, 1f) <= chanceToDropMeds) //check if it needs to spawn meds { int tempAmount = Random.Range(minMeds, maxMeds); if (tempAmount > 0) { meds = ItemManager.CreateByItemID(1079279582, tempAmount); } } PlayerCorpse corpse = entity.GetComponent <PlayerCorpse>(); if (corpse != null && corpse.containers != null && corpse.containers[0] != null && corpse.containers[1] != null && corpse.containers[2] != null) { NextTick(() => { //one tick delay needed if (removeDefLoot) { corpse.containers[0].Clear(); } //debug stuff /* * var deflist = ItemManager.GetItemDefinitions(); * * * while(!corpse.containers[0].IsFull()) * ItemManager.Create(deflist.GetRandom()).MoveToContainer(corpse.containers[0]); * * while(!corpse.containers[1].IsFull()) * ItemManager.Create(deflist.GetRandom()).MoveToContainer(corpse.containers[1]); * * while(!corpse.containers[2].IsFull()) * ItemManager.Create(deflist.GetRandom()).MoveToContainer(corpse.containers[2]);*/ if (ammo != null && corpse != null && !corpse.containers[0].IsFull()) { ammo.MoveToContainer(corpse.containers[0]); } else if (ammo != null && corpse != null && corpse.containers[0].IsFull() && dropnearcorpse) { ammo.CreateWorldObject(entity.transform.position + new Vector3(Random.Range(0f, 0.5f), Random.Range(0f, 0.5f), Random.Range(0f, 0.5f))); if ((bool)ammo.GetWorldEntity()) { ammo.GetWorldEntity().SetVelocity(new Vector3(Random.Range(-1f, 1f), Random.Range(0f, 1f), Random.Range(-1f, 1f)) * Random.Range(0, 2f)); ammo.GetWorldEntity().SetAngularVelocity(new Vector3(Random.Range(-10f, 10f), Random.Range(-10f, 10f), Random.Range(-10f, 10f)) * Random.Range(0, 2f)); } } if (meds != null && corpse != null && !corpse.containers[0].IsFull()) { meds.MoveToContainer(corpse.containers[0]); } else if (meds != null && corpse != null && corpse.containers[0].IsFull() && dropnearcorpse) { meds.CreateWorldObject(entity.transform.position + new Vector3(Random.Range(0f, 0.5f), Random.Range(0f, 0.5f), Random.Range(0f, 0.5f))); if ((bool)meds.GetWorldEntity()) { meds.GetWorldEntity().SetVelocity(new Vector3(Random.Range(-1f, 1f), Random.Range(0f, 1f), Random.Range(-1f, 1f)) * Random.Range(0, 2f)); meds.GetWorldEntity().SetAngularVelocity(new Vector3(Random.Range(-10f, 10f), Random.Range(-10f, 10f), Random.Range(-10f, 10f)) * Random.Range(0, 2f)); } } if (weapon != null && corpse != null && !corpse.containers[2].IsFull()) { weapon.MoveToContainer(corpse.containers[2]); } else if (weapon != null && corpse != null && corpse.containers[2].IsFull() && !corpse.containers[0].IsFull()) { weapon.MoveToContainer(corpse.containers[0]); } else if (weapon != null && corpse != null && corpse.containers[0].IsFull() && dropnearcorpse && corpse.containers[2].IsFull()) { weapon.CreateWorldObject(entity.transform.position + new Vector3(Random.Range(0f, 0.5f), Random.Range(0f, 0.5f), Random.Range(0f, 0.5f))); if ((bool)weapon.GetWorldEntity()) { weapon.GetWorldEntity().SetVelocity(new Vector3(Random.Range(-1f, 1f), Random.Range(0f, 1f), Random.Range(-1f, 1f)) * Random.Range(0, 2f)); weapon.GetWorldEntity().SetAngularVelocity(new Vector3(Random.Range(-10f, 10f), Random.Range(-10f, 10f), Random.Range(-10f, 10f)) * Random.Range(0, 2f)); } } }); } } }
public override void OnPlayerDeath(Player player, PlayerCorpse corpse, int playerIndex, DeathCause cause, Vector2 position, int killerIndex) { //if(cause == DeathCause.Arrow) && base.Level.Session. //base.OnPlayerDeath(player, corpse, playerIndex, cause, position, killerIndex); }
internal void PlayerDeath(Player player, PlayerCorpse corpse, int playerIndex, DeathCause cause, Vector2 position, int killerIndex) { OnPlayerDeath?.Invoke(this, new PlayerDeathEventArgs(player, corpse, playerIndex, cause, position, killerIndex)); }
//public MyLevel myLevel; public MyTeamReviver(PlayerCorpse corpse, TeamReviver.Modes mode) : base(corpse, mode) { //myLevel = (Engine.Instance.Scene as MyLevel); }