Fancy Verb Menu & Verb API Refactor (#928)
This commit is contained in:
committed by
GitHub
parent
4527fc9e84
commit
cad59d2cb4
@@ -328,16 +328,9 @@ namespace Content.Server.GameObjects.Components
|
||||
[Verb]
|
||||
private sealed class LockToggleVerb : Verb<EntityStorageComponent>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override string GetText(IEntity user, EntityStorageComponent component)
|
||||
protected override void GetData(IEntity user, EntityStorageComponent component, VerbData data)
|
||||
{
|
||||
return component._locked ? "Unlock" : "Lock";
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override VerbVisibility GetVisibility(IEntity user, EntityStorageComponent component)
|
||||
{
|
||||
return VerbVisibility.Visible;
|
||||
data.Text = component._locked ? "Unlock" : "Lock";
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -350,16 +343,15 @@ namespace Content.Server.GameObjects.Components
|
||||
[Verb]
|
||||
private sealed class OpenToggleVerb : Verb<EntityStorageComponent>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override string GetText(IEntity user, EntityStorageComponent component)
|
||||
protected override void GetData(IEntity user, EntityStorageComponent component, VerbData data)
|
||||
{
|
||||
return component.Open ? "Close" : "Open";
|
||||
}
|
||||
if (component.NoDoor)
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override VerbVisibility GetVisibility(IEntity user, EntityStorageComponent component)
|
||||
{
|
||||
return component.NoDoor ? VerbVisibility.Invisible : VerbVisibility.Visible;
|
||||
data.Text = component.Open ? "Close" : "Open";
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -113,23 +113,15 @@ namespace Content.Server.GameObjects
|
||||
[Verb]
|
||||
public sealed class PickUpVerb : Verb<ItemComponent>
|
||||
{
|
||||
protected override string GetText(IEntity user, ItemComponent component)
|
||||
{
|
||||
if (user.TryGetComponent(out HandsComponent hands) && hands.IsHolding(component.Owner))
|
||||
{
|
||||
return "Pick Up (Already Holding)";
|
||||
}
|
||||
return "Pick Up";
|
||||
}
|
||||
|
||||
protected override VerbVisibility GetVisibility(IEntity user, ItemComponent component)
|
||||
protected override void GetData(IEntity user, ItemComponent component, VerbData data)
|
||||
{
|
||||
if (ContainerHelpers.IsInContainer(component.Owner) || !component.CanPickup(user))
|
||||
{
|
||||
return VerbVisibility.Invisible;
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
}
|
||||
|
||||
return VerbVisibility.Visible;
|
||||
data.Text = "Pick Up";
|
||||
}
|
||||
|
||||
protected override void Activate(IEntity user, ItemComponent component)
|
||||
|
||||
Reference in New Issue
Block a user