Work on hooks, element manager debugging
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-07-19 23:13:03 -04:00
parent d36b2f3237
commit 23f745c450
6 changed files with 22 additions and 7 deletions

View File

@ -40,6 +40,16 @@ class TestScene1 extends Scene {
}
},
/**
* Storing an item in inventory
*/
{
signal: "itemPickup",
callback: (entityId: number, inWorldItemEntityId: number, inInventoryItemEntityId: number) => {
console.log(entityId + ' picked up an item, destroying ' + inWorldItemEntityId + ' and creating ' + inInventoryItemEntityId)
}
},
]
}

View File

@ -78,8 +78,8 @@ export class HookManager {
this.signalHookMap[hookSignal] = signalArray
loggerScripts.DEBUG('register signal hook map')
loggerScripts.DEBUG(hookSignal)
loggerScripts.DEBUG(Object.keys(this.signalHookMap))
loggerScripts.DEBUG(this.signalHookMap[hookSignal])
loggerScripts.DEBUG(Object.keys(this.signalHookMap) + '')
loggerScripts.DEBUG(this.signalHookMap[hookSignal] + '')
//
//Scene related structures
//

View File

@ -2,9 +2,7 @@
Server commands client to load a given scene file
+ there is a sword lying on the ground
+ when you grab the sword, a tutorial popup appears to tell you how to use in
hook for grabbing an item
+ on clearing the tutorial, continue the game+ when the sword is equipped, create another popup to teach sword controls. it pauses the game
hook on equipping an item
script ability to pause and unpause game
+ when popup is accepted, spawn an rnemy with an effect
enemy ai

View File

@ -428,6 +428,12 @@ Work on testing
Scene Loading Refactor
Hooking into engine from script-side
(07/19/2024)
Element Manager debugging and logic simplification
Hooks debugging
On add item to inventory hook
Hook manager debugging
# TODO

View File

@ -18,6 +18,7 @@ import electrosphere.net.server.player.Player;
import electrosphere.server.datacell.Realm;
import electrosphere.server.datacell.ServerDataCell;
import electrosphere.server.datacell.utils.DataCellSearchUtils;
import electrosphere.server.utils.ServerScriptUtils;
public class InventoryUtils {
@ -113,6 +114,8 @@ public class InventoryUtils {
}
//destroy the item that was left over
ItemUtils.serverDestroyInWorldItem(item);
//alert script engine
ServerScriptUtils.fireSignalOnEntity(creature, "itemPickup", item.getId(), inventoryItem.getId());
}
}

View File

@ -11,7 +11,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
import org.joml.Vector2i;
import electrosphere.engine.Globals;
import electrosphere.logger.LoggerInterface;
import electrosphere.renderer.ui.elements.Window;
import electrosphere.renderer.ui.elementtypes.ContainerElement;
import electrosphere.renderer.ui.elementtypes.DraggableElement;
@ -267,8 +266,7 @@ public class ElementManager {
elementPropagation.add(el);
}
Element targetElement = el;
//search all window trees
while(targetElement.getParent() != null){
while(targetElement != null && targetElement.getParent() != null){
targetElement = targetElement.getParent();
elementPropagation.add(targetElement);
}