From 92a6cefc208b23e53709b52713aa67b0b5770516 Mon Sep 17 00:00:00 2001 From: austin Date: Wed, 31 Jul 2024 18:49:18 -0400 Subject: [PATCH] server plays blocking animation --- assets/Models/creatures/viewmodel.glb | Bin 774628 -> 774688 bytes .../entity/btree/StateTransitionUtil.java | 20 +++++++++++------- .../entity/state/block/ServerBlockTree.java | 8 ++++++- .../server/poseactor/PoseActor.java | 9 +++++--- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/assets/Models/creatures/viewmodel.glb b/assets/Models/creatures/viewmodel.glb index 6ba1d2cf49d145d29fb99f5c044e2cc510846247..91f5103b4ca6f9a4933d36d22b16f27b84cdcaef 100644 GIT binary patch delta 3152 zcmZ9Nc~lff8o)t8u~`%XGXYe<2)ZhY)1V;JRfP(o@dye8UPO!%+@L5D4EG9LDUBteGfc?EAa{u4}utEwi;;C=|8^Lzu#9~Usre6@!)H> zqEa`De?JVu@${&kMa5u%G+Z+V}zQ6q^Oe6z=38$h^F0=& z@VUqoNa9NgCfHK84Ka4kUKvQxNASe>v^AgRlcte#gl|^$wuA z5z0hG9VgFVPAlHYtOCWb4k&vz2mU}D8-*(*akWxh#6 z_PxC%dyct<>?PZtX22zRzO3)W6FM?60r9?c)QybN(Kxy*im+C$itJHS(kyDtSuJVP zF`!z>aegt`W5|OAQWrKLD3?_{h(o>D3$X`b-;4b%9t9WNX!t9~Rw1SJDOYSku>X0j zCFTUozL>wO+r~b+eheIV#>n66SDC$Ko-4)C53i#R_baBfgse|~^`-B0uT8J`w=@Z;x;$t{(0zGNsY z1@9gpZ^rgO*SX2m#yC0fPuhw)vCqLCI^y(Z6(PwlB1}B17j}|El`p8mt5!_6X(u^= zx$eFhlTdgYI$YmK-7?MwOz<|u`Bdz;M|}9NFV-h#={j~#1I~*AwH$Y1HpNWXG_wV6 zQn34UI2e#C(BGX7k0$JugK^TDK*wzGC_b7=^75?-!5sVjaVBcoS$NOg2^>vPfuCz) z5a)LVF8;K}qo3DA^AWS)oEd1$x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9sKG;Ugl;CG!92u znlCSu!FK4?>iPLXm|vEN#Qu^z5orgce=?dEH(qIY?QI3<_VV(g`MRb7X6!#9_?Ir? zDm5`^%KfGjMr1PmMB^lAexu5dE4gC>YK(vUf@UB5<=fI(_@YW`gT2!vvwhQt9;+IH zYd~CwElYDiSRM=v`*3+1ec<_? ze+bQy(MaStCYv;6hf>|kxw)w4vv$ale>2n z2o2#z=$7K0w*MM;1F_@!0*SqLrIElEeD(p%j@Zi5+_!fZjC(P+4V2flvg=hy>?UMw z^)Jhq1kLxA7TyW}+z)^FYRrq~sFMr|4PAzo-F0d;^)x|KZed7F?whV*&0NJockt=v zwicRCbX5sUJ;p(5s&{L`9DrK2ggFeLDdD9IcwFOZn1z4|-()1;9hQmbgT3Em5h4rw)8(_+A#Uz3o?ab1+e zPD9F4$&ahfkyg(A&YGp!&8Z*0$dhx9i;F?g(l8|Ui4Q^L+bHo0B)$B^`~^$%lEx$O zJ?%Bl{_+qQc^r$T9T#0C>u9<&lzZ9d2xjISZ=w0k*(Zc|Kgi~C5APQu_Gcln>(@^o z|09LdZ1>4wKH%8_u&?eqPjiFGE?7P;a1nfsFjAO;rrg4iz|Jvb9d{IybyR$0!rGAy zcYNIlPxCYwj7+G7tw-}tzN<~!tkEy;b<@@Q>ov;KU2)$!G6@&fhEtvxxH)so}& zyA8RGG(RkU3mRK=YXYq+gu+v)NaVQieR9_5SFt3sy1|+pv5Q0IdC^>}Fhl5NHNg0! zZu{sqB=X;yQ01DR;<@0|&z$0?9G>QW(<87fI18xfTMLEjy z$gInoX`VgwS2$SZjdrJ+qk!Q{@D;}^U8IgGxzla_mj$*U=_&6?^O~w(z=yNvLNm9I zT5S_|qiM$lE>h?9kx}2X<69KKtp5p5^8&lqVeh<+T+Z4{!tIa@BzD8*VK~6_zhh0m Jx=0t*{~wwA7ySSL diff --git a/src/main/java/electrosphere/entity/btree/StateTransitionUtil.java b/src/main/java/electrosphere/entity/btree/StateTransitionUtil.java index 03557d1e..32a6e2a4 100644 --- a/src/main/java/electrosphere/entity/btree/StateTransitionUtil.java +++ b/src/main/java/electrosphere/entity/btree/StateTransitionUtil.java @@ -158,20 +158,24 @@ public class StateTransitionUtil { if(state.getAnimation != null && state.getAnimation.get() != null){ animation = state.getAnimation.get(); } - - //Main simulation - if(!poseActor.isPlayingAnimation() && state.onComplete != null && state.startedAnimation == true && animation != null){ + + + if(animation == null){ + state.startedAnimation = true; + if(state.onComplete != null){ + state.onComplete.run(); + } + } else if(!poseActor.isPlayingAnimation() && state.onComplete != null && state.startedAnimation == true){ //state transition if this isn't set to loop state.onComplete.run(); state.startedAnimation = false; - } else if(state.animation != null && (!poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(animation))){ + } else if(!poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(animation)){ //play animation for state - poseActor.playAnimation(animation); + if(animation != null){ + poseActor.playAnimation(animation); + } poseActor.incrementAnimationTime(0.0001); state.startedAnimation = true; - } else if(state.animation == null && state.onComplete != null){ - state.onComplete.run(); - state.startedAnimation = false; } } } diff --git a/src/main/java/electrosphere/entity/state/block/ServerBlockTree.java b/src/main/java/electrosphere/entity/state/block/ServerBlockTree.java index bb8d3396..b8792d79 100644 --- a/src/main/java/electrosphere/entity/state/block/ServerBlockTree.java +++ b/src/main/java/electrosphere/entity/state/block/ServerBlockTree.java @@ -50,7 +50,13 @@ public class ServerBlockTree implements BehaviorTree { this.stateTransitionUtil = StateTransitionUtil.create(parent, true, new StateTransitionUtilItem[]{ StateTransitionUtilItem.create( BlockState.WIND_UP, - () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getWindUpAnimation();}, + () -> { + BlockVariant variant = this.blockSystem.getBlockVariant(this.currentBlockVariant); + if(variant != null){ + return variant.getWindUpAnimation(); + } + return null; + }, null, () -> {this.setState(BlockState.BLOCKING);} ), diff --git a/src/main/java/electrosphere/server/poseactor/PoseActor.java b/src/main/java/electrosphere/server/poseactor/PoseActor.java index 5655665a..8fcd6181 100644 --- a/src/main/java/electrosphere/server/poseactor/PoseActor.java +++ b/src/main/java/electrosphere/server/poseactor/PoseActor.java @@ -101,12 +101,15 @@ public class PoseActor { /** * Gets whether the animation is currently playing or not - * @param animationName The animation + * @param animationData The animation * @return True if the animation is playing, false otherwise */ - public boolean isPlayingAnimation(TreeDataAnimation animationName){ + public boolean isPlayingAnimation(TreeDataAnimation animationData){ + if(animationData == null){ + return false; + } for(ActorAnimationMask mask : animationQueue){ - if(mask.getAnimationName().contains(animationName.getNameThirdPerson())){ + if(mask.getAnimationName().contains(animationData.getNameThirdPerson())){ return true; } }