configurable unswappable nodes, ice mobs cause nonwalkable/buildable nodes to drop
This commit is contained in:
parent
4a3c5ea42f
commit
7becaaf4db
@ -5,13 +5,8 @@ local c_obsidian = minetest.get_content_id("default:obsidian")
|
|||||||
local c_brick = minetest.get_content_id("default:obsidianbrick")
|
local c_brick = minetest.get_content_id("default:obsidianbrick")
|
||||||
local c_chest = minetest.get_content_id("default:chest_locked")
|
local c_chest = minetest.get_content_id("default:chest_locked")
|
||||||
|
|
||||||
local no_swap_nodes = {
|
nssm.unswappable_nodes[#nssm.unswappable_nodes+1] = "bones:bones"
|
||||||
"bones:bones",
|
nssm.unswappable_nodes[#nssm.unswappable_nodes+1] = "default:chest_locked"
|
||||||
"ignore",
|
|
||||||
"default:chest_locked",
|
|
||||||
"nssm:mob_inhibitor",
|
|
||||||
"nssm_server:mob_inhibitor",
|
|
||||||
}
|
|
||||||
|
|
||||||
nssm.unswappable_node = function (pos, node_list)
|
nssm.unswappable_node = function (pos, node_list)
|
||||||
-- Return true if the original_node should not be swapped
|
-- Return true if the original_node should not be swapped
|
||||||
@ -33,7 +28,7 @@ nssm.unswappable_node = function (pos, node_list)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for _,node in pairs(no_swap_nodes) do
|
for _,node in pairs(nssm.unswappable_nodes) do
|
||||||
if node == original_node then return true end
|
if node == original_node then return true end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -173,9 +168,26 @@ function digging_attack(
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function safely_put_block(self, pos_under_mob, original_node, putting_block)
|
local function safely_put_block(self, pos_under_mob, original_node, putting_block)
|
||||||
--minetest.debug("Set node "..putting_block.." under "..minetest.pos_to_string(pos_under_mob))
|
|
||||||
if not nssm.unswappable_node(pos_under_mob, {putting_block, "air"}) then
|
if not nssm.unswappable_node(pos_under_mob, {putting_block, "air"}) then
|
||||||
|
|
||||||
|
-- walkable, non-buildable, or liquid
|
||||||
|
if minetest.registered_nodes[original_node]
|
||||||
|
and (
|
||||||
|
minetest.registered_nodes[original_node].walkable
|
||||||
|
and not minetest.registered_nodes[original_node].buildable_to
|
||||||
|
)
|
||||||
|
or (
|
||||||
|
minetest.registered_nodes[original_node].drawtype == "liquid"
|
||||||
|
or minetest.registered_nodes[original_node].drawtype == "flowingliquid"
|
||||||
|
) then
|
||||||
minetest.env:set_node(pos_under_mob, {name = putting_block})
|
minetest.env:set_node(pos_under_mob, {name = putting_block})
|
||||||
|
|
||||||
|
-- buildable to (snow, torch)
|
||||||
|
elseif minetest.registered_nodes[original_node].buildable_to then
|
||||||
|
minetest.env:set_node(pos_under_mob, {name = "air"})
|
||||||
|
minetest.add_item(pos_under_mob, {name = original_node})
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -528,7 +540,7 @@ local function add_drop(drops, item)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function destroy(drops, npos, cid, c_air, c_fire, on_blast_queue, ignore_protection, ignore_on_blast)
|
local function destroy(drops, npos, cid, c_air, c_fire, on_blast_queue, ignore_protection, ignore_on_blast)
|
||||||
if not ignore_protection and minetest.is_protected(npos, "") then
|
if minetest.is_protected(npos, "") then
|
||||||
return cid
|
return cid
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -8,3 +8,8 @@ nssm.inhibition_radius = tonumber(minetest.settings:get('nssm.inhibition_radius'
|
|||||||
nssm.energy_boosts = minetest.settings:get_bool('nssm.energy_boosts')
|
nssm.energy_boosts = minetest.settings:get_bool('nssm.energy_boosts')
|
||||||
|
|
||||||
nssm.energy_lights = minetest.settings:get_bool('nssm.energy_lights')
|
nssm.energy_lights = minetest.settings:get_bool('nssm.energy_lights')
|
||||||
|
|
||||||
|
nssm.unswappable_nodes = minetest.settings:get('nssm.unswappable_nodes') or ""
|
||||||
|
nssm.unswappable_nodes = nssm.unswappable_nodes:split(",")
|
||||||
|
|
||||||
|
minetest.debug( "------------> "..dump(nssm.unswappable_nodes) )
|
||||||
|
4
init.lua
4
init.lua
@ -7,8 +7,10 @@ function nssm:load(filepath)
|
|||||||
dofile(nssm.path.."/"..filepath)
|
dofile(nssm.path.."/"..filepath)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- General API
|
-- Load before all others
|
||||||
nssm:load("api/settings.lua")
|
nssm:load("api/settings.lua")
|
||||||
|
|
||||||
|
-- General API
|
||||||
nssm:load("api/main_api.lua")
|
nssm:load("api/main_api.lua")
|
||||||
nssm:load("api/darts.lua")
|
nssm:load("api/darts.lua")
|
||||||
nssm:load("api/abms.lua")
|
nssm:load("api/abms.lua")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user