514 lines
12 KiB
Text
514 lines
12 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/slot/slot > runtime` types
|
|
|
|
class ModifierRuntime {
|
|
|
|
construct new() {
|
|
} //new
|
|
|
|
} //ModifierRuntime
|
|
|
|
//`modifiers/slot/slot > 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/slot/slot > 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/slot/slot > runtime` block types
|
|
|
|
class BlockModifierRuntime {
|
|
|
|
field { "slot" }
|
|
source { "modifiers/slot/slot > 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/slot/slot > 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/slot/slot > data` types
|
|
|
|
class ModifierData {
|
|
|
|
construct new() {
|
|
_coord = [0, 0, 0]
|
|
_auto_naming = false
|
|
_field = ""
|
|
} //new
|
|
|
|
coord { _coord }
|
|
coord=(vvv) { _coord = vvv }
|
|
|
|
auto_naming { _auto_naming }
|
|
auto_naming=(vvv) { _auto_naming = vvv }
|
|
|
|
field { _field }
|
|
field=(vvv) { _field = vvv }
|
|
|
|
} //ModifierData
|
|
|
|
//`modifiers/slot/slot > data` compilers
|
|
|
|
class ModifierDataCompiler {
|
|
|
|
construct new() {
|
|
}
|
|
|
|
bytes_count(instance) {
|
|
|
|
var size = 4 //version
|
|
|
|
size = size + 12 // coord
|
|
|
|
size = size + 4 // auto_naming
|
|
|
|
size = size + 4 // field
|
|
|
|
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
|
|
"coord": false,
|
|
"auto_naming": false,
|
|
"field": 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 coord = instance["coord"]
|
|
if(coord == null) coord = [0, 0, 0]
|
|
out.write_float32(coord[0])
|
|
out.write_float32(coord[1])
|
|
out.write_float32(coord[2])
|
|
|
|
|
|
var auto_naming = instance["auto_naming"]
|
|
if(auto_naming == null) auto_naming = false
|
|
out.write_int32(auto_naming ? 1 : 0)
|
|
|
|
|
|
var field = instance["field"]
|
|
if(field == null) field = ""
|
|
out.write_uint32((field && field != "") ? compiler.string.hash(field) : 0)
|
|
|
|
|
|
return out
|
|
|
|
} //write
|
|
|
|
bytes_count_block() {
|
|
|
|
return 52
|
|
|
|
} //bytes_count_block
|
|
|
|
write_block(compiler, out) {
|
|
|
|
//source id
|
|
out.write_uint32(compiler.string.hash("modifiers/slot/slot > data"))
|
|
|
|
//fields count
|
|
out.write_int32(3)
|
|
|
|
// coord
|
|
out.write_uint32(compiler.string.hash("coord"))
|
|
out.write_uint32(1025475970) //type float3
|
|
var coord_default = [0, 0, 0]
|
|
out.write_float32(coord_default[0])
|
|
out.write_float32(coord_default[1])
|
|
out.write_float32(coord_default[2])
|
|
|
|
|
|
// auto_naming
|
|
out.write_uint32(compiler.string.hash("auto_naming"))
|
|
out.write_uint32(1710517951) //type boolean
|
|
var auto_naming_default = false
|
|
out.write_int32(auto_naming_default ? 1 : 0)
|
|
|
|
|
|
// field
|
|
out.write_uint32(compiler.string.hash("field"))
|
|
out.write_uint32(2729592961) //type id32
|
|
var field_default = ""
|
|
out.write_uint32((field_default && field_default != "") ? compiler.string.hash(field_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/slot/slot > data` block types
|
|
|
|
class BlockModifierData {
|
|
|
|
field { "slot" }
|
|
source { "modifiers/slot/slot > 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, "coord", "float3", [0, 0, 0])
|
|
Block.add(_block, "auto_naming", "boolean", false)
|
|
Block.add(_block, "field", "id32", "")
|
|
Block.set_type(_block, "modifiers/slot/slot > data")
|
|
} //new
|
|
|
|
instance_type {
|
|
|
|
class BlockInstModifierData {
|
|
coord { Block.get(_block, "coord", _slot) }
|
|
coord=(v) { Block.set(_block, "coord", _slot, v) }
|
|
auto_naming { Block.get(_block, "auto_naming", _slot) }
|
|
auto_naming=(v) { Block.set(_block, "auto_naming", _slot, v) }
|
|
field { Block.get(_block, "field", _slot) }
|
|
field=(v) { Block.set(_block, "field", _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/slot/slot > world` types
|
|
|
|
class ModifierWorld {
|
|
|
|
construct new() {
|
|
} //new
|
|
|
|
} //ModifierWorld
|
|
|
|
//`modifiers/slot/slot > 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/slot/slot > 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/slot/slot > world` block types
|
|
|
|
class BlockModifierWorld {
|
|
|
|
field { "slot" }
|
|
source { "modifiers/slot/slot > 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/slot/slot > 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
|
|
|