Minor bullet despawn fix

This commit is contained in:
Anuken
2022-04-23 09:26:52 -04:00
parent d559cd2412
commit 9a05b36478
3 changed files with 11 additions and 0 deletions
@@ -596,10 +596,14 @@ public class EntityProcess extends BaseProcessor{
//write the groups //write the groups
groupsBuilder.addMethod(groupInit.build()); groupsBuilder.addMethod(groupInit.build());
groupsBuilder.addField(boolean.class, "isClearing", Modifier.PUBLIC, Modifier.STATIC);
MethodSpec.Builder groupClear = MethodSpec.methodBuilder("clear").addModifiers(Modifier.PUBLIC, Modifier.STATIC); MethodSpec.Builder groupClear = MethodSpec.methodBuilder("clear").addModifiers(Modifier.PUBLIC, Modifier.STATIC);
groupClear.addStatement("isClearing = true");
for(GroupDefinition group : groupDefs){ for(GroupDefinition group : groupDefs){
groupClear.addStatement("$L.clear()", group.name); groupClear.addStatement("$L.clear()", group.name);
} }
groupClear.addStatement("isClearing = false");
//write clear //write clear
groupsBuilder.addMethod(groupClear.build()); groupsBuilder.addMethod(groupClear.build());
+5
View File
@@ -82,6 +82,11 @@ public class Renderer implements ApplicationListener{
public Renderer(){ public Renderer(){
camera = new Camera(); camera = new Camera();
Shaders.init(); Shaders.init();
Events.on(ResetEvent.class, e -> {
shakeTime = shakeIntensity = 0f;
camShakeOffset.setZero();
});
} }
public void shake(float intensity, float duration){ public void shake(float intensity, float duration){
@@ -67,6 +67,8 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw
@Override @Override
public void remove(){ public void remove(){
if(Groups.isClearing) return;
//'despawned' only counts when the bullet is killed externally or reaches the end of life //'despawned' only counts when the bullet is killed externally or reaches the end of life
if(!hit){ if(!hit){
type.despawned(self()); type.despawned(self());