DoActionHold¶
This page focuses more on the method which includes the actuation procedure and requirements for all fields abilitis. For information on what these abilities do, check the fields abilities documentation.
DoActionHold is a method that is only called by GetInput when processing the ability input in the following circumstances:
- The input was held for 20.0 or more frames
- The input was released, but the player was
diggingandkeepdigwas above 0.0 (it's still active)
The method attempts to perform the leader party member (playerdata[0])'s hold field action. However, it's possible that the conditions for the actions aren't met. If that's the case, DoActionTap is called instead which treats it as a tap action instead of a hold.
Before attempting the action, lastactionid is always reset to 0, but it won't be set in this method further.
The specific action depends on the playerdata[0]'s animid (not its entity's animid, but they should match under normal gameplay).
Bee's hold action (Bee Fly)¶
This action is only performed if all of the following conditions are fufilled:
- flags 19 is true (obtained Fly). Otherwise,
actionroutineis set to a new DoActionTap call if thebeemerangis null (meaning a throw isn't already in progress) - There are more than 1
playerdata buttonholdis false (meaning the ability input is still being held after the previousflyingso a new flight can't happen until the input is released)canflyis truejumproutineis null (JumpTo isn't in progress)
If all of the above conditions are fufilled, the action is performed:
- If
startheightis null, it is initialised to the player y position - entity.animstate set to 102
flyingset to true- entity.
overrideanimset to true - entity.
rigidhas its gravity disabled
The actual flying logic is maintained by LateUpdate using startheight to change the y position.
Beetle's hold action (Beetle Dig)¶
It's possible this action is called even when the player is already digging which would simply resume the existing action.
This action is only performed (or resumed) if all of the following conditions are fufilled:
- flags 18 is true (obtained Dig). Otherwise,
actionroutineis set to a new DoActionTap call candigis true- The entity is
onground - A Raycast from the player position + 0.1 in y heading down in y for up to 0.25 distance registers a hit with anything on layer 8 (
Ground)
If any of the conditions above aren't fufilled with the exception of the flag (since it causes the tap action to happen), CancelAction is called instead which stops any existing digging.
If all of the above conditions are fufilled, the action is performed (or resumed):
- If not
diggingalready and entity.animstate isn't 101, theDigsound plays at 0.7 volume - entity.
animstateset to 101 - entity.
overrideanimset to true - entity's y
spinset to 25.0 startdigset to true (this eventually will cause FixedUpdate to setdiggingto true)
This is where the logic differs between a new action and a resume which is checked by the digging value as if it's false, it means this is a new digging action and if it's true, it's resuming an existing digging action.
New action¶
- entity.StopMoving with targetstate being the entity.
animstate - If
diggingpartis null, it is initialised to a newDirtFlyingparticles at the player position with -90.0 x angle and -1.0 alivetime (infinite)
Resume an existing action¶
diggingpartis moved offscreen then destroyed in 1.0 second- If
tunnelpartis null:- RefreshPlayer with onlycollider is called which will cause ForceHitWall to be called on the player entity if not
ineventand not in abattle tunnelpartis initialed to a newDiggingparticles childed to the player at the player position with -90.0 x angle, -1.0 alivetime (infinite) and 2760 rendersort
- RefreshPlayer with onlycollider is called which will cause ForceHitWall to be called on the player entity if not
Moth's hold action (Shield)¶
It's possible this action is called even when the player is already in a shield which would simply resume the existing action.
This action is only performed (or resumed) if flags 20 is true (obtained Shield). Otherwise, actionroutine is set to a new DoActionTap call
Here's the logic of the action if it is performed (or resumed):
- entity.
overrideanimis set to true - entity.animstate is set to a value that depends on
delta's magnitude:- >= 0.1: 123
- < 0.1: 122
- If the player isn't already in a
shield(it's a new action):- TeleportFollowers is called
Shieldsound plays on the entity
shieldis set to true