welder stuff (#17476)
This commit is contained in:
@@ -62,5 +62,10 @@ namespace Content.Client.Tools
|
|||||||
welder.Lit = state.Lit;
|
welder.Lit = state.Lit;
|
||||||
welder.UiUpdateNeeded = true;
|
welder.UiUpdateNeeded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool IsWelder(EntityUid uid)
|
||||||
|
{
|
||||||
|
return HasComp<WelderComponent>(uid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,9 +16,6 @@ namespace Content.Server.Construction.Components
|
|||||||
[DataField("refineTime")]
|
[DataField("refineTime")]
|
||||||
public float RefineTime = 2f;
|
public float RefineTime = 2f;
|
||||||
|
|
||||||
[DataField("refineFuel")]
|
|
||||||
public float RefineFuel = 0f;
|
|
||||||
|
|
||||||
[DataField("qualityNeeded", customTypeSerializer:typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
|
[DataField("qualityNeeded", customTypeSerializer:typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
|
||||||
public string QualityNeeded = "Welding";
|
public string QualityNeeded = "Welding";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -347,7 +347,6 @@ namespace Content.Server.Construction
|
|||||||
if (validation)
|
if (validation)
|
||||||
{
|
{
|
||||||
// Then we only really need to check whether the tool entity has that quality or not.
|
// Then we only really need to check whether the tool entity has that quality or not.
|
||||||
// TODO fuel consumption?
|
|
||||||
return _toolSystem.HasQuality(interactUsing.Used, toolInsertStep.Tool)
|
return _toolSystem.HasQuality(interactUsing.Used, toolInsertStep.Tool)
|
||||||
? HandleResult.Validated
|
? HandleResult.Validated
|
||||||
: HandleResult.False;
|
: HandleResult.False;
|
||||||
@@ -364,8 +363,7 @@ namespace Content.Server.Construction
|
|||||||
TimeSpan.FromSeconds(toolInsertStep.DoAfter),
|
TimeSpan.FromSeconds(toolInsertStep.DoAfter),
|
||||||
new [] { toolInsertStep.Tool },
|
new [] { toolInsertStep.Tool },
|
||||||
new ConstructionInteractDoAfterEvent(interactUsing),
|
new ConstructionInteractDoAfterEvent(interactUsing),
|
||||||
out var doAfter,
|
out var doAfter);
|
||||||
fuel: toolInsertStep.Fuel);
|
|
||||||
|
|
||||||
return result && doAfter != null ? HandleResult.DoAfter : HandleResult.False;
|
return result && doAfter != null ? HandleResult.DoAfter : HandleResult.False;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Content.Server.Construction
|
|||||||
if (args.Handled)
|
if (args.Handled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
args.Handled = _toolSystem.UseTool(args.Used, args.User, uid, component.RefineTime, component.QualityNeeded, new WelderRefineDoAfterEvent(), component.RefineFuel);
|
args.Handled = _toolSystem.UseTool(args.Used, args.User, uid, component.RefineTime, component.QualityNeeded, new WelderRefineDoAfterEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDoAfter(EntityUid uid, WelderRefinableComponent component, WelderRefineDoAfterEvent args)
|
private void OnDoAfter(EntityUid uid, WelderRefinableComponent component, WelderRefineDoAfterEvent args)
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace Content.Server.Repairable
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Only try repair the target if it is damaged
|
// Only try repair the target if it is damaged
|
||||||
if (!EntityManager.TryGetComponent(uid, out DamageableComponent? damageable) || damageable.TotalDamage == 0)
|
if (!TryComp<DamageableComponent>(uid, out var damageable) || damageable.TotalDamage == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float delay = component.DoAfterDelay;
|
float delay = component.DoAfterDelay;
|
||||||
@@ -64,8 +64,8 @@ namespace Content.Server.Repairable
|
|||||||
if (args.User == args.Target)
|
if (args.User == args.Target)
|
||||||
delay *= component.SelfRepairPenalty;
|
delay *= component.SelfRepairPenalty;
|
||||||
|
|
||||||
// Can the tool actually repair this, does it have enough fuel?
|
// Run the repairing doafter
|
||||||
args.Handled = _toolSystem.UseTool(args.Used, args.User, uid, delay, component.QualityNeeded, new RepairFinishedEvent(), component.FuelCost);
|
args.Handled = _toolSystem.UseTool(args.Used, args.User, uid, delay, component.QualityNeeded, new RepairFinishedEvent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,13 +26,6 @@ public sealed class WeldableComponent : SharedWeldableComponent
|
|||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public bool Weldable = true;
|
public bool Weldable = true;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// How much fuel does it take to weld/unweld entity.
|
|
||||||
/// </summary>
|
|
||||||
[DataField("fuel")]
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
|
||||||
public float FuelConsumption = 3f;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How much time does it take to weld/unweld entity.
|
/// How much time does it take to weld/unweld entity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -13,25 +13,25 @@ namespace Content.Server.Tools.Components
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Solution on the entity that contains the fuel.
|
/// Solution on the entity that contains the fuel.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("fuelSolution")]
|
[DataField("fuelSolution"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
public string FuelSolution { get; } = "Welder";
|
public string FuelSolution { get; } = "Welder";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reagent that will be used as fuel for welding.
|
/// Reagent that will be used as fuel for welding.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("fuelReagent", customTypeSerializer:typeof(PrototypeIdSerializer<ReagentPrototype>))]
|
[DataField("fuelReagent", customTypeSerializer:typeof(PrototypeIdSerializer<ReagentPrototype>)), ViewVariables(VVAccess.ReadWrite)]
|
||||||
public string FuelReagent { get; } = "WeldingFuel";
|
public string FuelReagent { get; } = "WeldingFuel";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fuel consumption per second, while the welder is active.
|
/// Fuel consumption per second, while the welder is active.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("fuelConsumption")]
|
[DataField("fuelConsumption"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
public FixedPoint2 FuelConsumption { get; } = FixedPoint2.New(0.05f);
|
public FixedPoint2 FuelConsumption { get; } = FixedPoint2.New(2.0f);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A fuel amount to be consumed when the welder goes from being unlit to being lit.
|
/// A fuel amount to be consumed when the welder goes from being unlit to being lit.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("welderOnConsume")]
|
[DataField("fuelLitCost"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
public FixedPoint2 FuelLitCost { get; } = FixedPoint2.New(0.5f);
|
public FixedPoint2 FuelLitCost { get; } = FixedPoint2.New(0.5f);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public sealed class WeldableSystem : EntitySystem
|
|||||||
if (!CanWeld(uid, tool, user, component))
|
if (!CanWeld(uid, tool, user, component))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!_toolSystem.UseTool(tool, user, uid, component.WeldingTime.Seconds, component.WeldingQuality, new WeldFinishedEvent(), fuel: component.FuelConsumption))
|
if (!_toolSystem.UseTool(tool, user, uid, component.WeldingTime.Seconds, component.WeldingQuality, new WeldFinishedEvent()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Log attempt
|
// Log attempt
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ namespace Content.Server.Tools
|
|||||||
SubscribeLocalEvent<WelderComponent, ActivateInWorldEvent>(OnWelderActivate);
|
SubscribeLocalEvent<WelderComponent, ActivateInWorldEvent>(OnWelderActivate);
|
||||||
SubscribeLocalEvent<WelderComponent, AfterInteractEvent>(OnWelderAfterInteract);
|
SubscribeLocalEvent<WelderComponent, AfterInteractEvent>(OnWelderAfterInteract);
|
||||||
SubscribeLocalEvent<WelderComponent, DoAfterAttemptEvent<ToolDoAfterEvent>>(OnWelderToolUseAttempt);
|
SubscribeLocalEvent<WelderComponent, DoAfterAttemptEvent<ToolDoAfterEvent>>(OnWelderToolUseAttempt);
|
||||||
SubscribeLocalEvent<WelderComponent, ToolDoAfterEvent>(OnWelderDoAfter);
|
|
||||||
SubscribeLocalEvent<WelderComponent, ComponentShutdown>(OnWelderShutdown);
|
SubscribeLocalEvent<WelderComponent, ComponentShutdown>(OnWelderShutdown);
|
||||||
SubscribeLocalEvent<WelderComponent, ComponentGetState>(OnWelderGetState);
|
SubscribeLocalEvent<WelderComponent, ComponentGetState>(OnWelderGetState);
|
||||||
SubscribeLocalEvent<WelderComponent, GetMeleeDamageEvent>(OnGetMeleeDamage);
|
SubscribeLocalEvent<WelderComponent, GetMeleeDamageEvent>(OnGetMeleeDamage);
|
||||||
@@ -266,7 +265,6 @@ namespace Content.Server.Tools
|
|||||||
|
|
||||||
private void OnWelderToolUseAttempt(EntityUid uid, WelderComponent welder, DoAfterAttemptEvent<ToolDoAfterEvent> args)
|
private void OnWelderToolUseAttempt(EntityUid uid, WelderComponent welder, DoAfterAttemptEvent<ToolDoAfterEvent> args)
|
||||||
{
|
{
|
||||||
DebugTools.Assert(args.Event.Fuel > 0);
|
|
||||||
var user = args.DoAfter.Args.User;
|
var user = args.DoAfter.Args.User;
|
||||||
|
|
||||||
if (!welder.Lit)
|
if (!welder.Lit)
|
||||||
@@ -275,26 +273,6 @@ namespace Content.Server.Tools
|
|||||||
args.Cancel();
|
args.Cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var (fuel, _) = GetWelderFuelAndCapacity(uid, welder);
|
|
||||||
|
|
||||||
if (FixedPoint2.New(args.Event.Fuel) > fuel)
|
|
||||||
{
|
|
||||||
_popupSystem.PopupEntity(Loc.GetString("welder-component-cannot-weld-message"), uid, user);
|
|
||||||
args.Cancel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnWelderDoAfter(EntityUid uid, WelderComponent welder, ToolDoAfterEvent args)
|
|
||||||
{
|
|
||||||
if (args.Cancelled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!_solutionContainerSystem.TryGetSolution(uid, welder.FuelSolution, out var solution))
|
|
||||||
return;
|
|
||||||
|
|
||||||
solution.RemoveReagent(welder.FuelReagent, FixedPoint2.New(args.Fuel));
|
|
||||||
_entityManager.Dirty(welder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnWelderShutdown(EntityUid uid, WelderComponent welder, ComponentShutdown args)
|
private void OnWelderShutdown(EntityUid uid, WelderComponent welder, ComponentShutdown args)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.Atmos.EntitySystems;
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Server.Chemistry.EntitySystems;
|
using Content.Server.Chemistry.EntitySystems;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
|
using Content.Server.Tools.Components;
|
||||||
using Content.Shared.Tools;
|
using Content.Shared.Tools;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
@@ -32,5 +33,10 @@ namespace Content.Server.Tools
|
|||||||
|
|
||||||
UpdateWelders(frameTime);
|
UpdateWelders(frameTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool IsWelder(EntityUid uid)
|
||||||
|
{
|
||||||
|
return HasComp<WelderComponent>(uid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,16 +23,13 @@ namespace Content.Shared.Tools.Components
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempt event called *before* any do afters to see if the tool usage should succeed or not.
|
/// Attempt event called *before* any do afters to see if the tool usage should succeed or not.
|
||||||
/// You can change the fuel consumption by changing the Fuel property.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class ToolUseAttemptEvent : CancellableEntityEventArgs
|
public sealed class ToolUseAttemptEvent : CancellableEntityEventArgs
|
||||||
{
|
{
|
||||||
public float Fuel { get; set; }
|
|
||||||
public EntityUid User { get; }
|
public EntityUid User { get; }
|
||||||
|
|
||||||
public ToolUseAttemptEvent(float fuel, EntityUid user)
|
public ToolUseAttemptEvent(EntityUid user)
|
||||||
{
|
{
|
||||||
Fuel = fuel;
|
|
||||||
User = user;
|
User = user;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ public abstract partial class SharedToolSystem : EntitySystem
|
|||||||
/// <param name="toolQualitiesNeeded">The qualities needed for this tool to work.</param>
|
/// <param name="toolQualitiesNeeded">The qualities needed for this tool to work.</param>
|
||||||
/// <param name="doAfterEv">The event that will be raised when the tool has finished (including cancellation). Event
|
/// <param name="doAfterEv">The event that will be raised when the tool has finished (including cancellation). Event
|
||||||
/// will be directed at the tool target.</param>
|
/// will be directed at the tool target.</param>
|
||||||
/// <param name="fuel">Amount of fuel that should be taken from the tool.</param>
|
|
||||||
/// <param name="toolComponent">The tool component.</param>
|
/// <param name="toolComponent">The tool component.</param>
|
||||||
/// <returns>Returns true if any interaction takes place.</returns>
|
/// <returns>Returns true if any interaction takes place.</returns>
|
||||||
public bool UseTool(
|
public bool UseTool(
|
||||||
@@ -64,7 +63,6 @@ public abstract partial class SharedToolSystem : EntitySystem
|
|||||||
float doAfterDelay,
|
float doAfterDelay,
|
||||||
IEnumerable<string> toolQualitiesNeeded,
|
IEnumerable<string> toolQualitiesNeeded,
|
||||||
DoAfterEvent doAfterEv,
|
DoAfterEvent doAfterEv,
|
||||||
float fuel = 0f,
|
|
||||||
ToolComponent? toolComponent = null)
|
ToolComponent? toolComponent = null)
|
||||||
{
|
{
|
||||||
return UseTool(tool,
|
return UseTool(tool,
|
||||||
@@ -74,7 +72,6 @@ public abstract partial class SharedToolSystem : EntitySystem
|
|||||||
toolQualitiesNeeded,
|
toolQualitiesNeeded,
|
||||||
doAfterEv,
|
doAfterEv,
|
||||||
out _,
|
out _,
|
||||||
fuel,
|
|
||||||
toolComponent);
|
toolComponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +89,6 @@ public abstract partial class SharedToolSystem : EntitySystem
|
|||||||
/// will be directed at the tool target.</param>
|
/// will be directed at the tool target.</param>
|
||||||
/// <param name="id">The id of the DoAfter that was created. This may be null even if the function returns true in
|
/// <param name="id">The id of the DoAfter that was created. This may be null even if the function returns true in
|
||||||
/// the event that this tool-use cancelled an existing DoAfter</param>
|
/// the event that this tool-use cancelled an existing DoAfter</param>
|
||||||
/// <param name="fuel">Amount of fuel that should be taken from the tool.</param>
|
|
||||||
/// <param name="toolComponent">The tool component.</param>
|
/// <param name="toolComponent">The tool component.</param>
|
||||||
/// <returns>Returns true if any interaction takes place.</returns>
|
/// <returns>Returns true if any interaction takes place.</returns>
|
||||||
public bool UseTool(
|
public bool UseTool(
|
||||||
@@ -103,30 +99,31 @@ public abstract partial class SharedToolSystem : EntitySystem
|
|||||||
IEnumerable<string> toolQualitiesNeeded,
|
IEnumerable<string> toolQualitiesNeeded,
|
||||||
DoAfterEvent doAfterEv,
|
DoAfterEvent doAfterEv,
|
||||||
out DoAfterId? id,
|
out DoAfterId? id,
|
||||||
float fuel = 0f,
|
|
||||||
ToolComponent? toolComponent = null)
|
ToolComponent? toolComponent = null)
|
||||||
{
|
{
|
||||||
id = null;
|
id = null;
|
||||||
if (!Resolve(tool, ref toolComponent, false))
|
if (!Resolve(tool, ref toolComponent, false))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!CanStartToolUse(tool, user, target, fuel, toolQualitiesNeeded, toolComponent))
|
if (!CanStartToolUse(tool, user, target, toolQualitiesNeeded, toolComponent))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var toolEvent = new ToolDoAfterEvent(fuel, doAfterEv, target);
|
var toolEvent = new ToolDoAfterEvent(doAfterEv, target);
|
||||||
var doAfterArgs = new DoAfterArgs(user, delay / toolComponent.SpeedModifier, toolEvent, tool, target: target, used: tool)
|
var doAfterArgs = new DoAfterArgs(user, delay / toolComponent.SpeedModifier, toolEvent, tool, target: target, used: tool)
|
||||||
{
|
{
|
||||||
BreakOnDamage = true,
|
BreakOnDamage = true,
|
||||||
BreakOnTargetMove = true,
|
BreakOnTargetMove = true,
|
||||||
BreakOnUserMove = true,
|
BreakOnUserMove = true,
|
||||||
NeedHand = tool != user,
|
NeedHand = tool != user,
|
||||||
AttemptFrequency = fuel <= 0 ? AttemptFrequency.Never : AttemptFrequency.EveryTick
|
AttemptFrequency = IsWelder(tool) ? AttemptFrequency.Never : AttemptFrequency.EveryTick
|
||||||
};
|
};
|
||||||
|
|
||||||
_doAfterSystem.TryStartDoAfter(doAfterArgs, out id);
|
_doAfterSystem.TryStartDoAfter(doAfterArgs, out id);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected abstract bool IsWelder(EntityUid uid);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempts to use a tool on some entity, which will start a DoAfter. Returns true if an interaction occurred.
|
/// Attempts to use a tool on some entity, which will start a DoAfter. Returns true if an interaction occurred.
|
||||||
/// Note that this does not mean the interaction was successful, you need to listen for the DoAfter event.
|
/// Note that this does not mean the interaction was successful, you need to listen for the DoAfter event.
|
||||||
@@ -141,7 +138,6 @@ public abstract partial class SharedToolSystem : EntitySystem
|
|||||||
/// will be directed at the tool target.</param>
|
/// will be directed at the tool target.</param>
|
||||||
/// <param name="id">The id of the DoAfter that was created. This may be null even if the function returns true in
|
/// <param name="id">The id of the DoAfter that was created. This may be null even if the function returns true in
|
||||||
/// the event that this tool-use cancelled an existing DoAfter</param>
|
/// the event that this tool-use cancelled an existing DoAfter</param>
|
||||||
/// <param name="fuel">Amount of fuel that should be taken from the tool.</param>
|
|
||||||
/// <param name="toolComponent">The tool component.</param>
|
/// <param name="toolComponent">The tool component.</param>
|
||||||
/// <returns>Returns true if any interaction takes place.</returns>
|
/// <returns>Returns true if any interaction takes place.</returns>
|
||||||
public bool UseTool(
|
public bool UseTool(
|
||||||
@@ -151,7 +147,6 @@ public abstract partial class SharedToolSystem : EntitySystem
|
|||||||
float doAfterDelay,
|
float doAfterDelay,
|
||||||
string toolQualityNeeded,
|
string toolQualityNeeded,
|
||||||
DoAfterEvent doAfterEv,
|
DoAfterEvent doAfterEv,
|
||||||
float fuel = 0,
|
|
||||||
ToolComponent? toolComponent = null)
|
ToolComponent? toolComponent = null)
|
||||||
{
|
{
|
||||||
return UseTool(tool,
|
return UseTool(tool,
|
||||||
@@ -161,7 +156,6 @@ public abstract partial class SharedToolSystem : EntitySystem
|
|||||||
new[] { toolQualityNeeded },
|
new[] { toolQualityNeeded },
|
||||||
doAfterEv,
|
doAfterEv,
|
||||||
out _,
|
out _,
|
||||||
fuel,
|
|
||||||
toolComponent);
|
toolComponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,7 +175,7 @@ public abstract partial class SharedToolSystem : EntitySystem
|
|||||||
return Resolve(uid, ref tool, false) && tool.Qualities.ContainsAll(qualities);
|
return Resolve(uid, ref tool, false) && tool.Qualities.ContainsAll(qualities);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CanStartToolUse(EntityUid tool, EntityUid user, EntityUid? target, float fuel, IEnumerable<string> toolQualitiesNeeded, ToolComponent? toolComponent = null)
|
private bool CanStartToolUse(EntityUid tool, EntityUid user, EntityUid? target, IEnumerable<string> toolQualitiesNeeded, ToolComponent? toolComponent = null)
|
||||||
{
|
{
|
||||||
if (!Resolve(tool, ref toolComponent))
|
if (!Resolve(tool, ref toolComponent))
|
||||||
return false;
|
return false;
|
||||||
@@ -194,7 +188,7 @@ public abstract partial class SharedToolSystem : EntitySystem
|
|||||||
if (!toolComponent.Qualities.ContainsAll(toolQualitiesNeeded))
|
if (!toolComponent.Qualities.ContainsAll(toolQualitiesNeeded))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var beforeAttempt = new ToolUseAttemptEvent(fuel, user);
|
var beforeAttempt = new ToolUseAttemptEvent(user);
|
||||||
RaiseLocalEvent(tool, beforeAttempt, false);
|
RaiseLocalEvent(tool, beforeAttempt, false);
|
||||||
|
|
||||||
return !beforeAttempt.Cancelled;
|
return !beforeAttempt.Cancelled;
|
||||||
@@ -205,9 +199,6 @@ public abstract partial class SharedToolSystem : EntitySystem
|
|||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
protected sealed class ToolDoAfterEvent : DoAfterEvent
|
protected sealed class ToolDoAfterEvent : DoAfterEvent
|
||||||
{
|
{
|
||||||
[DataField("fuel")]
|
|
||||||
public readonly float Fuel;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Entity that the wrapped do after event will get directed at. If null, event will be broadcast.
|
/// Entity that the wrapped do after event will get directed at. If null, event will be broadcast.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -221,11 +212,10 @@ public abstract partial class SharedToolSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public ToolDoAfterEvent(float fuel, DoAfterEvent wrappedEvent, EntityUid? originalTarget)
|
public ToolDoAfterEvent(DoAfterEvent wrappedEvent, EntityUid? originalTarget)
|
||||||
{
|
{
|
||||||
DebugTools.Assert(wrappedEvent.GetType().HasCustomAttribute<NetSerializableAttribute>(), "Tool event is not serializable");
|
DebugTools.Assert(wrappedEvent.GetType().HasCustomAttribute<NetSerializableAttribute>(), "Tool event is not serializable");
|
||||||
|
|
||||||
Fuel = fuel;
|
|
||||||
WrappedEvent = wrappedEvent;
|
WrappedEvent = wrappedEvent;
|
||||||
OriginalTarget = originalTarget;
|
OriginalTarget = originalTarget;
|
||||||
}
|
}
|
||||||
@@ -238,7 +228,7 @@ public abstract partial class SharedToolSystem : EntitySystem
|
|||||||
if (evClone == WrappedEvent)
|
if (evClone == WrappedEvent)
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
return new ToolDoAfterEvent(Fuel, evClone, OriginalTarget);
|
return new ToolDoAfterEvent(evClone, OriginalTarget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
Blunt: 0 #this feels hacky, but is needed for burn damage while active (i think)
|
Blunt: 0 #this feels hacky, but is needed for burn damage while active (i think)
|
||||||
- type: Welder
|
- type: Welder
|
||||||
fuelConsumption: 0.01
|
fuelConsumption: 0.01
|
||||||
welderOnConsume: 0.1
|
fuelLitCost: 0.1
|
||||||
litMeleeDamageBonus:
|
litMeleeDamageBonus:
|
||||||
types:
|
types:
|
||||||
Heat: 1
|
Heat: 1
|
||||||
|
|||||||
@@ -62,7 +62,6 @@
|
|||||||
containers:
|
containers:
|
||||||
board: !type:Container
|
board: !type:Container
|
||||||
- type: Weldable
|
- type: Weldable
|
||||||
fuel: 5
|
|
||||||
time: 3
|
time: 3
|
||||||
- type: Airlock
|
- type: Airlock
|
||||||
- type: DoorBolt
|
- type: DoorBolt
|
||||||
|
|||||||
@@ -1,95 +1,94 @@
|
|||||||
- type: entity
|
- type: entity
|
||||||
id: HighSecDoor
|
id: HighSecDoor
|
||||||
parent: BaseStructure
|
parent: BaseStructure
|
||||||
name: high security door
|
name: high security door
|
||||||
description: Keeps the bad out and keeps the good in.
|
description: Keeps the bad out and keeps the good in.
|
||||||
placement:
|
placement:
|
||||||
mode: SnapgridCenter
|
mode: SnapgridCenter
|
||||||
components:
|
components:
|
||||||
- type: InteractionOutline
|
- type: InteractionOutline
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Structures/Doors/Airlocks/highsec/highsec.rsi
|
sprite: Structures/Doors/Airlocks/highsec/highsec.rsi
|
||||||
layers:
|
layers:
|
||||||
- state: closed
|
- state: closed
|
||||||
map: ["enum.DoorVisualLayers.Base"]
|
map: ["enum.DoorVisualLayers.Base"]
|
||||||
- state: closed_unlit
|
- state: closed_unlit
|
||||||
shader: unshaded
|
shader: unshaded
|
||||||
map: ["enum.DoorVisualLayers.BaseUnlit"]
|
map: ["enum.DoorVisualLayers.BaseUnlit"]
|
||||||
- state: welded
|
- state: welded
|
||||||
map: ["enum.WeldableLayers.BaseWelded"]
|
map: ["enum.WeldableLayers.BaseWelded"]
|
||||||
- state: bolted_unlit
|
- state: bolted_unlit
|
||||||
shader: unshaded
|
shader: unshaded
|
||||||
map: ["enum.DoorVisualLayers.BaseBolted"]
|
map: ["enum.DoorVisualLayers.BaseBolted"]
|
||||||
- state: emergency_unlit
|
- state: emergency_unlit
|
||||||
map: ["enum.DoorVisualLayers.BaseEmergencyAccess"]
|
map: ["enum.DoorVisualLayers.BaseEmergencyAccess"]
|
||||||
shader: unshaded
|
shader: unshaded
|
||||||
- state: panel_open
|
- state: panel_open
|
||||||
map: ["enum.WiresVisualLayers.MaintenancePanel"]
|
map: ["enum.WiresVisualLayers.MaintenancePanel"]
|
||||||
- type: AnimationPlayer
|
- type: AnimationPlayer
|
||||||
- type: Physics
|
- type: Physics
|
||||||
- type: Fixtures
|
- type: Fixtures
|
||||||
fixtures:
|
fixtures:
|
||||||
fix1:
|
fix1:
|
||||||
shape:
|
shape:
|
||||||
!type:PhysShapeAabb
|
!type:PhysShapeAabb
|
||||||
bounds: "-0.49,-0.49,0.49,0.49" # don't want this colliding with walls or they won't close
|
bounds: "-0.49,-0.49,0.49,0.49" # don't want this colliding with walls or they won't close
|
||||||
density: 100
|
density: 100
|
||||||
mask:
|
mask:
|
||||||
- FullTileMask
|
- FullTileMask
|
||||||
layer:
|
layer:
|
||||||
- WallLayer
|
- WallLayer
|
||||||
- type: ContainerFill
|
- type: ContainerFill
|
||||||
containers:
|
containers:
|
||||||
board: [ DoorElectronics ]
|
board: [ DoorElectronics ]
|
||||||
- type: ContainerContainer
|
- type: ContainerContainer
|
||||||
containers:
|
containers:
|
||||||
board: !type:Container
|
board: !type:Container
|
||||||
- type: Door
|
- type: Door
|
||||||
crushDamage:
|
crushDamage:
|
||||||
types:
|
types:
|
||||||
Blunt: 50
|
Blunt: 50
|
||||||
openSound:
|
openSound:
|
||||||
path: /Audio/Machines/airlock_open.ogg
|
path: /Audio/Machines/airlock_open.ogg
|
||||||
closeSound:
|
closeSound:
|
||||||
path: /Audio/Machines/airlock_close.ogg
|
path: /Audio/Machines/airlock_close.ogg
|
||||||
denySound:
|
denySound:
|
||||||
path: /Audio/Machines/airlock_deny.ogg
|
path: /Audio/Machines/airlock_deny.ogg
|
||||||
- type: Weldable
|
- type: Weldable
|
||||||
fuel: 10
|
time: 10
|
||||||
time: 10
|
- type: Airlock
|
||||||
- type: Airlock
|
- type: DoorBolt
|
||||||
- type: DoorBolt
|
- type: Appearance
|
||||||
- type: Appearance
|
- type: WiresVisuals
|
||||||
- type: WiresVisuals
|
- type: ApcPowerReceiver
|
||||||
- type: ApcPowerReceiver
|
powerLoad: 20
|
||||||
powerLoad: 20
|
- type: ExtensionCableReceiver
|
||||||
- type: ExtensionCableReceiver
|
- type: Electrified
|
||||||
- type: Electrified
|
enabled: false
|
||||||
enabled: false
|
usesApcPower: true
|
||||||
usesApcPower: true
|
- type: WiresPanel
|
||||||
- type: WiresPanel
|
- type: Wires
|
||||||
- type: Wires
|
BoardName: "HighSec Control"
|
||||||
BoardName: "HighSec Control"
|
LayoutId: HighSec
|
||||||
LayoutId: HighSec
|
alwaysRandomize: true
|
||||||
alwaysRandomize: true
|
- type: UserInterface
|
||||||
- type: UserInterface
|
interfaces:
|
||||||
interfaces:
|
- key: enum.WiresUiKey.Key
|
||||||
- key: enum.WiresUiKey.Key
|
type: WiresBoundUserInterface
|
||||||
type: WiresBoundUserInterface
|
- type: Airtight
|
||||||
- type: Airtight
|
fixVacuum: true
|
||||||
fixVacuum: true
|
- type: Occluder
|
||||||
- type: Occluder
|
- type: Damageable
|
||||||
- type: Damageable
|
damageContainer: Inorganic
|
||||||
damageContainer: Inorganic
|
damageModifierSet: Metallic
|
||||||
damageModifierSet: Metallic
|
- type: Destructible
|
||||||
- type: Destructible
|
thresholds:
|
||||||
thresholds:
|
- trigger:
|
||||||
- trigger:
|
!type:DamageTrigger
|
||||||
!type:DamageTrigger
|
damage: 1500
|
||||||
damage: 1500
|
behaviors:
|
||||||
behaviors:
|
- !type:DoActsBehavior
|
||||||
- !type:DoActsBehavior
|
acts: ["Destruction"]
|
||||||
acts: ["Destruction"]
|
- type: IconSmooth
|
||||||
- type: IconSmooth
|
key: walls
|
||||||
key: walls
|
mode: NoSprite
|
||||||
mode: NoSprite
|
|
||||||
|
|||||||
@@ -78,7 +78,6 @@
|
|||||||
openingAnimationTime: 0.6
|
openingAnimationTime: 0.6
|
||||||
closingAnimationTime: 0.6
|
closingAnimationTime: 0.6
|
||||||
- type: Weldable
|
- type: Weldable
|
||||||
fuel: 5
|
|
||||||
time: 3
|
time: 3
|
||||||
- type: Firelock
|
- type: Firelock
|
||||||
- type: Appearance
|
- type: Appearance
|
||||||
|
|||||||
Reference in New Issue
Block a user