diff --git a/change.log b/change.log index 9961143..c1e5821 100644 --- a/change.log +++ b/change.log @@ -9,3 +9,9 @@ v0.1.1 * Made digilines optional for solid conductor blocks. * Fixed lighting * Added puncher + + +v0.1.2 +* Added support for hopper as optional dependency for droppers, dispensers + and collectors. +* Added digilines message to punchers when something is punched. diff --git a/collector.lua b/collector.lua index 70bc962..5bdc731 100644 --- a/collector.lua +++ b/collector.lua @@ -20,7 +20,7 @@ local function send_collect_message (pos, name, count) if channel:len () > 0 then utils.digilines_receptor_send (pos, - digiline.rules.default, + utils.digilines_default_rules, channel, { action = "collect", name = name, @@ -389,7 +389,7 @@ local function digilines_support () { wire = { - rules = digiline.rules.default, + rules = utils.digilines_default_rules, }, effector = @@ -529,6 +529,38 @@ minetest.register_node("lwcomponents:collector_locked_on", { +utils.hopper_add_container({ + {"top", "lwcomponents:collector", "main"}, -- take items from above into hopper below + {"bottom", "lwcomponents:collector", "main"}, -- insert items below from hopper above + {"side", "lwcomponents:collector", "main"}, -- insert items from hopper at side +}) + + + +utils.hopper_add_container({ + {"top", "lwcomponents:collector_locked", "main"}, -- take items from above into hopper below + {"bottom", "lwcomponents:collector_locked", "main"}, -- insert items below from hopper above + {"side", "lwcomponents:collector_locked", "main"}, -- insert items from hopper at side +}) + + + +utils.hopper_add_container({ + {"top", "lwcomponents:collector_on", "main"}, -- take items from above into hopper below + {"bottom", "lwcomponents:collector_on", "main"}, -- insert items below from hopper above + {"side", "lwcomponents:collector_on", "main"}, -- insert items from hopper at side +}) + + + +utils.hopper_add_container({ + {"top", "lwcomponents:collector_locked_on", "main"}, -- take items from above into hopper below + {"bottom", "lwcomponents:collector_locked_on", "main"}, -- insert items below from hopper above + {"side", "lwcomponents:collector_locked_on", "main"}, -- insert items from hopper at side +}) + + + end -- utils.digilines_supported diff --git a/depends.txt b/depends.txt index 023d040..be9235a 100644 --- a/depends.txt +++ b/depends.txt @@ -4,3 +4,4 @@ mesecons? digilines? unifieddyes? intllib? +hopper? diff --git a/detector.lua b/detector.lua index 16b8910..d009964 100644 --- a/detector.lua +++ b/detector.lua @@ -69,7 +69,7 @@ local function send_detect_message (pos, item_type, name, label, item_pos, count if channel:len () > 0 then utils.digilines_receptor_send (pos, - digiline.rules.default, + utils.digilines_default_rules, channel, { action = "detect", type = item_type, @@ -565,7 +565,7 @@ local function digilines_support () { wire = { - rules = digiline.rules.default, + rules = utils.digilines_default_rules, }, effector = diff --git a/dispenser.lua b/dispenser.lua index e794e7d..7d13a59 100644 --- a/dispenser.lua +++ b/dispenser.lua @@ -52,7 +52,7 @@ local function send_dispense_message (pos, slot, name) if channel:len () > 0 then utils.digilines_receptor_send (pos, - digiline.rules.default, + utils.digilines_default_rules, channel, { action = "dispense", name = name, @@ -314,7 +314,7 @@ local function digilines_support () { wire = { - rules = digiline.rules.default, + rules = utils.digilines_default_rules, }, effector = @@ -422,6 +422,22 @@ minetest.register_node("lwcomponents:dispenser_locked", { +utils.hopper_add_container({ + {"top", "lwcomponents:dispenser", "main"}, -- take items from above into hopper below + {"bottom", "lwcomponents:dispenser", "main"}, -- insert items below from hopper above + {"side", "lwcomponents:dispenser", "main"}, -- insert items from hopper at side +}) + + + +utils.hopper_add_container({ + {"top", "lwcomponents:dispenser_locked", "main"}, -- take items from above into hopper below + {"bottom", "lwcomponents:dispenser_locked", "main"}, -- insert items below from hopper above + {"side", "lwcomponents:dispenser_locked", "main"}, -- insert items from hopper at side +}) + + + end -- utils.digilines_supported or utils.mesecon_supported diff --git a/dropper.lua b/dropper.lua index b190e2a..3fc0078 100644 --- a/dropper.lua +++ b/dropper.lua @@ -32,7 +32,7 @@ local function send_drop_message (pos, slot, name) if channel:len () > 0 then utils.digilines_receptor_send (pos, - digiline.rules.default, + utils.digilines_default_rules, channel, { action = "drop", name = name, @@ -290,7 +290,7 @@ local function digilines_support () { wire = { - rules = digiline.rules.default, + rules = utils.digilines_default_rules, }, effector = @@ -398,6 +398,21 @@ minetest.register_node("lwcomponents:dropper_locked", { +utils.hopper_add_container({ + {"top", "lwcomponents:dropper", "main"}, -- take items from above into hopper below + {"bottom", "lwcomponents:dropper", "main"}, -- insert items below from hopper above + {"side", "lwcomponents:dropper", "main"}, -- insert items from hopper at side +}) + + + +utils.hopper_add_container({ + {"top", "lwcomponents:dropper_locked", "main"}, -- take items from above into hopper below + {"bottom", "lwcomponents:dropper_locked", "main"}, -- insert items below from hopper above + {"side", "lwcomponents:dropper_locked", "main"}, -- insert items from hopper at side +}) + + end -- utils.digilines_supported or utils.mesecon_supported diff --git a/init.lua b/init.lua index 50221a1..20dbfa2 100644 --- a/init.lua +++ b/init.lua @@ -1,4 +1,4 @@ -local version = "0.1.1" +local version = "0.1.2" local mod_storage = minetest.get_mod_storage () diff --git a/mod.conf b/mod.conf index 7cdea89..a9c7ebb 100644 --- a/mod.conf +++ b/mod.conf @@ -3,4 +3,4 @@ description = Various components for mesecons and digilines. title = LWComponents name = lwcomponents depends = default -optional_depends = lwdrops, mesecons, digilines, unifieddyes, intllib +optional_depends = lwdrops, mesecons, digilines, unifieddyes, intllib, hopper diff --git a/puncher.lua b/puncher.lua index 0a6c446..962048b 100644 --- a/puncher.lua +++ b/puncher.lua @@ -7,6 +7,28 @@ if utils.digilines_supported or utils.mesecon_supported then +local function send_punch_message (pos, item_type, name, label) + if utils.digilines_supported then + local meta = minetest.get_meta (pos) + + if meta then + local channel = meta:get_string ("channel") + + if channel:len () > 0 then + utils.digilines_receptor_send (pos, + utils.digilines_default_rules, + channel, + { action = "punch", + type = item_type, + name = name, + label = label }) + end + end + end +end + + + local function direction_vector (pos) local meta = minetest.get_meta (pos) @@ -67,6 +89,11 @@ local function punch (pos) damage_groups = { fleshy = 4 } }, vector.direction (pos, object[i]:get_pos ())) + send_punch_message (pos, + "player", + object[i]:get_player_name (), + object[i]:get_player_name ()) + punched = true end @@ -80,6 +107,16 @@ local function punch (pos) -- entity if meta:get_string ("entities") == "true" then + local name = object[i]:get_nametag_attributes () + local label = "" + + if type (name) == "table" then + label = tostring (name.text or "") + end + + name = (object[i].get_luaentity and + object[i]:get_luaentity () and + object[i]:get_luaentity ().name) or "" object[i]:punch (object[i], 1.0, @@ -87,6 +124,11 @@ local function punch (pos) damage_groups = { fleshy = 4 } }, vector.direction (pos, object[i]:get_pos ())) + send_punch_message (pos, + "entity", + name, + label) + punched = true end @@ -368,7 +410,7 @@ local function digilines_support () { wire = { - rules = digiline.rules.default, + rules = utils.digilines_default_rules, }, effector = diff --git a/readme.txt b/readme.txt index b3f1755..a7850fd 100644 --- a/readme.txt +++ b/readme.txt @@ -13,7 +13,7 @@ CC BY-SA 3.0 Version ======= -0.1.1 +0.1.2 Minetest Version @@ -33,6 +33,7 @@ mesecons digilines unifieddyes intllib +hopper Installation @@ -56,7 +57,8 @@ Dropper * This block is only available if digilines and/or mesecons are loaded. Contains an inventory and drops an item on command. Also acts as a -digilines conductor. +digilines conductor. If the hopper mod is loaded, will take items from the +top and sides, and release them from the bottom. UI @@ -96,7 +98,8 @@ Dispenser * This block is only available if digilines and/or mesecons are loaded. Contains an inventory and dispenses (with velocity) an item on command. -Also acts as a digilines conductor. +Also acts as a digilines conductor. If the hopper mod is loaded, will take +items from the top and sides, and release them from the bottom. UI @@ -137,7 +140,8 @@ Collector * This block is only available if digilines is loaded. Picks up dropped items in adjacent block, with optional filtering. Also -acts as a digilines conductor. +acts as a digilines conductor. If the hopper mod is loaded, will take items +from the top and sides, and release them from the bottom. UI @@ -357,6 +361,27 @@ Digilines messages "punch" Action a single punch if the puncher is turned on. +When a player or entity is punched a digilines message is sent with the +puncher's channel. The message is a table with the following keys: +{ + action = "punch", + type = "", -- will be "entity" or "player" + name = "", + label = "