2020-07-08 13:41:32 +02:00
|
|
|
using System;
|
2020-08-18 14:39:08 +02:00
|
|
|
using System.Threading.Tasks;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Server.Act;
|
2021-07-19 12:07:37 +02:00
|
|
|
using Content.Server.Atmos.EntitySystems;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Server.Chat.Managers;
|
|
|
|
|
using Content.Server.Chemistry.Components;
|
|
|
|
|
using Content.Server.Explosion;
|
|
|
|
|
using Content.Server.Items;
|
|
|
|
|
using Content.Server.Notification;
|
2021-07-10 17:35:33 +02:00
|
|
|
using Content.Shared.Audio;
|
2021-09-06 15:49:44 +02:00
|
|
|
using Content.Shared.Chemistry.Components;
|
|
|
|
|
using Content.Shared.Chemistry.Components.SolutionManager;
|
|
|
|
|
using Content.Shared.Chemistry.EntitySystems;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Chemistry.Reagent;
|
|
|
|
|
using Content.Shared.Interaction;
|
2021-06-13 14:52:40 +02:00
|
|
|
using Content.Shared.Notification.Managers;
|
2021-07-10 17:35:33 +02:00
|
|
|
using Content.Shared.Sound;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Temperature;
|
|
|
|
|
using Content.Shared.Tool;
|
2020-05-11 15:26:07 +02:00
|
|
|
using Robust.Server.GameObjects;
|
2021-03-21 09:12:03 -07:00
|
|
|
using Robust.Shared.Audio;
|
2020-05-11 15:26:07 +02:00
|
|
|
using Robust.Shared.GameObjects;
|
2021-07-12 01:32:10 -07:00
|
|
|
using Robust.Shared.GameStates;
|
2020-05-11 15:26:07 +02:00
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
using Robust.Shared.Localization;
|
2021-03-21 09:12:03 -07:00
|
|
|
using Robust.Shared.Player;
|
2021-02-18 09:09:07 +01:00
|
|
|
using Robust.Shared.Players;
|
2021-03-05 01:08:38 +01:00
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2020-05-11 15:26:07 +02:00
|
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Tools.Components
|
2020-05-11 15:26:07 +02:00
|
|
|
{
|
|
|
|
|
[RegisterComponent]
|
|
|
|
|
[ComponentReference(typeof(ToolComponent))]
|
2020-07-02 14:50:57 -07:00
|
|
|
[ComponentReference(typeof(IToolComponent))]
|
2021-01-11 00:17:28 +01:00
|
|
|
[ComponentReference(typeof(IHotItem))]
|
2021-07-12 01:32:10 -07:00
|
|
|
[NetworkedComponent()]
|
2021-09-06 15:49:44 +02:00
|
|
|
public class WelderComponent : ToolComponent, IUse, ISuicideAct, IHotItem, IAfterInteract
|
2020-05-11 15:26:07 +02:00
|
|
|
{
|
2020-07-08 13:41:32 +02:00
|
|
|
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
|
2020-05-11 15:26:07 +02:00
|
|
|
|
|
|
|
|
public override string Name => "Welder";
|
|
|
|
|
|
2021-09-06 15:49:44 +02:00
|
|
|
public const string SolutionName = "welder";
|
|
|
|
|
|
2020-05-11 15:26:07 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Default Cost of using the welder fuel for an action
|
|
|
|
|
/// </summary>
|
|
|
|
|
public const float DefaultFuelCost = 10;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Rate at which we expunge fuel from ourselves when activated
|
|
|
|
|
/// </summary>
|
|
|
|
|
public const float FuelLossRate = 0.5f;
|
|
|
|
|
|
2020-07-08 13:41:32 +02:00
|
|
|
private bool _welderLit;
|
|
|
|
|
private WelderSystem _welderSystem = default!;
|
|
|
|
|
private SpriteComponent? _spriteComponent;
|
|
|
|
|
private PointLightComponent? _pointLightComponent;
|
2020-05-11 15:26:07 +02:00
|
|
|
|
2021-08-13 11:04:23 +02:00
|
|
|
[DataField("weldSounds")]
|
|
|
|
|
private SoundSpecifier WeldSounds { get; set; } = new SoundCollectionSpecifier("Welder");
|
2021-07-10 17:35:33 +02:00
|
|
|
|
|
|
|
|
[DataField("welderOffSounds")]
|
|
|
|
|
private SoundSpecifier WelderOffSounds { get; set; } = new SoundCollectionSpecifier("WelderOff");
|
|
|
|
|
|
|
|
|
|
[DataField("welderOnSounds")]
|
|
|
|
|
private SoundSpecifier WelderOnSounds { get; set; } = new SoundCollectionSpecifier("WelderOn");
|
|
|
|
|
|
|
|
|
|
[DataField("welderRefill")]
|
|
|
|
|
private SoundSpecifier WelderRefill { get; set; } = new SoundPathSpecifier("/Audio/Effects/refill.ogg");
|
2020-07-29 15:14:04 +02:00
|
|
|
|
2021-09-06 15:49:44 +02:00
|
|
|
[ViewVariables] public float Fuel => WelderSolution?.GetReagentQuantity("WeldingFuel").Float() ?? 0f;
|
2020-05-11 15:26:07 +02:00
|
|
|
|
2021-09-06 15:49:44 +02:00
|
|
|
[ViewVariables] public float FuelCapacity => WelderSolution?.MaxVolume.Float() ?? 0f;
|
|
|
|
|
|
|
|
|
|
private Solution? WelderSolution
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
Owner.EntityManager.EntitySysManager.GetEntitySystem<SolutionContainerSystem>()
|
|
|
|
|
.TryGetSolution(Owner, SolutionName, out var solution);
|
|
|
|
|
return solution;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-05-11 15:26:07 +02:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Status of welder, whether it is ignited
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables]
|
|
|
|
|
public bool WelderLit
|
|
|
|
|
{
|
|
|
|
|
get => _welderLit;
|
|
|
|
|
private set
|
|
|
|
|
{
|
|
|
|
|
_welderLit = value;
|
|
|
|
|
Dirty();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-11 00:17:28 +01:00
|
|
|
bool IHotItem.IsCurrentlyHot()
|
|
|
|
|
{
|
|
|
|
|
return WelderLit;
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-19 19:41:26 -07:00
|
|
|
protected override void Initialize()
|
2020-05-11 15:26:07 +02:00
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
|
2020-05-19 13:55:52 +02:00
|
|
|
AddQuality(ToolQuality.Welding);
|
2020-05-11 15:26:07 +02:00
|
|
|
|
|
|
|
|
_welderSystem = _entitySystemManager.GetEntitySystem<WelderSystem>();
|
|
|
|
|
|
2021-09-06 15:49:44 +02:00
|
|
|
Owner.EnsureComponent<SolutionContainerManagerComponent>();
|
2020-05-11 15:26:07 +02:00
|
|
|
Owner.TryGetComponent(out _spriteComponent);
|
2020-07-08 13:41:32 +02:00
|
|
|
Owner.TryGetComponent(out _pointLightComponent);
|
2021-09-06 15:49:44 +02:00
|
|
|
EntitySystem.Get<SolutionContainerSystem>().EnsureSolution(Owner, "welder");
|
2020-05-11 15:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
2021-02-18 09:09:07 +01:00
|
|
|
public override ComponentState GetComponentState(ICommonSession player)
|
2020-05-11 15:26:07 +02:00
|
|
|
{
|
|
|
|
|
return new WelderComponentState(FuelCapacity, Fuel, WelderLit);
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-06 15:49:44 +02:00
|
|
|
public override async Task<bool> UseTool(IEntity user, IEntity? target, float doAfterDelay,
|
|
|
|
|
ToolQuality toolQualityNeeded, Func<bool>? doAfterCheck = null)
|
2020-05-11 15:26:07 +02:00
|
|
|
{
|
2020-08-18 14:39:08 +02:00
|
|
|
bool ExtraCheck()
|
|
|
|
|
{
|
|
|
|
|
var extraCheck = doAfterCheck?.Invoke() ?? true;
|
|
|
|
|
|
|
|
|
|
if (!CanWeld(DefaultFuelCost))
|
|
|
|
|
{
|
2021-03-16 15:50:20 +01:00
|
|
|
target?.PopupMessage(user, "Can't weld!");
|
2020-08-18 14:39:08 +02:00
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return extraCheck;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var canUse = await base.UseTool(user, target, doAfterDelay, toolQualityNeeded, ExtraCheck);
|
2020-05-19 13:55:52 +02:00
|
|
|
|
2020-05-23 14:26:41 +02:00
|
|
|
return toolQualityNeeded.HasFlag(ToolQuality.Welding) ? canUse && TryWeld(DefaultFuelCost, user) : canUse;
|
2020-05-11 15:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
2021-09-06 15:49:44 +02:00
|
|
|
public async Task<bool> UseTool(IEntity user, IEntity target, float doAfterDelay, ToolQuality toolQualityNeeded,
|
|
|
|
|
float fuelConsumed, Func<bool>? doAfterCheck = null)
|
2020-05-17 12:58:54 +02:00
|
|
|
{
|
2020-08-18 14:39:08 +02:00
|
|
|
bool ExtraCheck()
|
|
|
|
|
{
|
|
|
|
|
var extraCheck = doAfterCheck?.Invoke() ?? true;
|
|
|
|
|
|
|
|
|
|
return extraCheck && CanWeld(fuelConsumed);
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-06 15:49:44 +02:00
|
|
|
return await base.UseTool(user, target, doAfterDelay, toolQualityNeeded, ExtraCheck) &&
|
|
|
|
|
TryWeld(fuelConsumed, user);
|
2020-05-17 12:58:54 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-08 13:41:32 +02:00
|
|
|
private bool TryWeld(float value, IEntity? user = null, bool silent = false)
|
2020-05-11 15:26:07 +02:00
|
|
|
{
|
2020-05-23 14:26:41 +02:00
|
|
|
if (!WelderLit)
|
|
|
|
|
{
|
2021-03-15 21:55:49 +01:00
|
|
|
if (!silent && user != null)
|
2021-06-21 02:13:54 +02:00
|
|
|
Owner.PopupMessage(user, Loc.GetString("welder-component-welder-not-lit-message"));
|
2021-03-15 21:55:49 +01:00
|
|
|
|
2020-05-23 14:26:41 +02:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!CanWeld(value))
|
|
|
|
|
{
|
2021-03-15 21:55:49 +01:00
|
|
|
if (!silent && user != null)
|
2021-06-21 02:13:54 +02:00
|
|
|
Owner.PopupMessage(user, Loc.GetString("welder-component-cannot-weld-message"));
|
2021-03-15 21:55:49 +01:00
|
|
|
|
2020-05-27 20:05:12 -03:00
|
|
|
return false;
|
2020-05-23 14:26:41 +02:00
|
|
|
}
|
|
|
|
|
|
2021-09-06 15:49:44 +02:00
|
|
|
if (WelderSolution == null)
|
2020-05-11 15:26:07 +02:00
|
|
|
return false;
|
|
|
|
|
|
2021-09-06 15:49:44 +02:00
|
|
|
var succeeded = EntitySystem.Get<SolutionContainerSystem>()
|
|
|
|
|
.TryRemoveReagent(Owner.Uid, WelderSolution, "WeldingFuel", ReagentUnit.New(value));
|
2020-07-29 15:14:04 +02:00
|
|
|
|
2021-07-31 19:52:33 +02:00
|
|
|
if (succeeded && !silent)
|
2020-07-29 15:14:04 +02:00
|
|
|
{
|
2021-07-31 19:52:33 +02:00
|
|
|
PlaySound(WeldSounds);
|
2020-07-29 15:14:04 +02:00
|
|
|
}
|
2021-09-06 15:49:44 +02:00
|
|
|
|
2020-07-29 15:14:04 +02:00
|
|
|
return succeeded;
|
2020-05-11 15:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
2020-05-19 13:55:52 +02:00
|
|
|
private bool CanWeld(float value)
|
2020-05-11 15:26:07 +02:00
|
|
|
{
|
2020-05-19 13:55:52 +02:00
|
|
|
return Fuel > value || Qualities != ToolQuality.Welding;
|
2020-05-11 15:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
2020-05-19 13:55:52 +02:00
|
|
|
private bool CanLitWelder()
|
2020-05-11 15:26:07 +02:00
|
|
|
{
|
2020-05-19 13:55:52 +02:00
|
|
|
return Fuel > 0 || Qualities != ToolQuality.Welding;
|
2020-05-11 15:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Deactivates welding tool if active, activates welding tool if possible
|
|
|
|
|
/// </summary>
|
2020-07-08 13:41:32 +02:00
|
|
|
private bool ToggleWelderStatus(IEntity? user = null)
|
2020-05-11 15:26:07 +02:00
|
|
|
{
|
2020-05-24 19:44:22 +00:00
|
|
|
var item = Owner.GetComponent<ItemComponent>();
|
|
|
|
|
|
2020-05-11 15:26:07 +02:00
|
|
|
if (WelderLit)
|
|
|
|
|
{
|
|
|
|
|
WelderLit = false;
|
|
|
|
|
// Layer 1 is the flame.
|
2020-05-24 19:44:22 +00:00
|
|
|
item.EquippedPrefix = "off";
|
2020-07-08 13:41:32 +02:00
|
|
|
_spriteComponent?.LayerSetVisible(1, false);
|
|
|
|
|
|
|
|
|
|
if (_pointLightComponent != null) _pointLightComponent.Enabled = false;
|
|
|
|
|
|
2021-07-31 19:52:33 +02:00
|
|
|
PlaySound(WelderOffSounds, -5);
|
2020-08-15 00:12:30 +02:00
|
|
|
_welderSystem.Unsubscribe(this);
|
2020-05-11 15:26:07 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-15 21:55:49 +01:00
|
|
|
if (!CanLitWelder() && user != null)
|
2020-05-23 14:26:41 +02:00
|
|
|
{
|
2021-06-21 02:13:54 +02:00
|
|
|
Owner.PopupMessage(user, Loc.GetString("welder-component-no-fuel-message"));
|
2020-05-23 14:26:41 +02:00
|
|
|
return false;
|
|
|
|
|
}
|
2020-05-11 15:26:07 +02:00
|
|
|
|
|
|
|
|
WelderLit = true;
|
2020-05-24 19:44:22 +00:00
|
|
|
item.EquippedPrefix = "on";
|
2020-07-08 13:41:32 +02:00
|
|
|
_spriteComponent?.LayerSetVisible(1, true);
|
|
|
|
|
|
|
|
|
|
if (_pointLightComponent != null) _pointLightComponent.Enabled = true;
|
|
|
|
|
|
2021-07-31 19:52:33 +02:00
|
|
|
PlaySound(WelderOnSounds, -5);
|
2020-08-15 00:12:30 +02:00
|
|
|
_welderSystem.Subscribe(this);
|
2020-08-11 22:34:37 +02:00
|
|
|
|
2021-07-19 12:07:37 +02:00
|
|
|
EntitySystem.Get<AtmosphereSystem>().HotspotExpose(Owner.Transform.Coordinates, 700, 50, true);
|
2020-08-11 22:34:37 +02:00
|
|
|
|
2020-05-11 15:26:07 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-04 17:44:49 +01:00
|
|
|
bool IUse.UseEntity(UseEntityEventArgs eventArgs)
|
2020-05-11 15:26:07 +02:00
|
|
|
{
|
2020-05-23 14:26:41 +02:00
|
|
|
return ToggleWelderStatus(eventArgs.User);
|
2020-05-11 15:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
2020-08-15 00:12:30 +02:00
|
|
|
protected override void Shutdown()
|
|
|
|
|
{
|
|
|
|
|
base.Shutdown();
|
|
|
|
|
_welderSystem.Unsubscribe(this);
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-11 15:26:07 +02:00
|
|
|
public void OnUpdate(float frameTime)
|
|
|
|
|
{
|
2020-08-15 00:12:30 +02:00
|
|
|
if (!HasQuality(ToolQuality.Welding) || !WelderLit || Owner.Deleted)
|
2020-05-11 15:26:07 +02:00
|
|
|
return;
|
|
|
|
|
|
2021-09-06 15:49:44 +02:00
|
|
|
EntitySystem.Get<SolutionContainerSystem>().TryRemoveReagent(Owner.Uid, WelderSolution, "WeldingFuel",
|
|
|
|
|
ReagentUnit.New(FuelLossRate * frameTime));
|
2020-05-11 15:26:07 +02:00
|
|
|
|
2021-07-19 12:07:37 +02:00
|
|
|
EntitySystem.Get<AtmosphereSystem>().HotspotExpose(Owner.Transform.Coordinates, 700, 50, true);
|
2020-08-14 18:03:52 +02:00
|
|
|
|
2020-05-11 15:26:07 +02:00
|
|
|
if (Fuel == 0)
|
|
|
|
|
ToggleWelderStatus();
|
|
|
|
|
}
|
2020-05-27 20:05:12 -03:00
|
|
|
|
2021-02-04 17:44:49 +01:00
|
|
|
SuicideKind ISuicideAct.Suicide(IEntity victim, IChatManager chat)
|
2020-05-27 20:05:12 -03:00
|
|
|
{
|
2020-08-30 11:28:46 +02:00
|
|
|
string othersMessage;
|
|
|
|
|
string selfMessage;
|
|
|
|
|
|
2020-05-27 20:05:12 -03:00
|
|
|
if (TryWeld(5, victim, silent: true))
|
|
|
|
|
{
|
2021-07-31 19:52:33 +02:00
|
|
|
PlaySound(WeldSounds);
|
2020-08-30 11:28:46 +02:00
|
|
|
|
|
|
|
|
othersMessage =
|
2021-06-21 02:13:54 +02:00
|
|
|
Loc.GetString("welder-component-suicide-lit-others-message",
|
2021-09-06 15:49:44 +02:00
|
|
|
("victim", victim));
|
2020-08-30 11:28:46 +02:00
|
|
|
victim.PopupMessageOtherClients(othersMessage);
|
|
|
|
|
|
2021-06-21 02:13:54 +02:00
|
|
|
selfMessage = Loc.GetString("welder-component-suicide-lit-message");
|
2020-08-30 11:28:46 +02:00
|
|
|
victim.PopupMessage(selfMessage);
|
|
|
|
|
|
2020-05-27 20:05:12 -03:00
|
|
|
return SuicideKind.Heat;
|
|
|
|
|
}
|
Bodysystem and damagesystem rework (#1544)
* Things and stuff with grids, unfinished w/ code debug changes.
* Updated submodule and also lost some progress cause I fucked it up xd
* First unfinished draft of the BodySystem. Doesn't compile.
* More changes to make it compile, but still just a framework. Doesn't do anything at the moment.
* Many cleanup changes.
* Revert "Merge branch 'master' of https://github.com/GlassEclipse/space-station-14 into body_system"
This reverts commit ddd4aebbc76cf2a0b7b102f72b93d55a0816c88c, reversing
changes made to 12d0dd752706bdda8879393bd8191a1199a0c978.
* Commit human.yml
* Updated a lot of things to be more classy, more progress overall, etc. etc.
* Latest update with many changes
* Minor changes
* Fixed Travis build bug
* Adds first draft of Body Scanner console, apparently I also forgot to tie Mechanisms into body parts so now a heart just sits in the Torso like a good boy :)
* Commit rest of stuff
* Latest changes
* Latest changes again
* 14 naked cowboys
* Yay!
* Latest changes (probably doesnt compile)
* Surgery!!!!!!!!!~1116y
* Cleaned some stuff up
* More cleanup
* Refactoring of code. Basic surgery path now done.
* Removed readme, has been added to HackMD
* Fixes typo (and thus test errors)
* WIP changes, committing so I can pull latest master changes
* Still working on that god awful merge
* Latest changes
* Latest changes!!
* Beginning of refactor to BoundUserInterface
* Surgery!
* Latest changes - fixes pr change requests and random fixes
* oops
* Fixes bodypart recursion
* Beginning of work on revamping the damage system.
* More latest changes
* Latest changes
* Finished merge
* Commit before removing old healthcode
* Almost done with removing speciescomponent...
* It compiles!!!
* yahoo more work
* Fixes to make it work
* Merge conflict fixes
* Deleting species visualizer was a mistake
* IDE warnings are VERBOTEN
* makes the server not kill itself on startup, some cleanup (#1)
* Namespaces, comments and exception fixes
* Fix conveyor and conveyor switch serialization
SS14 in reactive when
* Move damage, acts and body to shared
Damage cleanup
Comment cleanup
* Rename SpeciesComponent to RotationComponent and cleanup
Damage cleanup
Comment cleanup
* Fix nullable warnings
* Address old reviews
Fix off welder suicide damage type, deathmatch and suspicion
* Fix new test fail with units being able to accept items when unpowered
* Remove RotationComponent, change references to IBodyManagerComponent
* Add a bloodstream to humans
* More cleanups
* Add body conduits, connections, connectors substances and valves
* Revert "Add body conduits, connections, connectors substances and valves"
This reverts commit 9ab0b50e6b15fe98852d7b0836c0cdbf4bd76d20.
* Implement the heart mechanism behavior with the circulatory network
* Added network property to mechanism behaviors
* Changed human organ sprites and added missing ones
* Fix tests
* Add individual body part sprite rendering
* Fix error where dropped mechanisms are not initialized
* Implement client/server body damage
* Make DamageContainer take care of raising events
* Reimplement medical scanner with the new body system
* Improve the medical scanner ui
* Merge conflict fixes
* Fix crash when colliding with something
* Fix microwave suicides and eyes sprite rendering
* Fix nullable reference error
* Fix up surgery client side
* Fix missing using from merge conflict
* Add breathing
*inhale
* Merge conflict fixes
* Fix accumulatedframetime being reset to 0 instead of decreased by the threshold
https://github.com/space-wizards/space-station-14/pull/1617
* Use and add to the new AtmosHelpers
* Fix feet
* Add proper coloring to dropped body parts
* Fix Urist's lungs being too strong
* Merge conflict fixes
* Merge conflict fixes
* Merge conflict fixes
Co-authored-by: GlassEclipse <tsymall5@gmail.com>
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
Co-authored-by: AJCM-git <60196617+AJCM-git@users.noreply.github.com>
2020-08-17 01:42:42 +02:00
|
|
|
|
2021-06-21 02:13:54 +02:00
|
|
|
othersMessage = Loc.GetString("welder-component-suicide-unlit-others-message", ("victim", victim));
|
2020-08-30 11:28:46 +02:00
|
|
|
victim.PopupMessageOtherClients(othersMessage);
|
|
|
|
|
|
2021-06-21 02:13:54 +02:00
|
|
|
selfMessage = Loc.GetString("welder-component-suicide-unlit-message");
|
2020-08-30 11:28:46 +02:00
|
|
|
victim.PopupMessage(selfMessage);
|
|
|
|
|
|
Bodysystem and damagesystem rework (#1544)
* Things and stuff with grids, unfinished w/ code debug changes.
* Updated submodule and also lost some progress cause I fucked it up xd
* First unfinished draft of the BodySystem. Doesn't compile.
* More changes to make it compile, but still just a framework. Doesn't do anything at the moment.
* Many cleanup changes.
* Revert "Merge branch 'master' of https://github.com/GlassEclipse/space-station-14 into body_system"
This reverts commit ddd4aebbc76cf2a0b7b102f72b93d55a0816c88c, reversing
changes made to 12d0dd752706bdda8879393bd8191a1199a0c978.
* Commit human.yml
* Updated a lot of things to be more classy, more progress overall, etc. etc.
* Latest update with many changes
* Minor changes
* Fixed Travis build bug
* Adds first draft of Body Scanner console, apparently I also forgot to tie Mechanisms into body parts so now a heart just sits in the Torso like a good boy :)
* Commit rest of stuff
* Latest changes
* Latest changes again
* 14 naked cowboys
* Yay!
* Latest changes (probably doesnt compile)
* Surgery!!!!!!!!!~1116y
* Cleaned some stuff up
* More cleanup
* Refactoring of code. Basic surgery path now done.
* Removed readme, has been added to HackMD
* Fixes typo (and thus test errors)
* WIP changes, committing so I can pull latest master changes
* Still working on that god awful merge
* Latest changes
* Latest changes!!
* Beginning of refactor to BoundUserInterface
* Surgery!
* Latest changes - fixes pr change requests and random fixes
* oops
* Fixes bodypart recursion
* Beginning of work on revamping the damage system.
* More latest changes
* Latest changes
* Finished merge
* Commit before removing old healthcode
* Almost done with removing speciescomponent...
* It compiles!!!
* yahoo more work
* Fixes to make it work
* Merge conflict fixes
* Deleting species visualizer was a mistake
* IDE warnings are VERBOTEN
* makes the server not kill itself on startup, some cleanup (#1)
* Namespaces, comments and exception fixes
* Fix conveyor and conveyor switch serialization
SS14 in reactive when
* Move damage, acts and body to shared
Damage cleanup
Comment cleanup
* Rename SpeciesComponent to RotationComponent and cleanup
Damage cleanup
Comment cleanup
* Fix nullable warnings
* Address old reviews
Fix off welder suicide damage type, deathmatch and suspicion
* Fix new test fail with units being able to accept items when unpowered
* Remove RotationComponent, change references to IBodyManagerComponent
* Add a bloodstream to humans
* More cleanups
* Add body conduits, connections, connectors substances and valves
* Revert "Add body conduits, connections, connectors substances and valves"
This reverts commit 9ab0b50e6b15fe98852d7b0836c0cdbf4bd76d20.
* Implement the heart mechanism behavior with the circulatory network
* Added network property to mechanism behaviors
* Changed human organ sprites and added missing ones
* Fix tests
* Add individual body part sprite rendering
* Fix error where dropped mechanisms are not initialized
* Implement client/server body damage
* Make DamageContainer take care of raising events
* Reimplement medical scanner with the new body system
* Improve the medical scanner ui
* Merge conflict fixes
* Fix crash when colliding with something
* Fix microwave suicides and eyes sprite rendering
* Fix nullable reference error
* Fix up surgery client side
* Fix missing using from merge conflict
* Add breathing
*inhale
* Merge conflict fixes
* Fix accumulatedframetime being reset to 0 instead of decreased by the threshold
https://github.com/space-wizards/space-station-14/pull/1617
* Use and add to the new AtmosHelpers
* Fix feet
* Add proper coloring to dropped body parts
* Fix Urist's lungs being too strong
* Merge conflict fixes
* Merge conflict fixes
* Merge conflict fixes
Co-authored-by: GlassEclipse <tsymall5@gmail.com>
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
Co-authored-by: AJCM-git <60196617+AJCM-git@users.noreply.github.com>
2020-08-17 01:42:42 +02:00
|
|
|
return SuicideKind.Blunt;
|
2020-05-27 20:05:12 -03:00
|
|
|
}
|
2020-07-08 05:46:54 -04:00
|
|
|
|
2021-02-03 14:05:31 +01:00
|
|
|
async Task<bool> IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
|
|
|
|
|
{
|
|
|
|
|
if (eventArgs.Target == null || !eventArgs.CanReach)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (eventArgs.Target.TryGetComponent(out ReagentTankComponent? tank)
|
|
|
|
|
&& tank.TankType == ReagentTankType.Fuel
|
2021-09-06 15:49:44 +02:00
|
|
|
&& EntitySystem.Get<SolutionContainerSystem>()
|
|
|
|
|
.TryGetDrainableSolution(eventArgs.Target.Uid, out var targetSolution)
|
|
|
|
|
&& WelderSolution != null)
|
2021-02-03 14:05:31 +01:00
|
|
|
{
|
|
|
|
|
if (WelderLit)
|
|
|
|
|
{
|
|
|
|
|
// Oh no no
|
|
|
|
|
eventArgs.Target.SpawnExplosion();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-06 15:49:44 +02:00
|
|
|
var trans = ReagentUnit.Min(WelderSolution.AvailableVolume, targetSolution.DrainAvailable);
|
2021-02-03 14:05:31 +01:00
|
|
|
if (trans > 0)
|
|
|
|
|
{
|
2021-09-06 15:49:44 +02:00
|
|
|
var drained = EntitySystem.Get<SolutionContainerSystem>().Drain(eventArgs.Target.Uid, targetSolution, trans);
|
|
|
|
|
EntitySystem.Get<SolutionContainerSystem>().TryAddSolution(Owner.Uid, WelderSolution, drained);
|
2021-07-31 19:52:33 +02:00
|
|
|
SoundSystem.Play(Filter.Pvs(Owner), WelderRefill.GetSound(), Owner);
|
2021-09-06 15:49:44 +02:00
|
|
|
eventArgs.Target.PopupMessage(eventArgs.User,
|
|
|
|
|
Loc.GetString("welder-component-after-interact-refueled-message"));
|
2021-02-03 14:05:31 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2021-07-10 17:35:33 +02:00
|
|
|
|
2021-07-31 19:52:33 +02:00
|
|
|
private void PlaySound(SoundSpecifier sound, float volume = -5f)
|
2021-07-10 17:35:33 +02:00
|
|
|
{
|
2021-07-31 19:52:33 +02:00
|
|
|
SoundSystem.Play(Filter.Pvs(Owner), sound.GetSound(), Owner, AudioHelpers.WithVariation(0.15f).WithVolume(volume));
|
2021-07-10 17:35:33 +02:00
|
|
|
}
|
2020-05-11 15:26:07 +02:00
|
|
|
}
|
|
|
|
|
}
|