Skip to content

Commit

Permalink
Throwing Mini-Update 1 (#1434)
Browse files Browse the repository at this point in the history
# Description

Bug fixes:

- Re-enable damage examine for embeddable passive damage after the
Wizmerge for Station AI wiped it
(#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**


![image](https://github.com/user-attachments/assets/6fe2a47b-b354-415a-8835-8f0e33c6da00)

**Spear sorted damage examine**


![image](https://github.com/user-attachments/assets/0c93c125-08ce-4e5b-9af9-5c5ceddcd3b1)

**Emag stats**


![image](https://github.com/user-attachments/assets/ac9b1073-b209-4a44-badf-8f8ec9f8514a)

## Changelog

:cl: 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).
  • Loading branch information
angelofallars authored Jan 5, 2025
1 parent 138048d commit 6c70875
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 20 deletions.
3 changes: 2 additions & 1 deletion Content.Server/Damage/Systems/DamageOtherOnHitSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
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;
Expand All @@ -31,7 +32,7 @@ public override void Initialize()
base.Initialize();

SubscribeLocalEvent<StaminaComponent, BeforeThrowEvent>(OnBeforeThrow);
SubscribeLocalEvent<DamageOtherOnHitComponent, DamageExamineEvent>(OnDamageExamine);
SubscribeLocalEvent<DamageOtherOnHitComponent, DamageExamineEvent>(OnDamageExamine, after: [typeof(MeleeWeaponSystem)]);
}

private void OnBeforeThrow(EntityUid uid, StaminaComponent component, ref BeforeThrowEvent args)
Expand Down
21 changes: 21 additions & 0 deletions Content.Server/Projectiles/ProjectileSystem.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
using Content.Server.Administration.Logs;
using Content.Server.Damage.Systems;
using Content.Server.Effects;
using Content.Server.Weapons.Ranged.Systems;
using Content.Shared.Camera;
using Content.Shared.Damage;
using Content.Shared.Damage.Events;
using Content.Shared.Database;
using Content.Shared.Projectiles;
using Robust.Shared.Physics.Events;
using Robust.Shared.Player;
using Robust.Shared.Utility;

namespace Content.Server.Projectiles;

Expand All @@ -22,6 +25,7 @@ public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ProjectileComponent, StartCollideEvent>(OnStartCollide);
SubscribeLocalEvent<EmbeddableProjectileComponent, DamageExamineEvent>(OnDamageExamine, after: [typeof(DamageOtherOnHitSystem)]);
}

private void OnStartCollide(EntityUid uid, ProjectileComponent component, ref StartCollideEvent args)
Expand Down Expand Up @@ -75,4 +79,21 @@ private void OnStartCollide(EntityUid uid, ProjectileComponent component, ref St
if (component.ImpactEffect != null && TryComp(uid, out TransformComponent? xform))
RaiseNetworkEvent(new ImpactEffectEvent(component.ImpactEffect, GetNetCoordinates(xform.Coordinates)), Filter.Pvs(xform.Coordinates, entityMan: EntityManager));
}

private void OnDamageExamine(EntityUid uid, EmbeddableProjectileComponent component, ref DamageExamineEvent args)
{
if (!component.EmbedOnThrow)
return;

if (!args.Message.IsEmpty)
args.Message.PushNewline();

var isHarmful = TryComp<EmbedPassiveDamageComponent>(uid, out var passiveDamage) && passiveDamage.Damage.AnyPositive();
var loc = isHarmful
? "damage-examine-embeddable-harmful"
: "damage-examine-embeddable";

var staminaCostMarkup = FormattedMessage.FromMarkupOrThrow(Loc.GetString(loc));
args.Message.AddMessage(staminaCostMarkup);
}
}
3 changes: 2 additions & 1 deletion Content.Server/Weapons/Melee/MeleeWeaponSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Server.Chat.Systems;
using Content.Server.CombatMode.Disarm;
using Content.Server.Movement.Systems;
using Content.Server.Weapons.Ranged.Systems;
using Content.Shared.Actions.Events;
using Content.Shared.Administration.Components;
using Content.Shared.CombatMode;
Expand Down Expand Up @@ -44,7 +45,7 @@ public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<MeleeSpeechComponent, MeleeHitEvent>(OnSpeechHit);
SubscribeLocalEvent<MeleeWeaponComponent, DamageExamineEvent>(OnMeleeExamineDamage);
SubscribeLocalEvent<MeleeWeaponComponent, DamageExamineEvent>(OnMeleeExamineDamage, after: [typeof(GunSystem)]);
}

private void OnMeleeExamineDamage(EntityUid uid, MeleeWeaponComponent component, ref DamageExamineEvent args)
Expand Down
24 changes: 12 additions & 12 deletions Content.Shared/Damage/Systems/SharedDamageOtherOnHitSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ public override void Initialize()
/// </summary>
private void OnMapInit(EntityUid uid, DamageOtherOnHitComponent component, MapInitEvent args)
{
if (!TryComp<MeleeWeaponComponent>(uid, out var melee))
return;

if (component.Damage.Empty)
component.Damage = melee.Damage * component.MeleeDamageMultiplier;
if (component.SoundHit == null)
component.SoundHit = melee.SoundHit;
if (component.SoundNoDamage == null)
if (TryComp<MeleeWeaponComponent>(uid, out var melee))
{
if (melee.SoundNoDamage != null)
component.SoundNoDamage = melee.SoundNoDamage;
else
component.SoundNoDamage = new SoundCollectionSpecifier("WeakHit");
if (component.Damage.Empty)
component.Damage = melee.Damage * component.MeleeDamageMultiplier;
if (component.SoundHit == null)
component.SoundHit = melee.SoundHit;
if (component.SoundNoDamage == null)
{
if (melee.SoundNoDamage != null)
component.SoundNoDamage = melee.SoundNoDamage;
else
component.SoundNoDamage = new SoundCollectionSpecifier("WeakHit");
}
}

RaiseLocalEvent(uid, new DamageOtherOnHitStartupEvent((uid, component)));
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Objects/Misc/tiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
- type: DamageOnLand
damage:
types:
Blunt: 5
Blunt: 2

- type: entity
name: steel tile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
damage:
types:
Piercing: 10
staminaCost: 6
- type: Item
size: Ginormous
- type: Clothing
Expand Down Expand Up @@ -112,10 +113,6 @@
max: 1
- !type:DoActsBehavior
acts: [ "Destruction" ]
- type: DamageOnLand
damage:
types:
Blunt: 5
- type: UseDelay
- type: Appearance
- type: SolutionContainerVisuals
Expand Down
4 changes: 3 additions & 1 deletion Resources/Prototypes/Entities/Structures/base_structure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
- type: DamageOtherOnHit
damage:
types:
Blunt: 8
Blunt: 9
staminaCost: 50
soundHit:
collection: MetalThud

- type: entity
# This means that it's not anchored on spawn.
Expand Down

0 comments on commit 6c70875

Please sign in to comment.