Новые растения в ботанику (#416)

* add haloperidol, potassium iodide

* review fixes

* review and tuning

* add: translation

* new mutations

* translation string fix

* holymelons are holy now

* add: translation

* rename holymelon

* Tomato killers don't kill the server anymore. (#28173)

* tomato killer auto death

* fix

* Update miscellaneous.yml

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com>
This commit is contained in:
ThereDrD0
2024-07-03 01:03:39 +03:00
committed by GitHub
parent 317f24da0c
commit bc57436166
83 changed files with 1389 additions and 18 deletions

View File

@@ -0,0 +1,38 @@
using Content.Server.Radiation.Components;
using Content.Shared.Damage.Components;
using Robust.Shared.Prototypes;
namespace Content.Server.Radiation.EntitySystems;
public sealed class RadiationProtectionSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<RadiationProtectionComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<RadiationProtectionComponent, ComponentShutdown>(OnShutdown);
}
private void OnInit(EntityUid uid, RadiationProtectionComponent component, ComponentInit args)
{
if (!_prototypeManager.TryIndex(component.RadiationProtectionModifierSetId, out var modifier))
return;
var buffComp = EnsureComp<DamageProtectionBuffComponent>(uid);
// add the damage modifier if it isn't in the dict yet
if (!buffComp.Modifiers.ContainsKey(component.RadiationProtectionModifierSetId))
buffComp.Modifiers.Add(component.RadiationProtectionModifierSetId, modifier);
}
private void OnShutdown(EntityUid uid, RadiationProtectionComponent component, ComponentShutdown args)
{
if (!TryComp<DamageProtectionBuffComponent>(uid, out var buffComp))
return;
// remove the damage modifier from the dict
buffComp.Modifiers.Remove(component.RadiationProtectionModifierSetId);
// if the dict is empty now, remove the buff component
if (buffComp.Modifiers.Count == 0)
RemComp<DamageProtectionBuffComponent>(uid);
}
}