I already looked through the website and i could not find a "template" for new elements, does anybody know where i can find one?
Specifically, I am looking for a template that includes most if not all of the properties.
Any feedback would help. :)
S117:
I already looked through the website and i could not find a "template" for new elements, does anybody know where i can find one?
Specifically, I am looking for a template that includes most if not all of the properties.
Any feedback would help. :)
Did you look at the wiki? Specifically, https://powdertoy.co.uk/Wiki/W/Lua_API:Elements.html
Ok, not trying to sound like a newb but this is the element that i am trying to implement it into. (and im sorry if posting the source code like this breaks any rules) but I am still confused on where and how the PMODE_LFLARE 0x00000000 is supposed to be added. I dont really know javascript or c++.
EDIT: The math and stuff isnt mine, i borrowed it from another custom energy element.
local test1 = elem.allocate("S117", "TEST")
elem.element(test1, elem.element(elem.DEFAULT_PT_ELEC))
elem.property(test1, "Name", "TEST")
elem.property(test1, "Description", "TEST ENERGY")
elem.property(test1, "Colour", 0xff274)
elem.property(test1, "MenuSection", elem.SC_RADIOACTIVE)
elem.property(test1, "Properties", elem.TYPE_ENERGY)
elem.property(test1, "State", elem.ST_NONE)
elem.property(test1, "Temperature", 273.15)
elem.property(test1, "HeatConduct", 0)
elem.property(test1, "Weight", -1)
elem.property(test1, "Collision", -0.99)
local function energy(i, x, y, s, nt)
local tmp2 = sim.partProperty(i, sim.FIELD_TMP2)
if tmp2 == 0 then
local angle = math.random() * math.pi*2
sim.partProperty(i, sim.FIELD_TMP2, 1)
sim.partProperty(i, sim.FIELD_VX, math.sin(angle)*5)
sim.partProperty(i, sim.FIELD_VY, math.cos(angle)*5)
end
--for dx = -1, 1, 1 do
--for dy = -1, 1, 1 do
--end
--end
end
elements.property(test1, "Update", energy)
This is !o0o!lua!o0o!
You only need to post a source if it's C++ in which you make your own '.exe'
lua is a scipting language. you write a script, then powder toy runs it. There is no making of an '.exe'
lua is better than C++ to work with for people new to coding as it doesn't require as much programs and resources to use.
PMODE_LFLARE makes it have a flare like bomb elements, do you really want it?