forked from Mirrorlandia_minetest/tnt
Remove unused and clean up missused variable-value assignments.
* Unused variables * Unused values (assigned to variables, but overwritten before use) * Defining already defined variables instead of reassigning to them.
This commit is contained in:
parent
12fae236e3
commit
85f2dae56f
16
init.lua
16
init.lua
@ -153,7 +153,7 @@ local function entity_physics(pos, radius, drops)
|
|||||||
local dir = vector.normalize(vector.subtract(obj_pos, pos))
|
local dir = vector.normalize(vector.subtract(obj_pos, pos))
|
||||||
local moveoff = vector.multiply(dir, dist + 1.0)
|
local moveoff = vector.multiply(dir, dist + 1.0)
|
||||||
local newpos = vector.add(pos, moveoff)
|
local newpos = vector.add(pos, moveoff)
|
||||||
local newpos = vector.add(newpos, {x = 0, y = 0.2, z = 0})
|
newpos = vector.add(newpos, {x = 0, y = 0.2, z = 0})
|
||||||
obj:setpos(newpos)
|
obj:setpos(newpos)
|
||||||
|
|
||||||
obj:set_hp(obj:get_hp() - damage)
|
obj:set_hp(obj:get_hp() - damage)
|
||||||
@ -261,7 +261,7 @@ function tnt.burn(pos)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast)
|
local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast)
|
||||||
local pos = vector.round(pos)
|
pos = vector.round(pos)
|
||||||
-- scan for adjacent TNT nodes first, and enlarge the explosion
|
-- scan for adjacent TNT nodes first, and enlarge the explosion
|
||||||
local vm1 = VoxelManip()
|
local vm1 = VoxelManip()
|
||||||
local p1 = vector.subtract(pos, 2)
|
local p1 = vector.subtract(pos, 2)
|
||||||
@ -298,11 +298,11 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast)
|
|||||||
-- perform the explosion
|
-- perform the explosion
|
||||||
local vm = VoxelManip()
|
local vm = VoxelManip()
|
||||||
local pr = PseudoRandom(os.time())
|
local pr = PseudoRandom(os.time())
|
||||||
local p1 = vector.subtract(pos, radius)
|
p1 = vector.subtract(pos, radius)
|
||||||
local p2 = vector.add(pos, radius)
|
p2 = vector.add(pos, radius)
|
||||||
local minp, maxp = vm:read_from_map(p1, p2)
|
minp, maxp = vm:read_from_map(p1, p2)
|
||||||
local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
|
a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
|
||||||
local data = vm:get_data()
|
data = vm:get_data()
|
||||||
|
|
||||||
local drops = {}
|
local drops = {}
|
||||||
local on_blast_queue = {}
|
local on_blast_queue = {}
|
||||||
@ -515,7 +515,7 @@ if enable_tnt then
|
|||||||
end
|
end
|
||||||
|
|
||||||
function tnt.register_tnt(def)
|
function tnt.register_tnt(def)
|
||||||
local name = ""
|
local name
|
||||||
if not def.name:find(':') then
|
if not def.name:find(':') then
|
||||||
name = "tnt:" .. def.name
|
name = "tnt:" .. def.name
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user