Fix kitchen spike (#4008)
* Fix kitchen spike * Add fluent localization * Add newline * Prevent things that are not dead from being spiked
This commit is contained in:
@@ -5,6 +5,7 @@ using Content.Server.GameObjects.EntitySystems.DoAfter;
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Content.Server.Interfaces.GameObjects;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.GameObjects.Components.Mobs.State;
|
||||
using Content.Shared.GameObjects.Components.Nutrition;
|
||||
using Content.Shared.Interfaces;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
@@ -78,16 +79,19 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
||||
|
||||
if (_meatParts > 0)
|
||||
{
|
||||
Owner.PopupMessage(user, Loc.GetString("The spike already has something on it, finish collecting its meat first!"));
|
||||
Owner.PopupMessage(user, Loc.GetString("comp-kitchen-spike-deny-collect", ("this", Owner)));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!victim.TryGetComponent(out butcherable))
|
||||
{
|
||||
Owner.PopupMessage(user, Loc.GetString("{0:theName} can't be butchered on the spike.", victim));
|
||||
Owner.PopupMessage(user, Loc.GetString("comp-kitchen-spike-deny-butcher", ("victim", victim), ("this", Owner)));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (butcherable.MeatPrototype == null)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -98,16 +102,21 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
||||
|
||||
SharedButcherableComponent? butcherable;
|
||||
|
||||
if (!Spikeable(user, victim, out butcherable)) return;
|
||||
if (!Spikeable(user, victim, out butcherable))
|
||||
return;
|
||||
|
||||
// Prevent dead from being spiked TODO: Maybe remove when rounds can be played and DOT is implemented
|
||||
if (victim.TryGetComponent<IMobStateComponent>(out var state) &&
|
||||
!state.IsDead())
|
||||
{
|
||||
Owner.PopupMessage(user, Loc.GetString("comp-kitchen-spike-deny-not-dead", ("victim", victim)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (user != victim)
|
||||
{
|
||||
Owner.PopupMessage(victim, Loc.GetString("{0:theName} begins dragging you onto {1:theName}!", user, Owner));
|
||||
}
|
||||
Owner.PopupMessage(victim, Loc.GetString("comp-kitchen-spike-begin-hook-victim", ("user", user), ("this", Owner)));
|
||||
else
|
||||
{
|
||||
Owner.PopupMessage(user, Loc.GetString("You begin dragging yourself onto {0:theName}!", Owner));
|
||||
}
|
||||
Owner.PopupMessage(victim, Loc.GetString("comp-kitchen-spike-begin-hook-self", ("this", Owner)));
|
||||
|
||||
var doAfterSystem = EntitySystem.Get<DoAfterSystem>();
|
||||
|
||||
@@ -129,15 +138,16 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
||||
if (result == DoAfterStatus.Cancelled)
|
||||
return;
|
||||
|
||||
if (!Spikeable(user, victim, out butcherable)) return;
|
||||
if (!Spikeable(user, victim, out butcherable))
|
||||
return;
|
||||
|
||||
_meatPrototype = butcherable.MeatPrototype;
|
||||
_meatParts = 5;
|
||||
_meatSource1p = Loc.GetString("You remove some meat from {0:theName}.", victim);
|
||||
_meatSource0 = Loc.GetString("You remove the last piece of meat from {0:theName}!", victim);
|
||||
_meatSource1p = Loc.GetString("comp-kitchen-spike-remove-meat", ("victim", victim));
|
||||
_meatSource0 = Loc.GetString("comp-kitchen-spike-remove-meat-last", ("victim", victim));
|
||||
// TODO: This could stand to be improved somehow, but it'd require Name to be much 'richer' in detail than it presently is.
|
||||
// But Name is RobustToolbox-level, so presumably it'd have to be done in some other way (interface???)
|
||||
_meatName = Loc.GetString("{0:name} meat", victim);
|
||||
_meatName = Loc.GetString("comp-kitchen-spike-meat-name", ("victim", victim));
|
||||
|
||||
// TODO: Visualizer
|
||||
if (Owner.TryGetComponent<SpriteComponent>(out var sprite))
|
||||
@@ -145,7 +155,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
||||
sprite.LayerSetState(0, "spikebloody");
|
||||
}
|
||||
|
||||
Owner.PopupMessageEveryone(Loc.GetString("{0:theName} has forced {1:theName} onto the spike, killing them instantly!", user, victim));
|
||||
Owner.PopupMessageEveryone(Loc.GetString("comp-kitchen-spike-kill", ("user", user), ("victim", victim)));
|
||||
// TODO: Need to be able to leave them on the spike to do DoT, see ss13.
|
||||
victim.Delete();
|
||||
|
||||
@@ -155,10 +165,10 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
||||
|
||||
SuicideKind ISuicideAct.Suicide(IEntity victim, IChatManager chat)
|
||||
{
|
||||
var othersMessage = Loc.GetString("{0:theName} has thrown themselves on a meat spike!", victim);
|
||||
var othersMessage = Loc.GetString("comp-kitchen-spike-suicide-other", ("victim", victim));
|
||||
victim.PopupMessageOtherClients(othersMessage);
|
||||
|
||||
var selfMessage = Loc.GetString("You throw yourself on a meat spike!");
|
||||
var selfMessage = Loc.GetString("comp-kitchen-spike-suicide-self");
|
||||
victim.PopupMessage(selfMessage);
|
||||
|
||||
return SuicideKind.Piercing;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Mobs;
|
||||
using Content.Shared.GameObjects.Components.Mobs.State;
|
||||
using Content.Shared.GameObjects.Components.Nutrition;
|
||||
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -23,15 +24,13 @@ namespace Content.Shared.Kitchen
|
||||
|
||||
bool IDragDropOn.CanDragDropOn(DragDropEventArgs eventArgs)
|
||||
{
|
||||
if (eventArgs.User == eventArgs.Dragged ||
|
||||
!eventArgs.Dragged.TryGetComponent<IMobStateComponent>(out var state) ||
|
||||
(eventArgs.User.TryGetComponent(out SharedCombatModeComponent? combatMode) && !combatMode.IsInCombatMode))
|
||||
if (!eventArgs.Dragged.HasComponent<SharedButcherableComponent>())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: Once we get silicons need to check organic
|
||||
return !state.IsDead();
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract bool DragDropOn(DragDropEventArgs eventArgs);
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
comp-kitchen-spike-deny-collect = { THE($this) } already has something on it, finish collecting its meat first!
|
||||
comp-kitchen-spike-deny-butcher = { THE($victim) } can't be butchered on { THE($this) }.
|
||||
comp-kitchen-spike-deny-not-dead = { THE($victim) } can't be butchered. { THE($victim) } is not dead!.
|
||||
|
||||
comp-kitchen-spike-begin-hook-victim = { THE($user) } begins dragging you onto { THE($this) }!
|
||||
comp-kitchen-spike-begin-hook-self = You begin dragging yourself onto { THE($this) }!
|
||||
|
||||
comp-kitchen-spike-kill = { THE($user) } has forced { THE($victim) } onto the spike, killing them instantly!
|
||||
|
||||
comp-kitchen-spike-suicide-other = { THE($victim) } has thrown themselves on a meat spike!
|
||||
comp-kitchen-spike-suicide-self = You throw yourself on a meat spike!
|
||||
|
||||
comp-kitchen-spike-remove-meat = You remove some meat from { THE($victim) }.
|
||||
comp-kitchen-spike-remove-meat-last = You remove the last piece of meat from { THE($victim) }!
|
||||
|
||||
comp-kitchen-spike-meat-name = { $victim } meat
|
||||
Reference in New Issue
Block a user