Death Nettle changes (#25253)
* Added ThornyComponent, ThornyImmuneComponent, and ThornySystem, as well as changed Botanists glove's to have the ThornyImmuneComponent, and for Death Nettle to have the ThornyComponent. * Added heat damage to the player if they pickup nettle without gloves. Also displays a popup message . * Revised OnHandPickUp method and reduced whitespace * Touching death nettle without gloves now does damage split between heat and caustic, and does more damage. * File-scoped namespace adherence * Code revisions, and removal of old file. * Removed thornyImmune key from botanist's gloves in gloves.yml for cleanup / yaml linter * Adds new generic DamageOnPickup, still very WIP * Starting on localization, removed _Notes.txt, adds immunity component * Added OnPickupDamageImmune component to botanists gloves * Removed botany specific components/system, moved to generic DamageOnPickup. Added code comments. Extra checks in component for whether to toss an item, damage an entity. Still WIP. * changes to audio and popups * Removes my system/component/ftl in favor of DamageOnInteract, tweaking values * me stupid * Death nettle will 'wilt' after 5 hits * added interaction delay to stop spam clicking, added a 10% stun (paralyze) chance * minor changes/cleanup * more minor changes and cleanup * Reduced maximum amatoxin within fly amanita spores. * Readjusted to allow more than 5 amatoxin above 50 potency * Remove Debug.Log statement from system * Mark Death Nettle as major contraband.
This commit is contained in:
@@ -4,9 +4,15 @@ using Content.Shared.Database;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Random;
|
||||
using Content.Shared.Throwing;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Timing;
|
||||
using Content.Shared.Random;
|
||||
using Content.Shared.Movement.Pulling.Components;
|
||||
using Content.Shared.Effects;
|
||||
using Content.Shared.Stunnable;
|
||||
|
||||
namespace Content.Shared.Damage.Systems;
|
||||
|
||||
@@ -17,6 +23,10 @@ public sealed class DamageOnInteractSystem : EntitySystem
|
||||
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly InventorySystem _inventorySystem = default!;
|
||||
[Dependency] private readonly ThrowingSystem _throwingSystem = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly SharedStunSystem _stun = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -35,6 +45,13 @@ public sealed class DamageOnInteractSystem : EntitySystem
|
||||
/// <param name="args">Contains the user that interacted with the entity</param>
|
||||
private void OnHandInteract(Entity<DamageOnInteractComponent> entity, ref InteractHandEvent args)
|
||||
{
|
||||
// Stop the interaction if the user attempts to interact with the object before the timer is finished
|
||||
if (_gameTiming.CurTime < entity.Comp.NextInteraction)
|
||||
{
|
||||
args.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entity.Comp.IsDamageActive)
|
||||
return;
|
||||
|
||||
@@ -47,9 +64,8 @@ public sealed class DamageOnInteractSystem : EntitySystem
|
||||
|
||||
// or checking the entity for the comp itself if the inventory didn't work
|
||||
if (protectiveEntity.Comp == null && TryComp<DamageOnInteractProtectionComponent>(args.User, out var protectiveComp))
|
||||
{
|
||||
protectiveEntity = (args.User, protectiveComp);
|
||||
}
|
||||
|
||||
|
||||
// if protectiveComp isn't null after all that, it means the user has protection,
|
||||
// so let's calculate how much they resist
|
||||
@@ -59,17 +75,31 @@ public sealed class DamageOnInteractSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
totalDamage = _damageableSystem.TryChangeDamage(args.User, totalDamage, origin: args.Target);
|
||||
totalDamage = _damageableSystem.TryChangeDamage(args.User, totalDamage, origin: args.Target);
|
||||
|
||||
if (totalDamage != null && totalDamage.AnyPositive())
|
||||
{
|
||||
// Record this interaction and determine when a user is allowed to interact with this entity again
|
||||
entity.Comp.LastInteraction = _gameTiming.CurTime;
|
||||
entity.Comp.NextInteraction = _gameTiming.CurTime + TimeSpan.FromSeconds(entity.Comp.InteractTimer);
|
||||
|
||||
args.Handled = true;
|
||||
_adminLogger.Add(LogType.Damaged, $"{ToPrettyString(args.User):user} injured their hand by interacting with {ToPrettyString(args.Target):target} and received {totalDamage.GetTotal():damage} damage");
|
||||
_audioSystem.PlayPredicted(entity.Comp.InteractSound, args.Target, args.User);
|
||||
|
||||
if (entity.Comp.PopupText != null)
|
||||
_popupSystem.PopupClient(Loc.GetString(entity.Comp.PopupText), args.User, args.User);
|
||||
|
||||
// Attempt to paralyze the user after they have taken damage
|
||||
if (_random.Prob(entity.Comp.StunChance))
|
||||
_stun.TryParalyze(args.User, TimeSpan.FromSeconds(entity.Comp.StunSeconds), true);
|
||||
}
|
||||
// Check if the entity's Throw bool is false, or if the entity has the PullableComponent, then if the entity is currently being pulled.
|
||||
// BeingPulled must be checked because the entity will be spastically thrown around without this.
|
||||
if (!entity.Comp.Throw || !TryComp<PullableComponent>(entity, out var pullComp) || pullComp.BeingPulled)
|
||||
return;
|
||||
|
||||
_throwingSystem.TryThrow(entity, _random.NextVector2(), entity.Comp.ThrowSpeed, doSpin: true);
|
||||
}
|
||||
|
||||
public void SetIsDamageActiveTo(Entity<DamageOnInteractComponent> entity, bool mode)
|
||||
|
||||
Reference in New Issue
Block a user