editor entities dont use charges
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
636c0b1537
commit
2599343427
@ -1904,6 +1904,7 @@ OpenGLState VAO caching
|
|||||||
Ambient light sent in dedicated variable to shader
|
Ambient light sent in dedicated variable to shader
|
||||||
Major lighting shader organization rework
|
Major lighting shader organization rework
|
||||||
Material albedo work
|
Material albedo work
|
||||||
|
Editor entities don't use charges on placing blocks
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,9 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
|
import electrosphere.entity.Entity;
|
||||||
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The creature type loader
|
* The creature type loader
|
||||||
*/
|
*/
|
||||||
@ -83,6 +86,15 @@ public class CreatureTypeLoader {
|
|||||||
return idTypeMap.get(id);
|
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
|
* Gets the collection of all entity data
|
||||||
* @return the collection of all entity data
|
* @return the collection of all entity data
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import org.joml.Vector3i;
|
|||||||
import electrosphere.data.block.BlockType;
|
import electrosphere.data.block.BlockType;
|
||||||
import electrosphere.data.entity.item.Item;
|
import electrosphere.data.entity.item.Item;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
|
import electrosphere.engine.loadingthreads.LoadingUtils;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.state.equip.ServerToolbarState;
|
import electrosphere.entity.state.equip.ServerToolbarState;
|
||||||
import electrosphere.entity.state.item.ServerChargeState;
|
import electrosphere.entity.state.item.ServerChargeState;
|
||||||
@ -45,7 +46,9 @@ public class BlockActions {
|
|||||||
if(equippedItemType.equals(goalBlockEntityId)){
|
if(equippedItemType.equals(goalBlockEntityId)){
|
||||||
//place the block
|
//place the block
|
||||||
ServerBlockEditing.editBlockArea(playerRealm, chunkPos, blockPos, blockType, (short)0, editSize);
|
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){
|
public static void placeFab(Entity creature, Vector3i chunkPos, Vector3i blockPos, int blockRotation, String fabPath){
|
||||||
Realm playerRealm = Globals.serverState.realmManager.getEntityRealm(creature);
|
Realm playerRealm = Globals.serverState.realmManager.getEntityRealm(creature);
|
||||||
ServerBlockEditing.placeBlockFab(playerRealm, chunkPos, blockPos, blockRotation, fabPath);
|
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)){
|
if(CreatureUtils.hasControllerPlayerId(creature)){
|
||||||
Player player = Globals.serverState.playerManager.getPlayerFromId(CreatureUtils.getControllerPlayerId(creature));
|
Player player = Globals.serverState.playerManager.getPlayerFromId(CreatureUtils.getControllerPlayerId(creature));
|
||||||
Globals.serverState.structureScanningService.queue(player, ServerWorldData.convertLocalBlockToRealSpace(chunkPos, blockPos));
|
Globals.serverState.structureScanningService.queue(player, ServerWorldData.convertLocalBlockToRealSpace(chunkPos, blockPos));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user