Add insert verb to disposal units (#6463)

This commit is contained in:
Leon Friedrich
2022-02-07 14:54:54 +13:00
committed by GitHub
parent 062e8785d5
commit 133134d9cc

View File

@@ -68,6 +68,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
SubscribeLocalEvent<DisposalUnitComponent, DestructionEventArgs>(HandleDestruction);
// Verbs
SubscribeLocalEvent<DisposalUnitComponent, GetInteractionVerbsEvent>(AddInsertVerb);
SubscribeLocalEvent<DisposalUnitComponent, GetAlternativeVerbsEvent>(AddFlushEjectVerbs);
SubscribeLocalEvent<DisposalUnitComponent, GetOtherVerbsEvent>(AddClimbInsideVerb);
@@ -122,6 +123,31 @@ namespace Content.Server.Disposal.Unit.EntitySystems
args.Verbs.Add(verb);
}
private void AddInsertVerb(EntityUid uid, DisposalUnitComponent component, GetInteractionVerbsEvent args)
{
if (!args.CanAccess || !args.CanInteract || args.Hands == null || args.Using == null)
return;
if (!_actionBlockerSystem.CanDrop(args.User))
return;
if (!CanInsert(component, args.Using.Value))
return;
Verb insertVerb = new()
{
Text = Name(args.Using.Value),
Category = VerbCategory.Insert,
Act = () =>
{
args.Hands.Drop(args.Using.Value, component.Container);
AfterInsert(component, args.Using.Value);
}
};
args.Verbs.Add(insertVerb);
}
private void DoInsertDisposalUnit(DoInsertDisposalUnitEvent ev)
{
var toInsert = ev.ToInsert;