fix block tree not firing
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-11-29 11:21:02 -05:00
parent a1eb17cb51
commit ef8b070c88
8 changed files with 29 additions and 35 deletions

View File

@ -96,9 +96,6 @@
"offset": [0, 0, 0.15] "offset": [0, 0, 0.15]
} }
] ]
},
"itemBlockData": {
}, },
"equipData": { "equipData": {
"equipClass" : "weapon2H" "equipClass" : "weapon2H"

View File

@ -1156,7 +1156,7 @@ Convert PhysicsEntityUtils to use generic interface to load tri geom rigid bodie
Fix winding order on block meshes Fix winding order on block meshes
Add texture atlasing to blocks Add texture atlasing to blocks
(!1/25/2024) (11/25/2024)
Remove unused import Remove unused import
Geometry mesh generation class Geometry mesh generation class
Cloud shader Cloud shader
@ -1164,6 +1164,9 @@ VisualShader refactoring
VisualShader #include macro implementation VisualShader #include macro implementation
Fix particles not spawning in correct positions Fix particles not spawning in correct positions
(11/28/2024)
Fix block not firing
# TODO # TODO

View File

@ -423,7 +423,7 @@ public class ServerEquipState implements BehaviorTree {
BlockSystem blockData = blockTree.getBlockSystem(); BlockSystem blockData = blockTree.getBlockSystem();
for(EquipPoint point : pointsThatCanBlock){ for(EquipPoint point : pointsThatCanBlock){
Entity item = getEquippedItemAtPoint(point.getEquipPointId()); Entity item = getEquippedItemAtPoint(point.getEquipPointId());
if(item != null && Globals.gameConfigCurrent.getItemMap().getItem(item) != null && Globals.gameConfigCurrent.getItemMap().getItem(item).getItemBlockData() != null){ if(item != null && Globals.gameConfigCurrent.getItemMap().getItem(item) != null && Globals.gameConfigCurrent.getItemMap().getItem(item).getBlockSystem() != null){
BlockVariant blockVariant = blockData.getVariantForPointWithItem(point.getEquipPointId(),ItemUtils.getEquipClass(item)); BlockVariant blockVariant = blockData.getVariantForPointWithItem(point.getEquipPointId(),ItemUtils.getEquipClass(item));
//TODO: refactor to allow sending more than one variant at a time //TODO: refactor to allow sending more than one variant at a time

View File

@ -15,7 +15,6 @@ import electrosphere.game.data.creature.type.block.BlockVariant;
import electrosphere.game.data.creature.type.equip.EquipPoint; import electrosphere.game.data.creature.type.equip.EquipPoint;
import electrosphere.game.data.creature.type.equip.ToolbarData; import electrosphere.game.data.creature.type.equip.ToolbarData;
import electrosphere.game.data.item.EquipWhitelist; import electrosphere.game.data.item.EquipWhitelist;
import electrosphere.logger.LoggerInterface;
import java.util.List; import java.util.List;
@ -234,7 +233,7 @@ public class ServerToolbarState implements BehaviorTree {
} }
BlockSystem blockData = blockTree.getBlockSystem(); BlockSystem blockData = blockTree.getBlockSystem();
if(selectedItemEntity != null && Globals.gameConfigCurrent.getItemMap().getItem(selectedItemEntity) != null && Globals.gameConfigCurrent.getItemMap().getItem(selectedItemEntity).getItemBlockData() != null){ if(selectedItemEntity != null && Globals.gameConfigCurrent.getItemMap().getItem(selectedItemEntity) != null){
BlockVariant blockVariant = blockData.getVariantForPointWithItem(targetPoint.getEquipPointId(),ItemUtils.getEquipClass(selectedItemEntity)); BlockVariant blockVariant = blockData.getVariantForPointWithItem(targetPoint.getEquipPointId(),ItemUtils.getEquipClass(selectedItemEntity));
//TODO: refactor to allow sending more than one variant at a time //TODO: refactor to allow sending more than one variant at a time
@ -242,7 +241,7 @@ public class ServerToolbarState implements BehaviorTree {
if(blockVariant != null){ if(blockVariant != null){
blockTree.setCurrentBlockVariant(blockVariant.getVariantId()); blockTree.setCurrentBlockVariant(blockVariant.getVariantId());
} else { } else {
LoggerInterface.loggerEngine.ERROR(new IllegalStateException("Equipped item to equip point that does not have assigned block variant!!")); blockTree.setCurrentBlockVariant("");
} }
} }
} }

View File

@ -62,12 +62,7 @@ public class Item extends CommonEntityType {
* The usage logic for a secondary usage of this item * The usage logic for a secondary usage of this item
*/ */
ItemUsage secondaryUsage; ItemUsage secondaryUsage;
/**
* The block data for this item
*/
ItemBlockData itemBlockData;
/** /**
* Creates item data from a spawn item description * Creates item data from a spawn item description
* @param description The spawn item description * @param description The spawn item description
@ -160,15 +155,6 @@ public class Item extends CommonEntityType {
public String getClientSideSecondary(){ public String getClientSideSecondary(){
return clientSideSecondary; return clientSideSecondary;
} }
/**
* Gets the block data for the item
* @return THe block data
*/
public ItemBlockData getItemBlockData(){
return this.itemBlockData;
}
/** /**
* Gets the secondary usage logic of this item * Gets the secondary usage logic of this item
* @return The secondary usage logic * @return The secondary usage logic

View File

@ -1,9 +0,0 @@
package electrosphere.game.data.item;
/**
* Block data for the item
*/
public class ItemBlockData {
}

View File

@ -58,10 +58,10 @@ public class AIManager {
*/ */
public void simulate(){ public void simulate(){
//exec the services //exec the services
execServices(); this.execServices();
//simulate each tree //simulate each tree
if(isActive()){ if(this.isActive()){
for(AI ai : aiList){ for(AI ai : aiList){
ai.simulate(); ai.simulate();
} }

View File

@ -8,6 +8,9 @@ import electrosphere.entity.Entity;
import electrosphere.entity.state.block.ServerBlockTree; import electrosphere.entity.state.block.ServerBlockTree;
import electrosphere.entity.state.equip.ServerToolbarState; import electrosphere.entity.state.equip.ServerToolbarState;
import electrosphere.entity.types.common.CommonEntityUtils; import electrosphere.entity.types.common.CommonEntityUtils;
import electrosphere.entity.types.creature.CreatureUtils;
import electrosphere.game.data.creature.type.CreatureData;
import electrosphere.game.data.creature.type.block.BlockVariant;
import electrosphere.game.data.item.Item; import electrosphere.game.data.item.Item;
import electrosphere.game.data.item.ItemUsage; import electrosphere.game.data.item.ItemUsage;
import electrosphere.net.parser.net.message.InventoryMessage; import electrosphere.net.parser.net.message.InventoryMessage;
@ -32,7 +35,22 @@ public class PlayerActions {
ServerToolbarState serverToolbarState = ServerToolbarState.getServerToolbarState(playerEntity); ServerToolbarState serverToolbarState = ServerToolbarState.getServerToolbarState(playerEntity);
if(serverToolbarState != null && serverToolbarState.getRealWorldItem() != null){ if(serverToolbarState != null && serverToolbarState.getRealWorldItem() != null){
Item item = Globals.gameConfigCurrent.getItemMap().getItem(serverToolbarState.getRealWorldItem()); Item item = Globals.gameConfigCurrent.getItemMap().getItem(serverToolbarState.getRealWorldItem());
if(item.getBlockSystem() != null){ CreatureData creatureData = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(CreatureUtils.getType(playerEntity));
ServerBlockTree serverBlockTree = ServerBlockTree.getServerBlockTree(playerEntity);
//check block status
boolean shouldBlock = false;
if(creatureData.getBlockSystem() != null && creatureData.getBlockSystem().getAllVariants() != null && serverBlockTree != null){
for(BlockVariant variant : creatureData.getBlockSystem().getAllVariants()){
if(variant.getVariantId().equals(serverBlockTree.getCurrentBlockVariant())){
shouldBlock = true;
break;
}
}
}
//actually perform actions
if(shouldBlock){
PlayerActions.block(playerEntity, message); PlayerActions.block(playerEntity, message);
} else if(item.getSecondaryUsage() != null){ } else if(item.getSecondaryUsage() != null){
PlayerActions.secondaryUsage(playerEntity, item, message); PlayerActions.secondaryUsage(playerEntity, item, message);