delete entity on death
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-08-13 16:08:46 -04:00
parent 1ca9c60640
commit 25fff94029
5 changed files with 18 additions and 13 deletions

View File

@ -57,7 +57,7 @@
"modelPath" : "Models/items/weapons/katana1alt.fbx", "modelPath" : "Models/items/weapons/katana1alt.fbx",
"weaponData" : { "weaponData" : {
"weaponClass" : "sword2h", "weaponClass" : "sword2h",
"damage" : 10, "damage" : 34,
"hitboxes" : [ "hitboxes" : [
{ {
"type": "hit_connected", "type": "hit_connected",

View File

@ -7,9 +7,7 @@
+ when popup is accepted, spawn an enemy with an effect + when popup is accepted, spawn an enemy with an effect
enemy ai enemy ai
review combat code (lifestate, damage calculation, etc) review combat code (lifestate, damage calculation, etc)
- Damage event accumulator each frame on server side Maybe a fade-out before deleting entity on death?
Use accumulator to negate all damage if block box was hit
I-frames
+ rearchitecture + rearchitecture

View File

@ -554,6 +554,7 @@ Hitbox support offsets now
Multiple hitboxes per bone Multiple hitboxes per bone
Potential fix for client concurrency issue Potential fix for client concurrency issue
Debounce attack collisions Debounce attack collisions
Remove entities on death
# TODO # TODO

View File

@ -77,7 +77,7 @@ public class StateTransitionUtil {
public void simulate(Object stateEnum){ public void simulate(Object stateEnum){
StateTransitionUtilItem state = null; StateTransitionUtilItem state = null;
for(StateTransitionUtilItem targetState : states){ for(StateTransitionUtilItem targetState : states){
if(targetState.stateEnum == stateEnum){ if(targetState != null && targetState.stateEnum == stateEnum){
state = targetState; state = targetState;
break; break;
} }
@ -374,6 +374,13 @@ public class StateTransitionUtil {
treeData.getAudioData(), treeData.getAudioData(),
onComplete onComplete
); );
} else {
rVal = new StateTransitionUtilItem(
stateEnum,
(TreeDataAnimation)null,
null,
onComplete
);
} }
return rVal; return rVal;
} }

View File

@ -5,6 +5,7 @@ import electrosphere.entity.btree.BehaviorTree;
import electrosphere.entity.btree.StateTransitionUtil; import electrosphere.entity.btree.StateTransitionUtil;
import electrosphere.entity.btree.StateTransitionUtil.StateTransitionUtilItem; import electrosphere.entity.btree.StateTransitionUtil.StateTransitionUtilItem;
import electrosphere.entity.EntityDataStrings; import electrosphere.entity.EntityDataStrings;
import electrosphere.entity.ServerEntityUtils;
import electrosphere.entity.Entity; import electrosphere.entity.Entity;
import electrosphere.server.datacell.utils.ServerBehaviorTreeUtils; import electrosphere.server.datacell.utils.ServerBehaviorTreeUtils;
import electrosphere.net.parser.net.message.CombatMessage; import electrosphere.net.parser.net.message.CombatMessage;
@ -77,6 +78,8 @@ public class ServerLifeTree implements BehaviorTree {
this.stateTransitionUtil.simulate(LifeStateEnum.DYING); this.stateTransitionUtil.simulate(LifeStateEnum.DYING);
} break; } break;
case DEAD: { case DEAD: {
//delete the entity
ServerEntityUtils.destroyEntity(parent);
} break; } break;
} }
} }
@ -163,13 +166,9 @@ public class ServerLifeTree implements BehaviorTree {
); );
//do damage calculation //do damage calculation
int damage = ItemUtils.getWeaponDataRaw(event.source).getDamage(); if(this.isAlive()){
this.damage(damage); int damage = ItemUtils.getWeaponDataRaw(event.source).getDamage();
if(!this.isAlive()){ this.damage(damage);
throw new UnsupportedOperationException("Reviving not implemented yet!");
// Realm entityRealm = Globals.realmManager.getEntityRealm(receiverParent);
// EntityUtils.getPosition(receiverParent).set(entityRealm.getSpawnPoint());
// serverLifeTree.revive();
} }
} }
} }
@ -263,7 +262,7 @@ public class ServerLifeTree implements BehaviorTree {
this.lifeCurrent = this.lifeMax; this.lifeCurrent = this.lifeMax;
this.iFrameMaxCount = this.healthSystem.getOnDamageIFrames(); this.iFrameMaxCount = this.healthSystem.getOnDamageIFrames();
this.iFrameCurrent = 0; this.iFrameCurrent = 0;
stateTransitionUtil = StateTransitionUtil.create(parent, true, new StateTransitionUtilItem[]{ this.stateTransitionUtil = StateTransitionUtil.create(parent, true, new StateTransitionUtilItem[]{
StateTransitionUtilItem.create( StateTransitionUtilItem.create(
LifeStateEnum.DYING, LifeStateEnum.DYING,
this.healthSystem.getDyingState(), this.healthSystem.getDyingState(),