Add priorities to items slots (#8748)

This commit is contained in:
Leon Friedrich
2022-06-12 02:22:19 +12:00
committed by GitHub
parent 863a92eb6c
commit 538d93d19d
3 changed files with 15 additions and 5 deletions

View File

@@ -198,5 +198,11 @@ namespace Content.Shared.Containers.ItemSlots
// Convenience properties
public bool HasItem => ContainerSlot?.ContainedEntity != null;
public EntityUid? Item => ContainerSlot?.ContainedEntity;
/// <summary>
/// Priority for use with the eject & insert verbs for this slot.
/// </summary>
[DataField("priority")]
public int Priority = 0;
}
}

View File

@@ -431,6 +431,7 @@ namespace Content.Shared.Containers.ItemSlots
verb.Text = Loc.GetString(slot.EjectVerbText);
}
verb.Priority = slot.Priority;
args.Verbs.Add(verb);
}
}
@@ -462,6 +463,7 @@ namespace Content.Shared.Containers.ItemSlots
else
takeVerb.Text = Loc.GetString(slot.EjectVerbText);
takeVerb.Priority = slot.Priority;
args.Verbs.Add(takeVerb);
}
@@ -500,6 +502,7 @@ namespace Content.Shared.Containers.ItemSlots
insertVerb.Text = verbSubject;
}
insertVerb.Priority = slot.Priority;
args.Verbs.Add(insertVerb);
}
}

View File

@@ -53,6 +53,7 @@
- type: PDA
penSlot:
startingItem: Pen
priority: -1
whitelist:
tags:
- Write
@@ -177,11 +178,10 @@
- type: PDA
id: ClownIDCard
penSlot:
startingItem: CrayonOrange # no pink crayon?!?
# Maybe this is a bad idea.
# At least they can't just spam alt-click it.
# You need to remove the ID & alternate between inserting and ejecting
startingItem: CrayonOrange # no pink crayon?!?
# ^ Still unacceptable.
ejectSound: /Audio/Items/bikehorn.ogg
priority: -1
whitelist:
tags:
- Write
@@ -365,6 +365,7 @@
id: CaptainIDCard
penSlot:
startingItem: PenCap
priority: -1
whitelist:
tags:
- Write
@@ -385,6 +386,7 @@
id: HoPIDCard
penSlot:
startingItem: PenHop
priority: -1
whitelist:
tags:
- Write
@@ -410,7 +412,6 @@
- type: Icon
state: pda-ce
- type: entity
parent: BasePDA
id: EngineerPDA