Make welders only deal burn damage when lit. (#5695)

This commit is contained in:
Leon Friedrich
2021-12-12 12:12:48 +13:00
committed by GitHub
parent c041a8339f
commit 237a90cd48
5 changed files with 47 additions and 15 deletions

View File

@@ -1,4 +1,5 @@
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Damage;
using Content.Shared.FixedPoint;
using Content.Shared.Sound;
using Content.Shared.Tools.Components;
@@ -49,5 +50,15 @@ namespace Content.Server.Tools.Components
[DataField("welderRefill")]
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();
}
}

View File

@@ -1,10 +1,12 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Server.Chemistry.Components;
using Content.Server.Chemistry.Components.SolutionManager;
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Items;
using Content.Server.Tools.Components;
using Content.Server.Weapon.Melee;
using Content.Shared.Audio;
using Content.Shared.Examine;
using Content.Shared.FixedPoint;
@@ -41,6 +43,13 @@ namespace Content.Server.Tools
SubscribeLocalEvent<WelderComponent, ToolUseFinishAttemptEvent>(OnWelderToolUseFinishAttempt);
SubscribeLocalEvent<WelderComponent, ComponentShutdown>(OnWelderShutdown);
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)