-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Further work on Actions implementation
- Loading branch information
1 parent
7a355be
commit 440968c
Showing
44 changed files
with
1,495 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/AirborneActionDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.fqf.mario_qua_mario.definitions.actions; | ||
|
||
import com.fqf.mario_qua_mario.definitions.actions.util.IncompleteActionDefinition; | ||
import com.fqf.mario_qua_mario.definitions.actions.util.TransitionDefinition; | ||
import com.fqf.mario_qua_mario.mariodata.IMarioTravelData; | ||
import com.fqf.mario_qua_mario.util.CharaStat; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.List; | ||
|
||
public interface AirborneActionDefinition extends IncompleteActionDefinition { | ||
void travelHook(IMarioTravelData data, AirborneActionHelper helper); | ||
|
||
@NotNull List<TransitionDefinition> getBasicTransitions(AirborneActionHelper helper); | ||
@NotNull List<TransitionDefinition> getInputTransitions(AirborneActionHelper helper); | ||
@NotNull List<TransitionDefinition> getWorldCollisionTransitions(AirborneActionHelper helper); | ||
|
||
/** | ||
* Contains a number of methods intended to help with the creation of Airborne Actions. | ||
*/ | ||
interface AirborneActionHelper { | ||
void applyGravity( | ||
IMarioTravelData data, | ||
CharaStat gravity, @Nullable CharaStat jumpingGravity, | ||
CharaStat terminalVelocity | ||
); | ||
|
||
void airborneAccel( | ||
IMarioTravelData data, | ||
CharaStat forwardAccelStat, CharaStat forwardSpeedStat, | ||
CharaStat backwardAccelStat, CharaStat backwardSpeedStat, | ||
CharaStat strafeAccelStat, CharaStat strafeSpeedStat, | ||
double forwardAngleContribution, double strafeAngleContribution, CharaStat redirectStat | ||
); | ||
|
||
TransitionDefinition makeJumpCapTransition(IncompleteActionDefinition forAction, double capThreshold); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/AquaticActionDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.fqf.mario_qua_mario.definitions.actions; | ||
|
||
import com.fqf.mario_qua_mario.definitions.actions.util.IncompleteActionDefinition; | ||
import com.fqf.mario_qua_mario.definitions.actions.util.TransitionDefinition; | ||
import com.fqf.mario_qua_mario.mariodata.IMarioTravelData; | ||
import com.fqf.mario_qua_mario.util.CharaStat; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.List; | ||
|
||
public interface AquaticActionDefinition extends IncompleteActionDefinition { | ||
void travelHook(IMarioTravelData data, AquaticActionHelper helper); | ||
|
||
@NotNull List<TransitionDefinition> getBasicTransitions(AquaticActionHelper helper); | ||
@NotNull List<TransitionDefinition> getInputTransitions(AquaticActionHelper helper); | ||
@NotNull List<TransitionDefinition> getWorldCollisionTransitions(AquaticActionHelper helper); | ||
|
||
/** | ||
* Contains a number of methods intended to help with the creation of Aquatic Actions. | ||
*/ | ||
interface AquaticActionHelper { | ||
void applyGravity(IMarioTravelData data, CharaStat gravity, CharaStat terminalVelocity); | ||
|
||
void applyWaterDrag(IMarioTravelData data, CharaStat drag, CharaStat dragMin); | ||
|
||
void aquaticAccel( | ||
IMarioTravelData data, | ||
CharaStat forwardAccelStat, CharaStat forwardSpeedStat, | ||
CharaStat backwardAccelStat, CharaStat backwardSpeedStat, | ||
CharaStat strafeAccelStat, CharaStat strafeSpeedStat, | ||
double forwardAngleContribution, double strafeAngleContribution, CharaStat redirectStat | ||
); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/GenericActionDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.fqf.mario_qua_mario.definitions.actions; | ||
|
||
import com.fqf.mario_qua_mario.definitions.actions.util.IncompleteActionDefinition; | ||
import com.fqf.mario_qua_mario.definitions.actions.util.TransitionDefinition; | ||
import com.fqf.mario_qua_mario.mariodata.IMarioTravelData; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.List; | ||
|
||
public interface GenericActionDefinition extends IncompleteActionDefinition { | ||
void travelHook(IMarioTravelData data); | ||
|
||
@NotNull List<TransitionDefinition> getBasicTransitions(); | ||
@NotNull List<TransitionDefinition> getInputTransitions(); | ||
@NotNull List<TransitionDefinition> getWorldCollisionTransitions(); | ||
} |
74 changes: 74 additions & 0 deletions
74
api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/GroundedActionDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package com.fqf.mario_qua_mario.definitions.actions; | ||
|
||
import com.fqf.mario_qua_mario.definitions.actions.util.IncompleteActionDefinition; | ||
import com.fqf.mario_qua_mario.definitions.actions.util.TransitionDefinition; | ||
import com.fqf.mario_qua_mario.mariodata.IMarioTravelData; | ||
import com.fqf.mario_qua_mario.util.CharaStat; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.List; | ||
|
||
public interface GroundedActionDefinition extends IncompleteActionDefinition { | ||
void travelHook(IMarioTravelData data, GroundedActionHelper helper); | ||
|
||
@NotNull List<TransitionDefinition> getBasicTransitions(GroundedActionHelper helper); | ||
@NotNull List<TransitionDefinition> getInputTransitions(GroundedActionHelper helper); | ||
@NotNull List<TransitionDefinition> getWorldCollisionTransitions(GroundedActionHelper helper); | ||
|
||
/** | ||
* Contains a number of methods intended to help with the creation of Grounded Actions. Can be cast to any of the | ||
* other ActionHelpers, if for whatever reason you need them. | ||
*/ | ||
interface GroundedActionHelper { | ||
/** | ||
* Accelerates Mario using a custom formula. This detaches Mario's ability to gain or lose speed from his | ||
* ability to redirect the angle of existing speed. Unlike a regular entity, Mario's acceleration and | ||
* decceleration is almost always linear, rather than being based on drag. | ||
* | ||
* @param forwardAccelStat The rate at which Mario's forward velocity will change. The absolute value is used. | ||
* @param forwardSpeedStat The forward speed that Mario will try to reach. His acceleration won't overshoot | ||
* this value; if {@code forwardAccelStat} is sufficient to accelerate him past it, | ||
* he'll instead snap to its value. The value of this is scaled by the magnitude of | ||
* Mario's forward input; when using a keyboard, the magnitude is either 0 or 1, | ||
* but if the player is using a controller with an analog stick, it may be values in | ||
* between. | ||
* @param strafeAccelStat The rate at which Mario's sideways velocity will change. The absolute value is used. | ||
* @param strafeSpeedStat The rightwards speed that Mario will try to accelerate towards. Works similarly to | ||
* {@code forwardSpeedStat}. Negative values correspond to leftwards movement. | ||
* @param forwardAngleContribution The forward component of Mario's intended angle of motion. | ||
* @param strafeAngleContribution The rightward component of Mario's intended angle of motion. | ||
* @param redirectStat How far, in degrees, Mario's current motion vector will rotate towards the vector made | ||
* by {@code forwardAngleContribution} and {@code strafeAngleContribution}. This rotation | ||
* occurs before acceleration; even with a {@code redirectStat} of 0 he'll still be able | ||
* to change direction with his acceleration. | ||
*/ | ||
void groundAccel( | ||
IMarioTravelData data, | ||
CharaStat forwardAccelStat, CharaStat forwardSpeedStat, | ||
CharaStat strafeAccelStat, CharaStat strafeSpeedStat, | ||
double forwardAngleContribution, double strafeAngleContribution, CharaStat redirectStat | ||
); | ||
|
||
/** | ||
* Reduces Mario's speed by a portion of his current speed. It is recommended to use this sparingly; | ||
* normal Minecraft entities are subject to drag every tick, but Mario should only experience drag when | ||
* he's in an explicitly sliding-related action (or underwater). Under other circumstances, he should use | ||
* {@link #groundAccel}. | ||
* | ||
* @param drag The fractional portion of Mario's speed that should be lost each tick. For example, a drag of | ||
* 0.1 will result in 10% of Mario's speed being lost per tick. | ||
* @param dragMin The minimum amount of speed lost per tick. Used to ensure Mario comes to a prompt stop | ||
* instead of lingering on very low speed values. | ||
* @param forwardAngleContribution The forward component of Mario's intended angle of motion. | ||
* @param strafeAngleContribution The rightward component of Mario's intended angle of motion. | ||
* @param redirection How far, in degrees, Mario's current motion vector will rotate towards the intended | ||
* direction given by forwardAngleContribution and strafeAngleContribution. | ||
*/ | ||
void applyDrag( | ||
IMarioTravelData data, | ||
CharaStat drag, CharaStat dragMin, | ||
double forwardAngleContribution, double strafeAngleContribution, | ||
CharaStat redirection | ||
); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/WallboundActionDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.fqf.mario_qua_mario.definitions.actions; | ||
|
||
import com.fqf.mario_qua_mario.definitions.actions.util.IncompleteActionDefinition; | ||
import com.fqf.mario_qua_mario.definitions.actions.util.TransitionDefinition; | ||
import com.fqf.mario_qua_mario.mariodata.IMarioReadableMotionData; | ||
import com.fqf.mario_qua_mario.mariodata.IMarioTravelData; | ||
import com.fqf.mario_qua_mario.util.CharaStat; | ||
import net.minecraft.util.math.Vec3d; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.List; | ||
|
||
public interface WallboundActionDefinition extends IncompleteActionDefinition { | ||
void travelHook(IMarioTravelData data, WallInfo wall, WallboundActionHelper helper); | ||
|
||
@NotNull List<TransitionDefinition> getBasicTransitions(WallboundActionHelper helper); | ||
@NotNull List<TransitionDefinition> getInputTransitions(WallboundActionHelper helper); | ||
@NotNull List<TransitionDefinition> getWorldCollisionTransitions(WallboundActionHelper helper); | ||
|
||
/** | ||
* Provides some information about the wall Mario is interacting with and his relationship to it. | ||
*/ | ||
interface WallInfo { | ||
Vec3d getWallNormal(); | ||
double getNormalYaw(); | ||
|
||
double getTowardsWallInput(); | ||
double getSidleInput(); | ||
|
||
double getSidleVel(); | ||
} | ||
|
||
/** | ||
* Contains a number of methods intended to help with the creation of Wallbound Actions. | ||
*/ | ||
interface WallboundActionHelper { | ||
WallInfo getWallInfo(IMarioReadableMotionData data); | ||
|
||
void applyGravity(IMarioTravelData data, CharaStat gravity, CharaStat terminalVelocity); | ||
|
||
void climbWall( | ||
IMarioTravelData data, | ||
CharaStat ascendSpeedStat, CharaStat ascendAccelStat, | ||
CharaStat descendSpeedStat, CharaStat descendAccelStat, | ||
CharaStat sidleSpeedStat, CharaStat sidleAccelStat | ||
); | ||
|
||
void setSidleVel(IMarioTravelData data, double sidleVel); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/EvaluatorContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.fqf.mario_qua_mario.definitions.actions.util; | ||
|
||
public enum EvaluatorContext { | ||
CLIENT_ONLY, | ||
SERVER_ONLY, | ||
COMMON | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.