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()
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
biome_lib:generate_block_no_aircheck(0.1)
if #biome_lib.blocklist_no_aircheck == 0 then return end

View File

@ -1,6 +1,7 @@
Minetest mod: boost_cart
==========================
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
@ -16,31 +17,22 @@ Target: Run smoothly as possible even on laggy server
License for everything
------------------------
CC-0
CC-0, if not specified otherwise below
Authors
---------
Hawk777
carts_rail_ss.png
carts_rail_*_ss.png
hexafraction
carts_rail_brk.png
carts_rail_*_brk.png
carts_rail_pwr.png
carts_rail_*_pwr.png
Various authors
carts_rail_*.png
kddekadenz
cart_bottom.png
cart_side.png
cart_top.png
numberZero
carts_rail_dtc.png
carts_rail_dtc_on.png
carts_rail_*_dtc.png
carts_rail_*_dtc_on.png
klankbeeld (CC-BY 3.0)
http://freesound.org/people/klankbeeld/sounds/174042/
cart_rail.*.ogg
Zeg9
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
mesecons?
moreores?
moreores?
carts?

View File

@ -26,7 +26,7 @@ end
boost_cart:register_rail("boost_cart:detectorrail", {
description = "Detector rail",
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"
},
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", {
description = "Detector rail ON (you hacker you)",
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"
},
groups = boost_cart:get_rail_groups({

View File

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

View File

@ -4,8 +4,8 @@ boost_cart.modpath = minetest.get_modpath("boost_cart")
-- Maximal speed of the cart in m/s
boost_cart.speed_max = 10
-- Set to nil to disable punching the cart from inside (min = -1)
boost_cart.punch_speed_min = 7
-- Set to -1 to disable punching the cart from inside
boost_cart.punch_speed_max = 7
if not boost_cart.modpath then
@ -13,363 +13,23 @@ if not boost_cart.modpath then
"See also: http://dev.minetest.net/Installing_Mods")
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
if not default.player_attached then
default.player_attached = {}
end
boost_cart.cart = {
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"},
dofile(boost_cart.modpath.."/functions.lua")
dofile(boost_cart.modpath.."/rails.lua")
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,
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
if minetest.global_exists("mesecon") then
dofile(boost_cart.modpath.."/detector.lua")
--else
-- minetest.register_alias("carts:powerrail", "boost_cart:detectorrail")
-- minetest.register_alias("carts:powerrail", "boost_cart:detectorrail_on")
end
function boost_cart.cart:on_activate(staticdata, dtime_s)
self.object:set_armor_groups({immortal=1})
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
boost_cart.mtg_compat = minetest.global_exists("carts") and carts.pathfinder
if boost_cart.mtg_compat then
minetest.log("action", "[boost_cart] Overwriting definitions of similar carts mod")
end
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"},
},
})
dofile(boost_cart.modpath.."/cart_entity.lua")

View File

