mirror of
https://github.com/minetest-mods/digtron.git
synced 2025-01-03 09:37:27 +01:00
account for extrusion in power consumption, add on_place blacklist
This commit is contained in:
parent
c801e59942
commit
0430d423f7
@ -70,7 +70,7 @@ minetest.register_node("digtron:power_connector", {
|
||||
local layout = DigtronLayout.create(pos, sender)
|
||||
local max_cost = 0
|
||||
for _, node_image in pairs(layout.builders) do
|
||||
max_cost = max_cost + digtron.config.build_cost
|
||||
max_cost = max_cost + (digtron.config.build_cost * (node_image.meta.fields.extrusion or 1))
|
||||
end
|
||||
for _, node_image in pairs(layout.diggers) do
|
||||
max_cost = max_cost + max_dig_cost
|
||||
|
@ -28,6 +28,14 @@ digtron.facedir_to_dir_map = {
|
||||
1, 4, 3, 2,
|
||||
}
|
||||
|
||||
local function has_prefix(str, prefix)
|
||||
return str:sub(1, string.len(prefix)) == prefix
|
||||
end
|
||||
|
||||
local function blacklisted_on_place(item_name)
|
||||
if has_prefix(item_name, "stairs:slab_") then return true end
|
||||
end
|
||||
|
||||
local function copy_pointed_thing(pointed_thing)
|
||||
return {
|
||||
type = pointed_thing.type,
|
||||
@ -69,7 +77,7 @@ digtron.item_place_node = function(itemstack, placer, place_to, param2)
|
||||
pointed_thing.under = {x=place_to.x, y=place_to.y - 1, z=place_to.z}
|
||||
|
||||
-- Handle node-specific on_place calls as best we can.
|
||||
if def.on_place and def.on_place ~= minetest.nodedef_default.on_place then
|
||||
if def.on_place and def.on_place ~= minetest.nodedef_default.on_place and not blacklisted_on_place(itemstack:get_name()) then
|
||||
if def.paramtype2 == "facedir" then
|
||||
pointed_thing.under = vector.add(place_to, minetest.facedir_to_dir(param2))
|
||||
elseif def.paramtype2 == "wallmounted" then
|
||||
|
Loading…
Reference in New Issue
Block a user