bush harvesting
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
3b8ed5b192
commit
a530a7242a
@ -1443,6 +1443,8 @@ Fix visually attaching item on server creating item at 0,0,0 on init (thereby cr
|
||||
Fix test failure debug render writing to file
|
||||
Recursive recipe data files
|
||||
ServerEntityUtils recursive move function potential bugfix
|
||||
Harvest bushes kills them
|
||||
Fix harvest interaction targeting client player entity on server side
|
||||
|
||||
|
||||
|
||||
|
||||
@ -120,6 +120,14 @@ public class ServerLifeTree implements BehaviorTree {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Kills the entity
|
||||
*/
|
||||
public void kill(){
|
||||
lifeCurrent = 0;
|
||||
this.setState(LifeStateEnum.DYING);
|
||||
}
|
||||
|
||||
/**
|
||||
* Roll the loot pool
|
||||
*/
|
||||
@ -327,6 +335,17 @@ public class ServerLifeTree implements BehaviorTree {
|
||||
return (ServerLifeTree)entity.getData(EntityDataStrings.TREE_SERVERLIFETREE);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Checks if the entity has a copy of this tree
|
||||
* </p>
|
||||
* @param entity the entity
|
||||
* @return true if the entity has a copy of this tree, false otherwise
|
||||
*/
|
||||
public static boolean hasServerLifeTree(Entity entity){
|
||||
return entity.containsKey(EntityDataStrings.TREE_SERVERLIFETREE);
|
||||
}
|
||||
|
||||
/**
|
||||
* A single collision event
|
||||
*/
|
||||
|
||||
@ -57,7 +57,7 @@ public class EntityProtocol implements ServerProtocolTemplate<EntityMessage> {
|
||||
}
|
||||
} break;
|
||||
case INTERACT: {
|
||||
targetEntity = EntityLookupUtils.getEntityById(connectionHandler.getPlayerEntityId());
|
||||
targetEntity = EntityLookupUtils.getEntityById(message.getentityID());
|
||||
PlayerActions.attemptInteraction(connectionHandler, targetEntity, message.getinteractionSignal());
|
||||
} break;
|
||||
//ignore stack
|
||||
|
||||
@ -54,7 +54,7 @@ public class ServerSynchronizationManager {
|
||||
case CLIENTREQUESTBTREEACTION: {
|
||||
Entity entity = EntityLookupUtils.getEntityById(message.getentityId());
|
||||
if(entity != null){
|
||||
updateEntityState(entity,message.getbTreeId(),message);
|
||||
this.updateEntityState(entity,message.getbTreeId(),message);
|
||||
} else {
|
||||
LoggerInterface.loggerNetworking.WARNING("Receiving packet from client to perform action for nonexistant entity! " + message.getentityId());
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import electrosphere.engine.Globals;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.state.block.ServerBlockTree;
|
||||
import electrosphere.entity.state.equip.ServerToolbarState;
|
||||
import electrosphere.entity.state.life.ServerLifeTree;
|
||||
import electrosphere.entity.types.common.CommonEntityUtils;
|
||||
import electrosphere.entity.types.creature.CreatureUtils;
|
||||
import electrosphere.game.data.common.interact.InteractionData;
|
||||
@ -122,6 +123,10 @@ public class PlayerActions {
|
||||
Entity playerEntity = EntityLookupUtils.getEntityById(connectionHandler.getPlayerEntityId());
|
||||
switch(signal){
|
||||
case InteractionData.ON_INTERACT_HARVEST: {
|
||||
if(ServerLifeTree.hasServerLifeTree(target)){
|
||||
ServerLifeTree serverLifeTree = ServerLifeTree.getServerLifeTree(target);
|
||||
serverLifeTree.kill();
|
||||
}
|
||||
ServerScriptUtils.fireSignalOnEntity(playerEntity, "entityInteractHarvest", target);
|
||||
} break;
|
||||
default: {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user