33 lines
759 B
Text
33 lines
759 B
Text
|
|
import "math/observable" for Observable
|
||
|
|
import "luxe: Game" for Game
|
||
|
|
import "luxe: world" for Entity, Values, Tags
|
||
|
|
|
||
|
|
class Adventures{
|
||
|
|
planning{_planning}
|
||
|
|
|
||
|
|
construct new(){
|
||
|
|
_planning = Observable.new()
|
||
|
|
_in_progress = []
|
||
|
|
_archive = []
|
||
|
|
}
|
||
|
|
|
||
|
|
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")
|
||
|
|
_planning.value = adventure
|
||
|
|
return adventure
|
||
|
|
}
|
||
|
|
|
||
|
|
new_or_current(){
|
||
|
|
if(_planning.value) return _planning.value
|
||
|
|
return plan_new()
|
||
|
|
}
|
||
|
|
|
||
|
|
discard(){
|
||
|
|
Entity.destroy(_planning.value)
|
||
|
|
_planning.value = null
|
||
|
|
}
|
||
|
|
}
|