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 // Convenience properties
public bool HasItem => ContainerSlot?.ContainedEntity != null; public bool HasItem => ContainerSlot?.ContainedEntity != null;
public EntityUid? Item => ContainerSlot?.ContainedEntity; 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.Text = Loc.GetString(slot.EjectVerbText);
} }
verb.Priority = slot.Priority;
args.Verbs.Add(verb); args.Verbs.Add(verb);
} }
} }
@@ -462,6 +463,7 @@ namespace Content.Shared.Containers.ItemSlots
else else
takeVerb.Text = Loc.GetString(slot.EjectVerbText); takeVerb.Text = Loc.GetString(slot.EjectVerbText);
takeVerb.Priority = slot.Priority;
args.Verbs.Add(takeVerb); args.Verbs.Add(takeVerb);
} }
@@ -500,6 +502,7 @@ namespace Content.Shared.Containers.ItemSlots
insertVerb.Text = verbSubject; insertVerb.Text = verbSubject;
} }
insertVerb.Priority = slot.Priority;
args.Verbs.Add(insertVerb); args.Verbs.Add(insertVerb);
} }
} }

View File

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