diff --git a/Content.Server/Chemistry/ReagentEffects/HealthChange.cs b/Content.Server/Chemistry/ReagentEffects/HealthChange.cs index 2da455b780..54945d92ad 100644 --- a/Content.Server/Chemistry/ReagentEffects/HealthChange.cs +++ b/Content.Server/Chemistry/ReagentEffects/HealthChange.cs @@ -5,6 +5,8 @@ using Content.Shared.Damage.Prototypes; using Content.Shared.FixedPoint; using Content.Shared.Localizations; +using Content.Shared.SimpleStation14.Damage.Events; +using Content.Shared.SimpleStation14.Damage.Systems; using JetBrains.Annotations; using Robust.Shared.Prototypes; @@ -112,10 +114,17 @@ protected override string ReagentEffectGuidebookText(IPrototypeManager prototype public override void Effect(ReagentEffectArgs args) { + // Parkstation-ReagentDamageModifiers Start + var damage = Damage; + + damage = args.EntityManager.System().ModifyDamage(args.SolutionEntity, damage); + var scale = ScaleByQuantity ? args.Quantity * 2 : FixedPoint2.New(1); // Parkstation-fixReagentSuperPotency scale *= args.Scale; + damage *= scale; - args.EntityManager.System().TryChangeDamage(args.SolutionEntity, Damage * scale, IgnoreResistances); + args.EntityManager.System().TryChangeDamage(args.SolutionEntity, damage, IgnoreResistances); + // Parkstation-ReagentDamageModifiers End } } } diff --git a/Content.Shared/SimpleStation14/Damage/Components/ReagentDamageModifierComponent.cs b/Content.Shared/SimpleStation14/Damage/Components/ReagentDamageModifierComponent.cs new file mode 100644 index 0000000000..bb0dfa2243 --- /dev/null +++ b/Content.Shared/SimpleStation14/Damage/Components/ReagentDamageModifierComponent.cs @@ -0,0 +1,14 @@ +using Content.Shared.Damage.Prototypes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; + +namespace Content.Shared.SimpleStation14.Damage.Components; + +[RegisterComponent] +public sealed class ReagentDamageModifierComponent : Component +{ + /// + /// Modifier set prototype to use for reagent damages + /// + [DataField("modifierSet", customTypeSerializer: typeof(PrototypeIdSerializer), required: true)] + public string ModifierSet = ""; +} diff --git a/Content.Shared/SimpleStation14/Damage/Events/DamageEvents.cs b/Content.Shared/SimpleStation14/Damage/Events/DamageEvents.cs new file mode 100644 index 0000000000..047903e9fd --- /dev/null +++ b/Content.Shared/SimpleStation14/Damage/Events/DamageEvents.cs @@ -0,0 +1,16 @@ +using Content.Shared.Damage; + +namespace Content.Shared.SimpleStation14.Damage.Events; + +[ByRefEvent] +public sealed class ReagentDamageModifyEvent : EntityEventArgs +{ + public readonly DamageSpecifier OriginalDamage; + public DamageSpecifier Damage; + + public ReagentDamageModifyEvent(DamageSpecifier damage) + { + OriginalDamage = damage; + Damage = damage; + } +} diff --git a/Content.Shared/SimpleStation14/Damage/Systems/ReagentDamageModifierSystem.cs b/Content.Shared/SimpleStation14/Damage/Systems/ReagentDamageModifierSystem.cs new file mode 100644 index 0000000000..a1fd017d74 --- /dev/null +++ b/Content.Shared/SimpleStation14/Damage/Systems/ReagentDamageModifierSystem.cs @@ -0,0 +1,46 @@ +using Content.Shared.Damage; +using Content.Shared.Damage.Prototypes; +using Content.Shared.FixedPoint; +using Content.Shared.SimpleStation14.Damage.Events; +using Content.Shared.SimpleStation14.Damage.Components; +using Robust.Shared.Prototypes; + +namespace Content.Shared.SimpleStation14.Damage.Systems; + +public sealed class ReagentDamageModifierSystem : EntitySystem +{ + [Dependency] private readonly IPrototypeManager _prototype = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnReagentDamage); + } + + + /// + /// Applies a modifier set from the component to the reagent damage + /// + private void OnReagentDamage(EntityUid uid, ReagentDamageModifierComponent component, ref ReagentDamageModifyEvent args) + { + if (_prototype.TryIndex(component.ModifierSet, out var modifier)) + { + args.Damage = DamageSpecifier.ApplyModifierSet(args.Damage, modifier); + } + } + + + /// + /// Sends an event requesting reagent damage modifications since the HealthChange reagent effect can't send events + /// + /// Entity to raise the event on + /// Damage to be taken for modification + /// Modified damage set + public DamageSpecifier ModifyDamage(EntityUid uid, DamageSpecifier originalDamage) + { + var ev = new ReagentDamageModifyEvent(originalDamage); + RaiseLocalEvent(uid, ref ev); + return ev.Damage; + } +} diff --git a/Resources/Prototypes/Damage/modifier_sets.yml b/Resources/Prototypes/Damage/modifier_sets.yml index f9edcb3193..1c60b674b1 100644 --- a/Resources/Prototypes/Damage/modifier_sets.yml +++ b/Resources/Prototypes/Damage/modifier_sets.yml @@ -109,12 +109,19 @@ - type: damageModifierSet id: Slime coefficients: - Blunt: 0.6 - Slash: 1.2 - Piercing: 1.2 - Cold: 1.5 - Poison: 0.8 + Blunt: 2 # Lots of blunt, if they do more than 5 damage + Slash: 1.5 + Piercing: 0.5 + Cold: 1.6 + Heat: 0.4 + Poison: -1 Cellular: 0.2 + Asphyxiation: 0.9 + Bloodloss: 1.1 + Shock: 0.4 + Radiation: 0.5 + flatReductions: + Blunt: 4.5 - type: damageModifierSet id: Infernal diff --git a/Resources/Prototypes/Entities/Mobs/Species/slime.yml b/Resources/Prototypes/Entities/Mobs/Species/slime.yml index 829ba7f008..016eb7ade3 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/slime.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/slime.yml @@ -77,6 +77,18 @@ naturalImmunities: - Ultragigacancer - BleedersBite + - type: ReagentDamageModifier + modifierSet: SlimeReagents + - type: Temperature + heatDamageThreshold: 422 + coldDamageThreshold: 285 + currentTemperature: 320 + coldDamage: + types: + Cold : 0.3 + heatDamage: + types: + Heat : 0.1 - type: entity save: false diff --git a/Resources/Prototypes/SimpleStation14/Damage/modifier_sets.yml b/Resources/Prototypes/SimpleStation14/Damage/modifier_sets.yml index 4df72522d3..e2e33d315b 100644 --- a/Resources/Prototypes/SimpleStation14/Damage/modifier_sets.yml +++ b/Resources/Prototypes/SimpleStation14/Damage/modifier_sets.yml @@ -31,3 +31,8 @@ Shock: 1.25 Radiation: 1.3 +- type: damageModifierSet + id: SlimeReagents + coefficients: + Poison: -1 + minimumDamageToDamage: -999 diff --git a/Resources/ServerInfo/SimpleStation14/Guidebook/Species/WizdenSpecies/Slime.xml b/Resources/ServerInfo/SimpleStation14/Guidebook/Species/WizdenSpecies/Slime.xml index a42400b541..820e8b0a19 100644 --- a/Resources/ServerInfo/SimpleStation14/Guidebook/Species/WizdenSpecies/Slime.xml +++ b/Resources/ServerInfo/SimpleStation14/Guidebook/Species/WizdenSpecies/Slime.xml @@ -9,19 +9,28 @@ Slimes are sentient beings made from jelly that commonly appear as humans to ble ## Ability Differences -- Slimes have jelly instead of blood, which is toxic to other species when consumed. -- Slimes are incapable of living in cold environments, dying very quickly. -- To contrast, Slimes are able to survive longer in hot environments. -- Take less brute damage. -- Take more slash damage. -- Breathe Nitrogen instead of Oxygen. +- Have jelly instead of blood, which is toxic to other species when consumed +- Incapable of living in cold environments, dying very quickly +- Able to live in warmer environments +- Breathe Nitrogen instead of Oxygen +- Poison damage is inverted +- Minor blunt damages are without effect, but strong damages are singificantly more effective +- Take more slash damage +- Take half piercing damage +- Take more cold damage +- Take much less heat damage +- Take much less cellular damage +- Take a little less asphyxiation damage +- Take a little more bloodloss damage +- Take much less shock damage +- Take much less radiation damage ## Physical Differences -- Slimes are slightly transparent. -- Can have any color of skin. -- Have several additional marking options. -- Have different voices (screams/laughs). -- Can "Squish" (emote). -- Can be Genderless. +- Slightly transparent +- Can have any color of skin +- Several additional marking options +- Different voices (screams/laughs) +- Can "Squish" (emote) +- Can be genderless