Moves Hands to shared, some prediction (#3829)
* HandsGuiState * Gui state setting methods * code cleanup * Removes TryGetHands * ClientHand * Gui Hands * Refactor WIP 1 * Hand index * refactors 2 * wip 3 * wip 4 * wiip 4 * wip 5 * wip 6 * wip 7 * wip 8 * wip 9 * wip 11 * Hand ui mostly looks fine * hands gui cleanup 1 * cleanup 2 * wip 13 * hand enabled * stuff * Hands gui gap fix * onpressed test * hand gui buttons events work * bag activation works * fix item use * todo comment * hands activate fix * Moves Client Hands back to using strings to identify active hand * fixes action hand highlighting * diff fix * serverhand * SharedHand * SharedHand, IReadOnlyHand * Client Hands only stores SharedHand * cleanup server hands * server hand container shutdown * misc renames, refactors of serverhand * stuff 1 * stuff 3 * server hand refactor 1 * Undo API changes to remove massive diff * More API name fixes * server hands cleanup 2 * cleanup 3 * dropping cleanup * Cleanup 4 * MoveItemFromHand * Stuff * region sorting * Hand Putter methods cleanup * stuff 2 * Merges all of serverhand and clienthand into sharedhand * Other hands systems, hack to make inhands update (gui state set every frame, visualzier updated every frame) * GetFinalDropCoordinates cleanup * SwapHands cleanup * Moves server hands code to shared hands * Fixed hand selected and deselected * Naming fixes * Server hands system cleanup * Hands privacy fixes * Client hand updates when containers are modified * HeldItemVisualizer * Fixes hand gui item status panel * method name fix * Swap hands prediction * Dropping prediction * Fixes pickup entity animation * Fixes HeldItemsVisualizer * moves item pickup to shared * PR cleanup * fixes hand enabling/disabling * build fix * Conflict fixes * Fixes pickup animation * Uses component directed message subscriptions * event unsubscriptions in hand system * unsubscribe fix * CanInsertEntityIntoHand checks if hand is enabled * Moving items from one hand to another checks if the hands can pick up and drop * Fixes stop pulling not re-enabling hand * Fixes pickup animation for entities containers on the floor * Fixes using held items * Fixes multiple hands guis appearing * test fix * removes obsolete system sunsubscribes * Checks IsFirstTimePredicted before playing drop animation * fixes hand item deleted crash * Uses Get to get other system * Replaces AppearanceComponent with SharedAppearanceComponent * Replaces EnsureComponent with TryGetComponent * Improves event class names * Moves property up to top of class * Moves code for determining the hand visualizer rsi state into the visualizer instead of being determined on hand component * Eventbus todo comment * Yaml fix for changed visualizer name * Makes HandsVisuals a byte * Removes state from HandsVisualizer * Fixes hand using interaction method name * Namespace changes fixes * Fix for changed hand interaction method * missing } * conflict build fix * Moves cleint HandsSystem to correct folder * Moved namespace fix for interaction test * Moves Handsvisualizer ot correct folder * Moves SharedHandsSystem to correct folder * Fixes errors from moving namespace of hand systems * Fixes PDA component changes * Fixes ActionsComponent diff * Fixes inventory component diff * fixes null ref * Replaces obsolete Loc.GetString usage with fluent translations * Fluent for hands disarming * SwapHands and Drop user input specify to the server which hand * Pickup animation WorldPosiiton todo * Cleans up hands gui subscription handling * Fixes change in ActionBlockerSystem access * Namespace references fixes * HandsComponent PlayerAttached/Detached messages are handled through eventbus * Fixes GasCanisterSystem drop method usage * Fix gameticker equipping method at new location Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -21,7 +21,7 @@ namespace Content.Server.Hands.Components
|
||||
/// <summary>
|
||||
/// The hands in this component.
|
||||
/// </summary>
|
||||
IEnumerable<string> Hands { get; }
|
||||
IEnumerable<string> HandNames { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The hand name of the currently active hand.
|
||||
@@ -61,18 +61,6 @@ namespace Content.Server.Hands.Components
|
||||
/// <returns>True if the item was inserted, false otherwise.</returns>
|
||||
bool PutInHand(ItemComponent item, bool mobCheck = true);
|
||||
|
||||
/// <summary>
|
||||
/// Puts an item into a specific hand.
|
||||
/// </summary>
|
||||
/// <param name="item">The item to put in the hand.</param>
|
||||
/// <param name="index">The name of the hand to put the item into.</param>
|
||||
/// <param name="fallback">
|
||||
/// If true and the provided hand is full, the method will fall back to <see cref="PutInHand(ItemComponent)" />
|
||||
/// <param name="mobCheck">Whether to perform an ActionBlocker check to the entity.</param>
|
||||
/// </param>
|
||||
/// <returns>True if the item was inserted into a hand, false otherwise.</returns>
|
||||
bool PutInHand(ItemComponent item, string index, bool fallback=true, bool mobCheck = true);
|
||||
|
||||
/// <summary>
|
||||
/// Checks to see if an item can be put in any hand.
|
||||
/// </summary>
|
||||
@@ -81,43 +69,19 @@ namespace Content.Server.Hands.Components
|
||||
/// <returns>True if the item can be inserted, false otherwise.</returns>
|
||||
bool CanPutInHand(ItemComponent item, bool mobCheck = true);
|
||||
|
||||
/// <summary>
|
||||
/// Checks to see if an item can be put in the specified hand.
|
||||
/// </summary>
|
||||
/// <param name="item">The item to check for.</param>
|
||||
/// <param name="index">The name for the hand to check for.</param>
|
||||
/// <param name="mobCheck">Whether to perform an ActionBlocker check to the entity.</param>
|
||||
/// <returns>True if the item can be inserted, false otherwise.</returns>
|
||||
bool CanPutInHand(ItemComponent item, string index, bool mobCheck = true);
|
||||
|
||||
/// <summary>
|
||||
/// Finds the hand slot holding the specified entity, if any.
|
||||
/// </summary>
|
||||
/// <param name="entity">The entity to look for in our hands.</param>
|
||||
/// <param name="handName">
|
||||
/// The name of the hand slot if the entity is indeed held,
|
||||
/// <see langword="null" /> otherwise.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// true if the entity is held, false otherwise
|
||||
/// </returns>
|
||||
bool TryHand(IEntity entity, [NotNullWhen(true)] out string? handName);
|
||||
|
||||
/// <summary>
|
||||
/// Drops the item contained in the slot to the same position as our entity.
|
||||
/// </summary>
|
||||
/// <param name="slot">The slot of which to drop to drop the item.</param>
|
||||
/// <param name="mobChecks">Whether to check the <see cref="ActionBlockerSystem.CanDrop()"/> for the mob or not.</param>
|
||||
/// <param name="doDropInteraction">Whether to perform Dropped interactions.</param>
|
||||
/// <param name="mobChecks">Whether to check the <see cref="ActionBlockerSystem.CanDrop()"/> for the mob or not.</param
|
||||
/// <returns>True on success, false if something blocked the drop.</returns>
|
||||
bool Drop(string slot, bool mobChecks = true, bool doDropInteraction = true, bool intentional = true);
|
||||
bool Drop(string slot, bool mobChecks = true, bool intentional = true);
|
||||
|
||||
/// <summary>
|
||||
/// Drops an item held by one of our hand slots to the same position as our owning entity.
|
||||
/// </summary>
|
||||
/// <param name="entity">The item to drop.</param>
|
||||
/// <param name="mobChecks">Whether to check the <see cref="ActionBlockerSystem.CanDrop()"/> for the mob or not.</param>
|
||||
/// <param name="doDropInteraction">Whether to perform Dropped interactions.</param>
|
||||
/// <returns>True on success, false if something blocked the drop.</returns>
|
||||
/// <exception cref="ArgumentNullException">
|
||||
/// Thrown if <see cref="entity"/> is null.
|
||||
@@ -125,7 +89,7 @@ namespace Content.Server.Hands.Components
|
||||
/// <exception cref="ArgumentException">
|
||||
/// Thrown if <see cref="entity"/> is not actually held in any hand.
|
||||
/// </exception>
|
||||
bool Drop(IEntity entity, bool mobChecks = true, bool doDropInteraction = true, bool intentional = true);
|
||||
bool Drop(IEntity entity, bool mobChecks = true, bool intentional = true);
|
||||
|
||||
/// <summary>
|
||||
/// Drops the item in a slot.
|
||||
@@ -133,9 +97,8 @@ namespace Content.Server.Hands.Components
|
||||
/// <param name="slot">The slot to drop the item from.</param>
|
||||
/// <param name="coords"></param>
|
||||
/// <param name="doMobChecks">Whether to check the <see cref="ActionBlockerSystem.CanDrop()"/> for the mob or not.</param>
|
||||
/// <param name="doDropInteraction">Whether to perform Dropped interactions.</param>
|
||||
/// <returns>True if an item was dropped, false otherwise.</returns>
|
||||
bool Drop(string slot, EntityCoordinates coords, bool doMobChecks = true, bool doDropInteraction = true, bool intentional = true);
|
||||
bool TryDropHand(string slot, EntityCoordinates coords, bool doMobChecks = true, bool intentional = true);
|
||||
|
||||
/// <summary>
|
||||
/// Drop the specified entity in our hands to a certain position.
|
||||
@@ -147,7 +110,6 @@ namespace Content.Server.Hands.Components
|
||||
/// <param name="entity">The entity to drop, must be held in one of the hands.</param>
|
||||
/// <param name="coords">The coordinates to drop the entity at.</param>
|
||||
/// <param name="doMobChecks">Whether to check the <see cref="ActionBlockerSystem.CanDrop()"/> for the mob or not.</param>
|
||||
/// <param name="doDropInteraction">Whether to perform Dropped interactions.</param>
|
||||
/// <returns>
|
||||
/// True if the drop succeeded,
|
||||
/// false if it failed (due to failing to eject from our hand slot, etc...)
|
||||
@@ -158,22 +120,21 @@ namespace Content.Server.Hands.Components
|
||||
/// <exception cref="ArgumentException">
|
||||
/// Thrown if <see cref="entity"/> is not actually held in any hand.
|
||||
/// </exception>
|
||||
bool Drop(IEntity entity, EntityCoordinates coords, bool doMobChecks = true, bool doDropInteraction = true, bool intentional = true);
|
||||
bool TryDropEntity(IEntity entity, EntityCoordinates coords, bool doMobChecks = true, bool intentional = true);
|
||||
|
||||
/// <summary>
|
||||
/// Drop the item contained in a slot into another container.
|
||||
/// </summary>
|
||||
/// <param name="slot">The slot of which to drop the entity.</param>
|
||||
/// <param name="targetContainer">The container to drop into.</param>
|
||||
/// <param name="doMobChecks">Whether to check the <see cref="ActionBlockerSystem.CanDrop"/> for the mob or not.</param>
|
||||
/// <param name="doDropInteraction">Whether to perform Dropped interactions.</param>
|
||||
/// <param name="doMobChecks">Whether to check the <see cref="ActionBlockerSystem.CanDrop(IEntity)"/> for the mob or not.</param>
|
||||
/// <returns>True on success, false if something was blocked (insertion or removal).</returns>
|
||||
/// <exception cref="InvalidOperationException">
|
||||
/// Thrown if dry-run checks reported OK to remove and insert,
|
||||
/// but practical remove or insert returned false anyways.
|
||||
/// This is an edge-case that is currently unhandled.
|
||||
/// </exception>
|
||||
bool Drop(string slot, BaseContainer targetContainer, bool doMobChecks = true, bool doDropInteraction = true, bool intentional = true);
|
||||
bool TryPutHandIntoContainer(string slot, BaseContainer targetContainer, bool doMobChecks = true);
|
||||
|
||||
/// <summary>
|
||||
/// Drops an item in one of the hands into a container.
|
||||
@@ -181,7 +142,6 @@ namespace Content.Server.Hands.Components
|
||||
/// <param name="entity">The item to drop.</param>
|
||||
/// <param name="targetContainer">The container to drop into.</param>
|
||||
/// <param name="doMobChecks">Whether to check the <see cref="ActionBlockerSystem.CanDrop()"/> for the mob or not.</param>
|
||||
/// <param name="doDropInteraction">Whether to perform Dropped interactions.</param>
|
||||
/// <returns>True on success, false if something was blocked (insertion or removal).</returns>
|
||||
/// <exception cref="InvalidOperationException">
|
||||
/// Thrown if dry-run checks reported OK to remove and insert,
|
||||
@@ -194,7 +154,7 @@ namespace Content.Server.Hands.Components
|
||||
/// <exception cref="ArgumentException">
|
||||
/// Thrown if <see cref="entity"/> is not actually held in any hand.
|
||||
/// </exception>
|
||||
bool Drop(IEntity entity, BaseContainer targetContainer, bool doMobChecks = true, bool doDropInteraction = true, bool intentional = true);
|
||||
bool Drop(IEntity entity, BaseContainer targetContainer, bool doMobChecks = true);
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether the item in the specified hand can be dropped.
|
||||
@@ -213,7 +173,7 @@ namespace Content.Server.Hands.Components
|
||||
/// <exception cref="InvalidOperationException">
|
||||
/// Thrown if a hand with specified name already exists.
|
||||
/// </exception>
|
||||
void AddHand(string name);
|
||||
void AddHand(string name, HandLocation handLocation);
|
||||
|
||||
/// <summary>
|
||||
/// Removes a hand from this hands component.
|
||||
@@ -230,7 +190,5 @@ namespace Content.Server.Hands.Components
|
||||
/// <param name="name">The hand name to check.</param>
|
||||
/// <returns>True if the hand exists, false otherwise.</returns>
|
||||
bool HasHand(string name);
|
||||
|
||||
void HandleSlotModifiedMaybe(ContainerModifiedMessage message);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user