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

View File

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

View File

@ -37,28 +37,35 @@ public class ServerHitboxResolutionCallback implements CollisionResolutionCallba
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
boolean isDamageEvent =
impactorShapeStatus != null &&
receiverShapeStatus != null &&
impactorShapeStatus.getType() == HitboxType.HIT &&
receiverShapeStatus.getType() == HitboxType.HURT &&
AttachUtils.getParent(impactorParent) != receiverParent
!impactorShapeStatusIsNull &&
!receiverShapeStatusIsNull &&
impactorIsHit &&
receiverIsHurt &&
parentsAreDifferent
;
boolean isBlockEvent =
impactorShapeStatus != null &&
receiverShapeStatus != null &&
impactorShapeStatus.getType() == HitboxType.HIT &&
(receiverShapeStatus.getType() == HitboxType.BLOCK || (receiverShapeStatus.getType() == HitboxType.HIT && receiverShapeStatus.isBlockOverride())) &&
AttachUtils.getParent(impactorParent) != receiverParent
!impactorShapeStatusIsNull &&
!receiverShapeStatusIsNull &&
impactorIsHit &&
receiverIsBlock &&
parentsAreDifferent
;
if(impactorShapeStatus != null){
if(!impactorShapeStatusIsNull){
impactorShapeStatus.setHadCollision(true);
}
if(receiverShapeStatus != null){
if(!receiverShapeStatusIsNull){
receiverShapeStatus.setHadCollision(true);
}