LUA Unexpected Character Error
Hi, I'm new to these forums, but not to modding mt or to lua.
I'm currently hunting for an "unexpected character" near the comma on the last line.
Relevant code:
Thanks,
Defenestrator
I'm currently hunting for an "unexpected character" near the comma on the last line.
Relevant code:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.register_node("cannon:cannon", {
tiles={"cannon_cannon.png","cannon_cannon.png","cannon_cannon.png","cannon_cannon.png","cannon_cannon.png","cannon_cannon.png","cannon_front.png",},
groups={cracky=1,level=3},
paramtype2="facedir",
on_rightclick=function(pos, node, clicker, itemstack)
if (itemstack:get_name() == "cannon:ball_item") then
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
local dir = node["param2"] / 4
local obj = minetest.env:add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, "cannon:ball")
local shootdir = {x=0,y=0,z=0}
local rotation = math.pi * (90 * dir) / 180
if (dir == 0) then
shootdir.y = 1
else if (dir == 1) then
shootdir.z = 1
else if (dir == 2) then
shootdir.z = -1
else if (dir == 3) then
shootdir.x = 1
else if (dir == 4) then
shootdir.x = -1
else
shootdir.y = 1
end
obj:setvelocity({x=shootdir.x*19, y=shootdir.y*19, z=shootdir.z*19})
obj:setacceleration({x=shootdir.x*-3, y=-10, z=shootdir.z*-3})
obj:setyaw(rotation + math.pi)
minetest.sound_play("cannon_fire", {pos=pos})
return itemstack
end
end,
})
Thanks,
Defenestrator