Make welders only deal burn damage when lit. (#5695)
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using Content.Shared.Chemistry.Reagent;
|
using Content.Shared.Chemistry.Reagent;
|
||||||
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using Content.Shared.Sound;
|
using Content.Shared.Sound;
|
||||||
using Content.Shared.Tools.Components;
|
using Content.Shared.Tools.Components;
|
||||||
@@ -49,5 +50,15 @@ namespace Content.Server.Tools.Components
|
|||||||
|
|
||||||
[DataField("welderRefill")]
|
[DataField("welderRefill")]
|
||||||
public SoundSpecifier WelderRefill { get; } = new SoundPathSpecifier("/Audio/Effects/refill.ogg");
|
public SoundSpecifier WelderRefill { get; } = new SoundPathSpecifier("/Audio/Effects/refill.ogg");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// When the welder is lit, this damage is added to the base melee weapon damage.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// If this is a standard welder, this damage bonus should probably subtract the entity's standard melee weapon damage
|
||||||
|
/// and replace it all with heat damage.
|
||||||
|
/// </remarks>
|
||||||
|
[DataField("litMeleeDamageBonus")]
|
||||||
|
public DamageSpecifier LitMeleeDamageBonus = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Chemistry.Components;
|
using Content.Server.Chemistry.Components;
|
||||||
using Content.Server.Chemistry.Components.SolutionManager;
|
using Content.Server.Chemistry.Components.SolutionManager;
|
||||||
using Content.Server.Chemistry.EntitySystems;
|
using Content.Server.Chemistry.EntitySystems;
|
||||||
using Content.Server.Items;
|
using Content.Server.Items;
|
||||||
using Content.Server.Tools.Components;
|
using Content.Server.Tools.Components;
|
||||||
|
using Content.Server.Weapon.Melee;
|
||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
using Content.Shared.Examine;
|
using Content.Shared.Examine;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
@@ -41,6 +43,13 @@ namespace Content.Server.Tools
|
|||||||
SubscribeLocalEvent<WelderComponent, ToolUseFinishAttemptEvent>(OnWelderToolUseFinishAttempt);
|
SubscribeLocalEvent<WelderComponent, ToolUseFinishAttemptEvent>(OnWelderToolUseFinishAttempt);
|
||||||
SubscribeLocalEvent<WelderComponent, ComponentShutdown>(OnWelderShutdown);
|
SubscribeLocalEvent<WelderComponent, ComponentShutdown>(OnWelderShutdown);
|
||||||
SubscribeLocalEvent<WelderComponent, ComponentGetState>(OnWelderGetState);
|
SubscribeLocalEvent<WelderComponent, ComponentGetState>(OnWelderGetState);
|
||||||
|
SubscribeLocalEvent<WelderComponent, MeleeHitEvent>(OnMeleeHit);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnMeleeHit(EntityUid uid, WelderComponent component, MeleeHitEvent args)
|
||||||
|
{
|
||||||
|
if (!args.Handled && component.Lit)
|
||||||
|
args.BonusDamage += component.LitMeleeDamageBonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public (FixedPoint2 fuel, FixedPoint2 capacity) GetWelderFuelAndCapacity(EntityUid uid, WelderComponent? welder = null, SolutionContainerManagerComponent? solutionContainer = null)
|
public (FixedPoint2 fuel, FixedPoint2 capacity) GetWelderFuelAndCapacity(EntityUid uid, WelderComponent? welder = null, SolutionContainerManagerComponent? solutionContainer = null)
|
||||||
|
|||||||
@@ -94,17 +94,17 @@ namespace Content.Server.Weapon.Melee
|
|||||||
|
|
||||||
RaiseLocalEvent(target, new AttackedEvent(args.Used, args.User, args.ClickLocation));
|
RaiseLocalEvent(target, new AttackedEvent(args.Used, args.User, args.ClickLocation));
|
||||||
|
|
||||||
var damage = _damageableSystem.TryChangeDamage(target,
|
var modifiedDamage = DamageSpecifier.ApplyModifierSets(comp.Damage + hitEvent.BonusDamage, hitEvent.ModifiersList);
|
||||||
DamageSpecifier.ApplyModifierSets(comp.Damage, hitEvent.ModifiersList));
|
var damageResult = _damageableSystem.TryChangeDamage(target, modifiedDamage);
|
||||||
|
|
||||||
if (damage != null)
|
if (damageResult != null)
|
||||||
{
|
{
|
||||||
if (args.Used == args.User)
|
if (args.Used == args.User)
|
||||||
_logSystem.Add(LogType.MeleeHit,
|
_logSystem.Add(LogType.MeleeHit,
|
||||||
$"{args.User} melee attacked {args.TargetEntity} using their hands and dealt {damage.Total} damage");
|
$"{args.User} melee attacked {args.TargetEntity} using their hands and dealt {damageResult.Total} damage");
|
||||||
else
|
else
|
||||||
_logSystem.Add(LogType.MeleeHit,
|
_logSystem.Add(LogType.MeleeHit,
|
||||||
$"{args.User} melee attacked {args.TargetEntity} using {args.Used} and dealt {damage.Total} damage");
|
$"{args.User} melee attacked {args.TargetEntity} using {args.Used} and dealt {damageResult.Total} damage");
|
||||||
}
|
}
|
||||||
|
|
||||||
SoundSystem.Play(Filter.Pvs(owner), comp.HitSound.GetSound(), target);
|
SoundSystem.Play(Filter.Pvs(owner), comp.HitSound.GetSound(), target);
|
||||||
@@ -167,21 +167,22 @@ namespace Content.Server.Weapon.Melee
|
|||||||
SoundSystem.Play(Filter.Pvs(owner), comp.MissSound.GetSound(), EntityManager.GetComponent<TransformComponent>(args.User).Coordinates);
|
SoundSystem.Play(Filter.Pvs(owner), comp.MissSound.GetSound(), EntityManager.GetComponent<TransformComponent>(args.User).Coordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var modifiedDamage = DamageSpecifier.ApplyModifierSets(comp.Damage + hitEvent.BonusDamage, hitEvent.ModifiersList);
|
||||||
|
|
||||||
foreach (var entity in hitEntities)
|
foreach (var entity in hitEntities)
|
||||||
{
|
{
|
||||||
RaiseLocalEvent(entity, new AttackedEvent(args.Used, args.User, args.ClickLocation));
|
RaiseLocalEvent(entity, new AttackedEvent(args.Used, args.User, args.ClickLocation));
|
||||||
|
|
||||||
var damage = _damageableSystem.TryChangeDamage(entity,
|
var damageResult = _damageableSystem.TryChangeDamage(entity, modifiedDamage);
|
||||||
DamageSpecifier.ApplyModifierSets(comp.Damage, hitEvent.ModifiersList));
|
|
||||||
|
|
||||||
if (damage != null)
|
if (damageResult != null)
|
||||||
{
|
{
|
||||||
if (args.Used == args.User)
|
if (args.Used == args.User)
|
||||||
_logSystem.Add(LogType.MeleeHit,
|
_logSystem.Add(LogType.MeleeHit,
|
||||||
$"{args.User} melee attacked {entity} using their hands and dealt {damage.Total} damage");
|
$"{args.User} melee attacked {entity} using their hands and dealt {damageResult.Total} damage");
|
||||||
else
|
else
|
||||||
_logSystem.Add(LogType.MeleeHit,
|
_logSystem.Add(LogType.MeleeHit,
|
||||||
$"{args.User} melee attacked {entity} using {args.Used} and dealt {damage.Total} damage");
|
$"{args.User} melee attacked {entity} using {args.Used} and dealt {damageResult.Total} damage");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -307,9 +308,12 @@ namespace Content.Server.Weapon.Melee
|
|||||||
public List<DamageModifierSet> ModifiersList = new();
|
public List<DamageModifierSet> ModifiersList = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A flat amount of damage to add. Same reason as above with Multiplier.
|
/// Damage to add to the default melee weapon damage. Applied before modifiers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int FlatDamage = 0;
|
/// <remarks>
|
||||||
|
/// This might be required as damage modifier sets cannot add a new damage type to a DamageSpecifier.
|
||||||
|
/// </remarks>
|
||||||
|
public DamageSpecifier BonusDamage = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A list containing every hit entity. Can be zero.
|
/// A list containing every hit entity. Can be zero.
|
||||||
@@ -317,7 +321,7 @@ namespace Content.Server.Weapon.Melee
|
|||||||
public IEnumerable<EntityUid> HitEntities { get; }
|
public IEnumerable<EntityUid> HitEntities { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The user who attacked with the melee wepaon.
|
/// The user who attacked with the melee weapon.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public EntityUid User { get; }
|
public EntityUid User { get; }
|
||||||
|
|
||||||
|
|||||||
@@ -128,6 +128,11 @@
|
|||||||
HeldPrefix: off
|
HeldPrefix: off
|
||||||
- type: Tool
|
- type: Tool
|
||||||
speed: 0.05
|
speed: 0.05
|
||||||
|
- type: Welder
|
||||||
|
litMeleeDamageBonus:
|
||||||
|
types: # When lit, negate standard melee damage and replace with heat
|
||||||
|
Heat: 0.5
|
||||||
|
Blunt: -10
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: milkalyzer
|
name: milkalyzer
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
damage:
|
damage:
|
||||||
types:
|
types:
|
||||||
Blunt: 10
|
Blunt: 10
|
||||||
Heat: 10 # Hotfix to make kudzu die.
|
|
||||||
- type: ItemStatus
|
- type: ItemStatus
|
||||||
- type: RefillableSolution
|
- type: RefillableSolution
|
||||||
solution: Welder
|
solution: Welder
|
||||||
@@ -39,6 +38,10 @@
|
|||||||
collection: Welder
|
collection: Welder
|
||||||
qualities: Welding
|
qualities: Welding
|
||||||
- type: Welder
|
- type: Welder
|
||||||
|
litMeleeDamageBonus:
|
||||||
|
types: # When lit, negate standard melee damage and replace with heat
|
||||||
|
Heat: 10
|
||||||
|
Blunt: -10
|
||||||
- type: PointLight
|
- type: PointLight
|
||||||
enabled: false
|
enabled: false
|
||||||
radius: 1.5
|
radius: 1.5
|
||||||
|
|||||||
Reference in New Issue
Block a user