Update several mods:

biome_lib, boost_cart, building_blocks, castle, homedecor, glooptest,
currency, roads, invsaw, maptools, mesecons, moreblocks, nixie_tubes,
pipeworks, signs_lib, technic, unified_inventory, unifiedbricks, worldedit,
xban2
master
Vanessa Ezekowitz 2016-12-01 04:22:40 -05:00
parent 67d414d2f9
commit 2922421f4a
108 changed files with 1410 additions and 1081 deletions

View File

@ -458,7 +458,7 @@ end)
minetest.register_on_shutdown(function() minetest.register_on_shutdown(function()
print("[biome_lib] Stand by, playing out the rest of the no-aircheck mapblock log") print("[biome_lib] Stand by, playing out the rest of the no-aircheck mapblock log")
print("(there are "..#biome_lib.blocklist_aircheck.." entries)...") print("(there are "..#biome_lib.blocklist_no_aircheck.." entries)...")
while true do while true do
biome_lib:generate_block_no_aircheck(0.1) biome_lib:generate_block_no_aircheck(0.1)
if #biome_lib.blocklist_no_aircheck == 0 then return end if #biome_lib.blocklist_no_aircheck == 0 then return end

View File

@ -1,6 +1,7 @@
Minetest mod: boost_cart Minetest mod: boost_cart
========================== ==========================
Based on (and fully compatible with) the mod "carts" by PilzAdam Based on (and fully compatible with) the mod "carts" by PilzAdam
Also compatible with the carts mod in the subgame "minetest_game".
Target: Run smoothly as possible even on laggy server Target: Run smoothly as possible even on laggy server
@ -16,31 +17,22 @@ Target: Run smoothly as possible even on laggy server
License for everything License for everything
------------------------ ------------------------
CC-0 CC-0, if not specified otherwise below
Authors Authors
--------- ---------
Hawk777 Various authors
carts_rail_ss.png carts_rail_*.png
carts_rail_*_ss.png
hexafraction
carts_rail_brk.png
carts_rail_*_brk.png
carts_rail_pwr.png
carts_rail_*_pwr.png
kddekadenz kddekadenz
cart_bottom.png cart_bottom.png
cart_side.png cart_side.png
cart_top.png cart_top.png
numberZero klankbeeld (CC-BY 3.0)
carts_rail_dtc.png http://freesound.org/people/klankbeeld/sounds/174042/
carts_rail_dtc_on.png cart_rail.*.ogg
carts_rail_*_dtc.png
carts_rail_*_dtc_on.png
Zeg9 Zeg9
cart.x cart.x

378
boost_cart/cart_entity.lua Normal file
View File

@ -0,0 +1,378 @@
local HAVE_MESECONS_ENABLED = minetest.global_exists("mesecon")
function boost_cart:on_rail_step(pos)
-- Play rail sound
if self.sound_counter <= 0 then
minetest.sound_play("cart_rail", {
pos = pos,
max_hear_distance = 40,
gain = 0.5
})
self.sound_counter = math.random(4, 15)
end
self.sound_counter = self.sound_counter - 1
if HAVE_MESECONS_ENABLED then
boost_cart:signal_detector_rail(pos)
end
end
local cart_entity = {
physical = false,
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
visual = "mesh",
mesh = "cart.x",
visual_size = {x=1, y=1},
textures = {"cart.png"},
driver = nil,
punched = false, -- used to re-send velocity and position
velocity = {x=0, y=0, z=0}, -- only used on punch
old_dir = {x=1, y=0, z=0}, -- random value to start the cart on punch
old_pos = nil,
old_switch = 0,
sound_counter = 0,
railtype = nil,
attached_items = {}
}
function cart_entity:on_rightclick(clicker)
if not clicker or not clicker:is_player() then
return
end
local player_name = clicker:get_player_name()
if self.driver and player_name == self.driver then
self.driver = nil
boost_cart:manage_attachment(clicker, nil)
elseif not self.driver then
self.driver = player_name
boost_cart:manage_attachment(clicker, self.object)
end
end
function cart_entity:on_activate(staticdata, dtime_s)
self.object:set_armor_groups({immortal=1})
self.sound_counter = math.random(4, 15)
if string.sub(staticdata, 1, string.len("return")) ~= "return" then
return
end
local data = minetest.deserialize(staticdata)
if not data or type(data) ~= "table" then
return
end
self.railtype = data.railtype
if data.old_dir then
self.old_dir = data.old_dir
end
end
function cart_entity:get_staticdata()
return minetest.serialize({
railtype = self.railtype,
old_dir = self.old_dir
})
end
function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
local pos = self.object:getpos()
if not self.railtype then
local node = minetest.get_node(pos).name
self.railtype = minetest.get_item_group(node, "connect_to_raillike")
end
if not puncher or not puncher:is_player() then
local cart_dir = boost_cart:get_rail_direction(pos, self.old_dir, nil, nil, self.railtype)
if vector.equals(cart_dir, {x=0, y=0, z=0}) then
return
end
self.velocity = vector.multiply(cart_dir, 3)
self.punched = true
return
end
if puncher:get_player_control().sneak then
-- Pick up cart: Drop all attachments
if self.driver then
if self.old_pos then
self.object:setpos(self.old_pos)
end
local player = minetest.get_player_by_name(self.driver)
boost_cart:manage_attachment(player, nil)
end
for _, obj_ in pairs(self.attached_items) do
if obj_ then
obj_:set_detach()
end
end
local leftover = puncher:get_inventory():add_item("main", "carts:cart")
if not leftover:is_empty() then
minetest.add_item(self.object:getpos(), leftover)
end
self.object:remove()
return
end
local vel = self.object:getvelocity()
if puncher:get_player_name() == self.driver then
if math.abs(vel.x + vel.z) > boost_cart.punch_speed_max then
return
end
end
local punch_dir = boost_cart:velocity_to_dir(puncher:get_look_dir())
punch_dir.y = 0
local cart_dir = boost_cart:get_rail_direction(pos, punch_dir, nil, nil, self.railtype)
if vector.equals(cart_dir, {x=0, y=0, z=0}) then
return
end
local punch_interval = 1
if tool_capabilities and tool_capabilities.full_punch_interval then
punch_interval = tool_capabilities.full_punch_interval
end
time_from_last_punch = math.min(time_from_last_punch or punch_interval, punch_interval)
local f = 3 * (time_from_last_punch / punch_interval)
self.velocity = vector.multiply(cart_dir, f)
self.old_dir = cart_dir
self.punched = true
end
function cart_entity:on_step(dtime)
local vel = self.object:getvelocity()
if self.punched then
vel = vector.add(vel, self.velocity)
self.object:setvelocity(vel)
self.old_dir.y = 0
elseif vector.equals(vel, {x=0, y=0, z=0}) then
return
end
local pos = self.object:getpos()
local update = {}
if self.old_pos and not self.punched then
local flo_pos = vector.round(pos)
local flo_old = vector.round(self.old_pos)
if vector.equals(flo_pos, flo_old) then
-- Do not check one node multiple times
return
end
end
local ctrl, player
-- Get player controls
if self.driver then
player = minetest.get_player_by_name(self.driver)
if player then
ctrl = player:get_player_control()
end
end
if self.old_pos then
-- Detection for "skipping" nodes
local found_path = boost_cart:pathfinder(
pos, self.old_pos, self.old_dir, ctrl, self.old_switch, self.railtype
)
if not found_path then
-- No rail found: reset back to the expected position
pos = vector.new(self.old_pos)
update.pos = true
end
end
local cart_dir = boost_cart:velocity_to_dir(vel)
-- dir: New moving direction of the cart
-- switch_keys: Currently pressed L/R key, used to ignore the key on the next rail node
local dir, switch_keys = boost_cart:get_rail_direction(
pos, cart_dir, ctrl, self.old_switch, self.railtype
)
local new_acc = {x=0, y=0, z=0}
if vector.equals(dir, {x=0, y=0, z=0}) then
vel = {x=0, y=0, z=0}
pos = vector.round(pos)
update.pos = true
update.vel = true
else
-- Direction change detected
if not vector.equals(dir, self.old_dir) then
vel = vector.multiply(dir, math.abs(vel.x + vel.z))
update.vel = true
if dir.y ~= self.old_dir.y then
pos = vector.round(pos)
update.pos = true
end
end
-- Center on the rail
if dir.z ~= 0 and math.floor(pos.x + 0.5) ~= pos.x then
pos.x = math.floor(pos.x + 0.5)
update.pos = true
end
if dir.x ~= 0 and math.floor(pos.z + 0.5) ~= pos.z then
pos.z = math.floor(pos.z + 0.5)
update.pos = true
end
-- Calculate current cart acceleration
local acc = nil
local acc_meta = minetest.get_meta(pos):get_string("cart_acceleration")
if acc_meta == "halt" then
-- Stop rail
vel = {x=0, y=0, z=0}
acc = false
pos = vector.round(pos)
update.pos = true
update.vel = true
mod_found = true
end
if acc == nil then
-- Meta speed modifier
local speed_mod = tonumber(acc_meta)
if speed_mod and speed_mod ~= 0 then
-- Try to make it similar to the original carts mod
acc = speed_mod * 10
end
end
if acc == nil and boost_cart.mtg_compat then
-- MTG Cart API adaption
local rail_node = minetest.get_node(vector.round(pos))
local railparam = carts.railparams[rail_node.name]
if railparam and railparam.acceleration then
acc = railparam.acceleration
end
end
if acc == nil then
-- Handbrake
if ctrl and ctrl.down then
acc = -2
else
acc = -0.4
end
end
-- Slow down or speed up, depending on Y direction
if acc then
acc = acc + dir.y * -2.5
else
acc = 0
end
if self.old_dir.y ~= 1 and not self.punched then
-- Stop the cart swing between two rail parts (handbrake)
if vector.equals(vector.multiply(self.old_dir, -1), dir) then
vel = {x=0, y=0, z=0}
acc = 0
if self.old_pos then
pos = vector.new(self.old_pos)
update.pos = true
end
dir = vector.new(self.old_dir)
update.vel = true
end
end
new_acc = vector.multiply(dir, acc)
end
boost_cart.on_rail_step(self, vector.round(pos))
-- Limits
local max_vel = boost_cart.speed_max
for _,v in pairs({"x","y","z"}) do
if math.abs(vel[v]) > max_vel then
vel[v] = boost_cart:get_sign(vel[v]) * max_vel
new_acc[v] = 0
update.vel = true
end
end
self.object:setacceleration(new_acc)
self.old_pos = pos
if not vector.equals(dir, {x=0, y=0, z=0}) then
self.old_dir = dir
end
self.old_switch = switch_keys
if self.punched then
-- Collect dropped items
for _, obj_ in pairs(minetest.get_objects_inside_radius(pos, 1)) do
if not obj_:is_player() and
obj_:get_luaentity() and
not obj_:get_luaentity().physical_state and
obj_:get_luaentity().name == "__builtin:item" then
obj_:set_attach(self.object, "", {x=0, y=0, z=0}, {x=0, y=0, z=0})
self.attached_items[#self.attached_items + 1] = obj_
end
end
self.punched = false
update.vel = true
end
if not (update.vel or update.pos) then
return
end
local yaw = 0
if self.old_dir.x < 0 then
yaw = 0.5
elseif self.old_dir.x > 0 then
yaw = 1.5
elseif self.old_dir.z < 0 then
yaw = 1
end
self.object:setyaw(yaw * math.pi)
local anim = {x=0, y=0}
if dir.y == -1 then
anim = {x=1, y=1}
elseif dir.y == 1 then
anim = {x=2, y=2}
end
self.object:set_animation(anim, 1, 0)
self.object:setvelocity(vel)
if update.pos then
self.object:setpos(pos)
end
end
minetest.register_entity(":carts:cart", cart_entity)
minetest.register_craftitem(":carts:cart", {
description = "Cart (Sneak+Click to pick up)",
inventory_image = minetest.inventorycube("cart_top.png", "cart_side.png", "cart_side.png"),
wield_image = "cart_side.png",
on_place = function(itemstack, placer, pointed_thing)
if not pointed_thing.type == "node" then
return
end
if boost_cart:is_rail(pointed_thing.under) then
minetest.add_entity(pointed_thing.under, "carts:cart")
elseif boost_cart:is_rail(pointed_thing.above) then
minetest.add_entity(pointed_thing.above, "carts:cart")
else
return
end
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end,
})
minetest.register_craft({
output = "carts:cart",
recipe = {
{"default:steel_ingot", "", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
},
})

View File

@ -1,3 +1,4 @@
default default
mesecons? mesecons?
moreores? moreores?
carts?

View File

@ -26,7 +26,7 @@ end
boost_cart:register_rail("boost_cart:detectorrail", { boost_cart:register_rail("boost_cart:detectorrail", {
description = "Detector rail", description = "Detector rail",
tiles = { tiles = {
"carts_rail_dtc.png", "carts_rail_curved_dtc.png", "carts_rail_straight_dtc.png", "carts_rail_curved_dtc.png",
"carts_rail_t_junction_dtc.png", "carts_rail_crossing_dtc.png" "carts_rail_t_junction_dtc.png", "carts_rail_crossing_dtc.png"
}, },
groups = boost_cart:get_rail_groups({detector_rail = 1}), groups = boost_cart:get_rail_groups({detector_rail = 1}),
@ -37,7 +37,7 @@ boost_cart:register_rail("boost_cart:detectorrail", {
boost_cart:register_rail("boost_cart:detectorrail_on", { boost_cart:register_rail("boost_cart:detectorrail_on", {
description = "Detector rail ON (you hacker you)", description = "Detector rail ON (you hacker you)",
tiles = { tiles = {
"carts_rail_dtc_on.png", "carts_rail_curved_dtc_on.png", "carts_rail_straight_dtc_on.png", "carts_rail_curved_dtc_on.png",
"carts_rail_t_junction_dtc_on.png", "carts_rail_crossing_dtc_on.png" "carts_rail_t_junction_dtc_on.png", "carts_rail_crossing_dtc_on.png"
}, },
groups = boost_cart:get_rail_groups({ groups = boost_cart:get_rail_groups({

View File

@ -6,10 +6,11 @@ function boost_cart:get_sign(z)
end end
end end
function boost_cart:manage_attachment(player, status, obj) function boost_cart:manage_attachment(player, obj)
if not player then if not player then
return return
end end
local status = obj ~= nil
local player_name = player:get_player_name() local player_name = player:get_player_name()
if default.player_attached[player_name] == status then if default.player_attached[player_name] == status then
return return
@ -157,9 +158,9 @@ function boost_cart:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
return {x=0, y=0, z=0} return {x=0, y=0, z=0}
end end
function boost_cart:pathfinder(pos_, expected_pos, old_dir, ctrl, pf_switch, railtype) function boost_cart:pathfinder(pos_, old_pos, old_dir, ctrl, pf_switch, railtype)
local pos = vector.round(pos_) local pos = vector.round(pos_)
local pf_pos = vector.round(expected_pos) local pf_pos = vector.round(old_pos)
local pf_dir = vector.new(old_dir) local pf_dir = vector.new(old_dir)
for i = 1, 3 do for i = 1, 3 do
@ -196,7 +197,7 @@ function boost_cart:register_rail(name, def)
drawtype = "raillike", drawtype = "raillike",
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
is_ground_content = true, is_ground_content = false,
walkable = false, walkable = false,
selection_box = { selection_box = {
type = "fixed", type = "fixed",

View File

@ -4,8 +4,8 @@ boost_cart.modpath = minetest.get_modpath("boost_cart")
-- Maximal speed of the cart in m/s -- Maximal speed of the cart in m/s
boost_cart.speed_max = 10 boost_cart.speed_max = 10
-- Set to nil to disable punching the cart from inside (min = -1) -- Set to -1 to disable punching the cart from inside
boost_cart.punch_speed_min = 7 boost_cart.punch_speed_max = 7
if not boost_cart.modpath then if not boost_cart.modpath then
@ -13,363 +13,23 @@ if not boost_cart.modpath then
"See also: http://dev.minetest.net/Installing_Mods") "See also: http://dev.minetest.net/Installing_Mods")
end end
function vector.floor(v)
return {
x = math.floor(v.x),
y = math.floor(v.y),
z = math.floor(v.z)
}
end
dofile(boost_cart.modpath.."/functions.lua")
dofile(boost_cart.modpath.."/rails.lua")
local HAVE_MESECONS_ENABLED = minetest.global_exists("mesecon")
if HAVE_MESECONS_ENABLED then
dofile(boost_cart.modpath.."/detector.lua")
end
-- Support for non-default games -- Support for non-default games
if not default.player_attached then if not default.player_attached then
default.player_attached = {} default.player_attached = {}
end end
boost_cart.cart = { dofile(boost_cart.modpath.."/functions.lua")
physical = false, dofile(boost_cart.modpath.."/rails.lua")
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
visual = "mesh",
mesh = "cart.x",
visual_size = {x=1, y=1},
textures = {"cart.png"},
driver = nil, if minetest.global_exists("mesecon") then
punched = false, -- used to re-send velocity and position dofile(boost_cart.modpath.."/detector.lua")
velocity = {x=0, y=0, z=0}, -- only used on punch --else
old_dir = {x=1, y=0, z=0}, -- random value to start the cart on punch -- minetest.register_alias("carts:powerrail", "boost_cart:detectorrail")
old_pos = nil, -- minetest.register_alias("carts:powerrail", "boost_cart:detectorrail_on")
old_switch = 0,
railtype = nil,
attached_items = {}
}
function boost_cart.cart:on_rightclick(clicker)
if not clicker or not clicker:is_player() then
return
end
local player_name = clicker:get_player_name()
if self.driver and player_name == self.driver then
self.driver = nil
boost_cart:manage_attachment(clicker, false)
elseif not self.driver then
self.driver = player_name
boost_cart:manage_attachment(clicker, true, self.object)
end
end end
function boost_cart.cart:on_activate(staticdata, dtime_s) boost_cart.mtg_compat = minetest.global_exists("carts") and carts.pathfinder
self.object:set_armor_groups({immortal=1}) if boost_cart.mtg_compat then
if string.sub(staticdata, 1, string.len("return")) ~= "return" then minetest.log("action", "[boost_cart] Overwriting definitions of similar carts mod")
return
end
local data = minetest.deserialize(staticdata)
if not data or type(data) ~= "table" then
return
end
self.railtype = data.railtype
if data.old_dir then
self.old_dir = data.old_dir
end
end end
dofile(boost_cart.modpath.."/cart_entity.lua")
function boost_cart.cart:get_staticdata()
return minetest.serialize({
railtype = self.railtype,
old_dir = self.old_dir
})
end
function boost_cart.cart:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
local pos = self.object:getpos()
if not self.railtype then
local bar = vector.floor(vector.add(pos, 0.1))
local node = minetest.get_node(bar).name
self.railtype = minetest.get_item_group(node, "connect_to_raillike")
end
if not puncher or not puncher:is_player() then
local cart_dir = boost_cart:get_rail_direction(pos, self.old_dir, nil, nil, self.railtype)
if vector.equals(cart_dir, {x=0, y=0, z=0}) then
return
end
self.velocity = vector.multiply(cart_dir, 3)
self.old_pos = nil
self.punched = true
return
end
if puncher:get_player_control().sneak then
-- Pick up cart: Drop all attachments
if self.driver then
if self.old_pos then
self.object:setpos(self.old_pos)
end
local player = minetest.get_player_by_name(self.driver)
boost_cart:manage_attachment(player, false)
end
for _,obj_ in ipairs(self.attached_items) do
if obj_ then
obj_:set_detach()
end
end
local leftover = puncher:get_inventory():add_item("main", "carts:cart")
if not leftover:is_empty() then
minetest.add_item(self.object:getpos(), leftover)
end
self.object:remove()
return
end
local vel = self.object:getvelocity()
if puncher:get_player_name() == self.driver then
if math.abs(vel.x + vel.z) > boost_cart.punch_speed_min then
return
end
end
local punch_dir = boost_cart:velocity_to_dir(puncher:get_look_dir())
punch_dir.y = 0
local cart_dir = boost_cart:get_rail_direction(pos, punch_dir, nil, nil, self.railtype)
if vector.equals(cart_dir, {x=0, y=0, z=0}) then
return
end
local punch_interval = 1
if tool_capabilities and tool_capabilities.full_punch_interval then
punch_interval = tool_capabilities.full_punch_interval
end
time_from_last_punch = math.min(time_from_last_punch or punch_interval, punch_interval)
local f = 3 * (time_from_last_punch / punch_interval)
self.velocity = vector.multiply(cart_dir, f)
self.old_dir = cart_dir
self.old_pos = nil
self.punched = true
end
function boost_cart.cart:on_step(dtime)
local vel = self.object:getvelocity()
local update = {}
if self.punched then
vel = vector.add(vel, self.velocity)
self.object:setvelocity(vel)
self.old_dir.y = 0
elseif vector.equals(vel, {x=0, y=0, z=0}) then
return
end
-- dir: New moving direction of the cart
-- last_switch: Currently pressed L/R key, used to ignore the key on the next rail node
local dir, last_switch
local pos = self.object:getpos()
if self.old_pos and not self.punched then
local flo_pos = vector.round(pos)
local flo_old = vector.round(self.old_pos)
if vector.equals(flo_pos, flo_old) then
-- Do not check one node multiple times
return
end
end
local ctrl, player
-- Get player controls
if self.driver then
player = minetest.get_player_by_name(self.driver)
if player then
ctrl = player:get_player_control()
end
end
if self.old_pos then
-- Detection for "skipping" nodes
local expected_pos = vector.add(self.old_pos, self.old_dir)
local found_path = boost_cart:pathfinder(
pos, expected_pos, self.old_dir, ctrl, self.old_switch, self.railtype
)
if not found_path then
-- No rail found: reset back to the expected position
pos = expected_pos
update.pos = true
end
end
local cart_dir = boost_cart:velocity_to_dir(vel)
local max_vel = boost_cart.speed_max
if not dir then
dir, last_switch = boost_cart:get_rail_direction(
pos, cart_dir, ctrl, self.old_switch, self.railtype
)
end
local new_acc = {x=0, y=0, z=0}
if vector.equals(dir, {x=0, y=0, z=0}) then
vel = {x=0, y=0, z=0}
pos = vector.round(pos)
update.pos = true
update.vel = true
else
-- If the direction changed
if dir.x ~= 0 and self.old_dir.z ~= 0 then
vel.x = dir.x * math.abs(vel.z)
vel.z = 0
pos.z = math.floor(pos.z + 0.5)
update.pos = true
end
if dir.z ~= 0 and self.old_dir.x ~= 0 then
vel.z = dir.z * math.abs(vel.x)
vel.x = 0
pos.x = math.floor(pos.x + 0.5)
update.pos = true
end
-- Up, down?
if dir.y ~= self.old_dir.y then
vel.y = dir.y * math.abs(vel.x + vel.z)
pos = vector.round(pos)
update.pos = true
end
-- Slow down or speed up..
local acc = dir.y * -1.8
local speed_mod_string = minetest.get_meta(pos):get_string("cart_acceleration")
local speed_mod = tonumber(speed_mod_string)
if speed_mod_string == "halt" then
vel = {x=0, y=0, z=0}
acc = 0
pos = vector.round(pos)
update.pos = true
update.vel = true
elseif speed_mod and speed_mod ~= 0 then
-- Try to make it similar to the original carts mod
acc = acc + (speed_mod * 10)
else
acc = acc - 0.4
-- Handbrake
if ctrl and ctrl.down then
acc = acc - 1.2
end
end
if self.old_dir.y == 0 and not self.punched then
-- Stop the cart swing between two rail parts (handbrake)
if vector.equals(vector.multiply(self.old_dir, -1), dir) then
vel = {x=0, y=0, z=0}
acc = 0
if self.old_pos then
pos = vector.new(self.old_pos)
update.pos = true
end
dir = vector.new(self.old_dir)
update.vel = true
end
end
new_acc = vector.multiply(dir, acc)
end
if HAVE_MESECONS_ENABLED then
boost_cart:signal_detector_rail(vector.round(pos))
end
-- Limits
for _,v in ipairs({"x","y","z"}) do
if math.abs(vel[v]) > max_vel then
vel[v] = boost_cart:get_sign(vel[v]) * max_vel
new_acc[v] = 0
update.vel = true
end
end
self.object:setacceleration(new_acc)
self.old_pos = vector.new(pos)
if not vector.equals(dir, {x=0, y=0, z=0}) then
self.old_dir = vector.new(dir)
end
self.old_switch = last_switch
if self.punched then
-- Collect dropped items
for _,obj_ in ipairs(minetest.get_objects_inside_radius(pos, 1)) do
if not obj_:is_player() and
obj_:get_luaentity() and
not obj_:get_luaentity().physical_state and
obj_:get_luaentity().name == "__builtin:item" then
obj_:set_attach(self.object, "", {x=0, y=0, z=0}, {x=0, y=0, z=0})
self.attached_items[#self.attached_items + 1] = obj_
end
end
self.punched = false
update.vel = true -- update player animation
end
if not (update.vel or update.pos) then
return
end
local yaw = 0
if self.old_dir.x < 0 then
yaw = 0.5
elseif self.old_dir.x > 0 then
yaw = 1.5
elseif self.old_dir.z < 0 then
yaw = 1
end
self.object:setyaw(yaw * math.pi)
local anim = {x=0, y=0}
if dir.y == -1 then
anim = {x=1, y=1}
elseif dir.y == 1 then
anim = {x=2, y=2}
end
self.object:set_animation(anim, 1, 0)
self.object:setvelocity(vel)
if update.pos then
self.object:setpos(pos)
end
update = nil
end
minetest.register_entity(":carts:cart", boost_cart.cart)
minetest.register_craftitem(":carts:cart", {
description = "Cart (Sneak+Click to pick up)",
inventory_image = minetest.inventorycube("cart_top.png", "cart_side.png", "cart_side.png"),
wield_image = "cart_side.png",
on_place = function(itemstack, placer, pointed_thing)
if not pointed_thing.type == "node" then
return
end
if boost_cart:is_rail(pointed_thing.under) then
minetest.add_entity(pointed_thing.under, "carts:cart")
elseif boost_cart:is_rail(pointed_thing.above) then
minetest.add_entity(pointed_thing.above, "carts:cart")
else return end
itemstack:take_item()
return itemstack
end,
})
minetest.register_craft({
output = "carts:cart",
recipe = {
{"default:steel_ingot", "", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
},
})

View File

@ -1,68 +1,53 @@
minetest.register_node(":default:rail", { boost_cart:register_rail(":default:rail", {
description = "Rail", description = "Rail",
drawtype = "raillike",
tiles = { tiles = {
"default_rail.png", "default_rail_curved.png", "carts_rail_straight.png", "carts_rail_curved.png",
"default_rail_t_junction.png", "default_rail_crossing.png" "carts_rail_t_junction.png", "carts_rail_crossing.png"
}, },
inventory_image = "default_rail.png", groups = boost_cart:get_rail_groups()
wield_image = "default_rail.png",
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
},
groups = boost_cart:get_rail_groups(),
}) })
-- Moreores' copper rail
if minetest.get_modpath("moreores") then if minetest.get_modpath("moreores") then
-- Moreores' copper rail
minetest.register_alias("carts:copperrail", "moreores:copper_rail") minetest.register_alias("carts:copperrail", "moreores:copper_rail")
else else
boost_cart:register_rail(":carts:copperrail", { boost_cart:register_rail(":carts:copperrail", {
description = "Copper rail", description = "Copper rail",
tiles = { tiles = {
"carts_rail_cp.png", "carts_rail_curved_cp.png", "carts_rail_straight_cp.png", "carts_rail_curved_cp.png",
"carts_rail_t_junction_cp.png", "carts_rail_crossing_cp.png" "carts_rail_t_junction_cp.png", "carts_rail_crossing_cp.png"
}, },
groups = boost_cart:get_rail_groups(), groups = boost_cart:get_rail_groups()
}) })
minetest.register_craft({ minetest.register_craft({
output = "carts:copperrail 12", output = "carts:copperrail 12",
recipe = { recipe = {
{"default:copper_ingot", "", "default:copper_ingot"},
{"default:copper_ingot", "group:stick", "default:copper_ingot"}, {"default:copper_ingot", "group:stick", "default:copper_ingot"},
{"default:copper_ingot", "group:stick", "default:copper_ingot"}, {"default:copper_ingot", "", "default:copper_ingot"},
{"default:copper_ingot", "group:stick", "default:copper_ingot"},
} }
}) })
end end
-- Speed up -- Power rail
boost_cart:register_rail(":carts:powerrail", { boost_cart:register_rail(":carts:powerrail", {
description = "Powered rail", description = "Powered rail",
tiles = { tiles = {
"carts_rail_pwr.png", "carts_rail_curved_pwr.png", "carts_rail_straight_pwr.png", "carts_rail_curved_pwr.png",
"carts_rail_t_junction_pwr.png", "carts_rail_crossing_pwr.png" "carts_rail_t_junction_pwr.png", "carts_rail_crossing_pwr.png"
}, },
groups = boost_cart:get_rail_groups(), groups = boost_cart:get_rail_groups(),
after_place_node = function(pos, placer, itemstack) after_place_node = function(pos, placer, itemstack)
if not mesecon then if not mesecon then
minetest.get_meta(pos):set_string("cart_acceleration", "0.5") minetest.get_meta(pos):set_string("cart_acceleration", "0.5")
end end
end, end,
mesecons = { mesecons = {
effector = { effector = {
action_on = function(pos, node) action_on = function(pos, node)
boost_cart:boost_rail(pos, 0.5) boost_cart:boost_rail(pos, 0.5)
end, end,
action_off = function(pos, node) action_off = function(pos, node)
minetest.get_meta(pos):set_string("cart_acceleration", "0") minetest.get_meta(pos):set_string("cart_acceleration", "0")
end, end,
@ -79,26 +64,24 @@ minetest.register_craft({
} }
}) })
-- Brake rail
boost_cart:register_rail(":carts:brakerail", { boost_cart:register_rail(":carts:brakerail", {
description = "Brake rail", description = "Brake rail",
tiles = { tiles = {
"carts_rail_brk.png", "carts_rail_curved_brk.png", "carts_rail_straight_brk.png", "carts_rail_curved_brk.png",
"carts_rail_t_junction_brk.png", "carts_rail_crossing_brk.png" "carts_rail_t_junction_brk.png", "carts_rail_crossing_brk.png"
}, },
groups = boost_cart:get_rail_groups(), groups = boost_cart:get_rail_groups(),
after_place_node = function(pos, placer, itemstack) after_place_node = function(pos, placer, itemstack)
if not mesecon then if not mesecon then
minetest.get_meta(pos):set_string("cart_acceleration", "-0.3") minetest.get_meta(pos):set_string("cart_acceleration", "-0.3")
end end
end, end,
mesecons = { mesecons = {
effector = { effector = {
action_on = function(pos, node) action_on = function(pos, node)
minetest.get_meta(pos):set_string("cart_acceleration", "-0.3") minetest.get_meta(pos):set_string("cart_acceleration", "-0.3")
end, end,
action_off = function(pos, node) action_off = function(pos, node)
minetest.get_meta(pos):set_string("cart_acceleration", "0") minetest.get_meta(pos):set_string("cart_acceleration", "0")
end, end,
@ -118,23 +101,20 @@ minetest.register_craft({
boost_cart:register_rail("boost_cart:startstoprail", { boost_cart:register_rail("boost_cart:startstoprail", {
description = "Start-stop rail", description = "Start-stop rail",
tiles = { tiles = {
"carts_rail_ss.png", "carts_rail_curved_ss.png", "carts_rail_straight_ss.png", "carts_rail_curved_ss.png",
"carts_rail_t_junction_ss.png", "carts_rail_crossing_ss.png" "carts_rail_t_junction_ss.png", "carts_rail_crossing_ss.png"
}, },
groups = boost_cart:get_rail_groups(), groups = boost_cart:get_rail_groups(),
after_place_node = function(pos, placer, itemstack) after_place_node = function(pos, placer, itemstack)
if not mesecon then if not mesecon then
minetest.get_meta(pos):set_string("cart_acceleration", "halt") minetest.get_meta(pos):set_string("cart_acceleration", "halt")
end end
end, end,
mesecons = { mesecons = {
effector = { effector = {
action_on = function(pos, node) action_on = function(pos, node)
boost_cart:boost_rail(pos, 0.5) boost_cart:boost_rail(pos, 0.5)
end, end,
action_off = function(pos, node) action_off = function(pos, node)
minetest.get_meta(pos):set_string("cart_acceleration", "halt") minetest.get_meta(pos):set_string("cart_acceleration", "halt")
end, end,

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 755 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 549 B

After

Width:  |  Height:  |  Size: 765 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 495 B

After

Width:  |  Height:  |  Size: 735 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 458 B

After

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 458 B

After

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 458 B

After

Width:  |  Height:  |  Size: 847 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 B

After

Width:  |  Height:  |  Size: 813 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 537 B

After

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 B

After

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 443 B

After

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 443 B

After

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 443 B

After

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 445 B

After

Width:  |  Height:  |  Size: 832 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 785 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 789 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 728 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 830 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 830 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 836 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 843 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 789 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 538 B

After

Width:  |  Height:  |  Size: 714 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 496 B

After

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 431 B

After

Width:  |  Height:  |  Size: 752 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 431 B

After

Width:  |  Height:  |  Size: 808 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 539 B

After

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 433 B

After

Width:  |  Height:  |  Size: 813 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 B

View File

@ -573,8 +573,8 @@ minetest.register_tool("building_blocks:knife", {
tool_capabilities = { tool_capabilities = {
max_drop_level=0, max_drop_level=0,
groupcaps={ groupcaps={
choppy={times={[2]=7.50, [3]=2.80}, maxwear=0.01, maxlevel=1}, choppy={times={[2]=7.50, [3]=2.80}, uses=100, maxlevel=1},
fleshy={times={[2]=5.50, [3]=2.80}, maxwear=0.01, maxlevel=1} fleshy={times={[2]=5.50, [3]=2.80}, uses=100, maxlevel=1}
} }
}, },
}) })

0
carbone_mobs/models/mobs_dungeon_master.x Executable file → Normal file
View File

0
carbone_mobs/models/mobs_oerkki.x Executable file → Normal file
View File

0
carbone_mobs/models/mobs_rat.x Executable file → Normal file
View File

0
carbone_mobs/models/mobs_sand_monster.x Executable file → Normal file
View File

0
carbone_mobs/models/mobs_sheep.x Executable file → Normal file
View File

0
carbone_mobs/models/mobs_sheep_shaved.x Executable file → Normal file
View File

0
carbone_mobs/models/mobs_stone_monster.x Executable file → Normal file
View File

0
carbone_mobs/models/mobs_tree_monster.x Executable file → Normal file
View File

View File

@ -258,16 +258,8 @@ minetest.register_node("castle:ironbound_chest",{
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Ironbound Chest") meta:set_string("infotext", "Ironbound Chest")
meta:set_string("owner", "") meta:set_string("owner", "")
meta:set_string("formspec",
"size[8,8]"..
default.gui_bg ..
default.gui_bg_img ..
default.gui_slots ..
"list[current_name;main;0,0;8,5;]"..
"list[current_player;main;0,4;8,4;]"..
"infotext", "Ironbound Chest")
local inv = meta:get_inventory() local inv = meta:get_inventory()
inv:set_size("main", 8*3) inv:set_size("main", 8*4)
end, end,
can_dig = function(pos,player) can_dig = function(pos,player)
local meta = minetest.get_meta(pos); local meta = minetest.get_meta(pos);
@ -329,6 +321,7 @@ minetest.register_node("castle:ironbound_chest",{
) )
end end
end, end,
on_blast = function() end,
}) })
minetest.register_craft({ minetest.register_craft({

View File

@ -201,7 +201,7 @@ minetest.register_craft({
}) })
minetest.register_node("castle:crate", { minetest.register_node("castle:crate", {
description = "Cratelol", description = "Crate",
drawtype = "normal", drawtype = "normal",
tiles = {"castle_crate_top.png","castle_crate_top.png","castle_crate.png","castle_crate.png","castle_crate.png","castle_crate.png"}, tiles = {"castle_crate_top.png","castle_crate_top.png","castle_crate.png","castle_crate.png","castle_crate.png","castle_crate.png"},
groups = {choppy=3}, groups = {choppy=3},

View File

@ -316,8 +316,8 @@ minetest.register_node("computer:server_on", {
tiles = { tiles = {
'computer_server_t.png', 'computer_server_t.png',
'computer_server_bt.png', 'computer_server_bt.png',
'computer_server_r.png',
'computer_server_l.png', 'computer_server_l.png',
'computer_server_r.png',
'computer_server_bt.png', 'computer_server_bt.png',
'computer_server_f_on.png', 'computer_server_f_on.png',
}, },

View File

@ -84,9 +84,9 @@ minetest.register_node(":technic:blast_resistant_concrete", {
groups = {cracky=1, level=3, concrete=1}, groups = {cracky=1, level=3, concrete=1},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_blast = function(pos, intensity) on_blast = function(pos, intensity)
if intensity > 1 then if intensity > 9 then
minetest.remove_node(pos) minetest.remove_node(pos)
minetest.add_item(pos, "technic:blast_resistant_concrete") return {"technic:blast_resistant_concrete"}
end end
end, end,
}) })

View File

@ -2,7 +2,7 @@ minetest.register_craft({
output = 'currency:safe', output = 'currency:safe',
recipe = { recipe = {
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'default:steel_ingot', '', 'default:steel_ingot'}, {'default:steel_ingot', 'default:mese_crystal', 'default:steel_ingot'},
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
} }
}) })

View File

@ -8,7 +8,14 @@ function default.get_safe_formspec(pos)
end end
local function has_safe_privilege(meta, player) local function has_safe_privilege(meta, player)
if not player or player:get_player_name() ~= meta:get_string("owner") then local name = ""
if player then
if minetest.check_player_privs(player, "protection_bypass") then
return true
end
name = player:get_player_name()
end
if name ~= meta:get_string("owner") then
return false return false
end end
return true return true

0
customize-dreambuilder_game.sh Executable file → Normal file
View File

View File

@ -84,7 +84,9 @@ glooptest.extragen_module.treasure[5] = {
local treasure_chest_formspec = local treasure_chest_formspec =
"size[8,9]".. "size[8,9]"..
"list[current_name;main;0,0;8,4;]".. "list[current_name;main;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]" "list[current_player;main;0,5;8,4;]"..
"listring[current_name;main]"..
"listring[current_player;main]"
local treasure_chest_nodebox = { local treasure_chest_nodebox = {
{-7/16, -8/16, -7/16, 7/16, 6/16, 7/16}, {-7/16, -8/16, -7/16, 7/16, 6/16, 7/16},
@ -371,4 +373,4 @@ minetest.register_on_generated(function(minp, maxp)
end end
end) end)
--minetest.register_on_generated(glooptest.extragen_module.spawn_chests(minp, maxp)) --minetest.register_on_generated(glooptest.extragen_module.spawn_chests(minp, maxp))

View File

@ -392,7 +392,7 @@ for i in ipairs(gates_list) do
end, end,
mesecons = { mesecons = {
effector = { effector = {
action_on = function(pos,node) homedecor.flip_gate(pos,node,player,gate, "closed") end action_on = function(pos,node) homedecor.flip_gate(pos,node,nil,gate, "closed") end
} }
} }
} }
@ -420,7 +420,7 @@ for i in ipairs(gates_list) do
return itemstack return itemstack
end end
def.mesecons.effector = { def.mesecons.effector = {
action_off = function(pos,node) homedecor.flip_gate(pos,node,player,gate, "open") end action_off = function(pos,node) homedecor.flip_gate(pos,node,nil,gate, "open") end
} }
minetest.register_node("homedecor:gate_"..gate.."_open", def) minetest.register_node("homedecor:gate_"..gate.."_open", def)

View File

@ -30,7 +30,11 @@ local function make_formspec(furnacedef, percent)
"list[current_name;fuel;2,3;1,1;]".. "list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;1,1;]".. "list[current_name;src;2,1;1,1;]"..
"list[current_name;dst;5,1;"..w..","..h..";]".. "list[current_name;dst;5,1;"..w..","..h..";]"..
"list[current_player;main;0,5;8,4;]" "list[current_player;main;0,5;8,4;]"..
"listring[current_name;dst]"..
"listring[current_player;main]"..
"listring[current_name;src]"..
"listring[current_player;main]"
end end
--[[ --[[

View File

@ -35,7 +35,7 @@
CURVE_CHEVRON_LIGHT_RANGE = 12 -- an integer -> default = 12 | How much light do you want it to give? CURVE_CHEVRON_LIGHT_RANGE = 12 -- an integer -> default = 12 | How much light do you want it to give?
-- Crosswalk lighting -- Crosswalk lighting
CROSSWALK_LIGHTING_LIGHT_RANGE = 15 -- an integer -> default = 15 | How much light do you want it to give? CROSSWALK_LIGHTING_LIGHT_RANGE = 14 -- an integer -> default = 14 | How much light do you want it to give?
-- Crosswalk safety sign -- Crosswalk safety sign
CROSSWALK_SAFETY_SIGN_LIGHT_RANGE = 8 -- an integer -> default = 8 | How much light do you want it to give? CROSSWALK_SAFETY_SIGN_LIGHT_RANGE = 8 -- an integer -> default = 8 | How much light do you want it to give?
@ -44,6 +44,6 @@
RETROREFLECTIVE_SURFACE_LIGHT_RANGE = 8 -- an integer -> default = 8 | How much light do you want it to give? RETROREFLECTIVE_SURFACE_LIGHT_RANGE = 8 -- an integer -> default = 8 | How much light do you want it to give?
-- Aircraft warning light -- Aircraft warning light
AIRCRAFT_WARNING_LIGHT_LIGHT_RANGE = 15 -- an integer -> default = 15 | How much light do you want it to give? AIRCRAFT_WARNING_LIGHT_LIGHT_RANGE = 14 -- an integer -> default = 14 | How much light do you want it to give?
-- Warning light -- Warning light
WARNING_LIGHT_LIGHT_RANGE = 15 -- an integer -> default = 15 | How much light do you want it to give? WARNING_LIGHT_LIGHT_RANGE = 14 -- an integer -> default = 14 | How much light do you want it to give?

View File

@ -190,7 +190,7 @@ minetest.register_on_joinplayer(function(player)
on_put = invsaw.on_put, on_put = invsaw.on_put,
on_take = invsaw.on_take, on_take = invsaw.on_take,
allow_move = function() return 0 end allow_move = function() return 0 end
}) }, name)
inv:set_size("input",1) inv:set_size("input",1)
inv:set_size("micro",1) inv:set_size("micro",1)
inv:set_size("recycle",1) inv:set_size("recycle",1)

View File

@ -29,6 +29,8 @@ minetest.register_node("lrfurn:coffeetable_back", {
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local param2 = node.param2 local param2 = node.param2
local fdir = minetest.dir_to_facedir(placer:get_look_dir(), false)
if lrfurn.check_forward(pos, fdir, false, placer) then if lrfurn.check_forward(pos, fdir, false, placer) then
node.name = "lrfurn:coffeetable_front" node.name = "lrfurn:coffeetable_front"

View File

@ -242,7 +242,7 @@ minetest.register_node("maptools:lightbulb", {
drawtype = "airlike", drawtype = "airlike",
walkable = false, walkable = false,
pointable = false, pointable = false,
light_source = 15, light_source = 14,
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
drop = "", drop = "",

0
mesecons/doc/mesecon/preview.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

0
mesecons_blinkyplant/doc/blinkyplant/preview.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

0
mesecons_wires/doc/mesecon/preview.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -284,7 +284,7 @@ local nodes = {
tiles = {"moreblocks_super_glow_glass.png"}, tiles = {"moreblocks_super_glow_glass.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
light_source = 15, light_source = 14,
groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3}, groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3},
sounds = sound_glass, sounds = sound_glass,
}, },
@ -295,7 +295,7 @@ local nodes = {
tiles = {"moreblocks_trap_super_glow_glass.png"}, tiles = {"moreblocks_trap_super_glow_glass.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
light_source = 15, light_source = 14,
walkable = false, walkable = false,
groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3}, groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3},
sounds = sound_glass, sounds = sound_glass,

View File

@ -17,6 +17,21 @@ and minetest.setting_getbool("creative_mode") then
stairsplus.expect_infinite_stacks = true stairsplus.expect_infinite_stacks = true
end end
function stairsplus.copytable(orig)
local orig_type = type(orig)
local copy
if orig_type == 'table' then
copy = {}
for orig_key, orig_value in next, orig, nil do
copy[stairsplus.copytable(orig_key)] = stairsplus.copytable(orig_value)
end
setmetatable(copy, stairsplus.copytable(getmetatable(orig)))
else
copy = orig
end
return copy
end
function stairsplus:prepare_groups(groups) function stairsplus:prepare_groups(groups)
local result = {} local result = {}
if groups then if groups then
@ -41,6 +56,21 @@ function stairsplus:register_all(modname, subname, recipeitem, fields)
-- self:register_6dfacedir_conversion(modname, subname) -- Not needed as of Q3 2013, uncomment to fix old maps. -- self:register_6dfacedir_conversion(modname, subname) -- Not needed as of Q3 2013, uncomment to fix old maps.
end end
function stairsplus:register_alias_all(modname_old, subname_old, modname_new, subname_new)
self:register_stair_alias(modname_old, subname_old, modname_new, subname_new)
self:register_slab_alias(modname_old, subname_old, modname_new, subname_new)
self:register_slope_alias(modname_old, subname_old, modname_new, subname_new)
self:register_panel_alias(modname_old, subname_old, modname_new, subname_new)
self:register_micro_alias(modname_old, subname_old, modname_new, subname_new)
end
function stairsplus:register_alias_force_all(modname_old, subname_old, modname_new, subname_new)
self:register_stair_alias_force(modname_old, subname_old, modname_new, subname_new)
self:register_slab_alias_force(modname_old, subname_old, modname_new, subname_new)
self:register_slope_alias_force(modname_old, subname_old, modname_new, subname_new)
self:register_panel_alias_force(modname_old, subname_old, modname_new, subname_new)
self:register_micro_alias_force(modname_old, subname_old, modname_new, subname_new)
end
function register_stair_slab_panel_micro(modname, subname, recipeitem, groups, images, description, drop, light) function register_stair_slab_panel_micro(modname, subname, recipeitem, groups, images, description, drop, light)
stairsplus:register_all(modname, subname, recipeitem, { stairsplus:register_all(modname, subname, recipeitem, {
groups = groups, groups = groups,

View File

@ -20,52 +20,67 @@ function register_micro(modname, subname, recipeitem, groups, images, descriptio
}) })
end end
function stairsplus:register_micro(modname, subname, recipeitem, fields) local microblocks_defs = {
local defs = { [""] = {
[""] = { node_box = {
node_box = { type = "fixed",
type = "fixed", fixed = {-0.5, -0.5, 0, 0, 0, 0.5},
fixed = {-0.5, -0.5, 0, 0, 0, 0.5},
},
}, },
["_1"] = { },
node_box = { ["_1"] = {
type = "fixed", node_box = {
fixed = {-0.5, -0.5, 0, 0, -0.4375, 0.5}, type = "fixed",
}, fixed = {-0.5, -0.5, 0, 0, -0.4375, 0.5},
}, },
["_2"] = { },
node_box = { ["_2"] = {
type = "fixed", node_box = {
fixed = {-0.5, -0.5, 0, 0, -0.375, 0.5}, type = "fixed",
}, fixed = {-0.5, -0.5, 0, 0, -0.375, 0.5},
}, },
["_4"] = { },
node_box = { ["_4"] = {
type = "fixed", node_box = {
fixed = {-0.5, -0.5, 0, 0, -0.25, 0.5}, type = "fixed",
}, fixed = {-0.5, -0.5, 0, 0, -0.25, 0.5},
}, },
["_12"] = { },
node_box = { ["_12"] = {
type = "fixed", node_box = {
fixed = {-0.5, -0.5, 0, 0, 0.25, 0.5}, type = "fixed",
}, fixed = {-0.5, -0.5, 0, 0, 0.25, 0.5},
}, },
["_14"] = { },
node_box = { ["_14"] = {
type = "fixed", node_box = {
fixed = {-0.5, -0.5, 0, 0, 0.375, 0.5}, type = "fixed",
}, fixed = {-0.5, -0.5, 0, 0, 0.375, 0.5},
},
},
["_15"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0, 0.4375, 0.5},
}, },
["_15"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0, 0.4375, 0.5},
},
}
} }
}
function stairsplus:register_micro_alias(modname_old, subname_old, modname_new, subname_new)
local defs = stairsplus.copytable(microblocks_defs)
for alternate, def in pairs(defs) do
minetest.register_alias(modname_old .. ":micro_" .. subname_old .. alternate, modname_new .. ":micro_" .. subname_new .. alternate)
end
end
function stairsplus:register_micro_alias_force(modname_old, subname_old, modname_new, subname_new)
local defs = stairsplus.copytable(microblocks_defs)
for alternate, def in pairs(defs) do
minetest.register_alias_force(modname_old .. ":micro_" .. subname_old .. alternate, modname_new .. ":micro_" .. subname_new .. alternate)
end
end
function stairsplus:register_micro(modname, subname, recipeitem, fields)
local defs = stairsplus.copytable(microblocks_defs)
local desc = S("%s Microblock"):format(fields.description) local desc = S("%s Microblock"):format(fields.description)
for alternate, def in pairs(defs) do for alternate, def in pairs(defs) do
for k, v in pairs(fields) do for k, v in pairs(fields) do

View File

@ -20,52 +20,67 @@ function register_panel(modname, subname, recipeitem, groups, images, descriptio
}) })
end end
function stairsplus:register_panel(modname, subname, recipeitem, fields) local panels_defs = {
local defs = { [""] = {
[""] = { node_box = {
node_box = { type = "fixed",
type = "fixed", fixed = {-0.5, -0.5, 0, 0.5, 0, 0.5},
fixed = {-0.5, -0.5, 0, 0.5, 0, 0.5},
},
}, },
["_1"] = { },
node_box = { ["_1"] = {
type = "fixed", node_box = {
fixed = {-0.5, -0.5, 0, 0.5, -0.4375, 0.5}, type = "fixed",
}, fixed = {-0.5, -0.5, 0, 0.5, -0.4375, 0.5},
}, },
["_2"] = { },
node_box = { ["_2"] = {
type = "fixed", node_box = {
fixed = {-0.5, -0.5, 0, 0.5, -0.375, 0.5}, type = "fixed",
}, fixed = {-0.5, -0.5, 0, 0.5, -0.375, 0.5},
}, },
["_4"] = { },
node_box = { ["_4"] = {
type = "fixed", node_box = {
fixed = {-0.5, -0.5, 0, 0.5, -0.25, 0.5}, type = "fixed",
}, fixed = {-0.5, -0.5, 0, 0.5, -0.25, 0.5},
}, },
["_12"] = { },
node_box = { ["_12"] = {
type = "fixed", node_box = {
fixed = {-0.5, -0.5, 0, 0.5, 0.25, 0.5}, type = "fixed",
}, fixed = {-0.5, -0.5, 0, 0.5, 0.25, 0.5},
}, },
["_14"] = { },
node_box = { ["_14"] = {
type = "fixed", node_box = {
fixed = {-0.5, -0.5, 0, 0.5, 0.375, 0.5}, type = "fixed",
}, fixed = {-0.5, -0.5, 0, 0.5, 0.375, 0.5},
},
},
["_15"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, 0.4375, 0.5},
}, },
["_15"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, 0.4375, 0.5},
},
}
} }
}
function stairsplus:register_panel_alias(modname_old, subname_old, modname_new, subname_new)
local defs = stairsplus.copytable(panels_defs)
for alternate, def in pairs(defs) do
minetest.register_alias(modname_old .. ":panel_" .. subname_old .. alternate, modname_new .. ":panel_" .. subname_new .. alternate)
end
end
function stairsplus:register_panel_alias_force(modname_old, subname_old, modname_new, subname_new)
local defs = stairsplus.copytable(panels_defs)
for alternate, def in pairs(defs) do
minetest.register_alias_force(modname_old .. ":panel_" .. subname_old .. alternate, modname_new .. ":panel_" .. subname_new .. alternate)
end
end
function stairsplus:register_panel(modname, subname, recipeitem, fields)
local defs = stairsplus.copytable(panels_defs)
local desc = S("%s Panel"):format(fields.description) local desc = S("%s Panel"):format(fields.description)
for alternate, def in pairs(defs) do for alternate, def in pairs(defs) do
for k, v in pairs(fields) do for k, v in pairs(fields) do

View File

@ -20,17 +20,32 @@ function register_slab(modname, subname, recipeitem, groups, images, description
}) })
end end
function stairsplus:register_slab(modname, subname, recipeitem, fields) local slabs_defs = {
local defs = { [""] = 8,
[""] = 8, ["_quarter"] = 4,
["_quarter"] = 4, ["_three_quarter"] = 12,
["_three_quarter"] = 12, ["_1"] = 1,
["_1"] = 1, ["_2"] = 2,
["_2"] = 2, ["_14"] = 14,
["_14"] = 14, ["_15"] = 15,
["_15"] = 15, }
}
function stairsplus:register_slab_alias(modname_old, subname_old, modname_new, subname_new)
local defs = stairsplus.copytable(slabs_defs)
for alternate, def in pairs(defs) do
minetest.register_alias(modname_old .. ":slab_" .. subname_old .. alternate, modname_new .. ":slab_" .. subname_new .. alternate)
end
end
function stairsplus:register_slab_alias_force(modname_old, subname_old, modname_new, subname_new)
local defs = stairsplus.copytable(slabs_defs)
for alternate, def in pairs(defs) do
minetest.register_alias_force(modname_old .. ":slab_" .. subname_old .. alternate, modname_new .. ":slab_" .. subname_new .. alternate)
end
end
function stairsplus:register_slab(modname, subname, recipeitem, fields)
local defs = stairsplus.copytable(slabs_defs)
local desc_base = S("%s Slab"):format(fields.description) local desc_base = S("%s Slab"):format(fields.description)
for alternate, num in pairs(defs) do for alternate, num in pairs(defs) do
local def = { local def = {

View File

@ -123,103 +123,118 @@ function register_slope(modname, subname, recipeitem, groups, images, descriptio
}) })
end end
local slopes_defs = {
[""] = {
mesh = "moreblocks_slope.obj",
collision_box = box_slope,
selection_box = box_slope,
},
["_half"] = {
mesh = "moreblocks_slope_half.obj",
collision_box = box_slope_half,
selection_box = box_slope_half,
},
["_half_raised"] = {
mesh = "moreblocks_slope_half_raised.obj",
collision_box = box_slope_half_raised,
selection_box = box_slope_half_raised,
},
--==============================================================
["_inner"] = {
mesh = "moreblocks_slope_inner.obj",
collision_box = box_slope_inner,
selection_box = box_slope_inner,
},
["_inner_half"] = {
mesh = "moreblocks_slope_inner_half.obj",
collision_box = box_slope_inner_half,
selection_box = box_slope_inner_half,
},
["_inner_half_raised"] = {
mesh = "moreblocks_slope_inner_half_raised.obj",
collision_box = box_slope_inner_half_raised,
selection_box = box_slope_inner_half_raised,
},
--==============================================================
["_inner_cut"] = {
mesh = "moreblocks_slope_inner_cut.obj",
collision_box = box_slope_inner,
selection_box = box_slope_inner,
},
["_inner_cut_half"] = {
mesh = "moreblocks_slope_inner_cut_half.obj",
collision_box = box_slope_inner_half,
selection_box = box_slope_inner_half,
},
["_inner_cut_half_raised"] = {
mesh = "moreblocks_slope_inner_cut_half_raised.obj",
collision_box = box_slope_inner_half_raised,
selection_box = box_slope_inner_half_raised,
},
--==============================================================
["_outer"] = {
mesh = "moreblocks_slope_outer.obj",
collision_box = box_slope_outer,
selection_box = box_slope_outer,
},
["_outer_half"] = {
mesh = "moreblocks_slope_outer_half.obj",
collision_box = box_slope_outer_half,
selection_box = box_slope_outer_half,
},
["_outer_half_raised"] = {
mesh = "moreblocks_slope_outer_half_raised.obj",
collision_box = box_slope_outer_half_raised,
selection_box = box_slope_outer_half_raised,
},
--==============================================================
["_outer_cut"] = {
mesh = "moreblocks_slope_outer_cut.obj",
collision_box = box_slope_outer,
selection_box = box_slope_outer,
},
["_outer_cut_half"] = {
mesh = "moreblocks_slope_outer_cut_half.obj",
collision_box = box_slope_outer_half,
selection_box = box_slope_outer_half,
},
["_outer_cut_half_raised"] = {
mesh = "moreblocks_slope_outer_cut_half_raised.obj",
collision_box = box_slope_outer_half_raised,
selection_box = box_slope_outer_half_raised,
},
["_cut"] = {
mesh = "moreblocks_slope_cut.obj",
collision_box = box_slope_outer,
selection_box = box_slope_outer,
},
}
function stairsplus:register_slope_alias(modname_old, subname_old, modname_new, subname_new)
local defs = stairsplus.copytable(slopes_defs)
for alternate, def in pairs(defs) do
minetest.register_alias(modname_old .. ":slope_" .. subname_old .. alternate, modname_new .. ":slope_" .. subname_new .. alternate)
end
end
function stairsplus:register_slope_alias_force(modname_old, subname_old, modname_new, subname_new)
local defs = stairsplus.copytable(slopes_defs)
for alternate, def in pairs(defs) do
minetest.register_alias_force(modname_old .. ":slope_" .. subname_old .. alternate, modname_new .. ":slope_" .. subname_new .. alternate)
end
end
function stairsplus:register_slope(modname, subname, recipeitem, fields) function stairsplus:register_slope(modname, subname, recipeitem, fields)
local defs = { local defs = stairsplus.copytable(slopes_defs)
[""] = {
mesh = "moreblocks_slope.obj",
collision_box = box_slope,
selection_box = box_slope,
},
["_half"] = {
mesh = "moreblocks_slope_half.obj",
collision_box = box_slope_half,
selection_box = box_slope_half,
},
["_half_raised"] = {
mesh = "moreblocks_slope_half_raised.obj",
collision_box = box_slope_half_raised,
selection_box = box_slope_half_raised,
},
--==============================================================
["_inner"] = {
mesh = "moreblocks_slope_inner.obj",
collision_box = box_slope_inner,
selection_box = box_slope_inner,
},
["_inner_half"] = {
mesh = "moreblocks_slope_inner_half.obj",
collision_box = box_slope_inner_half,
selection_box = box_slope_inner_half,
},
["_inner_half_raised"] = {
mesh = "moreblocks_slope_inner_half_raised.obj",
collision_box = box_slope_inner_half_raised,
selection_box = box_slope_inner_half_raised,
},
--==============================================================
["_inner_cut"] = {
mesh = "moreblocks_slope_inner_cut.obj",
collision_box = box_slope_inner,
selection_box = box_slope_inner,
},
["_inner_cut_half"] = {
mesh = "moreblocks_slope_inner_cut_half.obj",
collision_box = box_slope_inner_half,
selection_box = box_slope_inner_half,
},
["_inner_cut_half_raised"] = {
mesh = "moreblocks_slope_inner_cut_half_raised.obj",
collision_box = box_slope_inner_half_raised,
selection_box = box_slope_inner_half_raised,
},
--==============================================================
["_outer"] = {
mesh = "moreblocks_slope_outer.obj",
collision_box = box_slope_outer,
selection_box = box_slope_outer,
},
["_outer_half"] = {
mesh = "moreblocks_slope_outer_half.obj",
collision_box = box_slope_outer_half,
selection_box = box_slope_outer_half,
},
["_outer_half_raised"] = {
mesh = "moreblocks_slope_outer_half_raised.obj",
collision_box = box_slope_outer_half_raised,
selection_box = box_slope_outer_half_raised,
},
--==============================================================
["_outer_cut"] = {
mesh = "moreblocks_slope_outer_cut.obj",
collision_box = box_slope_outer,
selection_box = box_slope_outer,
},
["_outer_cut_half"] = {
mesh = "moreblocks_slope_outer_cut_half.obj",
collision_box = box_slope_outer_half,
selection_box = box_slope_outer_half,
},
["_outer_cut_half_raised"] = {
mesh = "moreblocks_slope_outer_cut_half_raised.obj",
collision_box = box_slope_outer_half_raised,
selection_box = box_slope_outer_half_raised,
},
["_cut"] = {
mesh = "moreblocks_slope_cut.obj",
collision_box = box_slope_outer,
selection_box = box_slope_outer,
},
}
local desc = S("%s Slope"):format(fields.description) local desc = S("%s Slope"):format(fields.description)
for alternate, def in pairs(defs) do for alternate, def in pairs(defs) do
for k, v in pairs(fields) do for k, v in pairs(fields) do

View File

@ -20,92 +20,107 @@ function register_stair(modname, subname, recipeitem, groups, images, descriptio
}) })
end end
function stairsplus:register_stair(modname, subname, recipeitem, fields) local stairs_defs = {
local defs = { [""] = {
[""] = { node_box = {
node_box = { type = "fixed",
type = "fixed", fixed = {
fixed = { {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
{-0.5, -0.5, -0.5, 0.5, 0, 0.5}, {-0.5, 0, 0, 0.5, 0.5, 0.5},
{-0.5, 0, 0, 0.5, 0.5, 0.5},
},
}, },
}, },
["_half"] = { },
node_box = { ["_half"] = {
type = "fixed", node_box = {
fixed = { type = "fixed",
{-0.5, -0.5, -0.5, 0, 0, 0.5}, fixed = {
{-0.5, 0, 0, 0, 0.5, 0.5}, {-0.5, -0.5, -0.5, 0, 0, 0.5},
}, {-0.5, 0, 0, 0, 0.5, 0.5},
}, },
}, },
["_right_half" ]= { },
node_box = { ["_right_half" ]= {
type = "fixed", node_box = {
fixed = { type = "fixed",
{0, -0.5, -0.5, 0.5, 0, 0.5}, fixed = {
{0, 0, 0, 0.5, 0.5, 0.5}, {0, -0.5, -0.5, 0.5, 0, 0.5},
}, {0, 0, 0, 0.5, 0.5, 0.5},
}, },
}, },
["_inner"] = { },
node_box = { ["_inner"] = {
type = "fixed", node_box = {
fixed = { type = "fixed",
{-0.5, -0.5, -0.5, 0.5, 0, 0.5}, fixed = {
{-0.5, 0, 0, 0.5, 0.5, 0.5}, {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
{-0.5, 0, -0.5, 0, 0.5, 0}, {-0.5, 0, 0, 0.5, 0.5, 0.5},
}, {-0.5, 0, -0.5, 0, 0.5, 0},
}, },
}, },
["_outer"] = { },
node_box = { ["_outer"] = {
type = "fixed", node_box = {
fixed = { type = "fixed",
{-0.5, -0.5, -0.5, 0.5, 0, 0.5}, fixed = {
{-0.5, 0, 0, 0, 0.5, 0.5}, {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
}, {-0.5, 0, 0, 0, 0.5, 0.5},
}, },
}, },
["_alt"] = { },
node_box = { ["_alt"] = {
type = "fixed", node_box = {
fixed = { type = "fixed",
{-0.5, -0.5, -0.5, 0.5, 0, 0}, fixed = {
{-0.5, 0, 0, 0.5, 0.5, 0.5}, {-0.5, -0.5, -0.5, 0.5, 0, 0},
}, {-0.5, 0, 0, 0.5, 0.5, 0.5},
}, },
}, },
["_alt_1"] = { },
node_box = { ["_alt_1"] = {
type = "fixed", node_box = {
fixed = { type = "fixed",
{-0.5, -0.0625, -0.5, 0.5, 0, 0}, fixed = {
{-0.5, 0.4375, 0, 0.5, 0.5, 0.5}, {-0.5, -0.0625, -0.5, 0.5, 0, 0},
}, {-0.5, 0.4375, 0, 0.5, 0.5, 0.5},
}, },
}, },
["_alt_2"] = { },
node_box = { ["_alt_2"] = {
type = "fixed", node_box = {
fixed = { type = "fixed",
{-0.5, -0.125, -0.5, 0.5, 0, 0}, fixed = {
{-0.5, 0.375, 0, 0.5, 0.5, 0.5}, {-0.5, -0.125, -0.5, 0.5, 0, 0},
}, {-0.5, 0.375, 0, 0.5, 0.5, 0.5},
}, },
}, },
["_alt_4"] = { },
node_box = { ["_alt_4"] = {
type = "fixed", node_box = {
fixed = { type = "fixed",
{-0.5, -0.25, -0.5, 0.5, 0, 0}, fixed = {
{-0.5, 0.25, 0, 0.5, 0.5, 0.5}, {-0.5, -0.25, -0.5, 0.5, 0, 0},
}, {-0.5, 0.25, 0, 0.5, 0.5, 0.5},
}, },
}, },
} },
}
function stairsplus:register_stair_alias(modname_old, subname_old, modname_new, subname_new)
local defs = stairsplus.copytable(stairs_defs)
for alternate, def in pairs(defs) do
minetest.register_alias(modname_old .. ":stair_" .. subname_old .. alternate, modname_new .. ":stair_" .. subname_new .. alternate)
end
end
function stairsplus:register_stair_alias_force(modname_old, subname_old, modname_new, subname_new)
local defs = stairsplus.copytable(stairs_defs)
for alternate, def in pairs(defs) do
minetest.register_alias_force(modname_old .. ":stair_" .. subname_old .. alternate, modname_new .. ":stair_" .. subname_new .. alternate)
end
end
function stairsplus:register_stair(modname, subname, recipeitem, fields)
local defs = stairsplus.copytable(stairs_defs)
local desc = S("%s Stairs"):format(fields.description) local desc = S("%s Stairs"):format(fields.description)
for alternate, def in pairs(defs) do for alternate, def in pairs(defs) do
for k, v in pairs(fields) do for k, v in pairs(fields) do
@ -127,7 +142,7 @@ function stairsplus:register_stair(modname, subname, recipeitem, fields)
circular_saw.known_nodes[recipeitem] = {modname, subname} circular_saw.known_nodes[recipeitem] = {modname, subname}
-- Some saw-less recipes: -- Some saw-less recipes:
minetest.register_craft({ minetest.register_craft({
output = modname .. ":stair_" .. subname .. " 8", output = modname .. ":stair_" .. subname .. " 8",
recipe = { recipe = {
@ -145,67 +160,67 @@ function stairsplus:register_stair(modname, subname, recipeitem, fields)
{recipeitem, recipeitem, recipeitem}, {recipeitem, recipeitem, recipeitem},
}, },
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = modname .. ":stair_" .. subname, output = modname .. ":stair_" .. subname,
recipe = {modname .. ":panel_" .. subname, modname .. ":slab_" .. subname}, recipe = {modname .. ":panel_" .. subname, modname .. ":slab_" .. subname},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = modname .. ":stair_" .. subname, output = modname .. ":stair_" .. subname,
recipe = {modname .. ":panel_" .. subname, modname .. ":panel_" .. subname, modname .. ":panel_" .. subname}, recipe = {modname .. ":panel_" .. subname, modname .. ":panel_" .. subname, modname .. ":panel_" .. subname},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = modname .. ":stair_" .. subname .. "_outer", output = modname .. ":stair_" .. subname .. "_outer",
recipe = {modname .. ":micro_" .. subname, modname .. ":slab_" .. subname}, recipe = {modname .. ":micro_" .. subname, modname .. ":slab_" .. subname},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = modname .. ":stair_" .. subname .. "_half", output = modname .. ":stair_" .. subname .. "_half",
recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname}, recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = modname .. ":stair_" .. subname .. "_half", output = modname .. ":stair_" .. subname .. "_half",
recipe = {modname .. ":panel_" .. subname, modname .. ":micro_" .. subname}, recipe = {modname .. ":panel_" .. subname, modname .. ":micro_" .. subname},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = modname .. ":stair_" .. subname .. "_right_half", output = modname .. ":stair_" .. subname .. "_right_half",
recipe = {modname .. ":stair_" .. subname .. "_half"}, recipe = {modname .. ":stair_" .. subname .. "_half"},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = modname .. ":stair_" .. subname, output = modname .. ":stair_" .. subname,
recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname}, recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = modname .. ":stair_" .. subname .. "_inner", output = modname .. ":stair_" .. subname .. "_inner",
recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname}, recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = modname .. ":stair_" .. subname .. "_outer", output = modname .. ":stair_" .. subname .. "_outer",
recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname}, recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = modname .. ":stair_" .. subname, output = modname .. ":stair_" .. subname,
recipe = {modname .. ":panel_" .. subname, modname .. ":panel_" .. subname, modname .. ":panel_" .. subname}, recipe = {modname .. ":panel_" .. subname, modname .. ":panel_" .. subname, modname .. ":panel_" .. subname},
}) })
minetest.register_craft({ -- See mirrored variation of the recipe below. minetest.register_craft({ -- See mirrored variation of the recipe below.
output = modname .. ":stair_" .. subname .. "_alt", output = modname .. ":stair_" .. subname .. "_alt",
recipe = { recipe = {
@ -213,7 +228,7 @@ function stairsplus:register_stair(modname, subname, recipeitem, fields)
{"" , modname .. ":panel_" .. subname}, {"" , modname .. ":panel_" .. subname},
}, },
}) })
minetest.register_craft({ -- Mirrored variation of the recipe above. minetest.register_craft({ -- Mirrored variation of the recipe above.
output = modname .. ":stair_" .. subname .. "_alt", output = modname .. ":stair_" .. subname .. "_alt",
recipe = { recipe = {

View File

@ -312,7 +312,7 @@ local on_digiline_receive_alnum = function(pos, node, channel, msg)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local setchan = meta:get_string("channel") local setchan = meta:get_string("channel")
if setchan ~= channel then return end if setchan ~= channel then return end
if msg and msg ~= "" then if msg and msg ~= "" and type(msg) == "string" then
local asc = string.byte(msg) local asc = string.byte(msg)
if msg == "off" then if msg == "off" then
minetest.swap_node(pos, { name = "nixie_tubes:alnum_32", param2 = node.param2}) minetest.swap_node(pos, { name = "nixie_tubes:alnum_32", param2 = node.param2})
@ -328,6 +328,16 @@ local on_digiline_receive_alnum = function(pos, node, channel, msg)
minetest.swap_node(pos, { name = "nixie_tubes:alnum_129", param2 = node.param2}) minetest.swap_node(pos, { name = "nixie_tubes:alnum_129", param2 = node.param2})
elseif asc > 31 and alnum_chars[asc - 31] then elseif asc > 31 and alnum_chars[asc - 31] then
minetest.swap_node(pos, { name = "nixie_tubes:alnum_"..asc, param2 = node.param2}) minetest.swap_node(pos, { name = "nixie_tubes:alnum_"..asc, param2 = node.param2})
elseif msg == "get" then -- get value as ASCII numerical value
digiline:receptor_send(pos, digiline.rules.default, channel, tonumber(string.match(minetest.get_node(pos).name,"nixie_tubes:alnum_(.+)"))) -- wonderfully horrible string manipulaiton
elseif msg == "getstr" then -- get actual char
digiline:receptor_send(pos, digiline.rules.default, channel, string.char(tonumber(string.match(minetest.get_node(pos).name,"nixie_tubes:alnum_(.+)"))))
end
elseif msg and type(msg) == "number" then
if msg == 0 then
minetest.swap_node(pos, { name = "nixie_tubes:alnum_32", param2 = node.param2})
elseif msg > 31 and alnum_chars[msg - 31] ~= nil then
minetest.swap_node(pos, { name = "nixie_tubes:alnum_"..tostring(msg), param2 = node.param2})
end end
end end
end end

View File

@ -52,14 +52,40 @@ local function set_filter_formspec(data, meta)
end end
-- todo SOON: this function has *way too many* parameters -- todo SOON: this function has *way too many* parameters
local function grabAndFire(data,slotseq_mode,exmatch_mode,filtmeta,frominv,frominvname,frompos,fromnode,filterfor,fromtube,fromdef,dir,fakePlayer,all) local function grabAndFire(data,slotseq_mode,exmatch_mode,filtmeta,frominv,frominvname,frompos,fromnode,filterfor,fromtube,fromdef,dir,fakePlayer,all,digiline)
local sposes = {} local sposes = {}
for spos,stack in ipairs(frominv:get_list(frominvname)) do for spos,stack in ipairs(frominv:get_list(frominvname)) do
local matches local matches
if filterfor == "" then if filterfor == "" then
matches = stack:get_name() ~= "" matches = stack:get_name() ~= ""
else else
matches = stack:get_name() == filterfor.name local fname = filterfor.name
local fgroup = filterfor.group
local fwear = filterfor.wear
local fmetadata = filterfor.metadata
matches = (not fname -- If there's a name filter,
or stack:get_name() == fname) -- it must match.
and (not fgroup -- If there's a group filter,
or (type(fgroup) == "string" -- it must be a string
and minetest.get_item_group( -- and it must match.
stack:get_name(), fgroup) ~= 0))
and (not fwear -- If there's a wear filter:
or (type(fwear) == "number" -- If it's a number,
and stack:get_wear() == fwear) -- it must match.
or (type(fwear) == "table" -- If it's a table:
and (not fwear[1] -- If there's a lower bound,
or (type(fwear[1]) == "number" -- it must be a number
and fwear[1] <= stack:get_wear())) -- and it must be <= the actual wear.
and (not fwear[2] -- If there's an upper bound
or (type(fwear[2]) == "number" -- it must be a number
and stack:get_wear() < fwear[2])))) -- and it must be > the actual wear.
-- If the wear filter is of any other type, fail.
--
and (not fmetadata -- If there's a matadata filter,
or (type(fmetadata) == "string" -- it must be a string
and stack:get_metadata() == fmetadata)) -- and it must match.
end end
if matches then table.insert(sposes, spos) end if matches then table.insert(sposes, spos) end
end end
@ -104,10 +130,11 @@ local function grabAndFire(data,slotseq_mode,exmatch_mode,filtmeta,frominv,fromi
local count local count
if all then if all then
count = math.min(stack:get_count(), doRemove) count = math.min(stack:get_count(), doRemove)
if filterfor.count and filterfor.count > 1 then if filterfor.count and (filterfor.count > 1 or digiline) then
if exmatch_mode ~= 0 and filterfor.count > count then if exmatch_mode ~= 0 and filterfor.count > count then
return false return false -- not enough, fail
else else
-- limit quantity to filter amount
count = math.min(filterfor.count, count) count = math.min(filterfor.count, count)
end end
end end
@ -155,6 +182,20 @@ local function punch_filter(data, filtpos, filtnode, msg)
local filters = {} local filters = {}
if data.digiline then if data.digiline then
local function add_filter(name, group, count, wear, metadata)
table.insert(filters, {name = name, group = group, count = count, wear = wear, metadata = metadata})
end
local function add_itemstring_filter(filter)
local filterstack = ItemStack(filter)
local filtername = filterstack:get_name()
local filtercount = filterstack:get_count()
local filterwear = string.match(filter, "%S*:%S*%s%d%s(%d)") and filterstack:get_wear()
local filtermetadata = string.match(filter, "%S*:%S*%s%d%s%d(%s.*)") and filterstack:get_metadata()
add_filter(filtername, nil, filtercount, filterwear, filtermetadata)
end
local t_msg = type(msg) local t_msg = type(msg)
if t_msg == "table" then if t_msg == "table" then
local slotseq = msg.slotseq local slotseq = msg.slotseq
@ -206,28 +247,22 @@ local function punch_filter(data, filtpos, filtnode, msg)
return return
end end
if type(msg.name) == "string" then if msg.name or msg.group or msg.count or msg.wear or msg.metadata then
table.insert(filters, {name = msg.name, count = tonumber(msg.count) or 1}) add_filter(msg.name, msg.group, msg.count, msg.wear, msg.metadata)
else else
for _, filter in ipairs(msg) do for _, filter in ipairs(msg) do
local t_filter = type(filter) local t_filter = type(filter)
if t_filter == "table" then if t_filter == "table" then
if type(filter.name) == "string" then if filter.name or filter.group or filter.count or filter.wear or filter.metadata then
table.insert(filters, {name = filter.name, count = tonumber(filter.count) or 1}) add_filter(filter.name, filter.group, filter.count, filter.wear, filter.metadata)
end end
elseif t_filter == "string" then elseif t_filter == "string" then
local filterstack = ItemStack(filter) add_itemstring_filter(filter)
local filtername = filterstack:get_name()
local filtercount = filterstack:get_count()
if filtername ~= "" then table.insert(filters, {name = filtername, count = filtercount}) end
end end
end end
end end
elseif t_msg == "string" then elseif t_msg == "string" then
local filterstack = ItemStack(msg) add_itemstring_filter(msg)
local filtername = filterstack:get_name()
local filtercount = filterstack:get_count()
if filtername ~= "" then table.insert(filters, {name = filtername, count = filtercount}) end
end end
else else
for _, filterstack in ipairs(filtinv:get_list("main")) do for _, filterstack in ipairs(filtinv:get_list("main")) do
@ -252,7 +287,7 @@ local function punch_filter(data, filtpos, filtnode, msg)
for _, frominvname in ipairs(type(fromtube.input_inventory) == "table" and fromtube.input_inventory or {fromtube.input_inventory}) do for _, frominvname in ipairs(type(fromtube.input_inventory) == "table" and fromtube.input_inventory or {fromtube.input_inventory}) do
local done = false local done = false
for _, filterfor in ipairs(filters) do for _, filterfor in ipairs(filters) do
if grabAndFire(data, slotseq_mode, exact_match, filtmeta, frominv, frominvname, frompos, fromnode, filterfor, fromtube, fromdef, dir, fakePlayer, data.stackwise) then if grabAndFire(data, slotseq_mode, exact_match, filtmeta, frominv, frominvname, frompos, fromnode, filterfor, fromtube, fromdef, dir, fakePlayer, data.stackwise, data.digiline) then
done = true done = true
break break
end end

View File

@ -9,6 +9,8 @@
-- { delta = {entity position for 270° yaw}, exact yaw expression } -- { delta = {entity position for 270° yaw}, exact yaw expression }
-- { delta = {entity position for 90° yaw}, exact yaw expression } -- { delta = {entity position for 90° yaw}, exact yaw expression }
-- } -- }
-- Made colored metal signs optionals
local enable_colored_metal_signs = true
-- CWz's keyword interact mod uses this setting. -- CWz's keyword interact mod uses this setting.
local current_keyword = minetest.setting_get("interact_keyword") or "iaccept" local current_keyword = minetest.setting_get("interact_keyword") or "iaccept"
@ -844,47 +846,48 @@ if minetest.registered_nodes["default:sign_wall_steel"] then
end end
-- metal, colored signs -- metal, colored signs
if enable_colored_metal_signs then
local sign_colors = { "green", "yellow", "red", "white_red", "white_black", "orange", "blue", "brown" }
local sign_default_text_colors = { "f", "0", "f", "4", "0", "0", "f", "f" }
local sign_colors = { "green", "yellow", "red", "white_red", "white_black", "orange", "blue", "brown" } for i, color in ipairs(sign_colors) do
local sign_default_text_colors = { "f", "0", "f", "4", "0", "0", "f", "f" } minetest.register_node(":signs:sign_wall_"..color, {
description = S("Sign ("..color..", metal)"),
for i, color in ipairs(sign_colors) do inventory_image = "signs_"..color.."_inv.png",
minetest.register_node(":signs:sign_wall_"..color, { wield_image = "signs_"..color.."_inv.png",
description = S("Sign ("..color..", metal)"), node_placement_prediction = "",
inventory_image = "signs_"..color.."_inv.png", paramtype = "light",
wield_image = "signs_"..color.."_inv.png", sunlight_propagates = true,
node_placement_prediction = "", paramtype2 = "facedir",
paramtype = "light", drawtype = "nodebox",
sunlight_propagates = true, node_box = signs_lib.metal_wall_sign_model.nodebox,
paramtype2 = "facedir", tiles = {
drawtype = "nodebox", "signs_metal_tb.png",
node_box = signs_lib.metal_wall_sign_model.nodebox, "signs_metal_tb.png",
tiles = { "signs_metal_sides.png",
"signs_metal_tb.png", "signs_metal_sides.png",
"signs_metal_tb.png", "signs_metal_back.png",
"signs_metal_sides.png", "signs_"..color.."_front.png"
"signs_metal_sides.png", },
"signs_metal_back.png", default_color = sign_default_text_colors[i],
"signs_"..color.."_front.png" groups = sign_groups,
}, on_place = function(itemstack, placer, pointed_thing)
default_color = sign_default_text_colors[i], return signs_lib.determine_sign_type(itemstack, placer, pointed_thing)
groups = sign_groups, end,
on_place = function(itemstack, placer, pointed_thing) on_construct = function(pos)
return signs_lib.determine_sign_type(itemstack, placer, pointed_thing) signs_lib.construct_sign(pos)
end, end,
on_construct = function(pos) on_destruct = function(pos)
signs_lib.construct_sign(pos) signs_lib.destruct_sign(pos)
end, end,
on_destruct = function(pos) on_receive_fields = function(pos, formname, fields, sender)
signs_lib.destruct_sign(pos) signs_lib.receive_fields(pos, formname, fields, sender)
end, end,
on_receive_fields = function(pos, formname, fields, sender) on_punch = function(pos, node, puncher)
signs_lib.receive_fields(pos, formname, fields, sender) signs_lib.update_sign(pos)
end, end,
on_punch = function(pos, node, puncher) })
signs_lib.update_sign(pos) end
end,
})
end end
local signs_text_on_activate local signs_text_on_activate
@ -1022,134 +1025,136 @@ minetest.register_craft({
}) })
-- craft recipes for the metal signs -- craft recipes for the metal signs
if enable_colored_metal_signs then
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_green", output = "signs:sign_wall_green",
recipe = { recipe = {
{ "dye:dark_green", "dye:white", "dye:dark_green" }, { "dye:dark_green", "dye:white", "dye:dark_green" },
{ "", default_sign_metal, "" } { "", default_sign_metal, "" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_green 2", output = "signs:sign_wall_green 2",
recipe = { recipe = {
{ "dye:dark_green", "dye:white", "dye:dark_green" }, { "dye:dark_green", "dye:white", "dye:dark_green" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" } { "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_yellow", output = "signs:sign_wall_yellow",
recipe = { recipe = {
{ "dye:yellow", "dye:black", "dye:yellow" }, { "dye:yellow", "dye:black", "dye:yellow" },
{ "", default_sign_metal, "" } { "", default_sign_metal, "" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_yellow 2", output = "signs:sign_wall_yellow 2",
recipe = { recipe = {
{ "dye:yellow", "dye:black", "dye:yellow" }, { "dye:yellow", "dye:black", "dye:yellow" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" } { "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_red", output = "signs:sign_wall_red",
recipe = { recipe = {
{ "dye:red", "dye:white", "dye:red" }, { "dye:red", "dye:white", "dye:red" },
{ "", default_sign_metal, "" } { "", default_sign_metal, "" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_red 2", output = "signs:sign_wall_red 2",
recipe = { recipe = {
{ "dye:red", "dye:white", "dye:red" }, { "dye:red", "dye:white", "dye:red" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" } { "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_white_red", output = "signs:sign_wall_white_red",
recipe = { recipe = {
{ "dye:white", "dye:red", "dye:white" }, { "dye:white", "dye:red", "dye:white" },
{ "", default_sign_metal, "" } { "", default_sign_metal, "" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_white_red 2", output = "signs:sign_wall_white_red 2",
recipe = { recipe = {
{ "dye:white", "dye:red", "dye:white" }, { "dye:white", "dye:red", "dye:white" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" } { "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_white_black", output = "signs:sign_wall_white_black",
recipe = { recipe = {
{ "dye:white", "dye:black", "dye:white" }, { "dye:white", "dye:black", "dye:white" },
{ "", default_sign_metal, "" } { "", default_sign_metal, "" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_white_black 2", output = "signs:sign_wall_white_black 2",
recipe = { recipe = {
{ "dye:white", "dye:black", "dye:white" }, { "dye:white", "dye:black", "dye:white" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" } { "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_orange", output = "signs:sign_wall_orange",
recipe = { recipe = {
{ "dye:orange", "dye:black", "dye:orange" }, { "dye:orange", "dye:black", "dye:orange" },
{ "", default_sign_metal, "" } { "", default_sign_metal, "" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_orange 2", output = "signs:sign_wall_orange 2",
recipe = { recipe = {
{ "dye:orange", "dye:black", "dye:orange" }, { "dye:orange", "dye:black", "dye:orange" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" } { "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_blue", output = "signs:sign_wall_blue",
recipe = { recipe = {
{ "dye:blue", "dye:white", "dye:blue" }, { "dye:blue", "dye:white", "dye:blue" },
{ "", default_sign_metal, "" } { "", default_sign_metal, "" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_blue 2", output = "signs:sign_wall_blue 2",
recipe = { recipe = {
{ "dye:blue", "dye:white", "dye:blue" }, { "dye:blue", "dye:white", "dye:blue" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" } { "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_brown", output = "signs:sign_wall_brown",
recipe = { recipe = {
{ "dye:brown", "dye:white", "dye:brown" }, { "dye:brown", "dye:white", "dye:brown" },
{ "", default_sign_metal, "" } { "", default_sign_metal, "" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_brown 2", output = "signs:sign_wall_brown 2",
recipe = { recipe = {
{ "dye:brown", "dye:white", "dye:brown" }, { "dye:brown", "dye:white", "dye:brown" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" } { "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
}, },
}) })
end
if minetest.setting_get("log_mods") then if minetest.setting_get("log_mods") then
minetest.log("action", S("signs loaded")) minetest.log("action", S("signs loaded"))

View File

@ -63,64 +63,129 @@ technic.tube_inject_item = pipeworks.tube_inject_item or function(pos, start_pos
end end
-- Based on code by Uberi: https://gist.github.com/Uberi/3125280 --- Iterates over the node positions along the specified ray.
-- The returned positions will not include the starting position.
function technic.trace_node_ray(pos, dir, range) function technic.trace_node_ray(pos, dir, range)
local p = vector.round(pos) local x_step = dir.x > 0 and 1 or -1
local x_step, y_step, z_step = 0, 0, 0 local y_step = dir.y > 0 and 1 or -1
local x_component, y_component, z_component = 0, 0, 0 local z_step = dir.z > 0 and 1 or -1
local x_intersect, y_intersect, z_intersect = 0, 0, 0
if dir.x == 0 then local i = 1
x_intersect = math.huge return function(p)
elseif dir.x > 0 then -- Approximation of where we should be if we weren't rounding
x_step = 1 -- to nodes. This moves forward a bit faster then we do.
x_component = 1 / dir.x -- A correction is done below.
x_intersect = x_component local real_x = pos.x + (dir.x * i)
else local real_y = pos.y + (dir.y * i)
x_step = -1 local real_z = pos.z + (dir.z * i)
x_component = 1 / -dir.x
end
if dir.y == 0 then
y_intersect = math.huge
elseif dir.y > 0 then
y_step = 1
y_component = 1 / dir.y
y_intersect = y_component
else
y_step = -1
y_component = 1 / -dir.y
end
if dir.z == 0 then
z_intersect = math.huge
elseif dir.z > 0 then
z_step = 1
z_component = 1 / dir.z
z_intersect = z_component
else
z_step = -1
z_component = 1 / -dir.z
end
return function() -- How far off we've gotten from where we should be.
if x_intersect < y_intersect then local dx = math.abs(real_x - p.x)
if x_intersect < z_intersect then local dy = math.abs(real_y - p.y)
local dz = math.abs(real_z - p.z)
-- If the real position moves ahead too fast, stop it so we
-- can catch up. If it gets too far ahead it will smooth
-- out our movement too much and we won't turn fast enough.
if dx + dy + dz < 2 then
i = i + 1
end
-- Step in whichever direction we're most off course in.
if dx > dy then
if dx > dz then
p.x = p.x + x_step p.x = p.x + x_step
x_intersect = x_intersect + x_component
else else
p.z = p.z + z_step p.z = p.z + z_step
z_intersect = z_intersect + z_component
end end
elseif y_intersect < z_intersect then elseif dy > dz then
p.y = p.y + y_step p.y = p.y + y_step
y_intersect = y_intersect + y_component
else else
p.z = p.z + z_step p.z = p.z + z_step
z_intersect = z_intersect + z_component
end end
if vector.distance(pos, p) > range then if vector.distance(pos, p) > range then
return nil return nil
end end
return p return p
end end, vector.round(pos)
end
--- Like trace_node_ray, but includes extra positions close to the ray.
function technic.trace_node_ray_fat(pos, dir, range)
local x_step = dir.x > 0 and 1 or -1
local y_step = dir.y > 0 and 1 or -1
local z_step = dir.z > 0 and 1 or -1
local next_poses = {}
local i = 1
return function(p)
local ni, np = next(next_poses)
if np then
next_poses[ni] = nil
return np
end
-- Approximation of where we should be if we weren't rounding
-- to nodes. This moves forward a bit faster then we do.
-- A correction is done below.
local real_x = pos.x + (dir.x * i)
local real_y = pos.y + (dir.y * i)
local real_z = pos.z + (dir.z * i)
-- How far off we've gotten from where we should be.
local dx = math.abs(real_x - p.x)
local dy = math.abs(real_y - p.y)
local dz = math.abs(real_z - p.z)
-- If the real position moves ahead too fast, stop it so we
-- can catch up. If it gets too far ahead it will smooth
-- out our movement too much and we won't turn fast enough.
if dx + dy + dz < 2 then
i = i + 1
end
-- Step in whichever direction we're most off course in.
local sx, sy, sz -- Whether we've already stepped along each axis
if dx > dy then
if dx > dz then
sx = true
p.x = p.x + x_step
else
sz = true
p.z = p.z + z_step
end
elseif dy > dz then
sy = true
p.y = p.y + y_step
else
sz = true
p.z = p.z + z_step
end
if vector.distance(pos, p) > range then
return nil
end
-- Add other positions that we're significantly off on.
-- We can just use fixed integer keys here because the
-- table will be completely cleared before we reach this
-- code block again.
local dlen = math.sqrt(dx*dx + dy*dy + dz*dz)
-- Normalized axis deltas
local dxn, dyn, dzn = dx / dlen, dy / dlen, dz / dlen
if not sx and dxn > 0.5 then
next_poses[1] = vector.new(p.x + x_step, p.y, p.z)
end
if not sy and dyn > 0.5 then
next_poses[2] = vector.new(p.x, p.y + y_step, p.z)
end
if not sz and dzn > 0.5 then
next_poses[3] = vector.new(p.x, p.y, p.z + z_step)
end
return p
end, vector.round(pos)
end end

View File

@ -33,8 +33,15 @@ local function check_wind_mill(pos)
if pos.y < 30 then if pos.y < 30 then
return false return false
end end
pos = {x=pos.x, y=pos.y, z=pos.z}
for i = 1, 20 do for i = 1, 20 do
local node = minetest.get_node({x=pos.x, y=pos.y-i, z=pos.z}) pos.y = pos.y - 1
local node = minetest.get_node_or_nil(pos)
if not node then
-- we reached CONTENT_IGNORE, we can assume, that nothing changed
-- as the user will have to load the block to change it
return
end
if node.name ~= "technic:wind_mill_frame" then if node.name ~= "technic:wind_mill_frame" then
return false return false
end end
@ -45,17 +52,17 @@ end
local run = function(pos, node) local run = function(pos, node)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local machine_name = S("Wind %s Generator"):format("MV") local machine_name = S("Wind %s Generator"):format("MV")
local power = math.min(pos.y * 100, 5000)
if not check_wind_mill(pos) then local check = check_wind_mill(pos)
if check == false then
meta:set_int("MV_EU_supply", 0) meta:set_int("MV_EU_supply", 0)
meta:set_string("infotext", S("%s Improperly Placed"):format(machine_name)) meta:set_string("infotext", S("%s Improperly Placed"):format(machine_name))
return elseif check == true then
else local power = math.min(pos.y * 100, 5000)
meta:set_int("MV_EU_supply", power) meta:set_int("MV_EU_supply", power)
meta:set_string("infotext", S("@1 (@2 EU)", machine_name, technic.pretty_num(power)))
end end
-- check == nil: assume nothing has changed
meta:set_string("infotext", S("@1 (@2 EU)", machine_name, technic.pretty_num(power)))
end end
minetest.register_node("technic:wind_mill", { minetest.register_node("technic:wind_mill", {

View File

@ -320,7 +320,7 @@ local nodeboxes= {
else else
--local pointed_thing = {type = "node", under = pos} --local pointed_thing = {type = "node", under = pos}
if pointed_thing then if pointed_thing then
minetest.item_place_node(itemstack, placer, pointed_thing) return minetest.item_place_node(itemstack, placer, pointed_thing)
end end
end end
end, end,

View File

@ -38,8 +38,8 @@ local function laser_node(pos, node, player)
minetest.remove_node(pos) minetest.remove_node(pos)
minetest.add_particle({ minetest.add_particle({
pos = pos, pos = pos,
vel = {x=0, y=2, z=0}, velocity = {x=0, y=2, z=0},
acc = {x=0, y=-1, z=0}, acceleration = {x=0, y=-1, z=0},
expirationtime = 1.5, expirationtime = 1.5,
size = 6 + math.random() * 2, size = 6 + math.random() * 2,
texture = "smoke_puff.png^[transform" .. math.random(0, 7), texture = "smoke_puff.png^[transform" .. math.random(0, 7),
@ -61,17 +61,17 @@ local function laser_shoot(player, range, particle_texture, sound)
local start_pos = vector.new(player_pos) local start_pos = vector.new(player_pos)
-- Adjust to head height -- Adjust to head height
start_pos.y = start_pos.y + 1.9 start_pos.y = start_pos.y + 1.6
minetest.add_particle({ minetest.add_particle({
pos = startpos, pos = startpos,
vel = dir, velocity = dir,
acc = vector.multiply(dir, 50), acceleration = vector.multiply(dir, 50),
expirationtime = range / 11, expirationtime = range / 11,
size = 1, size = 1,
texture = particle_texture .. "^[transform" .. math.random(0, 7), texture = particle_texture .. "^[transform" .. math.random(0, 7),
}) })
minetest.sound_play(sound, {pos = player_pos, max_hear_distance = range}) minetest.sound_play(sound, {pos = player_pos, max_hear_distance = range})
for pos in technic.trace_node_ray(start_pos, dir, range) do for pos in technic.trace_node_ray_fat(start_pos, dir, range) do
if minetest.is_protected(pos, player_name) then if minetest.is_protected(pos, player_name) then
minetest.record_protection_violation(pos, player_name) minetest.record_protection_violation(pos, player_name)
break break

View File

@ -82,9 +82,11 @@ minetest.after(0.01, function()
-- appears after a “maybe” -- appears after a “maybe”
local max_start = true local max_start = true
-- Let's iterate through the items madness! -- Let's iterate through the items madness!
for i=1,#def.drop.items do -- Handle invalid drop entries gracefully.
local drop_items = def.drop.items or { }
for i=1,#drop_items do
if max_items_left ~= nil and max_items_left <= 0 then break end if max_items_left ~= nil and max_items_left <= 0 then break end
local itit = def.drop.items[i] local itit = drop_items[i]
for j=1,#itit.items do for j=1,#itit.items do
local dstack = ItemStack(itit.items[j]) local dstack = ItemStack(itit.items[j])
if not dstack:is_empty() and dstack:get_name() ~= name then if not dstack:is_empty() and dstack:get_name() ~= name then
@ -133,7 +135,7 @@ minetest.after(0.01, function()
for _, recipes in pairs(unified_inventory.crafts_for.recipe) do for _, recipes in pairs(unified_inventory.crafts_for.recipe) do
for _, recipe in ipairs(recipes) do for _, recipe in ipairs(recipes) do
local ingredient_items = {} local ingredient_items = {}
for _, spec in ipairs(recipe.items) do for _, spec in pairs(recipe.items) do
local matches_spec = unified_inventory.canonical_item_spec_matcher(spec) local matches_spec = unified_inventory.canonical_item_spec_matcher(spec)
for _, name in ipairs(unified_inventory.items_list) do for _, name in ipairs(unified_inventory.items_list) do
if matches_spec(name) then if matches_spec(name) then

View File

@ -31,80 +31,18 @@ unified_inventory.register_button("bags", {
hide_lite=true hide_lite=true
}) })
for i = 1, 4 do
unified_inventory.register_page("bag1", { local bi = i
unified_inventory.register_page("bag"..bi, {
get_formspec = function(player) get_formspec = function(player)
local stack = player:get_inventory():get_stack("bag1", 1) local stack = player:get_inventory():get_stack("bag"..bi, 1)
local image = stack:get_definition().inventory_image local image = stack:get_definition().inventory_image
local formspec = "image[7,0;1,1;"..image.."]" local formspec = ("image[7,0;1,1;"..image.."]"
formspec = formspec.."label[0,0;"..F("Bag 1").."]" .."label[0,0;"..F("Bag @1", bi).."]"
formspec = formspec.."listcolors[#00000000;#00000000]" .."listcolors[#00000000;#00000000]"
formspec = formspec.."list[current_player;bag1contents;0,1;8,3;]" .."list[current_player;bag"..bi.."contents;0,1;8,3;]"
formspec = formspec.."listring[current_name;bag1contents]" .."listring[current_name;bag"..bi.."contents]"
formspec = formspec.."listring[current_player;main]" .."listring[current_player;main]")
local slots = stack:get_definition().groups.bagslots
if slots == 8 then
formspec = formspec.."background[0.06,0.99;7.92,7.52;ui_bags_sm_form.png]"
elseif slots == 16 then
formspec = formspec.."background[0.06,0.99;7.92,7.52;ui_bags_med_form.png]"
elseif slots == 24 then
formspec = formspec.."background[0.06,0.99;7.92,7.52;ui_bags_lg_form.png]"
end
return {formspec=formspec}
end,
})
unified_inventory.register_page("bag2", {
get_formspec = function(player)
local stack = player:get_inventory():get_stack("bag2", 1)
local image = stack:get_definition().inventory_image
local formspec = "image[7,0;1,1;"..image.."]"
formspec = formspec.."label[0,0;"..F("Bag 2").."]"
formspec = formspec.."listcolors[#00000000;#00000000]"
formspec = formspec.."list[current_player;bag2contents;0,1;8,3;]"
formspec = formspec.."listring[current_name;bag2contents]"
formspec = formspec.."listring[current_player;main]"
local slots = stack:get_definition().groups.bagslots
if slots == 8 then
formspec = formspec.."background[0.06,0.99;7.92,7.52;ui_bags_sm_form.png]"
elseif slots == 16 then
formspec = formspec.."background[0.06,0.99;7.92,7.52;ui_bags_med_form.png]"
elseif slots == 24 then
formspec = formspec.."background[0.06,0.99;7.92,7.52;ui_bags_lg_form.png]"
end
return {formspec=formspec}
end,
})
unified_inventory.register_page("bag3", {
get_formspec = function(player)
local stack = player:get_inventory():get_stack("bag3", 1)
local image = stack:get_definition().inventory_image
local formspec = "image[7,0;1,1;"..image.."]"
formspec = formspec.."label[0,0;"..F("Bag 3").."]"
formspec = formspec.."listcolors[#00000000;#00000000]"
formspec = formspec.."list[current_player;bag3contents;0,1;8,3;]"
formspec = formspec.."listring[current_name;bag3contents]"
formspec = formspec.."listring[current_player;main]"
local slots = stack:get_definition().groups.bagslots
if slots == 8 then
formspec = formspec.."background[0.06,0.99;7.92,7.52;ui_bags_sm_form.png]"
elseif slots == 16 then
formspec = formspec.."background[0.06,0.99;7.92,7.52;ui_bags_med_form.png]"
elseif slots == 24 then
formspec = formspec.."background[0.06,0.99;7.92,7.52;ui_bags_lg_form.png]"
end
return {formspec=formspec}
end,
})
unified_inventory.register_page("bag4", {
get_formspec = function(player)
local stack = player:get_inventory():get_stack("bag4", 1)
local image = stack:get_definition().inventory_image
local formspec = "image[7,0;1,1;"..image.."]"
formspec = formspec.."label[0,0;"..F("Bag 4").."]"
formspec = formspec.."listcolors[#00000000;#00000000]"
formspec = formspec.."list[current_player;bag4contents;0,1;8,3;]"
formspec = formspec.."listring[current_name;bag4contents]"
formspec = formspec.."listring[current_player;main]"
local slots = stack:get_definition().groups.bagslots local slots = stack:get_definition().groups.bagslots
if slots == 8 then if slots == 8 then
formspec = formspec.."background[0.06,0.99;7.92,7.52;ui_bags_sm_form.png]" formspec = formspec.."background[0.06,0.99;7.92,7.52;ui_bags_sm_form.png]"
@ -113,9 +51,12 @@ unified_inventory.register_button("bags", {
elseif slots == 24 then elseif slots == 24 then
formspec = formspec.."background[0.06,0.99;7.92,7.52;ui_bags_lg_form.png]" formspec = formspec.."background[0.06,0.99;7.92,7.52;ui_bags_lg_form.png]"
end end
formspec = (formspec.."background[6.06,0;0.92,0.92;ui_bags_trash.png]"
.."list[detached:trash;main;6,0.1;1,1;]")
return {formspec=formspec} return {formspec=formspec}
end, end,
}) })
end
minetest.register_on_player_receive_fields(function(player, formname, fields) minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "" then if formname ~= "" then
@ -135,7 +76,8 @@ end)
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
local player_inv = player:get_inventory() local player_inv = player:get_inventory()
local bags_inv = minetest.create_detached_inventory(player:get_player_name().."_bags",{ local player_name = player:get_player_name()
local bags_inv = minetest.create_detached_inventory(player_name.."_bags",{
on_put = function(inv, listname, index, stack, player) on_put = function(inv, listname, index, stack, player)
player:get_inventory():set_stack(listname, index, stack) player:get_inventory():set_stack(listname, index, stack)
player:get_inventory():set_size(listname.."contents", player:get_inventory():set_size(listname.."contents",
@ -186,7 +128,7 @@ minetest.register_on_joinplayer(function(player)
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
return 0 return 0
end, end,
}) }, player_name)
for i=1,4 do for i=1,4 do
local bag = "bag"..i local bag = "bag"..i
player_inv:set_size(bag, 1) player_inv:set_size(bag, 1)

View File

@ -43,7 +43,7 @@ minetest.register_on_joinplayer(function(player)
minetest.sound_play("electricity", minetest.sound_play("electricity",
{to_player=player_name, gain = 1.0}) {to_player=player_name, gain = 1.0})
end, end,
}) }, player_name)
refill:set_size("main", 1) refill:set_size("main", 1)
end) end)
@ -154,7 +154,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end end
end end
if fields.searchbutton then if fields.searchbutton
or fields.key_enter_field == "searchbox" then
unified_inventory.apply_filter(player, unified_inventory.current_searchbox[player_name], "nochange") unified_inventory.apply_filter(player, unified_inventory.current_searchbox[player_name], "nochange")
unified_inventory.set_inventory_formspec(player, unified_inventory.set_inventory_formspec(player,
unified_inventory.current_page[player_name]) unified_inventory.current_page[player_name])

View File

@ -1,4 +1,6 @@
default
creative? creative?
sfinv?
intllib? intllib?
datastorage? datastorage?
farming? farming?

View File

@ -2,7 +2,15 @@
local modpath = minetest.get_modpath(minetest.get_current_modname()) local modpath = minetest.get_modpath(minetest.get_current_modname())
local worldpath = minetest.get_worldpath() local worldpath = minetest.get_worldpath()
local mygettext = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end local mygettext
if rawget(_G, "intllib") then
mygettext = intllib.Getter()
else
function mygettext(s, ...)
local t = { ... }
return (s:gsub("@(%d+)", function(n) return t[tonumber(n)] end))
end
end
-- Data tables definitions -- Data tables definitions
unified_inventory = { unified_inventory = {
@ -33,7 +41,7 @@ unified_inventory = {
-- intllib -- intllib
gettext = mygettext, gettext = mygettext,
fgettext = function(s) return minetest.formspec_escape(mygettext(s)) end, fgettext = function(...) return minetest.formspec_escape(mygettext(...)) end,
-- "Lite" mode -- "Lite" mode
lite_mode = minetest.setting_getbool("unified_inventory_lite"), lite_mode = minetest.setting_getbool("unified_inventory_lite"),
@ -57,16 +65,24 @@ if creative then
end end
end end
-- Disable sfinv inventory
local sfinv = rawget(_G, "sfinv")
if sfinv then
sfinv.enabled = false
end
dofile(modpath.."/group.lua") dofile(modpath.."/group.lua")
dofile(modpath.."/api.lua") dofile(modpath.."/api.lua")
dofile(modpath.."/internal.lua") dofile(modpath.."/internal.lua")
dofile(modpath.."/callbacks.lua") dofile(modpath.."/callbacks.lua")
dofile(modpath.."/register.lua") dofile(modpath.."/register.lua")
dofile(modpath.."/bags.lua")
if minetest.setting_getbool("unified_inventory_bags") ~= false then
dofile(modpath.."/bags.lua")
end
dofile(modpath.."/item_names.lua") dofile(modpath.."/item_names.lua")
if minetest.get_modpath("datastorage") then if minetest.get_modpath("datastorage") then
dofile(modpath.."/waypoints.lua") dofile(modpath.."/waypoints.lua")
end end

View File

@ -107,14 +107,23 @@ function unified_inventory.get_formspec(player, page)
end end
if def.type == "image" then if def.type == "image" then
formspec[n] = "image_button[" if (def.condition == nil or def.condition(player) == true) then
formspec[n+1] = ( ui_peruser.main_button_x + 0.65 * (i - 1) - button_col * 0.65 * 4) formspec[n] = "image_button["
formspec[n+2] = ","..(ui_peruser.main_button_y + button_row * 0.7)..";0.8,0.8;" formspec[n+1] = ( ui_peruser.main_button_x + 0.65 * (i - 1) - button_col * 0.65 * 4)
formspec[n+3] = minetest.formspec_escape(def.image)..";" formspec[n+2] = ","..(ui_peruser.main_button_y + button_row * 0.7)..";0.8,0.8;"
formspec[n+4] = minetest.formspec_escape(def.name)..";]" formspec[n+3] = minetest.formspec_escape(def.image)..";"
formspec[n+5] = "tooltip["..minetest.formspec_escape(def.name) formspec[n+4] = minetest.formspec_escape(def.name)..";]"
formspec[n+6] = ";"..(def.tooltip or "").."]" formspec[n+5] = "tooltip["..minetest.formspec_escape(def.name)
n = n+7 formspec[n+6] = ";"..(def.tooltip or "").."]"
n = n+7
else
formspec[n] = "image["
formspec[n+1] = ( ui_peruser.main_button_x + 0.65 * (i - 1) - button_col * 0.65 * 4)
formspec[n+2] = ","..(ui_peruser.main_button_y + button_row * 0.7)..";0.8,0.8;"
formspec[n+3] = minetest.formspec_escape(def.image).."^[colorize:#808080:alpha]"
n = n+4
end
end end
end end
@ -173,6 +182,8 @@ function unified_inventory.get_formspec(player, page)
n = n+1 n = n+1
-- Search box -- Search box
formspec[n] = "field_close_on_enter[searchbox;false]"
n = n+1
if not draw_lite_mode then if not draw_lite_mode then
formspec[n] = "field[9.5,8.325;3,1;searchbox;;" formspec[n] = "field[9.5,8.325;3,1;searchbox;;"

View File

@ -5,10 +5,7 @@ Digging (by chance) = Graben (durch Zufall)
### bags.lua ### ### bags.lua ###
Bags = Taschen Bags = Taschen
Bag 1 = Tasche 1 Bag @1 = Tasche @1
Bag 2 = Tasche 2
Bag 3 = Tasche 3
Bag 4 = Tasche 4
Small Bag = Kleine Tasche Small Bag = Kleine Tasche
Medium Bag = Mittelgroße Tasche Medium Bag = Mittelgroße Tasche
Large Bag = Große Tasche Large Bag = Große Tasche

View File

@ -1,12 +1,12 @@
# Translation by Diego Martínez <kaeza> # Translation by Diego Martínez <kaeza>
### api.lua ###
Digging (by chance) = Excavado (por azar)
# Template # Template
### bags.lua ### ### bags.lua ###
Bags = Bolsas Bags = Bolsas
Bag 1 = Bolsa 1 Bag @1 = Bolsa @1
Bag 2 = Bolsa 2
Bag 3 = Bolsa 3
Bag 4 = Bolsa 4
Small Bag = Bolsa Pequeña Small Bag = Bolsa Pequeña
Medium Bag = Bolsa Mediana Medium Bag = Bolsa Mediana
Large Bag = Bolsa Grande Large Bag = Bolsa Grande

View File

@ -3,10 +3,7 @@
# Template # Template
### bags.lua ### ### bags.lua ###
Bags = Sacs Bags = Sacs
Bag 1 = Sac 1 Bag @1 = Sac @1
Bag 2 = Sac 2
Bag 3 = Sac 3
Bag 4 = Sac 4
Small Bag = Petit sac Small Bag = Petit sac
Medium Bag = Sac moyen Medium Bag = Sac moyen
Large Bag = Grand sac Large Bag = Grand sac

View File

@ -2,10 +2,7 @@
### bags.lua ### ### bags.lua ###
Bags = Plecaki Bags = Plecaki
Bag 1 = Plecak 1 Bag @1 = Plecak @1
Bag 2 = Plecak 2
Bag 3 = Plecak 3
Bag 4 = Plecak 4
Small Bag = Maly plecak Small Bag = Maly plecak
Medium Bag = Sredni plecak Medium Bag = Sredni plecak
Large Bag = Duzy plecak Large Bag = Duzy plecak

View File

@ -3,10 +3,7 @@
# Template # Template
### bags.lua ### ### bags.lua ###
Bags = Сумки Bags = Сумки
Bag 1 = Сумка 1 Bag @1 = Сумка @1
Bag 2 = Сумка 2
Bag 3 = Сумка 3
Bag 4 = Сумка 4
Small Bag = Малая сумка Small Bag = Малая сумка
Medium Bag = Средняя сумка Medium Bag = Средняя сумка
Large Bag = Большая сумка Large Bag = Большая сумка

View File

@ -6,10 +6,7 @@ Digging (by chance) =
# Template # Template
### bags.lua ### ### bags.lua ###
Bags = Bags =
Bag 1 = Bag @1 =
Bag 2 =
Bag 3 =
Bag 4 =
Small Bag = Small Bag =
Medium Bag = Medium Bag =
Large Bag = Large Bag =

View File

@ -3,10 +3,7 @@
# Template # Template
### bags.lua ### ### bags.lua ###
Bags = Çantalarım Bags = Çantalarım
Bag 1 = 1. Çanta Bag @1 = @1. Çanta
Bag 2 = 2. Çanta
Bag 3 = 3. Çanta
Bag 4 = 4. Çanta
Small Bag = Küçük Çanta Small Bag = Küçük Çanta
Medium Bag = Çanta Medium Bag = Çanta
Large Bag = Büyük Çanta Large Bag = Büyük Çanta

View File

@ -59,8 +59,12 @@ unified_inventory.register_button("home_gui_set", {
else else
minetest.chat_send_player(player_name, minetest.chat_send_player(player_name,
S("You don't have the \"home\" privilege!")) S("You don't have the \"home\" privilege!"))
unified_inventory.set_inventory_formspec(player, unified_inventory.current_page[player_name])
end end
end, end,
condition = function(player)
return minetest.check_player_privs(player:get_player_name(), {home=true})
end,
}) })
unified_inventory.register_button("home_gui_go", { unified_inventory.register_button("home_gui_go", {
@ -77,8 +81,12 @@ unified_inventory.register_button("home_gui_go", {
else else
minetest.chat_send_player(player_name, minetest.chat_send_player(player_name,
S("You don't have the \"home\" privilege!")) S("You don't have the \"home\" privilege!"))
unified_inventory.set_inventory_formspec(player, unified_inventory.current_page[player_name])
end end
end, end,
condition = function(player)
return minetest.check_player_privs(player:get_player_name(), {home=true})
end,
}) })
unified_inventory.register_button("misc_set_day", { unified_inventory.register_button("misc_set_day", {
@ -97,8 +105,12 @@ unified_inventory.register_button("misc_set_day", {
else else
minetest.chat_send_player(player_name, minetest.chat_send_player(player_name,
S("You don't have the settime privilege!")) S("You don't have the settime privilege!"))
unified_inventory.set_inventory_formspec(player, unified_inventory.current_page[player_name])
end end
end, end,
condition = function(player)
return minetest.check_player_privs(player:get_player_name(), {settime=true})
end,
}) })
unified_inventory.register_button("misc_set_night", { unified_inventory.register_button("misc_set_night", {
@ -117,8 +129,12 @@ unified_inventory.register_button("misc_set_night", {
else else
minetest.chat_send_player(player_name, minetest.chat_send_player(player_name,
S("You don't have the settime privilege!")) S("You don't have the settime privilege!"))
unified_inventory.set_inventory_formspec(player, unified_inventory.current_page[player_name])
end end
end, end,
condition = function(player)
return minetest.check_player_privs(player:get_player_name(), {settime=true})
end,
}) })
unified_inventory.register_button("clear_inv", { unified_inventory.register_button("clear_inv", {
@ -133,6 +149,7 @@ unified_inventory.register_button("clear_inv", {
.." of creative mode to prevent" .." of creative mode to prevent"
.." accidental inventory trashing." .." accidental inventory trashing."
.."\nUse the trash slot instead.")) .."\nUse the trash slot instead."))
unified_inventory.set_inventory_formspec(player, unified_inventory.current_page[player_name])
return return
end end
player:get_inventory():set_list("main", {}) player:get_inventory():set_list("main", {})
@ -140,6 +157,9 @@ unified_inventory.register_button("clear_inv", {
minetest.sound_play("trash_all", minetest.sound_play("trash_all",
{to_player=player_name, gain = 1.0}) {to_player=player_name, gain = 1.0})
end, end,
condition = function(player)
return unified_inventory.is_creative(player:get_player_name())
end,
}) })
unified_inventory.register_page("craft", { unified_inventory.register_page("craft", {
@ -249,6 +269,12 @@ unified_inventory.register_page("craftguide", {
formspec = formspec.."listcolors[#00000000;#00000000]" formspec = formspec.."listcolors[#00000000;#00000000]"
local item_name = unified_inventory.current_item[player_name] local item_name = unified_inventory.current_item[player_name]
if not item_name then return {formspec=formspec} end if not item_name then return {formspec=formspec} end
local item_name_shown
if minetest.registered_items[item_name] and minetest.registered_items[item_name].description then
item_name_shown = string.format(S("%s (%s)"), minetest.registered_items[item_name].description, item_name)
else
item_name_shown = item_name
end
local dir = unified_inventory.current_craft_direction[player_name] local dir = unified_inventory.current_craft_direction[player_name]
local rdir local rdir
@ -264,7 +290,7 @@ unified_inventory.register_page("craftguide", {
formspec = formspec.."background[0.5,"..(formspecy + 0.2)..";8,3;ui_craftguide_form.png]" formspec = formspec.."background[0.5,"..(formspecy + 0.2)..";8,3;ui_craftguide_form.png]"
formspec = formspec.."textarea["..craftresultx..","..craftresulty formspec = formspec.."textarea["..craftresultx..","..craftresulty
..";10,1;;"..minetest.formspec_escape(F(role_text[dir])..": "..item_name)..";]" ..";10,1;;"..minetest.formspec_escape(F(role_text[dir])..": "..item_name_shown)..";]"
formspec = formspec..stack_image_button(0, formspecy, 1.1, 1.1, "item_button_" formspec = formspec..stack_image_button(0, formspecy, 1.1, 1.1, "item_button_"
.. rdir .. "_", ItemStack(item_name)) .. rdir .. "_", ItemStack(item_name))
@ -276,7 +302,7 @@ unified_inventory.register_page("craftguide", {
formspec = formspec.."image["..no_pos..","..formspecy..";1.1,1.1;ui_no.png]" formspec = formspec.."image["..no_pos..","..formspecy..";1.1,1.1;ui_no.png]"
formspec = formspec..stack_image_button(item_pos, formspecy, 1.1, 1.1, "item_button_" formspec = formspec..stack_image_button(item_pos, formspecy, 1.1, 1.1, "item_button_"
..other_dir[dir].."_", ItemStack(item_name)) ..other_dir[dir].."_", ItemStack(item_name))
if player_privs.give == true then if player_privs.give == true or player_privs.creative == true or minetest.setting_getbool("creative_mode") == true then
formspec = formspec.."label[0,"..(formspecy + 2.10)..";" .. F("Give me:") .. "]" formspec = formspec.."label[0,"..(formspecy + 2.10)..";" .. F("Give me:") .. "]"
.."button[0, "..(formspecy + 2.7)..";0.6,0.5;craftguide_giveme_1;1]" .."button[0, "..(formspecy + 2.7)..";0.6,0.5;craftguide_giveme_1;1]"
.."button[0.6,"..(formspecy + 2.7)..";0.7,0.5;craftguide_giveme_10;10]" .."button[0.6,"..(formspecy + 2.7)..";0.7,0.5;craftguide_giveme_10;10]"
@ -353,7 +379,7 @@ unified_inventory.register_page("craftguide", {
.."button[0.6,"..(formspecy + 1.5)..";0.7,0.5;craftguide_craft_10;10]" .."button[0.6,"..(formspecy + 1.5)..";0.7,0.5;craftguide_craft_10;10]"
.."button[1.3,"..(formspecy + 1.5)..";0.8,0.5;craftguide_craft_max;" .. F("All") .. "]" .."button[1.3,"..(formspecy + 1.5)..";0.8,0.5;craftguide_craft_max;" .. F("All") .. "]"
end end
if player_privs.give then if player_privs.give == true or player_privs.creative == true or minetest.setting_getbool("creative_mode") == true then
formspec = formspec.."label[0,"..(formspecy + 2.1)..";" .. F("Give me:") .. "]" formspec = formspec.."label[0,"..(formspecy + 2.1)..";" .. F("Give me:") .. "]"
.."button[0, "..(formspecy + 2.7)..";0.6,0.5;craftguide_giveme_1;1]" .."button[0, "..(formspecy + 2.7)..";0.6,0.5;craftguide_giveme_1;1]"
.."button[0.6,"..(formspecy + 2.7)..";0.7,0.5;craftguide_giveme_10;10]" .."button[0.6,"..(formspecy + 2.7)..";0.7,0.5;craftguide_giveme_10;10]"

View File

@ -0,0 +1,7 @@
#Enabling lite mode enables a smaller and simpler version of the Unified
#Inventory, optimized for small displays.
unified_inventory_lite (Lite mode) bool false
#If enabled, bags will be made available which can be used to extend
#inventory storage size.
unified_inventory_bags (Enable bags) bool true

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

1
unifiedbricks/mod.conf Normal file
View File

@ -0,0 +1 @@
name = unifiedbricks

Some files were not shown because too many files have changed in this diff Show More