From 8fc1f4d06c328f9983d1ae98a62b7e8d42a28ea4 Mon Sep 17 00:00:00 2001 From: EmoGarbage404 <98561806+EmoGarbage404@users.noreply.github.com> Date: Tue, 19 Apr 2022 21:54:10 -0400 Subject: [PATCH] Zombie Bugfix (#7641) * wip * heal on bite * more fixes and additions * don't crash * Update medicine.yml * zombie claw item and damage resist * ignoredcomponents.cs * Add zombie claw, fix infection, add immunities * fix * razzle dazzle * yaml fix * Update Content.Server/Disease/DiseaseZombieSystem.cs Co-authored-by: Moony * Update Content.Server/Disease/DiseaseZombieSystem.cs Co-authored-by: Moony * Update Content.Server/Disease/DiseaseZombieSystem.cs Co-authored-by: Moony * Update Content.Server/Disease/DiseaseZombieSystem.cs Co-authored-by: Moony * sdasadsadsadasd * Generalize DiseaseProgression.cs * final final final final final final cope seethe * Update medicine.yml * Update Content.Server/Disease/Components/DiseaseZombieComponent.cs Co-authored-by: mirrorcult * Update BloodstreamSystem.cs * Update Content.Server/Disease/Components/DiseaseZombieComponent.cs Co-authored-by: mirrorcult * Update Content.Server/Disease/DiseaseZombieSystem.cs Co-authored-by: mirrorcult * fixing until i die * folder + zombietransfer fix * smol fixe * the smallest of fixes * aaaa * Infection timer buff * Update BibleSystem.cs * Update ZombieOutbreak.cs * Update zombie.ftl * Update ZombieTransferSystem.cs * Update DiseaseZombieSystem.cs * Update DiseaseZombieSystem.cs * Tunes outbreak to only happen toward the end of a round. * Update BibleSystem.cs * general fixes+cleaning code Co-authored-by: Moony Co-authored-by: mirrorcult --- .../Disease/Zombie/DiseaseZombieSystem.cs | 57 ++++++++----------- .../StationEvents/Events/ZombieOutbreak.cs | 3 +- .../ZombieTransfer/ZombieTransferSystem.cs | 6 +- Resources/Locale/en-US/disease/zombie.ftl | 1 + .../Objects/Weapons/Melee/zombieclaw.yml | 1 + 5 files changed, 32 insertions(+), 36 deletions(-) diff --git a/Content.Server/Disease/Zombie/DiseaseZombieSystem.cs b/Content.Server/Disease/Zombie/DiseaseZombieSystem.cs index 0be6c14c55..fb9758c5e5 100644 --- a/Content.Server/Disease/Zombie/DiseaseZombieSystem.cs +++ b/Content.Server/Disease/Zombie/DiseaseZombieSystem.cs @@ -1,4 +1,4 @@ -using Robust.Shared.Containers; +using Robust.Shared.Player; using Content.Server.Speech.Components; using Content.Server.Ghost.Roles.Components; using Content.Server.Disease.Components; @@ -11,6 +11,7 @@ using Content.Server.Hands.Components; using Content.Server.Nutrition.Components; using Content.Server.Mind.Components; using Content.Server.Chat.Managers; +using Content.Server.Inventory; using Content.Shared.Damage; using Content.Shared.MobState.Components; using Content.Shared.Hands.EntitySystems; @@ -27,6 +28,8 @@ namespace Content.Server.Disease.Zombie public sealed class DiseaseZombieSystem : EntitySystem { [Dependency] private readonly DamageableSystem _damageable = default!; + [Dependency] private readonly ServerInventorySystem _serverInventory = default!; + [Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly BloodstreamSystem _bloodstream = default!; [Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifier = default!; [Dependency] private readonly SharedHandsSystem _sharedHands = default!; @@ -59,6 +62,7 @@ namespace Content.Server.Disease.Zombie _bloodstream.SetBloodLossThreshold(uid, 0f, bloodstream); _bloodstream.TryModifyBleedAmount(uid, -bloodstream.BleedAmount, bloodstream); _movementSpeedModifier.RefreshMovementSpeedModifiers(uid); + EntityManager.EnsureComponent(uid).Accent = "zombie"; if (TryComp(uid, out var comp)) @@ -84,8 +88,8 @@ namespace Content.Server.Disease.Zombie _sharedHands.TryDrop(uid); var pos = EntityManager.GetComponent(uid).Coordinates; - var virtualItem = EntityManager.SpawnEntity("ZombieClaw", pos); - _sharedHands.DoPickup(uid, hand.Value, virtualItem); + var claw = EntityManager.SpawnEntity("ZombieClaw", pos); + _sharedHands.DoPickup(uid, hand.Value, claw); } } else @@ -93,41 +97,28 @@ namespace Content.Server.Disease.Zombie EnsureComp(uid); } - if (TryComp(uid, out var cmcomp)) - { - foreach (var container in cmcomp.Containers) - { - if (container.Value.ID == "gloves") - { - foreach (var entity in container.Value.ContainedEntities) - { - container.Value.Remove(entity); - } - } - } - } + if (TryComp(uid, out var servInvComp)) + _serverInventory.TryUnequip(uid, "gloves", true, true, servInvComp); - if (TryComp(uid, out var mindcomp)) - { - if (mindcomp.Mind != null && mindcomp.Mind.TryGetSession(out var session)) - { - var chatMgr = IoCManager.Resolve(); - chatMgr.DispatchServerMessage(session, Loc.GetString("zombie-infection-greeting")); - } - } + _popupSystem.PopupEntity(Loc.GetString("zombie-transform", ("target", uid)), uid, Filter.Pvs(uid)); - uid.PopupMessageEveryone(Loc.GetString("zombie-transform", ("target", uid))); if (TryComp(uid, out var metacomp)) - { metacomp.EntityName = Loc.GetString("zombie-name-prefix", ("target", metacomp.EntityName)); - if (!HasComp(uid)) //this specific component gives build test trouble so pop off, ig - { - EntityManager.EnsureComponent(uid, out var ghostcomp); - ghostcomp.RoleName = metacomp.EntityName; - ghostcomp.RoleDescription = Loc.GetString("zombie-role-desc"); - ghostcomp.RoleRules = Loc.GetString("zombie-role-rules"); - } + var mindcomp = EnsureComp(uid); + + if (mindcomp.Mind != null && mindcomp.Mind.TryGetSession(out var session)) + { + var chatMgr = IoCManager.Resolve(); + chatMgr.DispatchServerMessage(session, Loc.GetString("zombie-infection-greeting")); + } + + if (!HasComp(uid) && !mindcomp.HasMind) //this specific component gives build test trouble so pop off, ig + { + EntityManager.EnsureComponent(uid, out var ghostcomp); + ghostcomp.RoleName = Loc.GetString("zombie-generic"); + ghostcomp.RoleDescription = Loc.GetString("zombie-role-desc"); + ghostcomp.RoleRules = Loc.GetString("zombie-role-rules"); } } diff --git a/Content.Server/StationEvents/Events/ZombieOutbreak.cs b/Content.Server/StationEvents/Events/ZombieOutbreak.cs index 43083c1587..17cf0f328e 100644 --- a/Content.Server/StationEvents/Events/ZombieOutbreak.cs +++ b/Content.Server/StationEvents/Events/ZombieOutbreak.cs @@ -15,7 +15,8 @@ namespace Content.Server.StationEvents.Events [Dependency] private readonly IChatManager _chatManager = default!; public override string Name => "ZombieOutbreak"; - public override float Weight => WeightLow; + public override int EarliestStart => 50; + public override float Weight => WeightLow / 2; public override string? StartAudio => "/Audio/Announcements/bloblarm.ogg"; protected override float EndAfter => 1.0f; diff --git a/Content.Server/Weapon/Melee/ZombieTransfer/ZombieTransferSystem.cs b/Content.Server/Weapon/Melee/ZombieTransfer/ZombieTransferSystem.cs index 2f3c1b14c9..ad80f8892b 100644 --- a/Content.Server/Weapon/Melee/ZombieTransfer/ZombieTransferSystem.cs +++ b/Content.Server/Weapon/Melee/ZombieTransfer/ZombieTransferSystem.cs @@ -10,12 +10,14 @@ using Content.Shared.Damage; using Content.Shared.MobState.Components; using Content.Server.Disease; using Content.Server.Weapons.Melee.ZombieTransfer.Components; +using Content.Server.Body.Components; namespace Content.Server.Weapons.Melee.ZombieTransfer { public sealed class ZombieTransferSystem : EntitySystem { [Dependency] private readonly DiseaseSystem _disease = default!; + [Dependency] private readonly BodySystem _body = default!; [Dependency] private readonly BloodstreamSystem _bloodstream = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; public override void Initialize() @@ -37,7 +39,7 @@ namespace Content.Server.Weapons.Melee.ZombieTransfer if (args.User == entity) continue; - if (!HasComp(entity)) + if (!HasComp(entity) || HasComp(entity)) continue; if (_robustRandom.Prob(diseaseZombieComp.Probability) && HasComp(entity)) @@ -55,7 +57,7 @@ namespace Content.Server.Weapons.Melee.ZombieTransfer dspec.DamageDict.TryAdd("Piercing", -7); args.BonusDamage += dspec; } - else if (mobState.IsAlive() && !HasComp(entity)) //heals when zombies bite live entities + else if (mobState.IsAlive()) //heals when zombies bite live entities { var healingSolution = new Solution(); healingSolution.AddReagent("Bicaridine", 1.00); //if OP, reduce/change chem diff --git a/Resources/Locale/en-US/disease/zombie.ftl b/Resources/Locale/en-US/disease/zombie.ftl index 29c8d222bd..606717ed35 100644 --- a/Resources/Locale/en-US/disease/zombie.ftl +++ b/Resources/Locale/en-US/disease/zombie.ftl @@ -1,6 +1,7 @@ zombie-transform = {CAPITALIZE(THE($target))} turned into a zombie! zombie-infection-greeting = You have become a zombie. Your goal is to seek out the living and to try to infect them. Work together with your fellow zombies to overpower the remaining crewmates. +zombie-generic = zombie zombie-name-prefix = zombified {$target} zombie-role-desc = A malevolent creature of the dead. zombie-role-rules = You are an antagonist. Search out the living and bite them in order to infect them and turn them into zombies. Work together with other the zombies to overtake the station. diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Melee/zombieclaw.yml b/Resources/Prototypes/Entities/Objects/Weapons/Melee/zombieclaw.yml index 794b2c5596..b1bdd295fb 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Melee/zombieclaw.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Melee/zombieclaw.yml @@ -8,6 +8,7 @@ sprite: Objects/Weapons/Melee/zombie_claw.rsi state: icon - type: Item + - type: Sharp - type: ZombieTransfer - type: Unremoveable - type: MeleeWeapon