private void AddMagazineInteractionVerbs(EntityUid uid, ServerMagazineBarrelComponent component, GetInteractionVerbsEvent args) { if (args.Hands == null || !args.CanAccess || !args.CanInteract) { return; } // Toggle bolt verb Verb toggleBolt = new(); toggleBolt.Text = component.BoltOpen ? Loc.GetString("close-bolt-verb-get-data-text") : Loc.GetString("open-bolt-verb-get-data-text"); toggleBolt.Act = () => component.BoltOpen = !component.BoltOpen; args.Verbs.Add(toggleBolt); // Are we holding a mag that we can insert? if (args.Using == null || !component.CanInsertMagazine(args.User, args.Using) || !_actionBlockerSystem.CanDrop(args.User)) { return; } // Insert mag verb Verb insert = new(); insert.Text = args.Using.Name; insert.Category = VerbCategory.Insert; insert.Act = () => component.InsertMagazine(args.User, args.Using); args.Verbs.Add(insert); }
private void AddEjectMagazineVerb(EntityUid uid, ServerMagazineBarrelComponent component, GetAlternativeVerbsEvent args) { if (args.Hands == null || !args.CanAccess || !args.CanInteract || !component.HasMagazine || !_actionBlockerSystem.CanPickup(args.User)) { return; } if (component.MagNeedsOpenBolt && !component.BoltOpen) { return; } Verb verb = new(); verb.Text = EntityManager.GetComponent <MetaDataComponent>(component.MagazineContainer.ContainedEntity !.Value).EntityName; verb.Category = VerbCategory.Eject; verb.Act = () => component.RemoveMagazine(args.User); args.Verbs.Add(verb); }