diff --git a/Luxe/blocks/adventures.wren b/Luxe/blocks/adventures.wren index 327f00e..4f5b33b 100644 --- a/Luxe/blocks/adventures.wren +++ b/Luxe/blocks/adventures.wren @@ -1,6 +1,6 @@ import "math/observable" for Observable -import "luxe: Game" for Game import "luxe: world" for Entity, Values, Tags +import "globals" for Globals class Adventures{ planning{_planning} @@ -12,11 +12,7 @@ class Adventures{ } plan_new(){ - var adventure = Entity.create(Game.app.world, "Adventure") - Values.set(adventure, "adventurers", []) - Values.set(adventure, "resources", {}) - Values.set(adventure, "data", {}) - Tags.add(adventure, "Adventure") + var adventure = Adventure.new() _planning.value = adventure return adventure } @@ -27,7 +23,26 @@ class Adventures{ } discard(){ - Entity.destroy(_planning.value) _planning.value = null } +} + +class Adventure{ + adventurers{_adventurers} + resources{_resources} + data{_data} + + construct new(){ + _adventurers = [] + _resources = [] + _data = {} + } + + add_adventurer(adventurer){ + _adventurers.add(adventurer) + } + + add_resource(resource){ + _resources.add(resource) + } } \ No newline at end of file diff --git a/Luxe/blocks/ui/info.wren b/Luxe/blocks/ui/info.wren index 45b4101..19bd2e7 100644 --- a/Luxe/blocks/ui/info.wren +++ b/Luxe/blocks/ui/info.wren @@ -17,7 +17,6 @@ import "math/stringUtil" for StringUtil import "blocks/ui/simple_text" for UISimpleText import "blocks/ui/ui" for Ui import "blocks/human/human" for Human -import "luxe: Game" for Game class UiInfo{ root{_root} @@ -82,7 +81,7 @@ class UiInfo{ ImageButton.set_tile_uv(button, tiles, [1, 0]) ImageButton.set_state_change(button) { |data| if(data["press"]){ - Game.adventures.new_or_current() + Globals["Game"].adventures.new_or_current() _ui.ui_mode = Ui.Planning } } diff --git a/Luxe/blocks/ui/ui.wren b/Luxe/blocks/ui/ui.wren index a4122f2..8b78448 100644 --- a/Luxe/blocks/ui/ui.wren +++ b/Luxe/blocks/ui/ui.wren @@ -84,7 +84,7 @@ class Ui{ var button = list_button(parent, tile) ImageButton.set_state_change(button) { |data| if(data["press"]){ - _ui.ui_mode = Ui.Info + pressFn.call() } } }