diff options
108 files changed, 1410 insertions, 1081 deletions
diff --git a/biome_lib/init.lua b/biome_lib/init.lua index 1054bd7..349b2f2 100644 --- a/biome_lib/init.lua +++ b/biome_lib/init.lua @@ -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 diff --git a/boost_cart/README.txt b/boost_cart/README.txt index 3a5d295..7565ee8 100644 --- a/boost_cart/README.txt +++ b/boost_cart/README.txt @@ -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 diff --git a/boost_cart/cart_entity.lua b/boost_cart/cart_entity.lua new file mode 100644 index 0000000..ba23713 --- /dev/null +++ b/boost_cart/cart_entity.lua @@ -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"}, + }, +}) diff --git a/boost_cart/depends.txt b/boost_cart/depends.txt index bfb43df..705a8eb 100644 --- a/boost_cart/depends.txt +++ b/boost_cart/depends.txt @@ -1,3 +1,4 @@ default mesecons? -moreores?
\ No newline at end of file +moreores? +carts?
\ No newline at end of file diff --git a/boost_cart/detector.lua b/boost_cart/detector.lua index 43acea5..f345ac6 100644 --- a/boost_cart/detector.lua +++ b/boost_cart/detector.lua @@ -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({ diff --git a/boost_cart/functions.lua b/boost_cart/functions.lua index e94ac07..fcdd1ad 100644 --- a/boost_cart/functions.lua +++ b/boost_cart/functions.lua @@ -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", diff --git a/boost_cart/init.lua b/boost_cart/init.lua index 42d3533..7dd5c44 100644 --- a/boost_cart/init.lua +++ b/boost_cart/init.lua @@ -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"}, - - 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 -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 -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) +dofile(boost_cart.modpath.."/functions.lua") +dofile(boost_cart.modpath.."/rails.lua") - self.velocity = vector.multiply(cart_dir, f) - self.old_dir = cart_dir - self.old_pos = nil - self.punched = true +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_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 +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 - -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") diff --git a/boost_cart/rails.lua b/boost_cart/rails.lua index 04d86b8..c2a58cd 100644 --- a/boost_cart/rails.lua +++ b/boost_cart/rails.lua @@ -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, diff --git a/boost_cart/sounds/cart_rail.1.ogg b/boost_cart/sounds/cart_rail.1.ogg Binary files differnew file mode 100644 index 0000000..ba2d9ef --- /dev/null +++ b/boost_cart/sounds/cart_rail.1.ogg diff --git a/boost_cart/sounds/cart_rail.2.ogg b/boost_cart/sounds/cart_rail.2.ogg Binary files differnew file mode 100644 index 0000000..1b930f0 --- /dev/null +++ b/boost_cart/sounds/cart_rail.2.ogg diff --git a/boost_cart/sounds/cart_rail.3.ogg b/boost_cart/sounds/cart_rail.3.ogg Binary files differnew file mode 100644 index 0000000..2db4991 --- /dev/null +++ b/boost_cart/sounds/cart_rail.3.ogg diff --git a/boost_cart/textures/carts_rail_crossing.png b/boost_cart/textures/carts_rail_crossing.png Binary files differnew file mode 100644 index 0000000..1591c70 --- /dev/null +++ b/boost_cart/textures/carts_rail_crossing.png diff --git a/boost_cart/textures/carts_rail_crossing_brk.png b/boost_cart/textures/carts_rail_crossing_brk.png Binary files differindex f9ce303..0e6adfa 100644 --- a/boost_cart/textures/carts_rail_crossing_brk.png +++ b/boost_cart/textures/carts_rail_crossing_brk.png diff --git a/boost_cart/textures/carts_rail_crossing_cp.png b/boost_cart/textures/carts_rail_crossing_cp.png Binary files differindex b04aa63..b2cd736 100644 --- a/boost_cart/textures/carts_rail_crossing_cp.png +++ b/boost_cart/textures/carts_rail_crossing_cp.png diff --git a/boost_cart/textures/carts_rail_crossing_dtc.png b/boost_cart/textures/carts_rail_crossing_dtc.png Binary files differindex a2e4760..8558c02 100644 --- a/boost_cart/textures/carts_rail_crossing_dtc.png +++ b/boost_cart/textures/carts_rail_crossing_dtc.png diff --git a/boost_cart/textures/carts_rail_crossing_dtc_on.png b/boost_cart/textures/carts_rail_crossing_dtc_on.png Binary files differindex 1adba4f..c5d0bf4 100644 --- a/boost_cart/textures/carts_rail_crossing_dtc_on.png +++ b/boost_cart/textures/carts_rail_crossing_dtc_on.png diff --git a/boost_cart/textures/carts_rail_crossing_pwr.png b/boost_cart/textures/carts_rail_crossing_pwr.png Binary files differindex dc317cf..ca9eac4 100644 --- a/boost_cart/textures/carts_rail_crossing_pwr.png +++ b/boost_cart/textures/carts_rail_crossing_pwr.png diff --git a/boost_cart/textures/carts_rail_crossing_ss.png b/boost_cart/textures/carts_rail_crossing_ss.png Binary files differindex 11a4226..d7b945a 100644 --- a/boost_cart/textures/carts_rail_crossing_ss.png +++ b/boost_cart/textures/carts_rail_crossing_ss.png diff --git a/boost_cart/textures/carts_rail_curved.png b/boost_cart/textures/carts_rail_curved.png Binary files differnew file mode 100644 index 0000000..8db11f3 --- /dev/null +++ b/boost_cart/textures/carts_rail_curved.png diff --git a/boost_cart/textures/carts_rail_curved_brk.png b/boost_cart/textures/carts_rail_curved_brk.png Binary files differindex c55183d..03f8bda 100644 --- a/boost_cart/textures/carts_rail_curved_brk.png +++ b/boost_cart/textures/carts_rail_curved_brk.png diff --git a/boost_cart/textures/carts_rail_curved_cp.png b/boost_cart/textures/carts_rail_curved_cp.png Binary files differindex 004ef56..b950453 100644 --- a/boost_cart/textures/carts_rail_curved_cp.png +++ b/boost_cart/textures/carts_rail_curved_cp.png diff --git a/boost_cart/textures/carts_rail_curved_dtc.png b/boost_cart/textures/carts_rail_curved_dtc.png Binary files differindex 0bf7501..67cc18b 100644 --- a/boost_cart/textures/carts_rail_curved_dtc.png +++ b/boost_cart/textures/carts_rail_curved_dtc.png diff --git a/boost_cart/textures/carts_rail_curved_dtc_on.png b/boost_cart/textures/carts_rail_curved_dtc_on.png Binary files differindex 71b8f93..b000d7b 100644 --- a/boost_cart/textures/carts_rail_curved_dtc_on.png +++ b/boost_cart/textures/carts_rail_curved_dtc_on.png diff --git a/boost_cart/textures/carts_rail_curved_pwr.png b/boost_cart/textures/carts_rail_curved_pwr.png Binary files differindex 4aef5dd..11d2dbf 100644 --- a/boost_cart/textures/carts_rail_curved_pwr.png +++ b/boost_cart/textures/carts_rail_curved_pwr.png diff --git a/boost_cart/textures/carts_rail_curved_ss.png b/boost_cart/textures/carts_rail_curved_ss.png Binary files differindex 5269fdd..934f499 100644 --- a/boost_cart/textures/carts_rail_curved_ss.png +++ b/boost_cart/textures/carts_rail_curved_ss.png diff --git a/boost_cart/textures/carts_rail_straight.png b/boost_cart/textures/carts_rail_straight.png Binary files differnew file mode 100644 index 0000000..36fdf4e --- /dev/null +++ b/boost_cart/textures/carts_rail_straight.png diff --git a/boost_cart/textures/carts_rail_straight_brk.png b/boost_cart/textures/carts_rail_straight_brk.png Binary files differnew file mode 100644 index 0000000..d68e396 --- /dev/null +++ b/boost_cart/textures/carts_rail_straight_brk.png diff --git a/boost_cart/textures/carts_rail_straight_cp.png b/boost_cart/textures/carts_rail_straight_cp.png Binary files differnew file mode 100644 index 0000000..232cee8 --- /dev/null +++ b/boost_cart/textures/carts_rail_straight_cp.png diff --git a/boost_cart/textures/carts_rail_straight_dtc.png b/boost_cart/textures/carts_rail_straight_dtc.png Binary files differnew file mode 100644 index 0000000..85a76b2 --- /dev/null +++ b/boost_cart/textures/carts_rail_straight_dtc.png diff --git a/boost_cart/textures/carts_rail_straight_dtc_on.png b/boost_cart/textures/carts_rail_straight_dtc_on.png Binary files differnew file mode 100644 index 0000000..68bfa14 --- /dev/null +++ b/boost_cart/textures/carts_rail_straight_dtc_on.png diff --git a/boost_cart/textures/carts_rail_straight_pwr.png b/boost_cart/textures/carts_rail_straight_pwr.png Binary files differnew file mode 100644 index 0000000..252dea4 --- /dev/null +++ b/boost_cart/textures/carts_rail_straight_pwr.png diff --git a/boost_cart/textures/carts_rail_straight_ss.png b/boost_cart/textures/carts_rail_straight_ss.png Binary files differnew file mode 100644 index 0000000..b0f537e --- /dev/null +++ b/boost_cart/textures/carts_rail_straight_ss.png diff --git a/boost_cart/textures/carts_rail_t_junction.png b/boost_cart/textures/carts_rail_t_junction.png Binary files differnew file mode 100644 index 0000000..0b55a0a --- /dev/null +++ b/boost_cart/textures/carts_rail_t_junction.png diff --git a/boost_cart/textures/carts_rail_t_junction_brk.png b/boost_cart/textures/carts_rail_t_junction_brk.png Binary files differindex 5689ffe..d6fc78a 100644 --- a/boost_cart/textures/carts_rail_t_junction_brk.png +++ b/boost_cart/textures/carts_rail_t_junction_brk.png diff --git a/boost_cart/textures/carts_rail_t_junction_cp.png b/boost_cart/textures/carts_rail_t_junction_cp.png Binary files differindex 3da9094..e266bcc 100644 --- a/boost_cart/textures/carts_rail_t_junction_cp.png +++ b/boost_cart/textures/carts_rail_t_junction_cp.png diff --git a/boost_cart/textures/carts_rail_t_junction_dtc.png b/boost_cart/textures/carts_rail_t_junction_dtc.png Binary files differindex e50cf3b..b69c649 100644 --- a/boost_cart/textures/carts_rail_t_junction_dtc.png +++ b/boost_cart/textures/carts_rail_t_junction_dtc.png diff --git a/boost_cart/textures/carts_rail_t_junction_dtc_on.png b/boost_cart/textures/carts_rail_t_junction_dtc_on.png Binary files differindex 41a08d1..2a21d1f 100644 --- a/boost_cart/textures/carts_rail_t_junction_dtc_on.png +++ b/boost_cart/textures/carts_rail_t_junction_dtc_on.png diff --git a/boost_cart/textures/carts_rail_t_junction_pwr.png b/boost_cart/textures/carts_rail_t_junction_pwr.png Binary files differindex d7edaf1..a2e0f1d 100644 --- a/boost_cart/textures/carts_rail_t_junction_pwr.png +++ b/boost_cart/textures/carts_rail_t_junction_pwr.png diff --git a/boost_cart/textures/carts_rail_t_junction_ss.png b/boost_cart/textures/carts_rail_t_junction_ss.png Binary files differindex f101298..303c6cf 100644 --- a/boost_cart/textures/carts_rail_t_junction_ss.png +++ b/boost_cart/textures/carts_rail_t_junction_ss.png diff --git a/boost_cart/textures/templates/crossing.png b/boost_cart/textures/templates/crossing.png Binary files differnew file mode 100644 index 0000000..67b7168 --- /dev/null +++ b/boost_cart/textures/templates/crossing.png diff --git a/boost_cart/textures/templates/curved.png b/boost_cart/textures/templates/curved.png Binary files differnew file mode 100644 index 0000000..a9070dc --- /dev/null +++ b/boost_cart/textures/templates/curved.png diff --git a/boost_cart/textures/templates/straight.png b/boost_cart/textures/templates/straight.png Binary files differnew file mode 100644 index 0000000..9911b36 --- /dev/null +++ b/boost_cart/textures/templates/straight.png diff --git a/boost_cart/textures/templates/t_junction.png b/boost_cart/textures/templates/t_junction.png Binary files differnew file mode 100644 index 0000000..8c6b621 --- /dev/null +++ b/boost_cart/textures/templates/t_junction.png diff --git a/building_blocks/init.lua b/building_blocks/init.lua index b0f3aa7..1df41e2 100644 --- a/building_blocks/init.lua +++ b/building_blocks/init.lua @@ -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} } }, }) diff --git a/carbone_mobs/models/mobs_dungeon_master.x b/carbone_mobs/models/mobs_dungeon_master.x index 613536a..613536a 100755..100644 --- a/carbone_mobs/models/mobs_dungeon_master.x +++ b/carbone_mobs/models/mobs_dungeon_master.x diff --git a/carbone_mobs/models/mobs_oerkki.x b/carbone_mobs/models/mobs_oerkki.x index 93f1701..93f1701 100755..100644 --- a/carbone_mobs/models/mobs_oerkki.x +++ b/carbone_mobs/models/mobs_oerkki.x diff --git a/carbone_mobs/models/mobs_rat.x b/carbone_mobs/models/mobs_rat.x index f5a69bd..f5a69bd 100755..100644 --- a/carbone_mobs/models/mobs_rat.x +++ b/carbone_mobs/models/mobs_rat.x diff --git a/carbone_mobs/models/mobs_sand_monster.x b/carbone_mobs/models/mobs_sand_monster.x index 52750d8..52750d8 100755..100644 --- a/carbone_mobs/models/mobs_sand_monster.x +++ b/carbone_mobs/models/mobs_sand_monster.x diff --git a/carbone_mobs/models/mobs_sheep.x b/carbone_mobs/models/mobs_sheep.x index 04a1dad..04a1dad 100755..100644 --- a/carbone_mobs/models/mobs_sheep.x +++ b/carbone_mobs/models/mobs_sheep.x diff --git a/carbone_mobs/models/mobs_sheep_shaved.x b/carbone_mobs/models/mobs_sheep_shaved.x index fa7e17c..fa7e17c 100755..100644 --- a/carbone_mobs/models/mobs_sheep_shaved.x +++ b/carbone_mobs/models/mobs_sheep_shaved.x diff --git a/carbone_mobs/models/mobs_stone_monster.x b/carbone_mobs/models/mobs_stone_monster.x index ad0c6d8..ad0c6d8 100755..100644 --- a/carbone_mobs/models/mobs_stone_monster.x +++ b/carbone_mobs/models/mobs_stone_monster.x diff --git a/carbone_mobs/models/mobs_tree_monster.x b/carbone_mobs/models/mobs_tree_monster.x index 57c681d..57c681d 100755..100644 --- a/carbone_mobs/models/mobs_tree_monster.x +++ b/carbone_mobs/models/mobs_tree_monster.x diff --git a/castle/init.lua b/castle/init.lua index 73a97d7..ed82a66 100644 --- a/castle/init.lua +++ b/castle/init.lua @@ -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({ diff --git a/castle/town_item.lua b/castle/town_item.lua index d1b496a..ee7d22f 100644 --- a/castle/town_item.lua +++ b/castle/town_item.lua @@ -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}, diff --git a/computer/computers.lua b/computer/computers.lua index 47ce2e1..877ccbd 100644 --- a/computer/computers.lua +++ b/computer/computers.lua @@ -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', }, diff --git a/concrete/init.lua b/concrete/init.lua index 4d5e781..66564ba 100644 --- a/concrete/init.lua +++ b/concrete/init.lua @@ -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, }) diff --git a/currency/crafting.lua b/currency/crafting.lua index 33a9553..d80b74c 100644 --- a/currency/crafting.lua +++ b/currency/crafting.lua @@ -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'},
}
})
diff --git a/currency/safe.lua b/currency/safe.lua index 428711f..794e23a 100644 --- a/currency/safe.lua +++ b/currency/safe.lua @@ -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
diff --git a/customize-dreambuilder_game.sh b/customize-dreambuilder_game.sh index d042f35..d042f35 100755..100644 --- a/customize-dreambuilder_game.sh +++ b/customize-dreambuilder_game.sh diff --git a/glooptest/othergen_module/init.lua b/glooptest/othergen_module/init.lua index 77a6e66..3ec79e5 100644 --- a/glooptest/othergen_module/init.lua +++ b/glooptest/othergen_module/init.lua @@ -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))
\ No newline at end of file +--minetest.register_on_generated(glooptest.extragen_module.spawn_chests(minp, maxp)) diff --git a/homedecor/doors_and_gates.lua b/homedecor/doors_and_gates.lua index 3787e2b..1e6ae0a 100644 --- a/homedecor/doors_and_gates.lua +++ b/homedecor/doors_and_gates.lua @@ -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) diff --git a/homedecor/handlers/furnaces.lua b/homedecor/handlers/furnaces.lua index aaa2fef..d436b49 100644 --- a/homedecor/handlers/furnaces.lua +++ b/homedecor/handlers/furnaces.lua @@ -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 --[[ diff --git a/infrastructure/settings.lua b/infrastructure/settings.lua index 1433e22..7ab8213 100644 --- a/infrastructure/settings.lua +++ b/infrastructure/settings.lua @@ -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?
diff --git a/invsaw/init.lua b/invsaw/init.lua index 0dda0b5..589775b 100644 --- a/invsaw/init.lua +++ b/invsaw/init.lua @@ -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) diff --git a/lrfurn/coffeetable.lua b/lrfurn/coffeetable.lua index afce15e..7f7afaa 100644 --- a/lrfurn/coffeetable.lua +++ b/lrfurn/coffeetable.lua @@ -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" diff --git a/maptools/nodes.lua b/maptools/nodes.lua index 744f105..51daddc 100644 --- a/maptools/nodes.lua +++ b/maptools/nodes.lua @@ -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 = "", diff --git a/mesecons/doc/mesecon/preview.png b/mesecons/doc/mesecon/preview.png Binary files differindex f81e5cb..f81e5cb 100755..100644 --- a/mesecons/doc/mesecon/preview.png +++ b/mesecons/doc/mesecon/preview.png diff --git a/mesecons_blinkyplant/doc/blinkyplant/preview.png b/mesecons_blinkyplant/doc/blinkyplant/preview.png Binary files differindex 40ce5b5..40ce5b5 100755..100644 --- a/mesecons_blinkyplant/doc/blinkyplant/preview.png +++ b/mesecons_blinkyplant/doc/blinkyplant/preview.png diff --git a/mesecons_wires/doc/mesecon/preview.png b/mesecons_wires/doc/mesecon/preview.png Binary files differindex f81e5cb..f81e5cb 100755..100644 --- a/mesecons_wires/doc/mesecon/preview.png +++ b/mesecons_wires/doc/mesecon/preview.png diff --git a/moreblocks/nodes.lua b/moreblocks/nodes.lua index 8e81131..da61b3f 100644 --- a/moreblocks/nodes.lua +++ b/moreblocks/nodes.lua @@ -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, diff --git a/moreblocks/stairsplus/init.lua b/moreblocks/stairsplus/init.lua index 44f5972..1f2cefe 100644 --- a/moreblocks/stairsplus/init.lua +++ b/moreblocks/stairsplus/init.lua @@ -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, diff --git a/moreblocks/stairsplus/microblocks.lua b/moreblocks/stairsplus/microblocks.lua index 3d5de1f..a457d10 100644 --- a/moreblocks/stairsplus/microblocks.lua +++ b/moreblocks/stairsplus/microblocks.lua @@ -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 diff --git a/moreblocks/stairsplus/panels.lua b/moreblocks/stairsplus/panels.lua index ab6ef83..314939b 100644 --- a/moreblocks/stairsplus/panels.lua +++ b/moreblocks/stairsplus/panels.lua @@ -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 diff --git a/moreblocks/stairsplus/slabs.lua b/moreblocks/stairsplus/slabs.lua index 236d91e..2acdd41 100644 --- a/moreblocks/stairsplus/slabs.lua +++ b/moreblocks/stairsplus/slabs.lua @@ -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 = { diff --git a/moreblocks/stairsplus/slopes.lua b/moreblocks/stairsplus/slopes.lua index f0e8c20..da524b6 100644 --- a/moreblocks/stairsplus/slopes.lua +++ b/moreblocks/stairsplus/slopes.lua @@ -123,103 +123,118 @@ function register_slope(modname, subname, recipeitem, groups, images, descriptio }) 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, - }, +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, + }, - ["_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, - }, - } + --============================================================== + + ["_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 = 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 diff --git a/moreblocks/stairsplus/stairs.lua b/moreblocks/stairsplus/stairs.lua index ee8075f..6609466 100644 --- a/moreblocks/stairsplus/stairs.lua +++ b/moreblocks/stairsplus/stairs.lua @@ -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 = { diff --git a/nixie_tubes/init.lua b/nixie_tubes/init.lua index 97bbd68..81bfe8f 100644 --- a/nixie_tubes/init.lua +++ b/nixie_tubes/init.lua @@ -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 diff --git a/pipeworks/filter-injector.lua b/pipeworks/filter-injector.lua index 7fbabc2..3427894 100644 --- a/pipeworks/filter-injector.lua +++ b/pipeworks/filter-injector.lua @@ -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 diff --git a/signs_lib/init.lua b/signs_lib/init.lua index b8f56a6..6953e0e 100644 --- a/signs_lib/init.lua +++ b/signs_lib/init.lua @@ -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 - -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, - }) +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" } + + 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")) diff --git a/technic/helpers.lua b/technic/helpers.lua index 164cf7e..5780f27 100644 --- a/technic/helpers.lua +++ b/technic/helpers.lua @@ -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 - - 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 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 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) + + -- 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) - return function() - if x_intersect < y_intersect then - if x_intersect < z_intersect then + -- 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 diff --git a/technic/machines/MV/wind_mill.lua b/technic/machines/MV/wind_mill.lua index 1377c67..28a075d 100644 --- a/technic/machines/MV/wind_mill.lua +++ b/technic/machines/MV/wind_mill.lua @@ -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", { diff --git a/technic/machines/other/frames.lua b/technic/machines/other/frames.lua index b3f39b9..2d630a2 100644 --- a/technic/machines/other/frames.lua +++ b/technic/machines/other/frames.lua @@ -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, diff --git a/technic/tools/mining_lasers.lua b/technic/tools/mining_lasers.lua index c09aa92..ef1eecb 100644 --- a/technic/tools/mining_lasers.lua +++ b/technic/tools/mining_lasers.lua @@ -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 diff --git a/unified_inventory/api.lua b/unified_inventory/api.lua index 936ee72..e1b980a 100644 --- a/unified_inventory/api.lua +++ b/unified_inventory/api.lua @@ -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 diff --git a/unified_inventory/bags.lua b/unified_inventory/bags.lua index 7e925db..4af4ff5 100644 --- a/unified_inventory/bags.lua +++ b/unified_inventory/bags.lua @@ -31,80 +31,18 @@ unified_inventory.register_button("bags", { hide_lite=true }) - - unified_inventory.register_page("bag1", { - get_formspec = function(player) - local stack = player:get_inventory():get_stack("bag1", 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", { +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("bag3", 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 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) diff --git a/unified_inventory/callbacks.lua b/unified_inventory/callbacks.lua index ad6de0a..e6ea3e7 100644 --- a/unified_inventory/callbacks.lua +++ b/unified_inventory/callbacks.lua @@ -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]) diff --git a/unified_inventory/depends.txt b/unified_inventory/depends.txt index 3879b2c..20eb8b0 100644 --- a/unified_inventory/depends.txt +++ b/unified_inventory/depends.txt @@ -1,4 +1,6 @@ +default creative? +sfinv? intllib? datastorage? farming? diff --git a/unified_inventory/init.lua b/unified_inventory/init.lua index e24fff2..67bc56e 100644 --- a/unified_inventory/init.lua +++ b/unified_inventory/init.lua @@ -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 - diff --git a/unified_inventory/internal.lua b/unified_inventory/internal.lua index 42ab722..5732971 100644 --- a/unified_inventory/internal.lua +++ b/unified_inventory/internal.lua @@ -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;;" diff --git a/unified_inventory/locale/de.txt b/unified_inventory/locale/de.txt index a2f7c3d..ad8009d 100644 --- a/unified_inventory/locale/de.txt +++ b/unified_inventory/locale/de.txt @@ -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 diff --git a/unified_inventory/locale/es.txt b/unified_inventory/locale/es.txt index 26508fb..d8c0dd6 100644 --- a/unified_inventory/locale/es.txt +++ b/unified_inventory/locale/es.txt @@ -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 diff --git a/unified_inventory/locale/fr.txt b/unified_inventory/locale/fr.txt index e4923a0..43c52f0 100644 --- a/unified_inventory/locale/fr.txt +++ b/unified_inventory/locale/fr.txt @@ -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 diff --git a/unified_inventory/locale/pl.txt b/unified_inventory/locale/pl.txt index 6173a5f..ef3e821 100644 --- a/unified_inventory/locale/pl.txt +++ b/unified_inventory/locale/pl.txt @@ -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 diff --git a/unified_inventory/locale/ru.txt b/unified_inventory/locale/ru.txt index 821f2b1..a7bbe54 100644 --- a/unified_inventory/locale/ru.txt +++ b/unified_inventory/locale/ru.txt @@ -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 = Большая сумка diff --git a/unified_inventory/locale/template.txt b/unified_inventory/locale/template.txt index bd27f2f..0ea805b 100644 --- a/unified_inventory/locale/template.txt +++ b/unified_inventory/locale/template.txt @@ -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 = diff --git a/unified_inventory/locale/tr.txt b/unified_inventory/locale/tr.txt index 138e66c..e171fd6 100644 --- a/unified_inventory/locale/tr.txt +++ b/unified_inventory/locale/tr.txt @@ -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 diff --git a/unified_inventory/register.lua b/unified_inventory/register.lua index ff38168..127df7e 100644 --- a/unified_inventory/register.lua +++ b/unified_inventory/register.lua @@ -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]" diff --git a/unified_inventory/settingtypes.txt b/unified_inventory/settingtypes.txt new file mode 100644 index 0000000..1054fa9 --- /dev/null +++ b/unified_inventory/settingtypes.txt @@ -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 diff --git a/unified_inventory/textures/ui_bags_trash.png b/unified_inventory/textures/ui_bags_trash.png Binary files differnew file mode 100644 index 0000000..6338999 --- /dev/null +++ b/unified_inventory/textures/ui_bags_trash.png diff --git a/unifiedbricks/mod.conf b/unifiedbricks/mod.conf new file mode 100644 index 0000000..266e0dc --- /dev/null +++ b/unifiedbricks/mod.conf @@ -0,0 +1 @@ +name = unifiedbricks diff --git a/worldedit/primitives.lua b/worldedit/primitives.lua index 962a02f..fe22fff 100644 --- a/worldedit/primitives.lua +++ b/worldedit/primitives.lua @@ -150,8 +150,9 @@ end -- @param axis Axis ("x", "y", or "z")
-- @param height Pyramid height.
-- @param node_name Name of node to make pyramid of.
+-- @param hollow Whether the pyramid should be hollow.
-- @return The number of nodes added.
-function worldedit.pyramid(pos, axis, height, node_name)
+function worldedit.pyramid(pos, axis, height, node_name, hollow)
local other1, other2 = worldedit.get_axis_others(axis)
-- Set up voxel manipulator
@@ -187,10 +188,12 @@ function worldedit.pyramid(pos, axis, height, node_name) local new_index2 = new_index1 + (index2 + offset[other1]) * stride[other1]
for index3 = -size, size do
local i = new_index2 + (index3 + offset[other2]) * stride[other2]
- data[i] = node_id
+ if (not hollow or size - math.abs(index2) < 2 or size - math.abs(index3) < 2) then
+ data[i] = node_id
+ count = count + 1
+ end
end
end
- count = count + (size * 2 + 1) ^ 2
size = size - 1
end
diff --git a/worldedit_commands/init.lua b/worldedit_commands/init.lua index ca2b9e4..b9313cc 100644 --- a/worldedit_commands/init.lua +++ b/worldedit_commands/init.lua @@ -517,9 +517,25 @@ minetest.register_chatcommand("/cylinder", { end, check_cylinder),
})
-minetest.register_chatcommand("/pyramid", {
+local check_pyramid = function(name, param)
+ if worldedit.pos1[name] == nil then
+ worldedit.player_notify(name, "no position 1 selected")
+ return nil
+ end
+ local found, _, axis, height, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(.+)$")
+ if found == nil then
+ worldedit.player_notify(name, "invalid usage: " .. param)
+ return nil
+ end
+ local node = get_node(name, nodename)
+ if not node then return nil end
+ height = tonumber(height)
+ return math.ceil(((height * 2 + 1) ^ 2) * height / 3)
+end
+
+minetest.register_chatcommand("/hollowpyramid", {
params = "x/y/z/? <height> <node>",
- description = "Add pyramid centered at WorldEdit position 1 along the x/y/z/? axis with height <height>, composed of <node>",
+ description = "Add hollow pyramid centered at WorldEdit position 1 along the x/y/z/? axis with height <height>, composed of <node>",
privs = {worldedit=true},
func = safe_region(function(name, param)
local found, _, axis, height, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(.+)$")
@@ -529,24 +545,26 @@ minetest.register_chatcommand("/pyramid", { height = height * sign
end
local node = get_node(name, nodename)
- local count = worldedit.pyramid(worldedit.pos1[name], axis, height, node)
+ local count = worldedit.pyramid(worldedit.pos1[name], axis, height, node, true)
worldedit.player_notify(name, count .. " nodes added")
- end,
- function(name, param)
- if worldedit.pos1[name] == nil then
- worldedit.player_notify(name, "no position 1 selected")
- return nil
- end
+ end, check_pyramid),
+})
+
+minetest.register_chatcommand("/pyramid", {
+ params = "x/y/z/? <height> <node>",
+ description = "Add pyramid centered at WorldEdit position 1 along the x/y/z/? axis with height <height>, composed of <node>",
+ privs = {worldedit=true},
+ func = safe_region(function(name, param)
local found, _, axis, height, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(.+)$")
- if found == nil then
- worldedit.player_notify(name, "invalid usage: " .. param)
- return nil
+ height = tonumber(height)
+ if axis == "?" then
+ axis, sign = worldedit.player_axis(name)
+ height = height * sign
end
local node = get_node(name, nodename)
- if not node then return nil end
- height = tonumber(height)
- return math.ceil(((height * 2 + 1) ^ 2) * height / 3)
- end),
+ local count = worldedit.pyramid(worldedit.pos1[name], axis, height, node)
+ worldedit.player_notify(name, count .. " nodes added")
+ end, check_pyramid),
})
minetest.register_chatcommand("/spiral", {
@@ -571,7 +589,7 @@ minetest.register_chatcommand("/spiral", { end
local node = get_node(name, nodename)
if not node then return nil end
- return check_region(name, param)
+ return 1 -- TODO: return an useful value
end),
})
diff --git a/worldedit_commands/mark.lua b/worldedit_commands/mark.lua index 4062cae..7f880ea 100644 --- a/worldedit_commands/mark.lua +++ b/worldedit_commands/mark.lua @@ -153,7 +153,11 @@ minetest.register_entity(":worldedit:region_cube", { end
end,
on_punch = function(self, hitter)
- for _, entity in ipairs(worldedit.marker_region[self.player_name]) do
+ local markers = worldedit.marker_region[self.player_name]
+ if not markers then
+ return
+ end
+ for _, entity in ipairs(markers) do
entity:remove()
end
worldedit.marker_region[self.player_name] = nil
diff --git a/worldedit_gui/functionality.lua b/worldedit_gui/functionality.lua index c358a8c..7010b14 100644 --- a/worldedit_gui/functionality.lua +++ b/worldedit_gui/functionality.lua @@ -300,18 +300,21 @@ worldedit.register_gui_function("worldedit_gui_pyramid", { or "image[5.5,1.1;1,1;unknown_node.png]") ..
string.format("field[0.5,2.5;4,0.8;worldedit_gui_pyramid_length;Length;%s]", minetest.formspec_escape(length)) ..
string.format("dropdown[4,2.18;2.5;worldedit_gui_pyramid_axis;X axis,Y axis,Z axis,Look direction;%d]", axis) ..
- "button_exit[0,3.5;3,0.8;worldedit_gui_pyramid_submit;Pyramid]"
+ "button_exit[0,3.5;3,0.8;worldedit_gui_pyramid_submit_hollow;Hollow Pyramid]" ..
+ "button_exit[3.5,3.5;3,0.8;worldedit_gui_pyramid_submit_solid;Solid Pyramid]"
end,
})
worldedit.register_gui_handler("worldedit_gui_pyramid", function(name, fields)
- if fields.worldedit_gui_pyramid_search or fields.worldedit_gui_pyramid_submit then
+ if fields.worldedit_gui_pyramid_search or fields.worldedit_gui_pyramid_submit_solid or fields.worldedit_gui_pyramid_submit_hollow or fields.worldedit_gui_pyramid_axis then
gui_nodename1[name] = tostring(fields.worldedit_gui_pyramid_node)
gui_axis1[name] = axis_indices[fields.worldedit_gui_pyramid_axis]
gui_distance1[name] = tostring(fields.worldedit_gui_pyramid_length)
worldedit.show_page(name, "worldedit_gui_pyramid")
- if fields.worldedit_gui_pyramid_submit then
+ if fields.worldedit_gui_pyramid_submit_solid then
minetest.chatcommands["/pyramid"].func(name, string.format("%s %s %s", axis_values[gui_axis1[name]], gui_distance1[name], gui_nodename1[name]))
+ elseif fields.worldedit_gui_pyramid_submit_hollow then
+ minetest.chatcommands["/hollowpyramid"].func(name, string.format("%s %s %s", axis_values[gui_axis1[name]], gui_distance1[name], gui_nodename1[name]))
end
return true
end
@@ -667,7 +670,7 @@ worldedit.register_gui_function("worldedit_gui_lua", { worldedit.register_gui_handler("worldedit_gui_lua", function(name, fields)
if fields.worldedit_gui_lua_run or fields.worldedit_gui_lua_transform then
- gui_code[name] = fields.worldedit_gui_lua_value
+ gui_code[name] = fields.worldedit_gui_lua_code
worldedit.show_page(name, "worldedit_gui_lua")
if fields.worldedit_gui_lua_run then
minetest.chatcommands["/lua"].func(name, gui_code[name])
diff --git a/worldedit_shortcommands/init.lua b/worldedit_shortcommands/init.lua index a3cbb67..a4350ae 100644 --- a/worldedit_shortcommands/init.lua +++ b/worldedit_shortcommands/init.lua @@ -31,6 +31,7 @@ worldedit.alias_chatcommand("/hdo", "/hollowdome") worldedit.alias_chatcommand("/do", "/dome")
worldedit.alias_chatcommand("/hcyl", "/hollowcylinder")
worldedit.alias_chatcommand("/cyl", "/cylinder")
+worldedit.alias_chatcommand("/hpyr", "/hollowpyramid")
worldedit.alias_chatcommand("/pyr", "/pyramid")
worldedit.alias_chatcommand("/spl", "/spiral")
worldedit.alias_chatcommand("/m", "/move")
@@ -47,4 +48,4 @@ worldedit.alias_chatcommand("/hlt", "/highlight") worldedit.alias_chatcommand("/rsr", "/restore")
worldedit.alias_chatcommand("/l", "/lua")
worldedit.alias_chatcommand("/lt", "/luatransform")
-worldedit.alias_chatcommand("/clro", "/clearobjects")
\ No newline at end of file +worldedit.alias_chatcommand("/clro", "/clearobjects")
diff --git a/xban2/gui.lua b/xban2/gui.lua index fb0c1df..d3306e2 100644 --- a/xban2/gui.lua +++ b/xban2/gui.lua @@ -100,6 +100,11 @@ end minetest.register_on_player_receive_fields(function(player, formname, fields) if formname ~= FORMNAME then return end local name = player:get_player_name() + if not minetest.check_player_privs(name, { ban=true }) then + minetest.log("warning", + "[xban2] Received fields from unauthorized user: "..name) + return + end local state = get_state(name) if fields.player then local t = minetest.explode_textlist_event(fields.player) @@ -128,6 +133,7 @@ end) minetest.register_chatcommand("xban_gui", { description = "Show XBan GUI", params = "", + privs = { ban=true, }, func = function(name, params) minetest.show_formspec(name, FORMNAME, make_fs(name)) end, diff --git a/xban2/init.lua b/xban2/init.lua index 81818a8..d8b20e7 100644 --- a/xban2/init.lua +++ b/xban2/init.lua @@ -72,7 +72,13 @@ function xban.get_info(player) --> ip_name_list, banned, last_record end function xban.ban_player(player, source, expires, reason) --> bool, err + if xban.get_whitelist(player) then + return nil, "Player is whitelisted; remove from whitelist first" + end local e = xban.find_entry(player, true) + if e.banned then + return nil, "Already banned" + end local rec = { source = source, time = os.time(), @@ -131,6 +137,28 @@ function xban.unban_player(player, source) --> bool, err return true end +function xban.get_whitelist(name_or_ip) + return db.whitelist and db.whitelist[name_or_ip] +end + +function xban.remove_whitelist(name_or_ip) + if db.whitelist then + db.whitelist[name_or_ip] = nil + end +end + +function xban.add_whitelist(name_or_ip, source) + local wl = db.whitelist + if not wl then + wl = { } + db.whitelist = wl + end + wl[name_or_ip] = { + source=source, + } + return true +end + function xban.get_record(player) local e = xban.find_entry(player) if not e then @@ -158,6 +186,8 @@ function xban.get_record(player) end minetest.register_on_prejoinplayer(function(name, ip) + local wl = db.whitelist or { } + if wl[name] or wl[ip] then return end local e = xban.find_entry(name) or xban.find_entry(ip) if not e then return end if e.banned then @@ -195,8 +225,8 @@ minetest.register_chatcommand("xban", { if not (plname and reason) then return false, "Usage: /xban <player> <reason>" end - xban.ban_player(plname, name, nil, reason) - return true, ("Banned %s."):format(plname) + local ok, e = xban.ban_player(plname, name, nil, reason) + return ok, ok and ("Banned %s."):format(plname) or e end, }) @@ -214,8 +244,9 @@ minetest.register_chatcommand("xtempban", { return false, "You must ban for at least 60 seconds." end local expires = os.time() + time - xban.ban_player(plname, name, expires, reason) - return true, ("Banned %s until %s."):format(plname, os.date("%c", expires)) + local ok, e = xban.ban_player(plname, name, expires, reason) + return ok, (ok and ("Banned %s until %s."):format( + plname, os.date("%c", expires)) or e) end, }) @@ -260,6 +291,31 @@ minetest.register_chatcommand("xban_record", { end, }) +minetest.register_chatcommand("xban_wl", { + description = "Manages the whitelist", + params = "(add|del|get) <name_or_ip>", + privs = { ban=true }, + func = function(name, params) + local cmd, plname = params:match("%s*(%S+)%s*(%S+)") + if cmd == "add" then + xban.add_whitelist(plname, name) + ACTION("%s adds %s to whitelist", source, plname) + return true, "Added to whitelist: "..plname + elseif cmd == "del" then + xban.remove_whitelist(plname) + ACTION("%s removes %s to whitelist", source, plname) + return true, "Removed from whitelist: "..plname + elseif cmd == "get" then + local e = xban.get_whitelist(plname) + if e then + return true, "Source: "..(e.source or "Unknown") + else + return true, "No whitelist for: "..plname + end + end + end, +}) + local function check_temp_bans() minetest.after(60, check_temp_bans) local to_rm = { } diff --git a/xban2/mod.conf b/xban2/mod.conf new file mode 100644 index 0000000..b046e3c --- /dev/null +++ b/xban2/mod.conf @@ -0,0 +1 @@ +name = xban2 |