Add WelderComponent back
This commit is contained in:
@@ -16,12 +16,13 @@ namespace Content.Client.GameObjects.Components.Interactable
|
||||
public class ToolComponent : SharedToolComponent, IItemStatus
|
||||
{
|
||||
private Tool _behavior;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)] private bool _uiUpdateNeeded;
|
||||
|
||||
private bool _statusShowBehavior;
|
||||
[ViewVariables] public float FuelCapacity { get; private set; }
|
||||
[ViewVariables] public float Fuel { get; private set; }
|
||||
[ViewVariables] public bool Activated { get; private set; }
|
||||
|
||||
[ViewVariables] public bool StatusShowBehavior => _statusShowBehavior;
|
||||
|
||||
[ViewVariables]
|
||||
public override Tool Behavior
|
||||
{
|
||||
@@ -37,15 +38,11 @@ namespace Content.Client.GameObjects.Components.Interactable
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
{
|
||||
if (!(curState is ToolComponentState cast))
|
||||
return;
|
||||
|
||||
FuelCapacity = cast.FuelCapacity;
|
||||
Fuel = cast.Fuel;
|
||||
Activated = cast.Activated;
|
||||
_behavior = cast.Behavior;
|
||||
if (!(curState is ToolComponentState tool)) return;
|
||||
|
||||
_behavior = tool.Behavior;
|
||||
_uiUpdateNeeded = true;
|
||||
|
||||
}
|
||||
|
||||
public Control MakeControl() => new StatusControl(this);
|
||||
@@ -75,21 +72,10 @@ namespace Content.Client.GameObjects.Components.Interactable
|
||||
|
||||
_parent._uiUpdateNeeded = false;
|
||||
|
||||
if (_parent.Behavior == Tool.Welder)
|
||||
{
|
||||
var fuelCap = _parent.FuelCapacity;
|
||||
var fuel = _parent.Fuel;
|
||||
|
||||
_label.SetMarkup(Loc.GetString("Fuel: [color={0}]{1}/{2}[/color]",
|
||||
fuel < fuelCap / 4f ? "darkorange" : "orange", Math.Round(fuel), fuelCap));
|
||||
}
|
||||
if(!_parent.StatusShowBehavior)
|
||||
_label.SetMarkup(string.Empty);
|
||||
else
|
||||
{
|
||||
if(!_parent.StatusShowBehavior)
|
||||
_label.SetMarkup(string.Empty);
|
||||
else
|
||||
_label.SetMarkup(_parent.Behavior.ToString());
|
||||
}
|
||||
_label.SetMarkup(_parent.Behavior.ToString());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user