554 lines
13 KiB
Text
554 lines
13 KiB
Text
|
|
//-- this file is generated! don't try editing it.
|
|
|
|
import "luxe: io" for IO
|
|
import "luxe: bytes" for Byter, Bytes
|
|
import "luxe: world" for Block
|
|
|
|
//`modifiers/trail/trail > runtime` types
|
|
|
|
class ModifierRuntime {
|
|
|
|
construct new() {
|
|
} //new
|
|
|
|
} //ModifierRuntime
|
|
|
|
//`modifiers/trail/trail > runtime` compilers
|
|
|
|
class ModifierRuntimeCompiler {
|
|
|
|
construct new() {
|
|
}
|
|
|
|
bytes_count(instance) {
|
|
|
|
var size = 4 //version
|
|
|
|
size = size + 0
|
|
|
|
return size
|
|
|
|
} //bytes_count
|
|
|
|
validate(from_source_id, elements) {
|
|
|
|
var fields = {
|
|
"type": false, //:luxe:internal
|
|
"uuid": false, //:luxe:internal
|
|
"luxe.self.modifier": false, //:luxe:internal
|
|
}
|
|
for(element in elements) {
|
|
var instance = element.value
|
|
for(field in instance) {
|
|
if(fields[field.key] == null) {
|
|
Fiber.abort("node `%(element.key)` in `%(from_source_id)` has extra field `%(field.key)`")
|
|
} //if not found
|
|
} //each field
|
|
for(field in fields) {
|
|
var required = field.value
|
|
if(required && instance[field.key] == null) {
|
|
Fiber.abort("node `%(element.key)` in `%(from_source_id)` is missing a required field `%(field.key)` (and the field has no default value)")
|
|
}
|
|
} //each field
|
|
} //each element
|
|
|
|
} //validate
|
|
|
|
write(compiler, instance, out) {
|
|
|
|
//version
|
|
out.write_int32(0)
|
|
|
|
return out
|
|
|
|
} //write
|
|
|
|
bytes_count_block() {
|
|
|
|
return 8
|
|
|
|
} //bytes_count_block
|
|
|
|
write_block(compiler, out) {
|
|
|
|
//source id
|
|
out.write_uint32(compiler.string.hash("modifiers/trail/trail > runtime"))
|
|
|
|
//fields count
|
|
out.write_int32(0)
|
|
|
|
} //write_block
|
|
|
|
write(instance) {
|
|
|
|
var size = bytes_count(instance)
|
|
var out = Byter.new(size+8)
|
|
|
|
out.write_string("LUXEMRTM")
|
|
|
|
write(instance, out)
|
|
|
|
return out
|
|
|
|
} //write
|
|
|
|
} //ModifierRuntimeCompiler
|
|
|
|
//`modifiers/trail/trail > runtime` block types
|
|
|
|
class BlockModifierRuntime {
|
|
|
|
field { "trail" }
|
|
source { "modifiers/trail/trail > runtime" }
|
|
|
|
construct new(block) {
|
|
_block = block
|
|
_inst_type = instance_type
|
|
_inst = _inst_type.new(_block, 0)
|
|
}
|
|
|
|
construct new() {
|
|
_block = Block.create()
|
|
_inst_type = instance_type
|
|
_inst = _inst_type.new(_block, 0)
|
|
Block.set_type(_block, "modifiers/trail/trail > runtime")
|
|
} //new
|
|
|
|
instance_type {
|
|
|
|
class BlockInstModifierRuntime {
|
|
slot { _slot }
|
|
entity { Block.get_handle(_block, _slot) }
|
|
block_set_slot(value) {
|
|
_slot=value
|
|
return this
|
|
}
|
|
construct new(block, slot) {
|
|
_block = block
|
|
_slot = slot
|
|
} //new
|
|
block { _block }
|
|
} //BlockInstModifierRuntime
|
|
|
|
return BlockInstModifierRuntime
|
|
|
|
} //instance_type
|
|
|
|
block { _block }
|
|
count { Block.get_count(_block) }
|
|
add() { Block.add(_block) }
|
|
append(other_block) { Block.append(_block, other_block) }
|
|
each(c, fn) {
|
|
for(i in 0 ... c) {
|
|
fn.call(0, _inst.block_set_slot(i))
|
|
}
|
|
} //each
|
|
|
|
[slot, inst] { _inst.block_set_slot(slot) }
|
|
|
|
[slot] { _inst_type.new(_block, slot) }
|
|
} //BlockModifierRuntime
|
|
|
|
|
|
//`modifiers/trail/trail > data` types
|
|
|
|
class ModifierData {
|
|
|
|
construct new() {
|
|
_edge_length = 100
|
|
_time_based = false
|
|
_length = 100
|
|
_subdivisions = 20
|
|
_material = "luxe: material/solid"
|
|
} //new
|
|
|
|
edge_length { _edge_length }
|
|
edge_length=(vvv) { _edge_length = vvv }
|
|
|
|
time_based { _time_based }
|
|
time_based=(vvv) { _time_based = vvv }
|
|
|
|
length { _length }
|
|
length=(vvv) { _length = vvv }
|
|
|
|
subdivisions { _subdivisions }
|
|
subdivisions=(vvv) { _subdivisions = vvv }
|
|
|
|
material { _material }
|
|
material=(vvv) { _material = vvv }
|
|
|
|
} //ModifierData
|
|
|
|
//`modifiers/trail/trail > data` compilers
|
|
|
|
class ModifierDataCompiler {
|
|
|
|
construct new() {
|
|
}
|
|
|
|
bytes_count(instance) {
|
|
|
|
var size = 4 //version
|
|
|
|
size = size + 8 // edge_length
|
|
|
|
size = size + 4 // time_based
|
|
|
|
size = size + 8 // length
|
|
|
|
size = size + 8 // subdivisions
|
|
|
|
size = size + 4 // material
|
|
|
|
size = size + 0
|
|
|
|
return size
|
|
|
|
} //bytes_count
|
|
|
|
validate(from_source_id, elements) {
|
|
|
|
var fields = {
|
|
"type": false, //:luxe:internal
|
|
"uuid": false, //:luxe:internal
|
|
"luxe.self.modifier": false, //:luxe:internal
|
|
"edge_length": false,
|
|
"time_based": false,
|
|
"length": false,
|
|
"subdivisions": false,
|
|
"material": false,
|
|
}
|
|
for(element in elements) {
|
|
var instance = element.value
|
|
for(field in instance) {
|
|
if(fields[field.key] == null) {
|
|
Fiber.abort("node `%(element.key)` in `%(from_source_id)` has extra field `%(field.key)`")
|
|
} //if not found
|
|
} //each field
|
|
for(field in fields) {
|
|
var required = field.value
|
|
if(required && instance[field.key] == null) {
|
|
Fiber.abort("node `%(element.key)` in `%(from_source_id)` is missing a required field `%(field.key)` (and the field has no default value)")
|
|
}
|
|
} //each field
|
|
} //each element
|
|
|
|
} //validate
|
|
|
|
write(compiler, instance, out) {
|
|
|
|
//version
|
|
out.write_int32(0)
|
|
|
|
var edge_length = instance["edge_length"]
|
|
if(edge_length == null) edge_length = 100
|
|
out.write_float64(edge_length)
|
|
|
|
|
|
var time_based = instance["time_based"]
|
|
if(time_based == null) time_based = false
|
|
out.write_int32(time_based ? 1 : 0)
|
|
|
|
|
|
var length = instance["length"]
|
|
if(length == null) length = 100
|
|
out.write_float64(length)
|
|
|
|
|
|
var subdivisions = instance["subdivisions"]
|
|
if(subdivisions == null) subdivisions = 20
|
|
out.write_float64(subdivisions)
|
|
|
|
|
|
var material = instance["material"]
|
|
if(material == null) material = "luxe: material/solid"
|
|
out.write_uint32((material && material != "") ? compiler.string.hash(material) : 0)
|
|
|
|
|
|
return out
|
|
|
|
} //write
|
|
|
|
bytes_count_block() {
|
|
|
|
return 80
|
|
|
|
} //bytes_count_block
|
|
|
|
write_block(compiler, out) {
|
|
|
|
//source id
|
|
out.write_uint32(compiler.string.hash("modifiers/trail/trail > data"))
|
|
|
|
//fields count
|
|
out.write_int32(5)
|
|
|
|
// edge_length
|
|
out.write_uint32(compiler.string.hash("edge_length"))
|
|
out.write_uint32(467038368) //type number
|
|
var edge_length_default = 100
|
|
out.write_float64(edge_length_default)
|
|
|
|
|
|
// time_based
|
|
out.write_uint32(compiler.string.hash("time_based"))
|
|
out.write_uint32(1710517951) //type boolean
|
|
var time_based_default = false
|
|
out.write_int32(time_based_default ? 1 : 0)
|
|
|
|
|
|
// length
|
|
out.write_uint32(compiler.string.hash("length"))
|
|
out.write_uint32(467038368) //type number
|
|
var length_default = 100
|
|
out.write_float64(length_default)
|
|
|
|
|
|
// subdivisions
|
|
out.write_uint32(compiler.string.hash("subdivisions"))
|
|
out.write_uint32(467038368) //type number
|
|
var subdivisions_default = 20
|
|
out.write_float64(subdivisions_default)
|
|
|
|
|
|
// material
|
|
out.write_uint32(compiler.string.hash("material"))
|
|
out.write_uint32(2729592961) //type id32
|
|
var material_default = "luxe: material/solid"
|
|
out.write_uint32((material_default && material_default != "") ? compiler.string.hash(material_default) : 0)
|
|
|
|
|
|
} //write_block
|
|
|
|
write(instance) {
|
|
|
|
var size = bytes_count(instance)
|
|
var out = Byter.new(size+8)
|
|
|
|
out.write_string("LUXEMDTA")
|
|
|
|
write(instance, out)
|
|
|
|
return out
|
|
|
|
} //write
|
|
|
|
} //ModifierDataCompiler
|
|
|
|
//`modifiers/trail/trail > data` block types
|
|
|
|
class BlockModifierData {
|
|
|
|
field { "trail" }
|
|
source { "modifiers/trail/trail > data" }
|
|
|
|
construct new(block) {
|
|
_block = block
|
|
_inst_type = instance_type
|
|
_inst = _inst_type.new(_block, 0)
|
|
}
|
|
|
|
construct new() {
|
|
_block = Block.create()
|
|
_inst_type = instance_type
|
|
_inst = _inst_type.new(_block, 0)
|
|
Block.add(_block, "edge_length", "number", 100)
|
|
Block.add(_block, "time_based", "boolean", false)
|
|
Block.add(_block, "length", "number", 100)
|
|
Block.add(_block, "subdivisions", "number", 20)
|
|
Block.add(_block, "material", "id32", "luxe: material/solid")
|
|
Block.set_type(_block, "modifiers/trail/trail > data")
|
|
} //new
|
|
|
|
instance_type {
|
|
|
|
class BlockInstModifierData {
|
|
edge_length { Block.get(_block, "edge_length", _slot) }
|
|
edge_length=(v) { Block.set(_block, "edge_length", _slot, v) }
|
|
time_based { Block.get(_block, "time_based", _slot) }
|
|
time_based=(v) { Block.set(_block, "time_based", _slot, v) }
|
|
length { Block.get(_block, "length", _slot) }
|
|
length=(v) { Block.set(_block, "length", _slot, v) }
|
|
subdivisions { Block.get(_block, "subdivisions", _slot) }
|
|
subdivisions=(v) { Block.set(_block, "subdivisions", _slot, v) }
|
|
material { Block.get(_block, "material", _slot) }
|
|
material=(v) { Block.set(_block, "material", _slot, v) }
|
|
slot { _slot }
|
|
entity { Block.get_handle(_block, _slot) }
|
|
block_set_slot(value) {
|
|
_slot=value
|
|
return this
|
|
}
|
|
construct new(block, slot) {
|
|
_block = block
|
|
_slot = slot
|
|
} //new
|
|
block { _block }
|
|
} //BlockInstModifierData
|
|
|
|
return BlockInstModifierData
|
|
|
|
} //instance_type
|
|
|
|
block { _block }
|
|
count { Block.get_count(_block) }
|
|
add() { Block.add(_block) }
|
|
append(other_block) { Block.append(_block, other_block) }
|
|
each(c, fn) {
|
|
for(i in 0 ... c) {
|
|
fn.call(0, _inst.block_set_slot(i))
|
|
}
|
|
} //each
|
|
|
|
[slot, inst] { _inst.block_set_slot(slot) }
|
|
|
|
[slot] { _inst_type.new(_block, slot) }
|
|
} //BlockModifierData
|
|
|
|
|
|
//`modifiers/trail/trail > world` types
|
|
|
|
class ModifierWorld {
|
|
|
|
construct new() {
|
|
} //new
|
|
|
|
} //ModifierWorld
|
|
|
|
//`modifiers/trail/trail > world` compilers
|
|
|
|
class ModifierWorldCompiler {
|
|
|
|
construct new() {
|
|
}
|
|
|
|
bytes_count(instance) {
|
|
|
|
var size = 4 //version
|
|
|
|
size = size + 0
|
|
|
|
return size
|
|
|
|
} //bytes_count
|
|
|
|
validate(from_source_id, elements) {
|
|
|
|
var fields = {
|
|
"type": false, //:luxe:internal
|
|
"uuid": false, //:luxe:internal
|
|
"luxe.self.modifier": false, //:luxe:internal
|
|
}
|
|
for(element in elements) {
|
|
var instance = element.value
|
|
for(field in instance) {
|
|
if(fields[field.key] == null) {
|
|
Fiber.abort("node `%(element.key)` in `%(from_source_id)` has extra field `%(field.key)`")
|
|
} //if not found
|
|
} //each field
|
|
for(field in fields) {
|
|
var required = field.value
|
|
if(required && instance[field.key] == null) {
|
|
Fiber.abort("node `%(element.key)` in `%(from_source_id)` is missing a required field `%(field.key)` (and the field has no default value)")
|
|
}
|
|
} //each field
|
|
} //each element
|
|
|
|
} //validate
|
|
|
|
write(compiler, instance, out) {
|
|
|
|
//version
|
|
out.write_int32(0)
|
|
|
|
return out
|
|
|
|
} //write
|
|
|
|
bytes_count_block() {
|
|
|
|
return 8
|
|
|
|
} //bytes_count_block
|
|
|
|
write_block(compiler, out) {
|
|
|
|
//source id
|
|
out.write_uint32(compiler.string.hash("modifiers/trail/trail > world"))
|
|
|
|
//fields count
|
|
out.write_int32(0)
|
|
|
|
} //write_block
|
|
|
|
write(instance) {
|
|
|
|
var size = bytes_count(instance)
|
|
var out = Byter.new(size+8)
|
|
|
|
out.write_string("LUXEMWLD")
|
|
|
|
write(instance, out)
|
|
|
|
return out
|
|
|
|
} //write
|
|
|
|
} //ModifierWorldCompiler
|
|
|
|
//`modifiers/trail/trail > world` block types
|
|
|
|
class BlockModifierWorld {
|
|
|
|
field { "trail" }
|
|
source { "modifiers/trail/trail > world" }
|
|
|
|
construct new(block) {
|
|
_block = block
|
|
_inst_type = instance_type
|
|
_inst = _inst_type.new(_block, 0)
|
|
}
|
|
|
|
construct new() {
|
|
_block = Block.create()
|
|
_inst_type = instance_type
|
|
_inst = _inst_type.new(_block, 0)
|
|
Block.set_type(_block, "modifiers/trail/trail > world")
|
|
} //new
|
|
|
|
instance_type {
|
|
|
|
class BlockInstModifierWorld {
|
|
slot { _slot }
|
|
entity { Block.get_handle(_block, _slot) }
|
|
block_set_slot(value) {
|
|
_slot=value
|
|
return this
|
|
}
|
|
construct new(block, slot) {
|
|
_block = block
|
|
_slot = slot
|
|
} //new
|
|
block { _block }
|
|
} //BlockInstModifierWorld
|
|
|
|
return BlockInstModifierWorld
|
|
|
|
} //instance_type
|
|
|
|
block { _block }
|
|
count { Block.get_count(_block) }
|
|
add() { Block.add(_block) }
|
|
append(other_block) { Block.append(_block, other_block) }
|
|
each(c, fn) {
|
|
for(i in 0 ... c) {
|
|
fn.call(0, _inst.block_set_slot(i))
|
|
}
|
|
} //each
|
|
|
|
[slot, inst] { _inst.block_set_slot(slot) }
|
|
|
|
[slot] { _inst_type.new(_block, slot) }
|
|
} //BlockModifierWorld
|
|
|