mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-20 06:58:55 +03:00
# Description Bug fixes: - Re-enable damage examine for embeddable passive damage after the Wizmerge for Station AI wiped it (https://github.com/Simple-Station/Einstein-Engines/pull/1351) - Fixed a bug where emags did not have embed passive damage (due to `DamageOtherOnHitStartupEvent` only raising when `MeleeWeaponComponent` exists on the entity) Tweaks: - Added a stamina cost to spears, 6 stamina, and removed spears dealing damage to itself when thrown - Floor tiles will now break when thrown 10 times instead of 4 times - Added the MetalThud sound effect for structures when thrown, and increased the base thrown damage of structures slightly from 8 to 9 Damage examine is now sorted properly. From top to bottom: - Gun damage - Melee weapon damage - Throwing weapon damage - Embed passive damage ## Media **Laser rifle sorted damage examine**  **Spear sorted damage examine**  **Emag stats**  ## Changelog 🆑 Skubman - fix: Fixed embeddable damage over time not showing when examining an item's damage values. - fix: Fixed the emag not dealing passive damage when embedded on a target. - tweak: Examining an item's damage values now shows values in a sorted order. From top to bottom: gun damage, melee damage, throwing damage, embedded damage. - tweak: Spears now have a 6 stamina cost when thrown, and they no longer break when thrown enough times. - tweak: Floor tiles now break when thrown 10 times instead of 4 times. - tweak: Closets, lockers and crates now play the proper sound effect when thrown (by Space Wind). (cherry picked from commit 6c70875882cb9435a6172ef103660e0fcf1d27fd)
68 lines
2.6 KiB
C#
68 lines
2.6 KiB
C#
using Content.Shared.Camera;
|
|
using Content.Shared.Damage;
|
|
using Content.Shared.Damage.Components;
|
|
using Content.Shared.Damage.Events;
|
|
using Content.Shared.Damage.Systems;
|
|
using Content.Shared.Database;
|
|
using Content.Shared.Effects;
|
|
using Content.Shared.Item.ItemToggle.Components;
|
|
using Content.Shared.Mobs.Components;
|
|
using Content.Shared.Projectiles;
|
|
using Content.Shared.Popups;
|
|
using Content.Shared.Throwing;
|
|
using Content.Shared.Weapons.Melee;
|
|
using Content.Server.Weapons.Melee;
|
|
using Robust.Server.GameObjects;
|
|
using Robust.Shared.Audio;
|
|
using Robust.Shared.Physics.Components;
|
|
using Robust.Shared.Player;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Server.Damage.Systems
|
|
{
|
|
public sealed class DamageOtherOnHitSystem : SharedDamageOtherOnHitSystem
|
|
{
|
|
[Dependency] private readonly DamageExamineSystem _damageExamine = default!;
|
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
|
[Dependency] private readonly StaminaSystem _stamina = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<StaminaComponent, BeforeThrowEvent>(OnBeforeThrow);
|
|
SubscribeLocalEvent<DamageOtherOnHitComponent, DamageExamineEvent>(OnDamageExamine, after: [typeof(MeleeWeaponSystem)]);
|
|
}
|
|
|
|
private void OnBeforeThrow(EntityUid uid, StaminaComponent component, ref BeforeThrowEvent args)
|
|
{
|
|
if (!TryComp<DamageOtherOnHitComponent>(args.ItemUid, out var damage))
|
|
return;
|
|
|
|
if (component.CritThreshold - component.StaminaDamage <= damage.StaminaCost)
|
|
{
|
|
args.Cancelled = true;
|
|
_popup.PopupEntity(Loc.GetString("throw-no-stamina", ("item", args.ItemUid)), uid, uid);
|
|
return;
|
|
}
|
|
|
|
_stamina.TakeStaminaDamage(uid, damage.StaminaCost, component, visual: false);
|
|
}
|
|
|
|
private void OnDamageExamine(EntityUid uid, DamageOtherOnHitComponent component, ref DamageExamineEvent args)
|
|
{
|
|
_damageExamine.AddDamageExamine(args.Message, GetDamage(uid, component, args.User), Loc.GetString("damage-throw"));
|
|
|
|
if (component.StaminaCost == 0)
|
|
return;
|
|
|
|
var staminaCostMarkup = FormattedMessage.FromMarkupOrThrow(
|
|
Loc.GetString("damage-stamina-cost",
|
|
("type", Loc.GetString("damage-throw")), ("cost", component.StaminaCost)));
|
|
args.Message.PushNewline();
|
|
args.Message.AddMessage(staminaCostMarkup);
|
|
}
|
|
}
|
|
}
|