voxel selection item
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
e0a73fc057
commit
ccaaa47127
@ -97,6 +97,9 @@
|
||||
"offset": [0, 0, 0.15]
|
||||
}
|
||||
]
|
||||
},
|
||||
"itemBlockData": {
|
||||
|
||||
},
|
||||
"equipData": {
|
||||
"equipClass" : "weapon2H"
|
||||
@ -313,6 +316,33 @@
|
||||
"offsetZ" : 0
|
||||
},
|
||||
"iconPath" : "Textures/icons/itemIconItemGeneric.png"
|
||||
},
|
||||
|
||||
{
|
||||
"id" : "terrainTool",
|
||||
"modelPath": "Models/basic/geometry/unitvector.glb",
|
||||
"tokens" : [
|
||||
"GRAVITY",
|
||||
"TARGETABLE"
|
||||
],
|
||||
"equipData": {
|
||||
"equipClass" : "tool"
|
||||
},
|
||||
"clientSidePrimary": "OPEN_VOXEL",
|
||||
"collidable": {
|
||||
"type" : "CUBE",
|
||||
"dimension1" : 0.1,
|
||||
"dimension2" : 0.1,
|
||||
"dimension3" : 0.35,
|
||||
"rotX": 0,
|
||||
"rotY": 0,
|
||||
"rotZ": 0,
|
||||
"rotW": 1,
|
||||
"offsetX" : 0,
|
||||
"offsetY" : 0.05,
|
||||
"offsetZ" : 0
|
||||
},
|
||||
"iconPath" : "Textures/icons/itemIconItemGeneric.png"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -24,6 +24,16 @@
|
||||
"itemId" : "Katana2H"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id" : "skeletonSwordsman",
|
||||
"creatureId" : "skeleton",
|
||||
"equipment" : [
|
||||
{
|
||||
"pointId" : "handsCombined",
|
||||
"itemId" : "Katana2H"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -29,6 +29,11 @@ Progress on the human creature
|
||||
- [ ] CrouchStrafeLeft
|
||||
- [ ] CrouchStrafeRight
|
||||
- [ ] CrouchJump
|
||||
- [ ] ClimbIdle
|
||||
- [ ] ClimbUp
|
||||
- [ ] ClimbLeft
|
||||
- [ ] ClimbDown
|
||||
- [ ] ClimbRight
|
||||
- [X] Sit (Ground)
|
||||
- [ ] Sit (Chair)
|
||||
- [X] HoldItemRH
|
||||
|
||||
@ -29,6 +29,11 @@ Progress on the skeleton creature
|
||||
- [ ] CrouchStrafeLeft
|
||||
- [ ] CrouchStrafeRight
|
||||
- [ ] CrouchJump
|
||||
- [ ] ClimbIdle
|
||||
- [ ] ClimbUp
|
||||
- [ ] ClimbLeft
|
||||
- [ ] ClimbDown
|
||||
- [ ] ClimbRight
|
||||
- [X] Sit (Ground)
|
||||
- [ ] Sit (Chair)
|
||||
- [X] HoldItemRH
|
||||
|
||||
@ -35,9 +35,13 @@
|
||||
- Spawn player in a town with a quest to complete a nearby dungeon
|
||||
|
||||
+ bug fixes
|
||||
Fix ui audio playing at world origin
|
||||
Fix light cluster mapping for foliage shader
|
||||
Fix lights not being deleted
|
||||
- Not sending a "light count" var to light calculations, so the data stays in buffer even though it is not being updated
|
||||
Fix ui elements not storing default discrete world size on level editor menu
|
||||
Fix static friction coeff causing player to slide on shallow slopes
|
||||
- Probably need to look into using capsules
|
||||
Fix skeleton right strafe
|
||||
Fix block tree preventing initiating an attack
|
||||
Fix return to title menu synchronization bug
|
||||
|
||||
@ -818,6 +818,10 @@ Point light offsets
|
||||
|
||||
(09/20/2024)
|
||||
Light manager buffer overflow bugfix
|
||||
Particle Emitter data definitions
|
||||
Torch w/ particle + lighting
|
||||
Fix text input collapsing while typing
|
||||
Voxel selection item
|
||||
|
||||
|
||||
# TODO
|
||||
@ -836,7 +840,6 @@ Bug Fixes
|
||||
- Fix typescript load error
|
||||
- Calculate bounding sphere for meshes by deforming vertices with bone default pose instead of no bone deform
|
||||
- Fix character creation menu
|
||||
- Fix text input collapsing while typing
|
||||
- Fix threads not synchronizing when returning to main menu (rendering still running when player entity deleted, race condition)
|
||||
|
||||
Startup Performance
|
||||
|
||||
@ -11,7 +11,6 @@ import electrosphere.engine.Globals;
|
||||
import electrosphere.entity.ClientEntityUtils;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.EntityDataStrings;
|
||||
import electrosphere.entity.EntityUtils;
|
||||
import electrosphere.entity.types.fluid.FluidChunk;
|
||||
import electrosphere.renderer.shader.ShaderProgram;
|
||||
import electrosphere.server.terrain.manager.ServerTerrainChunk;
|
||||
@ -86,7 +85,7 @@ public class FluidCell {
|
||||
public void destroy(){
|
||||
CollisionEngine collisionEngine = Globals.clientSceneWrapper.getCollisionEngine();
|
||||
collisionEngine.destroyPhysics(modelEntity);
|
||||
EntityUtils.cleanUpEntity(modelEntity);
|
||||
ClientEntityUtils.destroyEntity(modelEntity);
|
||||
//destruct model
|
||||
String modelPath = (String)modelEntity.getData(EntityDataStrings.DATA_STRING_MODEL_PATH);
|
||||
Globals.assetManager.deregisterModelPath(modelPath);
|
||||
|
||||
@ -21,6 +21,7 @@ import org.lwjgl.BufferUtils;
|
||||
import electrosphere.client.entity.camera.CameraEntityUtils;
|
||||
import electrosphere.client.terrain.cache.ChunkData;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.entity.ClientEntityUtils;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.EntityCreationUtils;
|
||||
import electrosphere.entity.EntityUtils;
|
||||
@ -193,7 +194,7 @@ public class FoliageCell {
|
||||
*/
|
||||
protected void destroy(){
|
||||
for(Entity entity : containedEntities){
|
||||
EntityUtils.cleanUpEntity(entity);
|
||||
ClientEntityUtils.destroyEntity(entity);
|
||||
}
|
||||
clearEntities();
|
||||
}
|
||||
|
||||
@ -1,6 +1,13 @@
|
||||
package electrosphere.client.item;
|
||||
|
||||
import electrosphere.client.ui.menu.WindowStrings;
|
||||
import electrosphere.client.ui.menu.WindowUtils;
|
||||
import electrosphere.client.ui.menu.ingame.MenuGeneratorsTerrainEditing;
|
||||
import electrosphere.controls.ControlHandler.ControlsState;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.state.equip.ClientEquipState;
|
||||
import electrosphere.game.data.item.type.Item;
|
||||
import electrosphere.net.parser.net.message.InventoryMessage;
|
||||
|
||||
/**
|
||||
@ -26,6 +33,19 @@ public class ItemActions {
|
||||
//tell the server we want the secondary hand item to START doing something
|
||||
Globals.clientConnection.queueOutgoingMessage(InventoryMessage.constructclientRequestPerformItemActionMessage("handRight", ITEM_ACTION_CODE_SECONDARY, ITEM_ACTION_CODE_STATE_ON));
|
||||
//TODO: do any immediate client side calculations here (ie start playing an animation until we get response from server)
|
||||
ClientEquipState clientEquipState = ClientEquipState.getClientEquipState(Globals.playerEntity);
|
||||
Entity rightHandItem = clientEquipState.getEquippedItemAtPoint("handRight");
|
||||
if(rightHandItem != null && Globals.gameConfigCurrent.getItemMap().getItem(rightHandItem) != null){
|
||||
Item data = Globals.gameConfigCurrent.getItemMap().getItem(rightHandItem);
|
||||
if(data.getClientSidePrimary() != null){
|
||||
switch(data.getClientSidePrimary()){
|
||||
case "OPEN_VOXEL": {
|
||||
WindowUtils.replaceWindow(WindowStrings.VOXEL_TYPE_SELECTION,MenuGeneratorsTerrainEditing.createVoxelTypeSelectionPanel());
|
||||
Globals.controlHandler.hintUpdateControlState(ControlsState.IN_GAME_MAIN_MENU);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -9,7 +9,6 @@ import electrosphere.collision.CollisionEngine;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.entity.ClientEntityUtils;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.EntityUtils;
|
||||
import electrosphere.entity.types.terrain.TerrainChunk;
|
||||
import electrosphere.renderer.meshgen.TransvoxelModelGeneration.TransvoxelChunkData;
|
||||
|
||||
@ -98,7 +97,7 @@ public class DrawCell {
|
||||
public void destroy(){
|
||||
CollisionEngine collisionEngine = Globals.clientSceneWrapper.getCollisionEngine();
|
||||
collisionEngine.destroyPhysics(modelEntity);
|
||||
EntityUtils.cleanUpEntity(modelEntity);
|
||||
ClientEntityUtils.destroyEntity(modelEntity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import electrosphere.audio.VirtualAudioSourceManager.VirtualAudioSourceType;
|
||||
import electrosphere.client.ui.menu.WindowStrings;
|
||||
import electrosphere.client.ui.menu.WindowUtils;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.engine.assetmanager.AssetDataStrings;
|
||||
import electrosphere.entity.state.inventory.InventoryUtils;
|
||||
import electrosphere.entity.types.item.ItemUtils;
|
||||
import electrosphere.game.data.item.type.Item;
|
||||
@ -32,7 +33,7 @@ public class MenuGeneratorsInventory {
|
||||
if(itemData.getItemAudio() != null && itemData.getItemAudio().getUIReleaseAudio() != null){
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource(itemData.getItemAudio().getUIReleaseAudio(), VirtualAudioSourceType.UI, false);
|
||||
} else {
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource("/Audio/inventorySlotItem.ogg", VirtualAudioSourceType.UI, false);
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource(AssetDataStrings.UI_SFX_ITEM_RELEASE, VirtualAudioSourceType.UI, false);
|
||||
}
|
||||
}
|
||||
//clear ui
|
||||
|
||||
@ -5,6 +5,7 @@ import java.util.function.Consumer;
|
||||
|
||||
import electrosphere.client.ui.menu.WindowStrings;
|
||||
import electrosphere.client.ui.menu.WindowUtils;
|
||||
import electrosphere.controls.ControlHandler.ControlsState;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.engine.signal.Signal.SignalType;
|
||||
import electrosphere.game.data.voxel.VoxelData;
|
||||
@ -69,6 +70,7 @@ public class MenuGeneratorsTerrainEditing {
|
||||
//nav logic
|
||||
terrainEditingSidePanelWindow.setOnNavigationCallback(new NavigationEventCallback() {public boolean execute(NavigationEvent event){
|
||||
WindowUtils.closeWindow(WindowStrings.VOXEL_TYPE_SELECTION);
|
||||
Globals.controlHandler.hintUpdateControlState(ControlsState.MAIN_GAME);
|
||||
MenuGeneratorsLevelEditor.voxelWindowOpen = false;
|
||||
return false;
|
||||
}});
|
||||
|
||||
@ -62,6 +62,7 @@ import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_LEFT;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_RIGHT;
|
||||
import static org.lwjgl.glfw.GLFW.glfwGetCursorPos;
|
||||
import static org.lwjgl.glfw.GLFW.glfwSetInputMode;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@ -324,7 +325,7 @@ public class ControlHandler {
|
||||
handler.addControl(INPUT_CODE_WALK, new Control(ControlType.KEY,GLFW_KEY_LEFT_ALT,false,"Walk (hold)","Causes the player to walk"));
|
||||
handler.addControl(INPUT_CODE_INTERACT, new Control(ControlType.KEY,GLFW_KEY_E,false,"Interact","Interacts with whatever is targeted currently"));
|
||||
handler.addControl(INPUT_CODE_DROP, new Control(ControlType.KEY,GLFW_KEY_Y,false,"Drop","Drops the currently equipped item"));
|
||||
handler.addControl(INPUT_CODE_INVENTORY_OPEN, new Control(ControlType.KEY,GLFW_KEY_I,false,"Inventory","Opens the player's inventory"));
|
||||
handler.addControl(INPUT_CODE_INVENTORY_OPEN, new Control(ControlType.KEY,GLFW.GLFW_KEY_TAB,false,"Inventory","Opens the player's inventory"));
|
||||
handler.addControl(ITEM_SECONDARY, new Control(ControlType.MOUSE_BUTTON,GLFW_MOUSE_BUTTON_RIGHT,false,"Secondary","Uses the secondary equipped item"));
|
||||
|
||||
/*
|
||||
@ -856,6 +857,10 @@ public class ControlHandler {
|
||||
}
|
||||
}});
|
||||
|
||||
|
||||
/**
|
||||
* Item actions
|
||||
*/
|
||||
mainGameControlList.add(controls.get(ITEM_SECONDARY));
|
||||
controls.get(ITEM_SECONDARY).setOnPress(new ControlMethod() {public void execute() {
|
||||
ItemActions.attemptSecondaryItemAction();
|
||||
|
||||
@ -174,7 +174,7 @@ public class LoadingUtils {
|
||||
template.putAttributeValue(attribute.getAttributeId(), attribute.getVariants().get(0).getId());
|
||||
}
|
||||
}
|
||||
template.getCreatureEquipData().setSlotItem("handsCombined",new EquippedItem(71, "Katana2H"));
|
||||
template.getCreatureEquipData().setSlotItem("handRight",new EquippedItem(71, "terrainTool"));
|
||||
//set player character template
|
||||
serverPlayerConnection.setCreatureTemplate(template);
|
||||
Globals.clientConnection.queueOutgoingMessage(CharacterMessage.constructRequestSpawnCharacterMessage());
|
||||
|
||||
@ -269,6 +269,7 @@ public class EntityDataStrings {
|
||||
Inventory in general
|
||||
*/
|
||||
public static final String NATURAL_INVENTORY = "inventoryNatural";
|
||||
public static final String INVENTORY_TOOLBAR = "inventoryToolbar";
|
||||
public static final String CLIENT_INVENTORY_STATE = "clientInventoryState";
|
||||
public static final String SERVER_INVENTORY_STATE = "serverInventoryState";
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ public class EntityUtils {
|
||||
* Cleans up the entity and deregisters it from all tracking datastructures
|
||||
* @param e The entity to clean up
|
||||
*/
|
||||
public static void cleanUpEntity(Entity e){
|
||||
protected static void cleanUpEntity(Entity e){
|
||||
//remove from client
|
||||
if(Globals.clientSceneWrapper != null){
|
||||
Globals.clientSceneWrapper.getScene().deregisterEntity(e);
|
||||
|
||||
@ -8,6 +8,7 @@ import java.util.Map;
|
||||
|
||||
import electrosphere.collision.PhysicsEntityUtils;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.entity.ClientEntityUtils;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.EntityCreationUtils;
|
||||
import electrosphere.entity.EntityDataStrings;
|
||||
@ -350,7 +351,7 @@ public class ClientEquipState implements BehaviorTree {
|
||||
} else {
|
||||
//does not depend on the type of creature
|
||||
AttachUtils.clientDetatchEntityFromEntityAtBone(parent, equipped);
|
||||
EntityUtils.cleanUpEntity(equipped);
|
||||
ClientEntityUtils.destroyEntity(equipped);
|
||||
}
|
||||
|
||||
//interrupt animation
|
||||
|
||||
@ -418,7 +418,7 @@ public class ServerEquipState implements BehaviorTree {
|
||||
BlockSystem blockData = blockTree.getBlockSystem();
|
||||
for(EquipPoint point : pointsThatCanBlock){
|
||||
Entity item = getEquippedItemAtPoint(point.getEquipPointId());
|
||||
if(item != null){
|
||||
if(item != null && Globals.gameConfigCurrent.getItemMap().getItem(item) != null && Globals.gameConfigCurrent.getItemMap().getItem(item).getItemBlockData() != null){
|
||||
BlockVariant blockVariant = blockData.getVariantForPointWithItem(point.getEquipPointId(),ItemUtils.getEquipClass(item));
|
||||
|
||||
//TODO: refactor to allow sending more than one variant at a time
|
||||
|
||||
@ -4,8 +4,8 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import electrosphere.client.ui.menu.WindowUtils;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.entity.ClientEntityUtils;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.EntityUtils;
|
||||
import electrosphere.entity.btree.BehaviorTree;
|
||||
import electrosphere.entity.state.equip.ClientEquipState;
|
||||
import electrosphere.entity.types.item.ItemUtils;
|
||||
@ -85,6 +85,9 @@ public class ClientInventoryState implements BehaviorTree {
|
||||
equipInventory.removeItemSlot(equipPointId);
|
||||
}
|
||||
} break;
|
||||
case InventoryProtocol.INVENTORY_TYPE_TOOLBAR: {
|
||||
throw new UnsupportedOperationException("todo");
|
||||
}
|
||||
}
|
||||
//once we've switched the items around, redraw the inventory to reflect the updated contents
|
||||
WindowUtils.attemptRedrawInventoryWindows();
|
||||
@ -96,7 +99,7 @@ public class ClientInventoryState implements BehaviorTree {
|
||||
Entity entityInSlot = equipState.getEquippedItemAtPoint(message.getequipPointId());
|
||||
equipState.clientTransformUnequipPoint(message.getequipPointId());
|
||||
//destroy the in-world manifestation of said item
|
||||
EntityUtils.cleanUpEntity(entityInSlot);
|
||||
ClientEntityUtils.destroyEntity(entityInSlot);
|
||||
}
|
||||
} break;
|
||||
case CLIENTREQUESTEQUIPITEM:
|
||||
|
||||
@ -55,6 +55,11 @@ public class InventoryUtils {
|
||||
return (UnrelationalInventoryState)target.getData(EntityDataStrings.NATURAL_INVENTORY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the entity has an equip inventory
|
||||
* @param target The entity
|
||||
* @return true if it has an equip inventory, false if it does not
|
||||
*/
|
||||
public static boolean hasEquipInventory(Entity target){
|
||||
return target.containsKey(EntityDataStrings.EQUIP_INVENTORY);
|
||||
}
|
||||
@ -80,6 +85,36 @@ public class InventoryUtils {
|
||||
return (RelationalInventoryState)target.getData(EntityDataStrings.EQUIP_INVENTORY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the entity has a toolbar inventory
|
||||
* @param target The entity
|
||||
* @return true if it has a toolbar inventory, false if it does not
|
||||
*/
|
||||
public static boolean hasToolbarInventory(Entity target){
|
||||
return target.containsKey(EntityDataStrings.INVENTORY_TOOLBAR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the toolbar inventory of the entity
|
||||
* @param target The target
|
||||
* @param inventoryState The inventory
|
||||
*/
|
||||
public static void setToolbarInventory(Entity target, RelationalInventoryState inventoryState){
|
||||
target.putData(EntityDataStrings.INVENTORY_TOOLBAR, inventoryState);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the toolbar inventory of the entity
|
||||
* @param target The entity
|
||||
* @return The inventory if it exists, null otherwise
|
||||
*/
|
||||
public static RelationalInventoryState getToolbarInventory(Entity target){
|
||||
if(!target.containsKey(EntityDataStrings.INVENTORY_TOOLBAR)){
|
||||
return null;
|
||||
}
|
||||
return (RelationalInventoryState)target.getData(EntityDataStrings.INVENTORY_TOOLBAR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current inventory state
|
||||
* @param target the entity to get inventory state from
|
||||
|
||||
@ -11,6 +11,11 @@ import electrosphere.game.data.creature.type.equip.EquipPoint;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
|
||||
public class RelationalInventoryState {
|
||||
|
||||
/**
|
||||
* The size of the toolbar
|
||||
*/
|
||||
static final int TOOLBAR_SIZE = 10;
|
||||
|
||||
Map<String,Entity> items = new HashMap<String,Entity>();
|
||||
Map<String,List<String>> slotWhitelists = new HashMap<String,List<String>>();
|
||||
@ -24,6 +29,11 @@ public class RelationalInventoryState {
|
||||
// return rVal;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Builds a relational inventory state based on a list of equip points
|
||||
* @param points The equip points
|
||||
* @return The relational inventory state
|
||||
*/
|
||||
public static RelationalInventoryState buildRelationalInventoryStateFromEquipList(List<EquipPoint> points){
|
||||
RelationalInventoryState rVal = new RelationalInventoryState();
|
||||
for(EquipPoint point : points){
|
||||
@ -34,16 +44,44 @@ public class RelationalInventoryState {
|
||||
return rVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a relational inventory state based on a list of equip points
|
||||
* @param points The equip points
|
||||
* @return The relational inventory state
|
||||
*/
|
||||
public static RelationalInventoryState buildToolbarInventory(){
|
||||
RelationalInventoryState rVal = new RelationalInventoryState();
|
||||
for(int i = 0; i < TOOLBAR_SIZE; i ++){
|
||||
rVal.items.put("" + i,null);
|
||||
}
|
||||
return rVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an item to the relational inventory state
|
||||
* @param slot The slot to add to
|
||||
* @param item The item
|
||||
*/
|
||||
public void addItem(String slot, Entity item){
|
||||
items.put(slot,item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the item from a slot in the inventory
|
||||
* @param slot The slot
|
||||
* @return The item that was removed, or null if no item was removed
|
||||
*/
|
||||
public Entity removeItemSlot(String slot){
|
||||
Entity rVal = items.remove(slot);
|
||||
items.put(slot,null);
|
||||
return rVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item in a given relational inventory state
|
||||
* @param slot The slot
|
||||
* @return The item if it exists, null otherwise
|
||||
*/
|
||||
public Entity getItemSlot(String slot){
|
||||
return items.get(slot);
|
||||
}
|
||||
@ -67,15 +105,29 @@ public class RelationalInventoryState {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the relational inventory has an item in a slot
|
||||
* @param slot The slot
|
||||
* @return true if there is an item in that slot, false otherwise
|
||||
*/
|
||||
public boolean hasItemInSlot(String slot){
|
||||
//if the slot is a key return if the value at the key isn't null, otherwise return false
|
||||
return items.containsKey(slot) ? items.get(slot) != null : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the slots in the relational inventory state
|
||||
* @return The list of slots
|
||||
*/
|
||||
public List<String> getSlots(){
|
||||
return new LinkedList<String>(items.keySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries removing an item from the inventory
|
||||
* @param item The item
|
||||
* @return The item if it was removed, null if it was not
|
||||
*/
|
||||
public Entity tryRemoveItem(Entity item){
|
||||
if(items.containsValue(item)){
|
||||
for(String slot : items.keySet()){
|
||||
|
||||
@ -43,7 +43,7 @@ public class ProjectileTree implements BehaviorTree {
|
||||
|
||||
lifeCurrent++;
|
||||
if(lifeCurrent >= maxLife){
|
||||
EntityUtils.cleanUpEntity(parent);
|
||||
// EntityUtils.cleanUpEntity(parent);
|
||||
ServerBehaviorTreeUtils.detatchBTreeFromEntity(parent,this);
|
||||
}
|
||||
|
||||
|
||||
@ -269,7 +269,8 @@ public class CommonEntityUtils {
|
||||
|
||||
if(rawType.getEquipPoints() != null && rawType.getEquipPoints().size() > 0){
|
||||
ClientEquipState.attachTree(entity, rawType.getEquipPoints());
|
||||
entity.putData(EntityDataStrings.EQUIP_INVENTORY, RelationalInventoryState.buildRelationalInventoryStateFromEquipList(rawType.getEquipPoints()));
|
||||
InventoryUtils.setEquipInventory(entity, RelationalInventoryState.buildRelationalInventoryStateFromEquipList(rawType.getEquipPoints()));
|
||||
InventoryUtils.setToolbarInventory(entity, RelationalInventoryState.buildToolbarInventory());
|
||||
}
|
||||
if(rawType.getBlockSystem() != null){
|
||||
ClientBlockTree.attachTree(entity, rawType.getBlockSystem());
|
||||
@ -541,7 +542,8 @@ public class CommonEntityUtils {
|
||||
//
|
||||
if(rawType.getEquipPoints() != null && rawType.getEquipPoints().size() > 0){
|
||||
ServerEquipState.attachTree(entity, rawType.getEquipPoints());
|
||||
entity.putData(EntityDataStrings.EQUIP_INVENTORY, RelationalInventoryState.buildRelationalInventoryStateFromEquipList(rawType.getEquipPoints()));
|
||||
InventoryUtils.setEquipInventory(entity, RelationalInventoryState.buildRelationalInventoryStateFromEquipList(rawType.getEquipPoints()));
|
||||
InventoryUtils.setToolbarInventory(entity, RelationalInventoryState.buildToolbarInventory());
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@ -9,6 +9,7 @@ import org.ode4j.ode.DBody;
|
||||
import electrosphere.collision.PhysicsEntityUtils;
|
||||
import electrosphere.collision.collidable.Collidable;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.entity.ClientEntityUtils;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.EntityCreationUtils;
|
||||
import electrosphere.entity.EntityDataStrings;
|
||||
@ -326,6 +327,9 @@ public class ItemUtils {
|
||||
* @return The type
|
||||
*/
|
||||
public static String getType(Entity item){
|
||||
if(item == null){
|
||||
return null;
|
||||
}
|
||||
return CommonEntityUtils.getEntitySubtype(item);
|
||||
}
|
||||
|
||||
@ -449,7 +453,7 @@ public class ItemUtils {
|
||||
//destroy hitboxes
|
||||
HitboxCollectionState.destroyHitboxState(item);
|
||||
//destroy graphics
|
||||
EntityUtils.cleanUpEntity(item);
|
||||
ClientEntityUtils.destroyEntity(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,6 +22,16 @@ public class Item extends CommonEntityType {
|
||||
*/
|
||||
ItemAudio itemAudio;
|
||||
|
||||
/**
|
||||
* A function that should be performed client-side when the player uses this as their primary item
|
||||
*/
|
||||
String clientSidePrimary;
|
||||
|
||||
/**
|
||||
* The block data for this item
|
||||
*/
|
||||
ItemBlockData itemBlockData;
|
||||
|
||||
/**
|
||||
* the idle animation for the item
|
||||
* @return
|
||||
@ -62,4 +72,20 @@ public class Item extends CommonEntityType {
|
||||
return itemAudio;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the client side primary action to perform
|
||||
* @return The action
|
||||
*/
|
||||
public String getClientSidePrimary(){
|
||||
return clientSidePrimary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the block data for the item
|
||||
* @return THe block data
|
||||
*/
|
||||
public ItemBlockData getItemBlockData(){
|
||||
return this.itemBlockData;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
package electrosphere.game.data.item.type;
|
||||
|
||||
/**
|
||||
* Block data for the item
|
||||
*/
|
||||
public class ItemBlockData {
|
||||
|
||||
|
||||
}
|
||||
@ -1,5 +1,7 @@
|
||||
package electrosphere.game.data.item.type.model;
|
||||
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.types.item.ItemUtils;
|
||||
import electrosphere.game.data.item.type.Item;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
|
||||
@ -24,5 +26,17 @@ public class ItemTypeMap {
|
||||
}
|
||||
return rVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item data of the item
|
||||
* @param item The item entity
|
||||
* @return The type
|
||||
*/
|
||||
public Item getItem(Entity item){
|
||||
if(item != null && ItemUtils.isItem(item) && ItemUtils.getType(item) != null){
|
||||
return getItem(ItemUtils.getType(item));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -9,7 +9,6 @@ import org.joml.Vector3d;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.entity.ClientEntityUtils;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.EntityUtils;
|
||||
import electrosphere.entity.state.attach.AttachUtils;
|
||||
import electrosphere.entity.state.equip.ClientEquipState;
|
||||
import electrosphere.entity.state.inventory.InventoryUtils;
|
||||
@ -144,7 +143,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
|
||||
case DESTROY: {
|
||||
Entity entity = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityID());
|
||||
if(entity != null){
|
||||
EntityUtils.cleanUpEntity(entity);
|
||||
ClientEntityUtils.destroyEntity(entity);
|
||||
}
|
||||
} break;
|
||||
|
||||
|
||||
@ -19,6 +19,8 @@ public class InventoryProtocol implements ServerProtocolTemplate<InventoryMessag
|
||||
public static final int INVENTORY_TYPE_EQUIP = 0;
|
||||
//the natural inventory of the entity
|
||||
public static final int INVENTORY_TYPE_NATURAL = 1;
|
||||
//the toolbar
|
||||
public static final int INVENTORY_TYPE_TOOLBAR = 2;
|
||||
|
||||
@Override
|
||||
public InventoryMessage handleAsyncMessage(ServerConnectionHandler connectionHandler, InventoryMessage message) {
|
||||
|
||||
@ -6,6 +6,7 @@ import electrosphere.audio.VirtualAudioSourceManager.VirtualAudioSourceType;
|
||||
import electrosphere.client.ui.menu.WindowStrings;
|
||||
import electrosphere.client.ui.menu.WindowUtils;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.engine.assetmanager.AssetDataStrings;
|
||||
import electrosphere.engine.signal.Signal.SignalType;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.state.equip.ClientEquipState;
|
||||
@ -59,7 +60,7 @@ public class EquipmentInventoryPanel {
|
||||
if(itemData.getItemAudio() != null && itemData.getItemAudio().getUIReleaseAudio() != null){
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource(itemData.getItemAudio().getUIReleaseAudio(), VirtualAudioSourceType.UI, false);
|
||||
} else {
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource("/Audio/inventorySlotItem.ogg", VirtualAudioSourceType.UI, false);
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource(AssetDataStrings.UI_SFX_ITEM_RELEASE, VirtualAudioSourceType.UI, false);
|
||||
}
|
||||
}
|
||||
//null out global state
|
||||
@ -155,7 +156,7 @@ public class EquipmentInventoryPanel {
|
||||
if(itemData.getItemAudio() != null && itemData.getItemAudio().getUIGrabAudio() != null){
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource(itemData.getItemAudio().getUIGrabAudio(), VirtualAudioSourceType.UI, false);
|
||||
} else {
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource("/Audio/inventoryGrabItem.ogg", VirtualAudioSourceType.UI, false);
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource(AssetDataStrings.UI_SFX_ITEM_GRAB, VirtualAudioSourceType.UI, false);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -194,10 +195,10 @@ public class EquipmentInventoryPanel {
|
||||
//play sound effect
|
||||
if(Globals.virtualAudioSourceManager != null){
|
||||
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(finalEnt));
|
||||
if(itemData.getItemAudio() != null && itemData.getItemAudio().getUIReleaseAudio() != null){
|
||||
if(itemData != null && itemData.getItemAudio() != null && itemData.getItemAudio().getUIReleaseAudio() != null){
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource(itemData.getItemAudio().getUIReleaseAudio(), VirtualAudioSourceType.UI, false);
|
||||
} else {
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource("/Audio/inventorySlotItem.ogg", VirtualAudioSourceType.UI, false);
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource(AssetDataStrings.UI_SFX_ITEM_RELEASE, VirtualAudioSourceType.UI, false);
|
||||
}
|
||||
}
|
||||
} else if(inventory.canEquipItemToCombinedSlot(Globals.draggedItem, slots.get(itemId))){
|
||||
@ -213,7 +214,7 @@ public class EquipmentInventoryPanel {
|
||||
if(itemData.getItemAudio() != null && itemData.getItemAudio().getUIReleaseAudio() != null){
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource(itemData.getItemAudio().getUIReleaseAudio(), VirtualAudioSourceType.UI, false);
|
||||
} else {
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource("/Audio/inventorySlotItem.ogg", VirtualAudioSourceType.UI, false);
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource(AssetDataStrings.UI_SFX_ITEM_RELEASE, VirtualAudioSourceType.UI, false);
|
||||
}
|
||||
}
|
||||
//update ui
|
||||
|
||||
@ -4,6 +4,7 @@ import electrosphere.audio.VirtualAudioSourceManager.VirtualAudioSourceType;
|
||||
import electrosphere.client.ui.menu.WindowStrings;
|
||||
import electrosphere.client.ui.menu.WindowUtils;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.engine.assetmanager.AssetDataStrings;
|
||||
import electrosphere.engine.signal.Signal.SignalType;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.state.equip.ClientEquipState;
|
||||
@ -83,7 +84,7 @@ public class NaturalInventoryPanel {
|
||||
if(itemData.getItemAudio() != null && itemData.getItemAudio().getUIReleaseAudio() != null){
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource(itemData.getItemAudio().getUIReleaseAudio(), VirtualAudioSourceType.UI, false);
|
||||
} else {
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource("/Audio/inventorySlotItem.ogg", VirtualAudioSourceType.UI, false);
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource(AssetDataStrings.UI_SFX_ITEM_RELEASE, VirtualAudioSourceType.UI, false);
|
||||
}
|
||||
}
|
||||
//clear ui
|
||||
@ -155,7 +156,7 @@ public class NaturalInventoryPanel {
|
||||
if(itemData.getItemAudio() != null && itemData.getItemAudio().getUIGrabAudio() != null){
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource(itemData.getItemAudio().getUIGrabAudio(), VirtualAudioSourceType.UI, false);
|
||||
} else {
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource("/Audio/inventoryGrabItem.ogg", VirtualAudioSourceType.UI, false);
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource(AssetDataStrings.UI_SFX_ITEM_GRAB, VirtualAudioSourceType.UI, false);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -195,7 +196,7 @@ public class NaturalInventoryPanel {
|
||||
if(itemData.getItemAudio() != null && itemData.getItemAudio().getUIReleaseAudio() != null){
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource(itemData.getItemAudio().getUIReleaseAudio(), VirtualAudioSourceType.UI, false);
|
||||
} else {
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource("/Audio/inventorySlotItem.ogg", VirtualAudioSourceType.UI, false);
|
||||
Globals.virtualAudioSourceManager.createVirtualAudioSource(AssetDataStrings.UI_SFX_ITEM_RELEASE, VirtualAudioSourceType.UI, false);
|
||||
}
|
||||
//update ui
|
||||
Globals.dragSourceInventory = null;
|
||||
|
||||
@ -254,12 +254,18 @@ public class TextInput extends StandardContainerElement implements DrawableEleme
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.setText(this.text + keyEvent.getKey());
|
||||
String newVal = this.text + keyEvent.getKey();
|
||||
this.setText(newVal);
|
||||
if(Globals.virtualAudioSourceManager != null && this.audioPathOnType != null){
|
||||
Globals.virtualAudioSourceManager.createUI(this.audioPathOnType);
|
||||
}
|
||||
}
|
||||
Globals.signalSystem.post(SignalType.YOGA_APPLY, this);
|
||||
//apply yoga at the window level
|
||||
Element parent = this.getParent();
|
||||
while(parent.getParent() != null){
|
||||
parent = parent.getParent();
|
||||
}
|
||||
Globals.signalSystem.post(SignalType.YOGA_APPLY, parent);
|
||||
//fire value change event
|
||||
Globals.elementService.fireEventNoPosition(new ValueChangeEvent(text), this);
|
||||
return false;
|
||||
|
||||
@ -14,6 +14,7 @@ import org.joml.Vector3i;
|
||||
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.engine.threads.LabeledThread.ThreadLabel;
|
||||
import electrosphere.entity.ClientEntityUtils;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.EntityUtils;
|
||||
import electrosphere.game.server.world.ServerWorldData;
|
||||
@ -305,7 +306,7 @@ public class GriddedDataCellManager implements DataCellManager, VoxelCellManager
|
||||
serverContentManager.saveContentToDisk(key, cell.getScene().getEntityList());
|
||||
//clear all entities in cell
|
||||
for(Entity entity : cell.getScene().getEntityList()){
|
||||
EntityUtils.cleanUpEntity(entity);
|
||||
ClientEntityUtils.destroyEntity(entity);
|
||||
}
|
||||
//save terrain to disk
|
||||
serverTerrainManager.savePositionToDisk(worldPos);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user