fix toolbar unequip bug
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-04-03 15:16:18 -04:00
parent b08d008a08
commit 840d325b1f
4 changed files with 37 additions and 0 deletions

View File

@ -1424,6 +1424,7 @@ Update ServerEntityUtils.repositionEntityRecursive behavior
Add bush entity
Add bushes to forest biome
Make foliage data files recursive
Fix bug with toolbar not unequipping items when moving to empty slot

View File

@ -18,6 +18,7 @@ import electrosphere.entity.state.AnimationPriorities;
import electrosphere.entity.state.attach.AttachUtils;
import electrosphere.entity.state.client.firstPerson.FirstPersonTree;
import electrosphere.entity.state.equip.ClientEquipState;
import electrosphere.entity.state.equip.ClientToolbarState;
import electrosphere.entity.state.foliage.AmbientFoliage;
import electrosphere.entity.state.hitbox.HitboxCollectionState;
import electrosphere.entity.state.server.ServerPlayerViewDirTree;
@ -68,6 +69,7 @@ public class ImGuiEntityMacros {
private static boolean showServerViewDirTab = false; //show server view dir
private static boolean showPhysicsTab = false; //show physics values
private static boolean showFoliageTab = false; //show foliage data
private static boolean showToolbarTab = false; //show toolbar data
private static boolean showDebugActionsTab = false; //show debug actions
/**
@ -182,6 +184,9 @@ public class ImGuiEntityMacros {
if(CommonEntityUtils.getCommonData(detailViewEntity) instanceof FoliageType && ImGui.checkbox("Foliage Data", showFoliageTab)){
showFoliageTab = !showFoliageTab;
}
if(ClientToolbarState.getClientToolbarState(detailViewEntity) != null && ImGui.checkbox("Toolbar Data", showToolbarTab)){
showToolbarTab = !showToolbarTab;
}
if(ImGui.checkbox("Debug Actions", showDebugActionsTab)){
showDebugActionsTab = !showDebugActionsTab;
}
@ -198,6 +203,7 @@ public class ImGuiEntityMacros {
ImGuiEntityMacros.drawServerViewDir();
ImGuiEntityPhysicsTab.drawPhysicsView(showPhysicsTab, detailViewEntity);
ImGuiEntityFoliageTab.drawFoliageView(showFoliageTab, detailViewEntity);
ImGuiEntityToolbarTab.drawToolbarTab(showToolbarTab, detailViewEntity);
ImGuiEntityDebugActions.drawDebugActions(showDebugActionsTab, detailViewEntity);
ImGuiEntityMacros.drawDataView();
}

View File

@ -0,0 +1,27 @@
package electrosphere.client.ui.menu.debug.entity;
import electrosphere.entity.Entity;
import electrosphere.entity.state.equip.ClientToolbarState;
import imgui.ImGui;
/**
* Debug menu for toolbar state
*/
public class ImGuiEntityToolbarTab {
/**
* Client scene entity view
*/
protected static void drawToolbarTab(boolean show, Entity detailViewEntity){
if(show && ImGui.collapsingHeader("Toolbar Data")){
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(detailViewEntity);
ImGui.indent();
if(detailViewEntity != null && clientToolbarState != null){
ImGui.text("Selected slot: " + clientToolbarState.getSelectedSlot());
ImGui.text("Selected item: " + clientToolbarState.getCurrentPrimaryItem());
}
ImGui.unindent();
}
}
}

View File

@ -232,6 +232,9 @@ public class ClientToolbarState implements BehaviorTree {
FirstPersonTree.conditionallyInterruptAnimation(parent, animation);
}
}
//null out the attached entity
this.equippedEntity = null;
}
}