Files
crystall-punk-14/Content.Server/Weapon/Melee/ZombieTransfer/ZombieTransferSystem.cs

70 lines
2.9 KiB
C#
Raw Normal View History

using System.Linq;
using Robust.Shared.Random;
using Content.Server.Body.Systems;
using Content.Server.Disease.Components;
using Content.Server.Disease.Zombie.Components;
using Content.Server.Drone.Components;
using Content.Server.Weapon.Melee;
using Content.Shared.Chemistry.Components;
using Content.Shared.Damage;
using Content.Shared.MobState.Components;
using Content.Server.Disease;
using Content.Server.Weapons.Melee.ZombieTransfer.Components;
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 <moonheart08@users.noreply.github.com> * Update Content.Server/Disease/DiseaseZombieSystem.cs Co-authored-by: Moony <moonheart08@users.noreply.github.com> * Update Content.Server/Disease/DiseaseZombieSystem.cs Co-authored-by: Moony <moonheart08@users.noreply.github.com> * Update Content.Server/Disease/DiseaseZombieSystem.cs Co-authored-by: Moony <moonheart08@users.noreply.github.com> * 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 <lunarautomaton6@gmail.com> * Update BloodstreamSystem.cs * Update Content.Server/Disease/Components/DiseaseZombieComponent.cs Co-authored-by: mirrorcult <lunarautomaton6@gmail.com> * Update Content.Server/Disease/DiseaseZombieSystem.cs Co-authored-by: mirrorcult <lunarautomaton6@gmail.com> * 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 <moonheart08@users.noreply.github.com> Co-authored-by: mirrorcult <lunarautomaton6@gmail.com>
2022-04-19 21:54:10 -04:00
using Content.Server.Body.Components;
namespace Content.Server.Weapons.Melee.ZombieTransfer
{
public sealed class ZombieTransferSystem : EntitySystem
{
[Dependency] private readonly DiseaseSystem _disease = default!;
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 <moonheart08@users.noreply.github.com> * Update Content.Server/Disease/DiseaseZombieSystem.cs Co-authored-by: Moony <moonheart08@users.noreply.github.com> * Update Content.Server/Disease/DiseaseZombieSystem.cs Co-authored-by: Moony <moonheart08@users.noreply.github.com> * Update Content.Server/Disease/DiseaseZombieSystem.cs Co-authored-by: Moony <moonheart08@users.noreply.github.com> * 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 <lunarautomaton6@gmail.com> * Update BloodstreamSystem.cs * Update Content.Server/Disease/Components/DiseaseZombieComponent.cs Co-authored-by: mirrorcult <lunarautomaton6@gmail.com> * Update Content.Server/Disease/DiseaseZombieSystem.cs Co-authored-by: mirrorcult <lunarautomaton6@gmail.com> * 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 <moonheart08@users.noreply.github.com> Co-authored-by: mirrorcult <lunarautomaton6@gmail.com>
2022-04-19 21:54:10 -04:00
[Dependency] private readonly BodySystem _body = default!;
[Dependency] private readonly BloodstreamSystem _bloodstream = default!;
[Dependency] private readonly IRobustRandom _robustRandom = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ZombieTransferComponent, MeleeHitEvent>(OnMeleeHit);
}
private void OnMeleeHit(EntityUid uid, ZombieTransferComponent component, MeleeHitEvent args)
{
if (!EntityManager.TryGetComponent<DiseaseZombieComponent>(args.User, out var diseaseZombieComp))
return;
if (!args.HitEntities.Any())
return;
foreach (EntityUid entity in args.HitEntities)
{
if (args.User == entity)
continue;
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 <moonheart08@users.noreply.github.com> * Update Content.Server/Disease/DiseaseZombieSystem.cs Co-authored-by: Moony <moonheart08@users.noreply.github.com> * Update Content.Server/Disease/DiseaseZombieSystem.cs Co-authored-by: Moony <moonheart08@users.noreply.github.com> * Update Content.Server/Disease/DiseaseZombieSystem.cs Co-authored-by: Moony <moonheart08@users.noreply.github.com> * 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 <lunarautomaton6@gmail.com> * Update BloodstreamSystem.cs * Update Content.Server/Disease/Components/DiseaseZombieComponent.cs Co-authored-by: mirrorcult <lunarautomaton6@gmail.com> * Update Content.Server/Disease/DiseaseZombieSystem.cs Co-authored-by: mirrorcult <lunarautomaton6@gmail.com> * 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 <moonheart08@users.noreply.github.com> Co-authored-by: mirrorcult <lunarautomaton6@gmail.com>
2022-04-19 21:54:10 -04:00
if (!HasComp<MobStateComponent>(entity) || HasComp<DroneComponent>(entity))
continue;
if (_robustRandom.Prob(diseaseZombieComp.Probability) && HasComp<DiseaseCarrierComponent>(entity))
{
_disease.TryAddDisease(entity, "ZombieInfection");
}
EntityManager.EnsureComponent<MobStateComponent>(entity, out var mobState);
if ((mobState.IsDead() || mobState.IsCritical()) && !HasComp<DiseaseZombieComponent>(entity)) //dead entities are eautomatically infected. MAYBE: have activated infect ability?
{
EntityManager.AddComponent<DiseaseZombieComponent>(entity);
var dspec = new DamageSpecifier();
//these damages match the zombie claw
dspec.DamageDict.TryAdd("Slash", -12);
dspec.DamageDict.TryAdd("Piercing", -7);
args.BonusDamage += dspec;
}
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 <moonheart08@users.noreply.github.com> * Update Content.Server/Disease/DiseaseZombieSystem.cs Co-authored-by: Moony <moonheart08@users.noreply.github.com> * Update Content.Server/Disease/DiseaseZombieSystem.cs Co-authored-by: Moony <moonheart08@users.noreply.github.com> * Update Content.Server/Disease/DiseaseZombieSystem.cs Co-authored-by: Moony <moonheart08@users.noreply.github.com> * 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 <lunarautomaton6@gmail.com> * Update BloodstreamSystem.cs * Update Content.Server/Disease/Components/DiseaseZombieComponent.cs Co-authored-by: mirrorcult <lunarautomaton6@gmail.com> * Update Content.Server/Disease/DiseaseZombieSystem.cs Co-authored-by: mirrorcult <lunarautomaton6@gmail.com> * 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 <moonheart08@users.noreply.github.com> Co-authored-by: mirrorcult <lunarautomaton6@gmail.com>
2022-04-19 21:54:10 -04:00
else if (mobState.IsAlive()) //heals when zombies bite live entities
{
var healingSolution = new Solution();
healingSolution.AddReagent("Bicaridine", 1.00); //if OP, reduce/change chem
_bloodstream.TryAddToChemicals(args.User, healingSolution);
}
}
}
}
}