@ -1,68 +1,53 @@
minetest.register_node(":default:rail", {
boost_cart:register_rail(":default:rail", {
description = "Rail",
drawtype = "raillike",
tiles = {
"default_rail.png", "default_rail_curved.png",
"default_rail_t_junction.png", "default_rail_crossing.png"
"carts_rail_straight.png", "carts_rail_curved.png",
"carts_rail_t_junction.png", "carts_rail_crossing.png"
},
inventory_image = "default_rail.png",
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(),
groups = boost_cart:get_rail_groups()
})
-- Moreores' copper rail
if minetest.get_modpath("moreores") then
-- Moreores' copper rail
minetest.register_alias("carts:copperrail", "moreores:copper_rail")
else
boost_cart:register_rail(":carts:copperrail", {
description = "Copper rail",
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"
},
groups = boost_cart:get_rail_groups(),
groups = boost_cart:get_rail_groups()
})
minetest.register_craft({
output = "carts:copperrail 12",
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"},
}
})
end
-- Speed up
-- Power rail
boost_cart:register_rail(":carts:powerrail", {
description = "Powered rail",
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"
},
groups = boost_cart:get_rail_groups(),
after_place_node = function(pos, placer, itemstack)
if not mesecon then
minetest.get_meta(pos):set_string("cart_acceleration", "0.5")
end
end,
mesecons = {
effector = {
action_on = function(pos, node)
boost_cart:boost_rail(pos, 0.5)
end,
action_off = function(pos, node)
minetest.get_meta(pos):set_string("cart_acceleration", "0")
end,
@ -79,26 +64,24 @@ minetest.register_craft({
}
})
-- Brake rail
boost_cart:register_rail(":carts:brakerail", {
description = "Brake rail",
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"
},
groups = boost_cart:get_rail_groups(),
after_place_node = function(pos, placer, itemstack)
if not mesecon then
minetest.get_meta(pos):set_string("cart_acceleration", "-0.3")
end
end,
mesecons = {
effector = {
action_on = function(pos, node)
minetest.get_meta(pos):set_string("cart_acceleration", "-0.3")
end,
action_off = function(pos, node)
minetest.get_meta(pos):set_string("cart_acceleration", "0")
end,
@ -118,23 +101,20 @@ minetest.register_craft({
boost_cart:register_rail("boost_cart:startstoprail", {
description = "Start-stop rail",
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"
},
groups = boost_cart:get_rail_groups(),
after_place_node = function(pos, placer, itemstack)
if not mesecon then
minetest.get_meta(pos):set_string("cart_acceleration", "halt")
end
end,
mesecons = {
effector = {
action_on = function(pos, node)
boost_cart:boost_rail(pos, 0.5)
end,
action_off = function(pos, node)
minetest.get_meta(pos):set_string("cart_acceleration", "halt")
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 = {
max_drop_level=0,
groupcaps={
choppy={times={[2]=7.50, [3]=2.80}, maxwear=0.01, maxlevel=1},
fleshy={times={[2]=5.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}, 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)
meta:set_string("infotext", "Ironbound Chest")
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()
inv:set_size("main", 8*3)
inv:set_size("main", 8*4)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
@ -329,6 +321,7 @@ minetest.register_node("castle:ironbound_chest",{
)
end
end,
on_blast = function() end,
})
minetest.register_craft({

View File

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

View File

@ -316,8 +316,8 @@ minetest.register_node("computer:server_on", {
tiles = {
'computer_server_t.png',
'computer_server_bt.png',
'computer_server_r.png',
'computer_server_l.png',
'computer_server_r.png',
'computer_server_bt.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},
sounds = default.node_sound_stone_defaults(),
on_blast = function(pos, intensity)
if intensity > 1 then
if intensity > 9 then
minetest.remove_node(pos)
minetest.add_item(pos, "technic:blast_resistant_concrete")
return {"technic:blast_resistant_concrete"}
end
end,
})

View File

@ -2,7 +2,7 @@ minetest.register_craft({
output = 'currency:safe',
recipe = {
{'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'},
}
})

View File

@ -8,7 +8,14 @@ function default.get_safe_formspec(pos)
end
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
end
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 =
"size[8,9]"..
"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 = {
{-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)
--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,
mesecons = {
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
end
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)

View File

@ -30,7 +30,11 @@ local function make_formspec(furnacedef, percent)
"list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;1,1;]"..
"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
--[[

View File

@ -35,7 +35,7 @@
CURVE_CHEVRON_LIGHT_RANGE = 12 -- an integer -> default = 12 | How much light do you want it to give?
-- 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_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?
-- 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_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_take = invsaw.on_take,
allow_move = function() return 0 end
})
}, name)
inv:set_size("input",1)
inv:set_size("micro",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 param2 = node.param2
local fdir = minetest.dir_to_facedir(placer:get_look_dir(), false)
if lrfurn.check_forward(pos, fdir, false, placer) then
node.name = "lrfurn:coffeetable_front"

View File

@ -242,7 +242,7 @@ minetest.register_node("maptools:lightbulb", {
drawtype = "airlike",
walkable = false,
pointable = false,
light_source = 15,
light_source = 14,
paramtype = "light",
sunlight_propagates = true,
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"},
paramtype = "light",
sunlight_propagates = true,
light_source = 15,
light_source = 14,
groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3},
sounds = sound_glass,
},
@ -295,7 +295,7 @@ local nodes = {
tiles = {"moreblocks_trap_super_glow_glass.png"},
paramtype = "light",
sunlight_propagates = true,
light_source = 15,
light_source = 14,
walkable = false,
groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3},
sounds = sound_glass,

View File

@ -17,6 +17,21 @@ and minetest.setting_getbool("creative_mode") then
stairsplus.expect_infinite_stacks = true
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)
local result = {}
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.
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)
stairsplus:register_all(modname, subname, recipeitem, {
groups = groups,

View File

@ -20,52 +20,67 @@ function register_micro(modname, subname, recipeitem, groups, images, descriptio
})
end
function stairsplus:register_micro(modname, subname, recipeitem, fields)
local defs = {
[""] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0, 0, 0.5},
},
local microblocks_defs = {
[""] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0, 0, 0.5},
},
["_1"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0, -0.4375, 0.5},
},
},
["_1"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0, -0.4375, 0.5},
},
["_2"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0, -0.375, 0.5},
},
},
["_2"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0, -0.375, 0.5},
},
["_4"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0, -0.25, 0.5},
},
},
["_4"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0, -0.25, 0.5},
},
["_12"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0, 0.25, 0.5},
},
},
["_12"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0, 0.25, 0.5},
},
["_14"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0, 0.375, 0.5},
},
},
["_14"] = {
node_box = {
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)
for alternate, def in pairs(defs) do
for k, v in pairs(fields) do

View File

@ -20,52 +20,67 @@ function register_panel(modname, subname, recipeitem, groups, images, descriptio
})
end
function stairsplus:register_panel(modname, subname, recipeitem, fields)
local defs = {
[""] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, 0, 0.5},
},
local panels_defs = {
[""] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, 0, 0.5},
},
["_1"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, -0.4375, 0.5},
},
},
["_1"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, -0.4375, 0.5},
},
["_2"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, -0.375, 0.5},
},
},
["_2"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, -0.375, 0.5},
},
["_4"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, -0.25, 0.5},
},
},
["_4"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, -0.25, 0.5},
},
["_12"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, 0.25, 0.5},
},
},
["_12"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, 0.25, 0.5},
},
["_14"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, 0.375, 0.5},
},
},
["_14"] = {
node_box = {
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)
for alternate, def in pairs(defs) do
for k, v in pairs(fields) do

View File

@ -20,17 +20,32 @@ function register_slab(modname, subname, recipeitem, groups, images, description
})
end
function stairsplus:register_slab(modname, subname, recipeitem, fields)
local defs = {
[""] = 8,
["_quarter"] = 4,
["_three_quarter"] = 12,
["_1"] = 1,
["_2"] = 2,
["_14"] = 14,
["_15"] = 15,
}
local slabs_defs = {
[""] = 8,
["_quarter"] = 4,
["_three_quarter"] = 12,
["_1"] = 1,
["_2"] = 2,
["_14"] = 14,
["_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)
for alternate, num in pairs(defs) do
local def = {

View File

@ -123,103 +123,118 @@ function register_slope(modname, subname, recipeitem, groups, images, descriptio
})
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)
local 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 defs = stairsplus.copytable(slopes_defs)
local desc = S("%s Slope"):format(fields.description)
for alternate, def in pairs(defs) do
for k, v in pairs(fields) do

View File

@ -20,92 +20,107 @@ function register_stair(modname, subname, recipeitem, groups, images, descriptio
})
end
function stairsplus:register_stair(modname, subname, recipeitem, fields)
local defs = {
[""] = {
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
{-0.5, 0, 0, 0.5, 0.5, 0.5},
},
local stairs_defs = {
[""] = {
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
{-0.5, 0, 0, 0.5, 0.5, 0.5},
},
},
["_half"] = {
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0, 0, 0.5},
{-0.5, 0, 0, 0, 0.5, 0.5},
},
},
["_half"] = {
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0, 0, 0.5},
{-0.5, 0, 0, 0, 0.5, 0.5},
},
},
["_right_half" ]= {
node_box = {
type = "fixed",
fixed = {
{0, -0.5, -0.5, 0.5, 0, 0.5},
{0, 0, 0, 0.5, 0.5, 0.5},
},
},
["_right_half" ]= {
node_box = {
type = "fixed",
fixed = {
{0, -0.5, -0.5, 0.5, 0, 0.5},
{0, 0, 0, 0.5, 0.5, 0.5},
},
},
["_inner"] = {
node_box = {
type = "fixed",
fixed = {
{-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.5, 0, 0.5, 0},
},
},
["_inner"] = {
node_box = {
type = "fixed",
fixed = {
{-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.5, 0, 0.5, 0},
},
},
["_outer"] = {
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
{-0.5, 0, 0, 0, 0.5, 0.5},
},
},
["_outer"] = {
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
{-0.5, 0, 0, 0, 0.5, 0.5},
},
},
["_alt"] = {
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0},
{-0.5, 0, 0, 0.5, 0.5, 0.5},
},
},
["_alt"] = {
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0},
{-0.5, 0, 0, 0.5, 0.5, 0.5},
},
},
["_alt_1"] = {
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.0625, -0.5, 0.5, 0, 0},
{-0.5, 0.4375, 0, 0.5, 0.5, 0.5},
},
},
["_alt_1"] = {
node_box = {
type = "fixed",
fixed = {
{-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 = {
type = "fixed",
fixed = {
{-0.5, -0.125, -0.5, 0.5, 0, 0},
{-0.5, 0.375, 0, 0.5, 0.5, 0.5},
},
},
["_alt_2"] = {
node_box = {
type = "fixed",
fixed = {
{-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 = {
type = "fixed",
fixed = {
{-0.5, -0.25, -0.5, 0.5, 0, 0},
{-0.5, 0.25, 0, 0.5, 0.5, 0.5},
},
},
["_alt_4"] = {
node_box = {
type = "fixed",
fixed = {
{-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)
for alternate, def in pairs(defs) 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}
-- Some saw-less recipes:
minetest.register_craft({
output = modname .. ":stair_" .. subname .. " 8",
recipe = {
@ -145,67 +160,67 @@ function stairsplus:register_stair(modname, subname, recipeitem, fields)
{recipeitem, recipeitem, recipeitem},
},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":stair_" .. subname,
recipe = {modname .. ":panel_" .. subname, modname .. ":slab_" .. subname},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":stair_" .. subname,
recipe = {modname .. ":panel_" .. subname, modname .. ":panel_" .. subname, modname .. ":panel_" .. subname},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":stair_" .. subname .. "_outer",
recipe = {modname .. ":micro_" .. subname, modname .. ":slab_" .. subname},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":stair_" .. subname .. "_half",
recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":stair_" .. subname .. "_half",
recipe = {modname .. ":panel_" .. subname, modname .. ":micro_" .. subname},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":stair_" .. subname .. "_right_half",
recipe = {modname .. ":stair_" .. subname .. "_half"},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":stair_" .. subname,
recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname},
})
minetest.register_craft({
type = "shapeless",
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},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":stair_" .. subname .. "_outer",
recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":stair_" .. subname,
recipe = {modname .. ":panel_" .. subname, modname .. ":panel_" .. subname, modname .. ":panel_" .. subname},
})
minetest.register_craft({ -- See mirrored variation of the recipe below.
output = modname .. ":stair_" .. subname .. "_alt",
recipe = {
@ -213,7 +228,7 @@ function stairsplus:register_stair(modname, subname, recipeitem, fields)
{"" , modname .. ":panel_" .. subname},
},
})
minetest.register_craft({ -- Mirrored variation of the recipe above.
output = modname .. ":stair_" .. subname .. "_alt",
recipe = {

View File

@ -312,7 +312,7 @@ local on_digiline_receive_alnum = function(pos, node, channel, msg)
local meta = minetest.get_meta(pos)
local setchan = meta:get_string("channel")
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)
if msg == "off" then
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})
elseif asc > 31 and alnum_chars[asc - 31] then
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

View File

@ -52,14 +52,40 @@ local function set_filter_formspec(data, meta)
end
-- 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 = {}
for spos,stack in ipairs(frominv:get_list(frominvname)) do
local matches
if filterfor == "" then
matches = stack:get_name() ~= ""
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
if matches then table.insert(sposes, spos) end
end
@ -104,10 +130,11 @@ local function grabAndFire(data,slotseq_mode,exmatch_mode,filtmeta,frominv,fromi
local count
if all then
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
return false
return false -- not enough, fail
else
-- limit quantity to filter amount
count = math.min(filterfor.count, count)
end
end
@ -155,6 +182,20 @@ local function punch_filter(data, filtpos, filtnode, msg)
local filters = {}
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)
if t_msg == "table" then
local slotseq = msg.slotseq
@ -206,28 +247,22 @@ local function punch_filter(data, filtpos, filtnode, msg)
return
end
if type(msg.name) == "string" then
table.insert(filters, {name = msg.name, count = tonumber(msg.count) or 1})
if msg.name or msg.group or msg.count or msg.wear or msg.metadata then
add_filter(msg.name, msg.group, msg.count, msg.wear, msg.metadata)
else
for _, filter in ipairs(msg) do
local t_filter = type(filter)
if t_filter == "table" then
if type(filter.name) == "string" then
table.insert(filters, {name = filter.name, count = tonumber(filter.count) or 1})
if filter.name or filter.group or filter.count or filter.wear or filter.metadata then
add_filter(filter.name, filter.group, filter.count, filter.wear, filter.metadata)
end
elseif t_filter == "string" then
local filterstack = ItemStack(filter)
local filtername = filterstack:get_name()
local filtercount = filterstack:get_count()
if filtername ~= "" then table.insert(filters, {name = filtername, count = filtercount}) end
add_itemstring_filter(filter)
end
end
end
elseif t_msg == "string" then
local filterstack = ItemStack(msg)
local filtername = filterstack:get_name()
local filtercount = filterstack:get_count()
if filtername ~= "" then table.insert(filters, {name = filtername, count = filtercount}) end
add_itemstring_filter(msg)
end
else
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
local done = false
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
break
end

View File

@ -9,6 +9,8 @@
-- { delta = {entity position for 270° 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.
local current_keyword = minetest.setting_get("interact_keyword") or "iaccept"
@ -844,47 +846,48 @@ if minetest.registered_nodes["default:sign_wall_steel"] then
end
-- 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" }
local sign_default_text_colors = { "f", "0", "f", "4", "0", "0", "f", "f" }
for i, color in ipairs(sign_colors) do
minetest.register_node(":signs:sign_wall_"..color, {
description = S("Sign ("..color..", metal)"),
inventory_image = "signs_"..color.."_inv.png",
wield_image = "signs_"..color.."_inv.png",
node_placement_prediction = "",
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
drawtype = "nodebox",
node_box = signs_lib.metal_wall_sign_model.nodebox,
tiles = {
"signs_metal_tb.png",
"signs_metal_tb.png",
"signs_metal_sides.png",
"signs_metal_sides.png",
"signs_metal_back.png",
"signs_"..color.."_front.png"
},
default_color = sign_default_text_colors[i],
groups = sign_groups,
on_place = function(itemstack, placer, pointed_thing)
return signs_lib.determine_sign_type(itemstack, placer, pointed_thing)
end,
on_construct = function(pos)
signs_lib.construct_sign(pos)
end,
on_destruct = function(pos)
signs_lib.destruct_sign(pos)
end,
on_receive_fields = function(pos, formname, fields, sender)
signs_lib.receive_fields(pos, formname, fields, sender)
end,
on_punch = function(pos, node, puncher)
signs_lib.update_sign(pos)
end,
})
for i, color in ipairs(sign_colors) do
minetest.register_node(":signs:sign_wall_"..color, {
description = S("Sign ("..color..", metal)"),
inventory_image = "signs_"..color.."_inv.png",
wield_image = "signs_"..color.."_inv.png",
node_placement_prediction = "",
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
drawtype = "nodebox",
node_box = signs_lib.metal_wall_sign_model.nodebox,
tiles = {
"signs_metal_tb.png",
"signs_metal_tb.png",
"signs_metal_sides.png",
"signs_metal_sides.png",
"signs_metal_back.png",
"signs_"..color.."_front.png"
},
default_color = sign_default_text_colors[i],
groups = sign_groups,
on_place = function(itemstack, placer, pointed_thing)
return signs_lib.determine_sign_type(itemstack, placer, pointed_thing)
end,
on_construct = function(pos)
signs_lib.construct_sign(pos)
end,
on_destruct = function(pos)
signs_lib.destruct_sign(pos)
end,
on_receive_fields = function(pos, formname, fields, sender)
signs_lib.receive_fields(pos, formname, fields, sender)
end,
on_punch = function(pos, node, puncher)
signs_lib.update_sign(pos)
end,
})
end
end
local signs_text_on_activate
@ -1022,134 +1025,136 @@ minetest.register_craft({
})
-- craft recipes for the metal signs
if enable_colored_metal_signs then
minetest.register_craft( {
output = "signs:sign_wall_green",
recipe = {
{ "dye:dark_green", "dye:white", "dye:dark_green" },
{ "", default_sign_metal, "" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_green",
recipe = {
{ "dye:dark_green", "dye:white", "dye:dark_green" },
{ "", default_sign_metal, "" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_green 2",
recipe = {
{ "dye:dark_green", "dye:white", "dye:dark_green" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_green 2",
recipe = {
{ "dye:dark_green", "dye:white", "dye:dark_green" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_yellow",
recipe = {
{ "dye:yellow", "dye:black", "dye:yellow" },
{ "", default_sign_metal, "" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_yellow",
recipe = {
{ "dye:yellow", "dye:black", "dye:yellow" },
{ "", default_sign_metal, "" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_yellow 2",
recipe = {
{ "dye:yellow", "dye:black", "dye:yellow" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_yellow 2",
recipe = {
{ "dye:yellow", "dye:black", "dye:yellow" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_red",
recipe = {
{ "dye:red", "dye:white", "dye:red" },
{ "", default_sign_metal, "" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_red",
recipe = {
{ "dye:red", "dye:white", "dye:red" },
{ "", default_sign_metal, "" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_red 2",
recipe = {
{ "dye:red", "dye:white", "dye:red" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_red 2",
recipe = {
{ "dye:red", "dye:white", "dye:red" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_white_red",
recipe = {
{ "dye:white", "dye:red", "dye:white" },
{ "", default_sign_metal, "" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_white_red",
recipe = {
{ "dye:white", "dye:red", "dye:white" },
{ "", default_sign_metal, "" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_white_red 2",
recipe = {
{ "dye:white", "dye:red", "dye:white" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_white_red 2",
recipe = {
{ "dye:white", "dye:red", "dye:white" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_white_black",
recipe = {
{ "dye:white", "dye:black", "dye:white" },
{ "", default_sign_metal, "" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_white_black",
recipe = {
{ "dye:white", "dye:black", "dye:white" },
{ "", default_sign_metal, "" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_white_black 2",
recipe = {
{ "dye:white", "dye:black", "dye:white" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_white_black 2",
recipe = {
{ "dye:white", "dye:black", "dye:white" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_orange",
recipe = {
{ "dye:orange", "dye:black", "dye:orange" },
{ "", default_sign_metal, "" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_orange",
recipe = {
{ "dye:orange", "dye:black", "dye:orange" },
{ "", default_sign_metal, "" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_orange 2",
recipe = {
{ "dye:orange", "dye:black", "dye:orange" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_orange 2",
recipe = {
{ "dye:orange", "dye:black", "dye:orange" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_blue",
recipe = {
{ "dye:blue", "dye:white", "dye:blue" },
{ "", default_sign_metal, "" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_blue",
recipe = {
{ "dye:blue", "dye:white", "dye:blue" },
{ "", default_sign_metal, "" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_blue 2",
recipe = {
{ "dye:blue", "dye:white", "dye:blue" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_blue 2",
recipe = {
{ "dye:blue", "dye:white", "dye:blue" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_brown",
recipe = {
{ "dye:brown", "dye:white", "dye:brown" },
{ "", default_sign_metal, "" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_brown",
recipe = {
{ "dye:brown", "dye:white", "dye:brown" },
{ "", default_sign_metal, "" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_brown 2",
recipe = {
{ "dye:brown", "dye:white", "dye:brown" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_brown 2",
recipe = {
{ "dye:brown", "dye:white", "dye:brown" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
},
})
end
if minetest.setting_get("log_mods") then
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
-- 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)
local p = vector.round(pos)
local x_step, y_step, z_step = 0, 0, 0
local x_component, y_component, z_component = 0, 0, 0
local x_intersect, y_intersect, z_intersect = 0, 0, 0
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
if dir.x == 0 then
x_intersect = math.huge
elseif dir.x > 0 then
x_step = 1
x_component = 1 / dir.x
x_intersect = x_component
else
x_step = -1
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
local i = 1
return function(p)
-- 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)
return function()
if x_intersect < y_intersect then
if x_intersect < z_intersect then
-- 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.
if dx > dy then
if dx > dz then
p.x = p.x + x_step
x_intersect = x_intersect + x_component
else
p.z = p.z + z_step
z_intersect = z_intersect + z_component
end
elseif y_intersect < z_intersect then
elseif dy > dz then
p.y = p.y + y_step
y_intersect = y_intersect + y_component
else
p.z = p.z + z_step
z_intersect = z_intersect + z_component
end
if vector.distance(pos, p) > range then
return nil
end
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

View File

@ -33,8 +33,15 @@ local function check_wind_mill(pos)
if pos.y < 30 then
return false
end
pos = {x=pos.x, y=pos.y, z=pos.z}
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
return false
end
@ -45,17 +52,17 @@ end
local run = function(pos, node)
local meta = minetest.get_meta(pos)
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_string("infotext", S("%s Improperly Placed"):format(machine_name))
return
else
elseif check == true then
local power = math.min(pos.y * 100, 5000)
meta:set_int("MV_EU_supply", power)
meta:set_string("infotext", S("@1 (@2 EU)", machine_name, technic.pretty_num(power)))
end
meta:set_string("infotext", S("@1 (@2 EU)", machine_name, technic.pretty_num(power)))
-- check == nil: assume nothing has changed
end
minetest.register_node("technic:wind_mill", {

View File

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

View File

@ -38,8 +38,8 @@ local function laser_node(pos, node, player)
minetest.remove_node(pos)
minetest.add_particle({
pos = pos,
vel = {x=0, y=2, z=0},
acc = {x=0, y=-1, z=0},
velocity = {x=0, y=2, z=0},
acceleration = {x=0, y=-1, z=0},
expirationtime = 1.5,
size = 6 + math.random() * 2,
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)
-- Adjust to head height
start_pos.y = start_pos.y + 1.9
start_pos.y = start_pos.y + 1.6
minetest.add_particle({
pos = startpos,
vel = dir,
acc = vector.multiply(dir, 50),
velocity = dir,
acceleration = vector.multiply(dir, 50),
expirationtime = range / 11,
size = 1,
texture = particle_texture .. "^[transform" .. math.random(0, 7),
})
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
minetest.record_protection_violation(pos, player_name)
break

View File

@ -82,9 +82,11 @@ minetest.after(0.01, function()
-- appears after a “maybe”
local max_start = true
-- 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
local itit = def.drop.items[i]
local itit = drop_items[i]
for j=1,#itit.items do
local dstack = ItemStack(itit.items[j])
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 _, recipe in ipairs(recipes) do
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)
for _, name in ipairs(unified_inventory.items_list) do
if matches_spec(name) then

View File

@ -31,80 +31,18 @@ unified_inventory.register_button("bags", {
hide_lite=true
})
unified_inventory.register_page("bag1", {
for i = 1, 4 do
local bi = i
unified_inventory.register_page("bag"..bi, {
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 formspec = "image[7,0;1,1;"..image.."]"
formspec = formspec.."label[0,0;"..F("Bag 1").."]"
formspec = formspec.."listcolors[#00000000;#00000000]"
formspec = formspec.."list[current_player;bag1contents;0,1;8,3;]"
formspec = formspec.."listring[current_name;bag1contents]"
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("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 formspec = ("image[7,0;1,1;"..image.."]"
.."label[0,0;"..F("Bag @1", bi).."]"
.."listcolors[#00000000;#00000000]"
.."list[current_player;bag"..bi.."contents;0,1;8,3;]"
.."listring[current_name;bag"..bi.."contents]"
.."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]"
@ -113,9 +51,12 @@ unified_inventory.register_button("bags", {
elseif slots == 24 then
formspec = formspec.."background[0.06,0.99;7.92,7.52;ui_bags_lg_form.png]"
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}
end,
})
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "" then
@ -135,7 +76,8 @@ end)
minetest.register_on_joinplayer(function(player)
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)
player:get_inventory():set_stack(listname, index, stack)
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)
return 0
end,
})
}, player_name)
for i=1,4 do
local bag = "bag"..i
player_inv:set_size(bag, 1)

View File

@ -43,7 +43,7 @@ minetest.register_on_joinplayer(function(player)
minetest.sound_play("electricity",
{to_player=player_name, gain = 1.0})
end,
})
}, player_name)
refill:set_size("main", 1)
end)
@ -154,7 +154,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
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.set_inventory_formspec(player,
unified_inventory.current_page[player_name])

View File

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

View File

@ -2,7 +2,15 @@
local modpath = minetest.get_modpath(minetest.get_current_modname())
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
unified_inventory = {
@ -33,7 +41,7 @@ unified_inventory = {
-- intllib
gettext = mygettext,
fgettext = function(s) return minetest.formspec_escape(mygettext(s)) end,
fgettext = function(...) return minetest.formspec_escape(mygettext(...)) end,
-- "Lite" mode
lite_mode = minetest.setting_getbool("unified_inventory_lite"),
@ -57,16 +65,24 @@ if creative then
end
end
-- Disable sfinv inventory
local sfinv = rawget(_G, "sfinv")
if sfinv then
sfinv.enabled = false
end
dofile(modpath.."/group.lua")
dofile(modpath.."/api.lua")
dofile(modpath.."/internal.lua")
dofile(modpath.."/callbacks.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")
if minetest.get_modpath("datastorage") then
dofile(modpath.."/waypoints.lua")
end

View File

@ -107,14 +107,23 @@ function unified_inventory.get_formspec(player, page)
end
if def.type == "image" then
formspec[n] = "image_button["
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)..";"
formspec[n+4] = minetest.formspec_escape(def.name)..";]"
formspec[n+5] = "tooltip["..minetest.formspec_escape(def.name)
formspec[n+6] = ";"..(def.tooltip or "").."]"
n = n+7
if (def.condition == nil or def.condition(player) == true) then
formspec[n] = "image_button["
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)..";"
formspec[n+4] = minetest.formspec_escape(def.name)..";]"
formspec[n+5] = "tooltip["..minetest.formspec_escape(def.name)
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
@ -173,6 +182,8 @@ function unified_inventory.get_formspec(player, page)
n = n+1
-- Search box
formspec[n] = "field_close_on_enter[searchbox;false]"
n = n+1
if not draw_lite_mode then
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 = Taschen
Bag 1 = Tasche 1
Bag 2 = Tasche 2
Bag 3 = Tasche 3
Bag 4 = Tasche 4
Bag @1 = Tasche @1
Small Bag = Kleine Tasche
Medium Bag = Mittelgroße Tasche
Large Bag = Große Tasche

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -59,8 +59,12 @@ unified_inventory.register_button("home_gui_set", {
else
minetest.chat_send_player(player_name,
S("You don't have the \"home\" privilege!"))
unified_inventory.set_inventory_formspec(player, unified_inventory.current_page[player_name])
end
end,
condition = function(player)
return minetest.check_player_privs(player:get_player_name(), {home=true})
end,
})
unified_inventory.register_button("home_gui_go", {
@ -77,8 +81,12 @@ unified_inventory.register_button("home_gui_go", {
else
minetest.chat_send_player(player_name,
S("You don't have the \"home\" privilege!"))
unified_inventory.set_inventory_formspec(player, unified_inventory.current_page[player_name])
end
end,
condition = function(player)
return minetest.check_player_privs(player:get_player_name(), {home=true})
end,
})
unified_inventory.register_button("misc_set_day", {
@ -97,8 +105,12 @@ unified_inventory.register_button("misc_set_day", {
else
minetest.chat_send_player(player_name,
S("You don't have the settime privilege!"))
unified_inventory.set_inventory_formspec(player, unified_inventory.current_page[player_name])
end
end,
condition = function(player)
return minetest.check_player_privs(player:get_player_name(), {settime=true})
end,
})
unified_inventory.register_button("misc_set_night", {
@ -117,8 +129,12 @@ unified_inventory.register_button("misc_set_night", {
else
minetest.chat_send_player(player_name,
S("You don't have the settime privilege!"))
unified_inventory.set_inventory_formspec(player, unified_inventory.current_page[player_name])
end
end,
condition = function(player)
return minetest.check_player_privs(player:get_player_name(), {settime=true})
end,
})
unified_inventory.register_button("clear_inv", {
@ -133,6 +149,7 @@ unified_inventory.register_button("clear_inv", {
.." of creative mode to prevent"
.." accidental inventory trashing."
.."\nUse the trash slot instead."))
unified_inventory.set_inventory_formspec(player, unified_inventory.current_page[player_name])
return
end
player:get_inventory():set_list("main", {})
@ -140,6 +157,9 @@ unified_inventory.register_button("clear_inv", {
minetest.sound_play("trash_all",
{to_player=player_name, gain = 1.0})
end,
condition = function(player)
return unified_inventory.is_creative(player:get_player_name())
end,
})
unified_inventory.register_page("craft", {
@ -249,6 +269,12 @@ unified_inventory.register_page("craftguide", {
formspec = formspec.."listcolors[#00000000;#00000000]"
local item_name = unified_inventory.current_item[player_name]
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 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.."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_"
.. 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..stack_image_button(item_pos, formspecy, 1.1, 1.1, "item_button_"
..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:") .. "]"
.."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]"
@ -353,7 +379,7 @@ unified_inventory.register_page("craftguide", {
.."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") .. "]"
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:") .. "]"
.."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]"

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