ECS verbs and update context menu (#4594)

* Functioning ECS verbs

Currently only ID card console works.

* Changed verb types and allow ID card insertions

* Verb GUI sorting and verb networking

* More networking, and shared components

* Clientside verbs work now.

* Verb enums changed to bitmask flags

* Verb Categories redo

* Fix range check

* GasTank Verb

* Remove unnecessary bodypart verb

* Buckle Verb

* buckle & unbuckle verbs

* Updated range checks

* Item cabinet verbs

* Add range user override

* construction verb

* Chemistry machine verbs

* Climb Verb

* Generalise pulled entity verbs

* ViewVariables Verb

* rejuvenate, delete, sentient, control verbs

* Outfit verb

* inrangeunoccluded and tubedirection verbs

* attach-to verbs

* remove unused verbs and move VV

* Rename DebugVerbSystem

* Ghost role and pointing verbs

* Remove global verbs

* Allow verbs to raise events

* Changing categories and simplifying debug verbs

* Add rotate and flip verbs

* fix rejuvenate test

* redo context menu

* new Add Gas debug verb

* Add Set Temperature debug verb

* Uncuff verb

* Disposal unit verbs

* Add pickup verb

* lock/unlock verb

* Remove verb type, add specific verb events

* rename verb messages -> events

* Context menu displays verbs by interaction type

* Updated context menu HandleMove

previously, checked if entities moved 1 tile from click location.

Now checks if entities moved out of view.

Now you can actually right-click interact with yourself while walking!

* Misc Verb menu GUI changes

* Fix non-human/ghost verbs

* Update types and categories

* Allow non-ghost/human to open context menu

* configuration verb

* tagger verb

* Morgue Verbs

* Medical Scanner Verbs

* Fix solution refactor merge issues

* Fix context menu in-view check

* Remove prepare GUI

* Redo verb restrictions

* Fix context menu UI

* Disposal Verbs

* Spill verb

* Light verb

* Hand Held light verb

* power cell verbs

* storage verbs

and adding names to insert/eject

* Pulling verb

* Close context menu on verb execution

* Strip verb

* AmmoBox verb

* fix pull verb

* gun barrel verbs

revolver verb
energy weapon verbs
Bolt action verb

* Magazine gun barrel  verbs

* Add charger verbs

* PDA verbs

* Transfer amount verb

* Add reagent verb

* make alt-click use ECS verbs

* Delete old verb files

* Magboot verb

* finalising tweaks

* context menu visibility changes

* code cleanup

* Update AdminAddReagentUI.cs

* Remove HasFlag

* Consistent verb keys

* Remove Linq, add comment

* Fix in-inventory check

* Update GUI text alignment and padding

* Added close-menu option

* Changed some "interaction" verbs to "activation"

* Remove verb keys, use sorted sets

* fix master merge

* update some verb text

* Undo Changes

Remove some new verbs that can be added later

undid some .ftl bugfixes, can and should be done separately

* fix merge

* Undo file rename

* fix merge

* Misc Cleanup

* remove contraction

* Fix keybinding issue

* fix comment

* merge fix

* fix merge

* fix merge

* fix merge

* fix merge

* fix open-close verbs

* adjust uncuff verb

* fix merge

and undo the renaming of SharedPullableComponent to PullableComponent. I'm tired of all of those merge conflicts
This commit is contained in:
Leon Friedrich
2021-10-05 14:29:03 +11:00
committed by GitHub
parent 1095c8fc08
commit 6cb58e608b
175 changed files with 3391 additions and 4305 deletions

View File

@@ -8,6 +8,7 @@ using Content.Server.Hands.Components;
using Content.Server.Items;
using Content.Server.Pulling;
using Content.Server.Timing;
using Content.Server.Verbs;
using Content.Shared.ActionBlocker;
using Content.Shared.DragDrop;
using Content.Shared.Hands;
@@ -17,6 +18,7 @@ using Content.Shared.Interaction;
using Content.Shared.Interaction.Helpers;
using Content.Shared.Inventory;
using Content.Shared.Popups;
using Content.Shared.Pulling.Components;
using Content.Shared.Rotatable;
using Content.Shared.Throwing;
using Content.Shared.Verbs;
@@ -47,6 +49,7 @@ namespace Content.Server.Interaction
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
[Dependency] private readonly VerbSystem _verbSystem = default!;
[Dependency] private readonly PullingSystem _pullSystem = default!;
public override void Initialize()
@@ -311,7 +314,7 @@ namespace Content.Server.Interaction
if (!InRangeUnobstructed(userEntity, pulledObject, popup: true))
return false;
if (!pulledObject.TryGetComponent(out PullableComponent? pull))
if (!pulledObject.TryGetComponent(out SharedPullableComponent? pull))
return false;
return _pullSystem.TogglePull(userEntity, pull);
@@ -380,13 +383,7 @@ namespace Content.Server.Interaction
{
// We are close to the nearby object.
if (altInteract)
// We are trying to use alternative interactions. Perform alternative interactions, using context
// menu verbs.
// Verbs can be triggered with an item in the hand, but currently there are no verbs that depend on
// the currently held item. Maybe this if statement should be changed to
// (altInteract && (item == null || item == target)).
// Note that item == target will happen when alt-clicking the item currently in your hands.
// Perform alternative interactions, using context menu verbs.
AltInteract(user, target);
else if (item != null && item != target)
// We are performing a standard interaction with an item, and the target isn't the same as the item
@@ -428,7 +425,7 @@ namespace Content.Server.Interaction
if (user.TryGetComponent(out BuckleComponent? buckle) && (buckle.BuckledTo != null))
{
// We're buckled to another object. Is that object rotatable?
if (buckle.BuckledTo!.Owner.TryGetComponent(out SharedRotatableComponent? rotatable) && rotatable.RotateWhileAnchored)
if (buckle.BuckledTo!.Owner.TryGetComponent(out RotatableComponent? rotatable) && rotatable.RotateWhileAnchored)
{
// Note the assumption that even if unanchored, user can only do spinnychair with an "independent wheel".
// (Since the user being buckled to it holds it down with their weight.)
@@ -511,36 +508,20 @@ namespace Content.Server.Interaction
/// Alternative interactions on an entity.
/// </summary>
/// <remarks>
/// Uses the context menu verb list, and acts out the first verb marked as an alternative interaction. Note
/// that this does not have any checks to see whether this interaction is valid, as these are all done in <see
/// cref="UserInteraction(IEntity, EntityCoordinates, EntityUid, bool)"/>
/// Uses the context menu verb list, and acts out the highest priority alternative interaction verb.
/// </remarks>
public void AltInteract(IEntity user, IEntity target)
{
// TODO VERB SYSTEM when ECS-ing verbs and re-writing VerbUtility.GetVerbs, maybe sort verbs by some
// priority property, such that which verbs appear first is more predictable?.
// Get list of alt-interact verbs
GetAlternativeVerbsEvent getVerbEvent = new(user, target);
RaiseLocalEvent(target.Uid, getVerbEvent);
// Iterate through list of verbs that apply to target. We do not include global verbs here. If in the future
// alt click should also support global verbs, this needs to be changed.
foreach (var (component, verb) in VerbUtility.GetVerbs(target))
foreach (var verb in getVerbEvent.Verbs)
{
// Check that the verb marked as an alternative interaction?
if (!verb.AlternativeInteraction)
if (verb.Disabled)
continue;
// Can the verb be acted out?
if (!VerbUtility.VerbAccessChecks(user, target, verb))
continue;
// Is the verb currently enabled?
var verbData = verb.GetData(user, component);
if (verbData.IsInvisible || verbData.IsDisabled)
continue;
// Act out the verb. Note that, if there is more than one AlternativeInteraction verb, only the first
// one is activated. The priority is effectively determined by the order in which VerbUtility.GetVerbs()
// returns the verbs.
verb.Activate(user, component);
_verbSystem.TryExecuteVerb(verb);
break;
}
}