mirror of
https://github.com/pandorabox-io/spacecannon.git
synced 2024-12-21 05:15:47 +01:00
node resilience wip
This commit is contained in:
parent
dc598bb21c
commit
373d1b2033
5
init.lua
5
init.lua
@ -6,13 +6,14 @@ spacecannon = {
|
||||
|
||||
-- charge value in EU
|
||||
powerrequirement = 2500
|
||||
|
||||
}
|
||||
},
|
||||
node_resilience = {}
|
||||
}
|
||||
|
||||
local MP = minetest.get_modpath("spacecannon")
|
||||
|
||||
dofile(MP.."/util.lua")
|
||||
dofile(MP.."/cannon.lua")
|
||||
dofile(MP.."/node_resilience.lua")
|
||||
|
||||
print("[OK] Spacecannon")
|
8
node_resilience.lua
Normal file
8
node_resilience.lua
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
-- default = 1
|
||||
-- >1 = stronger
|
||||
-- <1 = weaker
|
||||
|
||||
|
||||
spacecannon.node_resilience["default:obsidian"] = 3
|
||||
spacecannon.node_resilience["default:obsidian_glass"] = 3
|
3
util.lua
3
util.lua
@ -77,6 +77,8 @@ spacecannon.destroy = function(pos, range, intensity)
|
||||
|
||||
else
|
||||
-- default behavior
|
||||
local resilience = spacecannon.node_resilience[n.name] or 1
|
||||
if resilience <= 1 or math.random(resilience) == resilience then
|
||||
minetest.set_node(np, {name="air"})
|
||||
local itemstacks = minetest.get_node_drops(n.name)
|
||||
for _, itemname in ipairs(itemstacks) do
|
||||
@ -86,6 +88,7 @@ spacecannon.destroy = function(pos, range, intensity)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user