Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
32df0b8420 |
@@ -9,3 +9,9 @@ v0.1.1
|
|||||||
* Made digilines optional for solid conductor blocks.
|
* Made digilines optional for solid conductor blocks.
|
||||||
* Fixed lighting
|
* Fixed lighting
|
||||||
* Added puncher
|
* 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.
|
||||||
|
@@ -20,7 +20,7 @@ local function send_collect_message (pos, name, count)
|
|||||||
|
|
||||||
if channel:len () > 0 then
|
if channel:len () > 0 then
|
||||||
utils.digilines_receptor_send (pos,
|
utils.digilines_receptor_send (pos,
|
||||||
digiline.rules.default,
|
utils.digilines_default_rules,
|
||||||
channel,
|
channel,
|
||||||
{ action = "collect",
|
{ action = "collect",
|
||||||
name = name,
|
name = name,
|
||||||
@@ -389,7 +389,7 @@ local function digilines_support ()
|
|||||||
{
|
{
|
||||||
wire =
|
wire =
|
||||||
{
|
{
|
||||||
rules = digiline.rules.default,
|
rules = utils.digilines_default_rules,
|
||||||
},
|
},
|
||||||
|
|
||||||
effector =
|
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
|
end -- utils.digilines_supported
|
||||||
|
|
||||||
|
|
||||||
|
@@ -4,3 +4,4 @@ mesecons?
|
|||||||
digilines?
|
digilines?
|
||||||
unifieddyes?
|
unifieddyes?
|
||||||
intllib?
|
intllib?
|
||||||
|
hopper?
|
||||||
|
@@ -69,7 +69,7 @@ local function send_detect_message (pos, item_type, name, label, item_pos, count
|
|||||||
|
|
||||||
if channel:len () > 0 then
|
if channel:len () > 0 then
|
||||||
utils.digilines_receptor_send (pos,
|
utils.digilines_receptor_send (pos,
|
||||||
digiline.rules.default,
|
utils.digilines_default_rules,
|
||||||
channel,
|
channel,
|
||||||
{ action = "detect",
|
{ action = "detect",
|
||||||
type = item_type,
|
type = item_type,
|
||||||
@@ -565,7 +565,7 @@ local function digilines_support ()
|
|||||||
{
|
{
|
||||||
wire =
|
wire =
|
||||||
{
|
{
|
||||||
rules = digiline.rules.default,
|
rules = utils.digilines_default_rules,
|
||||||
},
|
},
|
||||||
|
|
||||||
effector =
|
effector =
|
||||||
|
@@ -52,7 +52,7 @@ local function send_dispense_message (pos, slot, name)
|
|||||||
|
|
||||||
if channel:len () > 0 then
|
if channel:len () > 0 then
|
||||||
utils.digilines_receptor_send (pos,
|
utils.digilines_receptor_send (pos,
|
||||||
digiline.rules.default,
|
utils.digilines_default_rules,
|
||||||
channel,
|
channel,
|
||||||
{ action = "dispense",
|
{ action = "dispense",
|
||||||
name = name,
|
name = name,
|
||||||
@@ -314,7 +314,7 @@ local function digilines_support ()
|
|||||||
{
|
{
|
||||||
wire =
|
wire =
|
||||||
{
|
{
|
||||||
rules = digiline.rules.default,
|
rules = utils.digilines_default_rules,
|
||||||
},
|
},
|
||||||
|
|
||||||
effector =
|
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
|
end -- utils.digilines_supported or utils.mesecon_supported
|
||||||
|
|
||||||
|
|
||||||
|
19
dropper.lua
19
dropper.lua
@@ -32,7 +32,7 @@ local function send_drop_message (pos, slot, name)
|
|||||||
|
|
||||||
if channel:len () > 0 then
|
if channel:len () > 0 then
|
||||||
utils.digilines_receptor_send (pos,
|
utils.digilines_receptor_send (pos,
|
||||||
digiline.rules.default,
|
utils.digilines_default_rules,
|
||||||
channel,
|
channel,
|
||||||
{ action = "drop",
|
{ action = "drop",
|
||||||
name = name,
|
name = name,
|
||||||
@@ -290,7 +290,7 @@ local function digilines_support ()
|
|||||||
{
|
{
|
||||||
wire =
|
wire =
|
||||||
{
|
{
|
||||||
rules = digiline.rules.default,
|
rules = utils.digilines_default_rules,
|
||||||
},
|
},
|
||||||
|
|
||||||
effector =
|
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
|
end -- utils.digilines_supported or utils.mesecon_supported
|
||||||
|
|
||||||
|
|
||||||
|
2
init.lua
2
init.lua
@@ -1,4 +1,4 @@
|
|||||||
local version = "0.1.1"
|
local version = "0.1.2"
|
||||||
local mod_storage = minetest.get_mod_storage ()
|
local mod_storage = minetest.get_mod_storage ()
|
||||||
|
|
||||||
|
|
||||||
|
2
mod.conf
2
mod.conf
@@ -3,4 +3,4 @@ description = Various components for mesecons and digilines.
|
|||||||
title = LWComponents
|
title = LWComponents
|
||||||
name = lwcomponents
|
name = lwcomponents
|
||||||
depends = default
|
depends = default
|
||||||
optional_depends = lwdrops, mesecons, digilines, unifieddyes, intllib
|
optional_depends = lwdrops, mesecons, digilines, unifieddyes, intllib, hopper
|
||||||
|
44
puncher.lua
44
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 function direction_vector (pos)
|
||||||
local meta = minetest.get_meta (pos)
|
local meta = minetest.get_meta (pos)
|
||||||
|
|
||||||
@@ -67,6 +89,11 @@ local function punch (pos)
|
|||||||
damage_groups = { fleshy = 4 } },
|
damage_groups = { fleshy = 4 } },
|
||||||
vector.direction (pos, object[i]:get_pos ()))
|
vector.direction (pos, object[i]:get_pos ()))
|
||||||
|
|
||||||
|
send_punch_message (pos,
|
||||||
|
"player",
|
||||||
|
object[i]:get_player_name (),
|
||||||
|
object[i]:get_player_name ())
|
||||||
|
|
||||||
punched = true
|
punched = true
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -80,6 +107,16 @@ local function punch (pos)
|
|||||||
|
|
||||||
-- entity
|
-- entity
|
||||||
if meta:get_string ("entities") == "true" then
|
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],
|
object[i]:punch (object[i],
|
||||||
1.0,
|
1.0,
|
||||||
@@ -87,6 +124,11 @@ local function punch (pos)
|
|||||||
damage_groups = { fleshy = 4 } },
|
damage_groups = { fleshy = 4 } },
|
||||||
vector.direction (pos, object[i]:get_pos ()))
|
vector.direction (pos, object[i]:get_pos ()))
|
||||||
|
|
||||||
|
send_punch_message (pos,
|
||||||
|
"entity",
|
||||||
|
name,
|
||||||
|
label)
|
||||||
|
|
||||||
punched = true
|
punched = true
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -368,7 +410,7 @@ local function digilines_support ()
|
|||||||
{
|
{
|
||||||
wire =
|
wire =
|
||||||
{
|
{
|
||||||
rules = digiline.rules.default,
|
rules = utils.digilines_default_rules,
|
||||||
},
|
},
|
||||||
|
|
||||||
effector =
|
effector =
|
||||||
|
33
readme.txt
33
readme.txt
@@ -13,7 +13,7 @@ CC BY-SA 3.0
|
|||||||
|
|
||||||
Version
|
Version
|
||||||
=======
|
=======
|
||||||
0.1.1
|
0.1.2
|
||||||
|
|
||||||
|
|
||||||
Minetest Version
|
Minetest Version
|
||||||
@@ -33,6 +33,7 @@ mesecons
|
|||||||
digilines
|
digilines
|
||||||
unifieddyes
|
unifieddyes
|
||||||
intllib
|
intllib
|
||||||
|
hopper
|
||||||
|
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
@@ -56,7 +57,8 @@ Dropper
|
|||||||
* This block is only available if digilines and/or mesecons are loaded.
|
* 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
|
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
|
UI
|
||||||
|
|
||||||
@@ -96,7 +98,8 @@ Dispenser
|
|||||||
* This block is only available if digilines and/or mesecons are loaded.
|
* This block is only available if digilines and/or mesecons are loaded.
|
||||||
|
|
||||||
Contains an inventory and dispenses (with velocity) an item on command.
|
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
|
UI
|
||||||
|
|
||||||
@@ -137,7 +140,8 @@ Collector
|
|||||||
* This block is only available if digilines is loaded.
|
* This block is only available if digilines is loaded.
|
||||||
|
|
||||||
Picks up dropped items in adjacent block, with optional filtering. Also
|
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
|
UI
|
||||||
|
|
||||||
@@ -357,6 +361,27 @@ Digilines messages
|
|||||||
"punch"
|
"punch"
|
||||||
Action a single punch if the puncher is turned on.
|
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 = "<type>", -- will be "entity" or "player"
|
||||||
|
name = "<name>",
|
||||||
|
label = "<label>"
|
||||||
|
}
|
||||||
|
|
||||||
|
type
|
||||||
|
Will be "entity" or "player".
|
||||||
|
|
||||||
|
name
|
||||||
|
For "entity" the registered entity name.
|
||||||
|
For "player" the player's name.
|
||||||
|
|
||||||
|
label
|
||||||
|
For "entity" the name tag text.
|
||||||
|
For "player" the player's name.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DigiSwitch
|
DigiSwitch
|
||||||
----------
|
----------
|
||||||
|
@@ -422,7 +422,7 @@ local function digilines_support ()
|
|||||||
{
|
{
|
||||||
wire =
|
wire =
|
||||||
{
|
{
|
||||||
rules = digiline.rules.default,
|
rules = utils.digilines_default_rules,
|
||||||
},
|
},
|
||||||
|
|
||||||
effector =
|
effector =
|
||||||
|
16
utils.lua
16
utils.lua
@@ -113,6 +113,22 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- check for hopper
|
||||||
|
if minetest.global_exists ("hopper") then
|
||||||
|
utils.hopper_supported = true
|
||||||
|
|
||||||
|
utils.hopper_add_container = function (list)
|
||||||
|
hopper:add_container (list)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
utils.hopper_supported = false
|
||||||
|
|
||||||
|
utils.hopper_add_container = function (list)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function utils.can_interact_with_node (pos, player)
|
function utils.can_interact_with_node (pos, player)
|
||||||
if not player or not player:is_player () then
|
if not player or not player:is_player () then
|
||||||
return false
|
return false
|
||||||
|
Reference in New Issue
Block a user