Add insert verb to disposal units (#6463)
This commit is contained in:
@@ -68,6 +68,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
|||||||
SubscribeLocalEvent<DisposalUnitComponent, DestructionEventArgs>(HandleDestruction);
|
SubscribeLocalEvent<DisposalUnitComponent, DestructionEventArgs>(HandleDestruction);
|
||||||
|
|
||||||
// Verbs
|
// Verbs
|
||||||
|
SubscribeLocalEvent<DisposalUnitComponent, GetInteractionVerbsEvent>(AddInsertVerb);
|
||||||
SubscribeLocalEvent<DisposalUnitComponent, GetAlternativeVerbsEvent>(AddFlushEjectVerbs);
|
SubscribeLocalEvent<DisposalUnitComponent, GetAlternativeVerbsEvent>(AddFlushEjectVerbs);
|
||||||
SubscribeLocalEvent<DisposalUnitComponent, GetOtherVerbsEvent>(AddClimbInsideVerb);
|
SubscribeLocalEvent<DisposalUnitComponent, GetOtherVerbsEvent>(AddClimbInsideVerb);
|
||||||
|
|
||||||
@@ -122,6 +123,31 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
|||||||
args.Verbs.Add(verb);
|
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)
|
private void DoInsertDisposalUnit(DoInsertDisposalUnitEvent ev)
|
||||||
{
|
{
|
||||||
var toInsert = ev.ToInsert;
|
var toInsert = ev.ToInsert;
|
||||||
|
|||||||
Reference in New Issue
Block a user