ahhhhh.
maybe i should be thinking in terms of how to hand an instanced guy hanging by
his arm from a world rope with an analog stick to control his hand motor. the
hand motor should have an override
what exactly do you want available on the lua side? how do you force the lua
code to save its state?
boxing the object pointer is the most flexible way of wrapping. that way you can
wrap after an object is created which is probably the best way.
the gbASE format is fine. you can have a lua based format later, but you have to
keep in mind that it should be used exactly like gbASE is. that is to provide a
real separation between and instance and what the instance came from.
guy_00=new.gbASE
{
ase="jziotd_data/guy.ase",
tweaks={"jziotd_data/guy.tweaks","guy"},
geoms=
{
leftHand=
{
position={0,0,0},
},
leftHandMotor=
{
overrides={"jziotd_data/guy.pop","guy_overrides.geoms.leftHandMotor"},
targetSpeed=4,
},
},
}
after this is created it will wrap all of the real geoms and replace the entry
in geoms with the wrapped geom. so guy_00.geoms.leftHand is a real geom
when it is saved out it just writes out the state. remember saving is not using
lua, it is generating lua.
pins are tricky because they force interaction between stuff. there are only two
types of stuff. geoms and pins. because all guis are named it should be easy to
bind them, but you have to do it after the file is loaded.
pin_00=new.gbPin
{
geomA="guy_00.geoms.leftHand",
geomB="rope",
}
after everything is loaded, all of the pins are visited and link is called. this
changes to name to a real pointer to a geom. it also swaps out the lua code to
point to the real geom
population is another thing [jziotd/guy.pop]
guy=new.gbASE
{
ase="jziotd_data/guy.ase",
overrides="jziot_data/guy.overrides",
}
spinStick=new.uvtAnalogStick
{
centerRate=0.1,
description="Spin Stick",
}
the population gets its own environment so you can grab them from globals. during
the initial positioning it keeps a list of all the geoms and ogpositions and
repositions them directly.
for overrides [jziotd_data/guy.tweaks]
guy=
{
geoms=
{
leftHandMotor=
{
targetSpeed=9,
},
},
}
these could be placed in a single file called .tweaks or something too.
the reason to wrap everything with lua is because that is how everything communicates with each other. this is with wires. wires are a first class citizen just like geoms and pins.
wire_00=new.gbWire
{
diode=true,
solderSpotA="spinStick_00.value",
solderSpotB="guy_00.geoms.leftHandMotor.targetSpeed",
}
geoms and pins can have a list of solderSpots. when a wire is created it will
create one and bind it to the property.
entities go away and everything lives in the universe