movement anim interrupt, debug hit work
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-08-12 17:57:26 -04:00
parent ea3518300f
commit b1b3d90b70
3 changed files with 36 additions and 22 deletions

View File

@ -297,7 +297,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
//update rotation //update rotation
rotation.set(movementQuaternion); rotation.set(movementQuaternion);
//play animation //play animation
String animationToPlay = determineCorrectAnimation(); String animationToPlay = determineCorrectAnimation(MovementTreeState.STARTUP);
if(entityActor != null){ if(entityActor != null){
if(!entityActor.isPlayingAnimation(animationToPlay)){ if(!entityActor.isPlayingAnimation(animationToPlay)){
entityActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT)); entityActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
@ -334,7 +334,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
//update rotation //update rotation
rotation.set(movementQuaternion); rotation.set(movementQuaternion);
//play animation //play animation
String animationToPlay = determineCorrectAnimation(); String animationToPlay = determineCorrectAnimation(MovementTreeState.MOVE);
if(entityActor != null){ if(entityActor != null){
if(!entityActor.isPlayingAnimation(animationToPlay)){ if(!entityActor.isPlayingAnimation(animationToPlay)){
entityActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT)); entityActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
@ -367,8 +367,9 @@ public class ClientGroundMovementTree implements BehaviorTree {
//update rotation //update rotation
rotation.set(movementQuaternion); rotation.set(movementQuaternion);
//run slowdown code //run slowdown code
String animationToPlay = determineCorrectAnimation(); String animationToPlay = determineCorrectAnimation(MovementTreeState.SLOWDOWN);
if(entityActor != null){ if(entityActor != null){
//play animations
if(!entityActor.isPlayingAnimation(animationToPlay)){ if(!entityActor.isPlayingAnimation(animationToPlay)){
entityActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT)); entityActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
entityActor.incrementAnimationTime(0.0001); entityActor.incrementAnimationTime(0.0001);
@ -377,6 +378,9 @@ public class ClientGroundMovementTree implements BehaviorTree {
this.playedFootstepSecond = false; this.playedFootstepSecond = false;
} }
FirstPersonTree.conditionallyPlayAnimation(parent, groundMovementData.getAnimationWindDown().getNameFirstPerson(), AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT)); FirstPersonTree.conditionallyPlayAnimation(parent, groundMovementData.getAnimationWindDown().getNameFirstPerson(), AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
if(entityActor.isPlayingAnimation(determineCorrectAnimation(MovementTreeState.MOVE))){
entityActor.stopAnimation(determineCorrectAnimation(MovementTreeState.MOVE));
}
} }
//conditionally play footstep audio //conditionally play footstep audio
this.playFootstepAudio(0,entityActor.getAnimationTime(animationToPlay),position); this.playFootstepAudio(0,entityActor.getAnimationTime(animationToPlay),position);
@ -388,7 +392,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
velocity = 0; velocity = 0;
state = MovementTreeState.IDLE; state = MovementTreeState.IDLE;
if(entityActor != null){ if(entityActor != null){
animationToPlay = determineCorrectAnimation(); animationToPlay = determineCorrectAnimation(MovementTreeState.SLOWDOWN);
if(entityActor.isPlayingAnimation() && entityActor.isPlayingAnimation(animationToPlay)){ if(entityActor.isPlayingAnimation() && entityActor.isPlayingAnimation(animationToPlay)){
entityActor.stopAnimation(animationToPlay); entityActor.stopAnimation(animationToPlay);
} }
@ -526,7 +530,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
return facing; return facing;
} }
public String determineCorrectAnimation(){ public String determineCorrectAnimation(MovementTreeState state){
String rVal = ""; String rVal = "";
if(sprintTree != null){ if(sprintTree != null){
switch(sprintTree.getState()){ switch(sprintTree.getState()){

View File

@ -256,7 +256,7 @@ public class ServerGroundMovementTree implements BehaviorTree {
switch(state){ switch(state){
case STARTUP: { case STARTUP: {
if(poseActor != null){ if(poseActor != null){
String animationToPlay = determineCorrectAnimation(); String animationToPlay = determineCorrectAnimation(MovementTreeState.STARTUP);
if( if(
!poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(animationToPlay) && !poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(animationToPlay) &&
(jumpTree == null || !jumpTree.isJumping()) && (jumpTree == null || !jumpTree.isJumping()) &&
@ -311,7 +311,7 @@ public class ServerGroundMovementTree implements BehaviorTree {
//check if can restart animation //check if can restart animation
//if yes, restart animation //if yes, restart animation
if(poseActor != null){ if(poseActor != null){
String animationToPlay = determineCorrectAnimation(); String animationToPlay = determineCorrectAnimation(MovementTreeState.MOVE);
if( if(
!poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(animationToPlay) && !poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(animationToPlay) &&
(jumpTree == null || !jumpTree.isJumping()) && (jumpTree == null || !jumpTree.isJumping()) &&
@ -363,7 +363,7 @@ public class ServerGroundMovementTree implements BehaviorTree {
case SLOWDOWN: { case SLOWDOWN: {
//run slowdown code //run slowdown code
if(poseActor != null){ if(poseActor != null){
String animationToPlay = determineCorrectAnimation(); String animationToPlay = determineCorrectAnimation(MovementTreeState.SLOWDOWN);
if( if(
!poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(animationToPlay) && !poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(animationToPlay) &&
(jumpTree == null || !jumpTree.isJumping()) && (jumpTree == null || !jumpTree.isJumping()) &&
@ -372,6 +372,9 @@ public class ServerGroundMovementTree implements BehaviorTree {
poseActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT)); poseActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
poseActor.incrementAnimationTime(0.0001); poseActor.incrementAnimationTime(0.0001);
} }
if(poseActor.isPlayingAnimation(determineCorrectAnimation(MovementTreeState.MOVE))){
poseActor.stopAnimation(determineCorrectAnimation(MovementTreeState.MOVE));
}
} }
//velocity stuff //velocity stuff
velocity = velocity - acceleration * (float)Globals.timekeeper.getSimFrameTime(); velocity = velocity - acceleration * (float)Globals.timekeeper.getSimFrameTime();
@ -380,7 +383,7 @@ public class ServerGroundMovementTree implements BehaviorTree {
velocity = 0; velocity = 0;
state = MovementTreeState.IDLE; state = MovementTreeState.IDLE;
if(poseActor != null){ if(poseActor != null){
String animationToPlay = determineCorrectAnimation(); String animationToPlay = determineCorrectAnimation(MovementTreeState.SLOWDOWN);
if(poseActor.isPlayingAnimation() && poseActor.isPlayingAnimation(animationToPlay)){ if(poseActor.isPlayingAnimation() && poseActor.isPlayingAnimation(animationToPlay)){
poseActor.stopAnimation(animationToPlay); poseActor.stopAnimation(animationToPlay);
} }
@ -513,7 +516,7 @@ public class ServerGroundMovementTree implements BehaviorTree {
return facing; return facing;
} }
public String determineCorrectAnimation(){ public String determineCorrectAnimation(MovementTreeState state){
String rVal = ""; String rVal = "";
if(sprintTree != null){ if(sprintTree != null){
switch(sprintTree.getState()){ switch(sprintTree.getState()){

View File

@ -37,28 +37,35 @@ public class ServerHitboxResolutionCallback implements CollisionResolutionCallba
HitboxState receiverShapeStatus = receiverState.getShapeStatus(receiverGeom); HitboxState receiverShapeStatus = receiverState.getShapeStatus(receiverGeom);
boolean impactorShapeStatusIsNull = impactorShapeStatus == null;
boolean receiverShapeStatusIsNull = receiverShapeStatus == null;
boolean impactorIsHit = impactorShapeStatus != null && impactorShapeStatus.getType() == HitboxType.HIT;
boolean receiverIsHurt = receiverShapeStatus != null && receiverShapeStatus.getType() == HitboxType.HURT;
boolean receiverIsBlock = receiverShapeStatus != null && (receiverShapeStatus.getType() == HitboxType.BLOCK || (receiverShapeStatus.getType() == HitboxType.HIT && receiverShapeStatus.isBlockOverride()));
boolean parentsAreDifferent = AttachUtils.getParent(impactorParent) != receiverParent;
//currently, impactor needs to be an item, and the receiver must not be an item //currently, impactor needs to be an item, and the receiver must not be an item
boolean isDamageEvent = boolean isDamageEvent =
impactorShapeStatus != null && !impactorShapeStatusIsNull &&
receiverShapeStatus != null && !receiverShapeStatusIsNull &&
impactorShapeStatus.getType() == HitboxType.HIT && impactorIsHit &&
receiverShapeStatus.getType() == HitboxType.HURT && receiverIsHurt &&
AttachUtils.getParent(impactorParent) != receiverParent parentsAreDifferent
; ;
boolean isBlockEvent = boolean isBlockEvent =
impactorShapeStatus != null && !impactorShapeStatusIsNull &&
receiverShapeStatus != null && !receiverShapeStatusIsNull &&
impactorShapeStatus.getType() == HitboxType.HIT && impactorIsHit &&
(receiverShapeStatus.getType() == HitboxType.BLOCK || (receiverShapeStatus.getType() == HitboxType.HIT && receiverShapeStatus.isBlockOverride())) && receiverIsBlock &&
AttachUtils.getParent(impactorParent) != receiverParent parentsAreDifferent
; ;
if(impactorShapeStatus != null){ if(!impactorShapeStatusIsNull){
impactorShapeStatus.setHadCollision(true); impactorShapeStatus.setHadCollision(true);
} }
if(receiverShapeStatus != null){ if(!receiverShapeStatusIsNull){
receiverShapeStatus.setHadCollision(true); receiverShapeStatus.setHadCollision(true);
} }