fix cyclic dependency

This commit is contained in:
Ronja 2020-09-06 17:04:34 +02:00
parent d5147eb33a
commit a167c92d2c
2 changed files with 15 additions and 16 deletions

View file

@ -5,9 +5,6 @@ import "math/util" for Util
import "globals" for Globals
import "luxe: assets" for Strings
import "luxe: input" for Input, MouseButton
import "blocks/ui" for Ui
System.print("ui is: %(Ui)")
//User facing API
//This is what the user of your modifier will interact with
@ -50,12 +47,12 @@ class Human {
//to do the actual work. You'll get notified when things change
//in the world and respond to them here.
class HumanSystem is ModifierSystem {
player_start{[26, 89]}
player_size{[10, 12]}
construct new() {
//called when your system is first created.
}
init(world) {
@ -80,8 +77,8 @@ class HumanSystem is ModifierSystem {
}
tick(delta) {
//called usually once every frame.
//called when the world that this modifier lives in, is ticked
//called usually once every frame.
//called when the world that this modifier lives in, is ticked
each {|entity, data|
if(!data.active) return
@ -92,21 +89,19 @@ class HumanSystem is ModifierSystem {
_hoverEnt = entity
Globals["Tooltip"].set(Strings.get(data.name), entity)
}
if(Input.mouse_state_pressed(MouseButton.left)){
var game = Globals["Game"]
System.print(Ui)
import "blocks/ui" for Ui
if(game.ui.ui_mode == Ui.Info){
game.Focus.value = entity
}
}
}
if(!over && _hoverEnt == entity){
_hoverEnt = null
Globals["Tooltip"].clear(entity)
}
}
if(Input.mouse_state_pressed(MouseButton.left)){
var game = Globals["Game"]
if(game.ui.ui_mode == Ui.Info && _hoverEnt){ //remove &&hoverEnt to allow unfocussing
game.Focus.value = _hoverEnt
}
}
} //tick
update(){
@ -132,3 +127,5 @@ class HumanSystem is ModifierSystem {
} //HumanSystem
var Modifier = HumanSystem //required
import "blocks/ui" for Ui //import at the end in case of cyclic dependency

View file

@ -197,4 +197,6 @@ class Ui{
test(){
ImageButton.get_data(_test)
}
}
}
//this is behind the class def to make cyclic dependency happy lol
import "blocks/human/human" for Human