editor entities dont use charges
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2025-05-19 15:49:33 -04:00
parent 636c0b1537
commit 2599343427
3 changed files with 20 additions and 2 deletions

View File

@ -1904,6 +1904,7 @@ OpenGLState VAO caching
Ambient light sent in dedicated variable to shader
Major lighting shader organization rework
Material albedo work
Editor entities don't use charges on placing blocks

View File

@ -8,6 +8,9 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.locks.ReentrantLock;
import electrosphere.entity.Entity;
import electrosphere.entity.types.creature.CreatureUtils;
/**
* The creature type loader
*/
@ -83,6 +86,15 @@ public class CreatureTypeLoader {
return idTypeMap.get(id);
}
/**
* Gets entity data from the entity
* @param ent The entity
* @return The entity data if it exists, null otherwise
*/
public CreatureData getType(Entity ent){
return idTypeMap.get(CreatureUtils.getType(ent));
}
/**
* Gets the collection of all entity data
* @return the collection of all entity data

View File

@ -5,6 +5,7 @@ import org.joml.Vector3i;
import electrosphere.data.block.BlockType;
import electrosphere.data.entity.item.Item;
import electrosphere.engine.Globals;
import electrosphere.engine.loadingthreads.LoadingUtils;
import electrosphere.entity.Entity;
import electrosphere.entity.state.equip.ServerToolbarState;
import electrosphere.entity.state.item.ServerChargeState;
@ -45,7 +46,9 @@ public class BlockActions {
if(equippedItemType.equals(goalBlockEntityId)){
//place the block
ServerBlockEditing.editBlockArea(playerRealm, chunkPos, blockPos, blockType, (short)0, editSize);
ServerChargeState.attemptRemoveCharges(creature, 1);
if(!Globals.gameConfigCurrent.getCreatureTypeLoader().getType(creature).getId().equals(LoadingUtils.EDITOR_RACE_NAME)){
ServerChargeState.attemptRemoveCharges(creature, 1);
}
}
}
}
@ -61,7 +64,9 @@ public class BlockActions {
public static void placeFab(Entity creature, Vector3i chunkPos, Vector3i blockPos, int blockRotation, String fabPath){
Realm playerRealm = Globals.serverState.realmManager.getEntityRealm(creature);
ServerBlockEditing.placeBlockFab(playerRealm, chunkPos, blockPos, blockRotation, fabPath);
ServerChargeState.attemptRemoveCharges(creature, 1);
if(!Globals.gameConfigCurrent.getCreatureTypeLoader().getType(creature).getId().equals(LoadingUtils.EDITOR_RACE_NAME)){
ServerChargeState.attemptRemoveCharges(creature, 1);
}
if(CreatureUtils.hasControllerPlayerId(creature)){
Player player = Globals.serverState.playerManager.getPlayerFromId(CreatureUtils.getControllerPlayerId(creature));
Globals.serverState.structureScanningService.queue(player, ServerWorldData.convertLocalBlockToRealSpace(chunkPos, blockPos));