63 lines
No EOL
1.2 KiB
Text
63 lines
No EOL
1.2 KiB
Text
import "math/observable" for Observable
|
|
import "luxe: world" for Entity, Values, Tags
|
|
import "globals" for Globals
|
|
import "blocks/resources" for Resources
|
|
|
|
class Adventures{
|
|
planning{_planning}
|
|
max_distance{_max_distance}
|
|
|
|
construct new(){
|
|
_planning = Observable.new()
|
|
_in_progress = []
|
|
_archive = []
|
|
_max_distance = 10
|
|
}
|
|
|
|
plan_new(){
|
|
var adventure = Adventure.new()
|
|
_planning.value = adventure
|
|
return adventure
|
|
}
|
|
|
|
new_or_current(){
|
|
if(_planning.value) return _planning.value
|
|
return plan_new()
|
|
}
|
|
|
|
discard(){
|
|
_planning.value = null
|
|
}
|
|
|
|
set_max_distance(dist){
|
|
_max_distance = dist
|
|
planning.emit()
|
|
}
|
|
}
|
|
|
|
class Adventure{
|
|
adventurers{_adventurers}
|
|
resources{_resources}
|
|
data{_data}
|
|
direction{_direction}
|
|
direction=(dir){_direction = dir}
|
|
distance{_distance}
|
|
distance=(dist){_distance = dist}
|
|
|
|
construct new(){
|
|
_adventurers = []
|
|
_resources = Resources.new()
|
|
_data = {}
|
|
|
|
_direction = 0
|
|
_distance = 0
|
|
}
|
|
|
|
add_adventurer(adventurer){
|
|
_adventurers.add(adventurer)
|
|
}
|
|
|
|
add_resource(resource){
|
|
_resources.add(resource)
|
|
}
|
|
} |