Compare commits

...

1 Commits

Author SHA1 Message Date
loosewheel
32df0b8420 Add files via upload 2021-11-12 14:40:43 +10:00
12 changed files with 169 additions and 16 deletions

View File

@@ -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.

View File

@@ -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

View File

@@ -4,3 +4,4 @@ mesecons?
digilines?
unifieddyes?
intllib?
hopper?

View File

@@ -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 =

View File

@@ -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

View File

@@ -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

View File

@@ -1,4 +1,4 @@
local version = "0.1.1"
local version = "0.1.2"
local mod_storage = minetest.get_mod_storage ()

View File

@@ -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

View File

@@ -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 =

View File

@@ -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 = "<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
----------

View File

@@ -422,7 +422,7 @@ local function digilines_support ()
{
wire =
{
rules = digiline.rules.default,
rules = utils.digilines_default_rules,
},
effector =

View File

@@ -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)
if not player or not player:is_player () then
return false