Improve codestyle
parent
b6ea056ba6
commit
63589ef10d
24
init.lua
24
init.lua
|
@ -3,13 +3,15 @@ local SERVER = minetest.is_singleplayer() or false
|
|||
SERVER = not SERVER
|
||||
local dur = 0
|
||||
if SERVER then
|
||||
dur = 8 --too high??
|
||||
dur = 8 -- lowering sends more pakets to clients and let flames faster disappear (not recommended)
|
||||
end
|
||||
|
||||
local VIEW_DISTANCE = 13 -- if player is near that distance flames are shown
|
||||
local VIEW_DISTANCE = 13 -- only if player is near that distance flames are shown
|
||||
|
||||
local dirs = {{-1,0,-1},{-1,0,0},{0,0,-1},
|
||||
{1,0,1},{1,0,0},{0,0,1},{0,1,0}}
|
||||
local dirs = {
|
||||
{-1,0,-1}, {-1,0,0}, {0,0,-1},
|
||||
{1,0,1}, {1,0,0}, {0,0,1}, {0,1,0}
|
||||
}
|
||||
|
||||
local particle_def = {
|
||||
pos = {x = 0, y = 0, z = 0},
|
||||
|
@ -45,9 +47,9 @@ end
|
|||
|
||||
--help functions
|
||||
function check_attached_node_fdir(p, n)
|
||||
local def = minetest.registered_nodes[n.name]
|
||||
local def = minetest.registered_nodes[n.name] or nil
|
||||
local d = {x = 0, y = 0, z = 0}
|
||||
if def.paramtype2 == "facedir" then
|
||||
if def and def.paramtype2 == "facedir" then
|
||||
if n.param2 == 0 then
|
||||
d.z = 1
|
||||
elseif n.param2 == 1 then
|
||||
|
@ -59,7 +61,7 @@ function check_attached_node_fdir(p, n)
|
|||
end
|
||||
end
|
||||
local p2 = {x = p.x + d.x, y = p.y + d.y, z = p.z + d.z}
|
||||
local nn = minetest.env:get_node(p2).name
|
||||
local nn = minetest.get_node(p2).name
|
||||
local def2 = minetest.registered_nodes[nn]
|
||||
if def2 and not def2.walkable then
|
||||
return false
|
||||
|
@ -83,7 +85,7 @@ local function is_wall(wallparam)
|
|||
end
|
||||
|
||||
local function player_near(pos)
|
||||
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, VIEW_DISTANCE)) do
|
||||
for _,object in ipairs(minetest.get_objects_inside_radius(pos, VIEW_DISTANCE)) do
|
||||
if object:is_player() then
|
||||
return true
|
||||
end
|
||||
|
@ -116,7 +118,7 @@ minetest.register_abm({
|
|||
action = function(pos)
|
||||
if player_near(pos) then
|
||||
local n = minetest.get_node_or_nil(pos)
|
||||
dir = {x=0,y=0,z=0}
|
||||
local dir = {x = 0, y = 0, z = 0}
|
||||
if n and n.param2 then
|
||||
dir = get_offset(n.param2)
|
||||
end
|
||||
|
@ -165,7 +167,7 @@ minetest.register_craftitem(":default:torch", {
|
|||
wield_scale = {x = 1, y = 1, z = 1 + 1/16},
|
||||
liquids_pointable = false,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= "node" or string.find(minetest.env:get_node(pointed_thing.above).name, "torch") then
|
||||
if pointed_thing.type ~= "node" or string.find(minetest.get_node(pointed_thing.above).name, "torch") then
|
||||
return itemstack
|
||||
end
|
||||
local above = pointed_thing.above
|
||||
|
@ -198,7 +200,6 @@ minetest.register_craftitem(":default:torch", {
|
|||
})
|
||||
|
||||
minetest.register_node("torches:floor", {
|
||||
--description = "Fakel",
|
||||
inventory_image = "default_torch.png",
|
||||
wield_image = "torches_torch.png",
|
||||
wield_scale = {x = 1, y = 1, z = 1 + 2/16},
|
||||
|
@ -228,7 +229,6 @@ minetest.register_node("torches:floor", {
|
|||
})
|
||||
|
||||
minetest.register_node("torches:wand", {
|
||||
--description = "Fakel",
|
||||
inventory_image = "default_torch.png",
|
||||
wield_image = "torches_torch.png",
|
||||
wield_scale = {x = 1, y = 1, z = 1 + 1/16},
|
||||
|
|
Loading…
Reference in New Issue