Intersecting_Circles/intersecting-circles-modifiers/modifiers/move/move.modifier.wren
2021-12-14 12:52:41 +01:00

468 lines
10 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/move/move > runtime` types
class ModifierRuntime {
construct new() {
} //new
} //ModifierRuntime
//`modifiers/move/move > 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/move/move > 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/move/move > runtime` block types
class BlockModifierRuntime {
field { "move" }
source { "modifiers/move/move > 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/move/move > 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/move/move > data` types
class ModifierData {
construct new() {
_velocity = [0, 0]
} //new
velocity { _velocity }
velocity=(vvv) { _velocity = vvv }
} //ModifierData
//`modifiers/move/move > data` compilers
class ModifierDataCompiler {
construct new() {
}
bytes_count(instance) {
var size = 4 //version
size = size + 8 // velocity
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
"velocity": 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 velocity = instance["velocity"]
if(velocity == null) velocity = [0, 0]
out.write_float32(velocity[0])
out.write_float32(velocity[1])
return out
} //write
bytes_count_block() {
return 24
} //bytes_count_block
write_block(compiler, out) {
//source id
out.write_uint32(compiler.string.hash("modifiers/move/move > data"))
//fields count
out.write_int32(1)
// velocity
out.write_uint32(compiler.string.hash("velocity"))
out.write_uint32(1042253589) //type float2
var velocity_default = [0, 0]
out.write_float32(velocity_default[0])
out.write_float32(velocity_default[1])
} //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/move/move > data` block types
class BlockModifierData {
field { "move" }
source { "modifiers/move/move > 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, "velocity", "float2", [0, 0])
Block.set_type(_block, "modifiers/move/move > data")
} //new
instance_type {
class BlockInstModifierData {
velocity { Block.get(_block, "velocity", _slot) }
velocity=(v) { Block.set(_block, "velocity", _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/move/move > world` types
class ModifierWorld {
construct new() {
} //new
} //ModifierWorld
//`modifiers/move/move > 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/move/move > 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/move/move > world` block types
class BlockModifierWorld {
field { "move" }
source { "modifiers/move/move > 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/move/move > 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