Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrench support extend #2

Merged
merged 130 commits into from
Mar 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
5605ed7
change <world>/technic.conf:enable_wrench_crafting -> minetest.conf:w…
nixnoxus Nov 29, 2021
8590d7b
add bones support
nixnoxus Nov 29, 2021
7ceec2a
add connected_chests support
nixnoxus Nov 29, 2021
c784eb9
add xdecor support
nixnoxus Nov 29, 2021
9e99f5d
add pipeworks support [WIP]
nixnoxus Nov 29, 2021
b776d6e
add "technic:injector" support
nixnoxus Nov 29, 2021
e67ce4d
update luacheck
nixnoxus Nov 30, 2021
803d391
update README.md
nixnoxus Nov 30, 2021
f646673
add "pipeworks:nodebreaker_*" support
nixnoxus Dec 1, 2021
c0fb5e0
Update README.md
nixnoxus Dec 1, 2021
2581e19
support node timers
OgelGames Dec 1, 2021
93c3806
adjust craft recipe
OgelGames Dec 1, 2021
45edd1b
fixes
OgelGames Dec 1, 2021
ca83ab2
`more_chests` support
OgelGames Dec 1, 2021
61b3b62
remove the use of translated()
nixnoxus Dec 1, 2021
468ac9c
update README.md
nixnoxus Dec 1, 2021
b4063a5
fix node timers
nixnoxus Dec 1, 2021
5453122
add "pipeworks:*filter" support
nixnoxus Dec 1, 2021
23af4f0
if timeout then
nixnoxus Dec 2, 2021
1fe5ea3
`3d_armor_stand` support
OgelGames Dec 2, 2021
8cf6a7a
add missing optional deps
OgelGames Dec 2, 2021
56d39bb
support node drop
nixnoxus Dec 2, 2021
6a4550b
drop pipeworks wielder in state "off" like digging
nixnoxus Dec 2, 2021
d449bda
add some "pipeworks:*tube*" support
nixnoxus Dec 2, 2021
91f9a8a
`def.drop` can be a string or a boolean
nixnoxus Dec 2, 2021
166d073
nodes/pipeworks.lua
nixnoxus Dec 2, 2021
f73a8da
update luacheck
nixnoxus Dec 2, 2021
26aa3a3
move handling for `def.drop` to `wrench.register_node()`
OgelGames Dec 3, 2021
42c6585
add `def.after_pickup` and always update tube nodes
OgelGames Dec 3, 2021
62f05cb
move api functions to api.lua
OgelGames Dec 3, 2021
25a0965
little code fixes
OgelGames Dec 3, 2021
5992fe1
`biofuel` refinery support
OgelGames Dec 3, 2021
b90694e
add setting wrench.enable_debug (very experimental)
nixnoxus Dec 3, 2021
538488f
add `xdecor:hive` support
nixnoxus Dec 3, 2021
179ac80
add `bees:hive_wild` support
nixnoxus Dec 3, 2021
bfba1b8
add `vessels:shelf` support
nixnoxus Dec 3, 2021
aaf9777
add `mesecons` support (WIP)
nixnoxus Dec 3, 2021
3cc3faf
fix mesecons disconnection
nixnoxus Dec 3, 2021
15a4729
update luacheck
nixnoxus Dec 3, 2021
836ab3f
add `digilines` support
nixnoxus Dec 3, 2021
c4ba022
add `mobs:spawner` support
nixnoxus Dec 3, 2021
3878f16
also update connections on place
OgelGames Dec 4, 2021
fddfbe4
meta:get_string always returns a string
OgelGames Dec 4, 2021
9e2e68d
fix metas
OgelGames Dec 4, 2021
b53d9ce
use `drop_node` in get_description()
nixnoxus Dec 4, 2021
17644a7
fix luacontroller* and descriptions added
nixnoxus Dec 4, 2021
7e5cfae
add `realchess:chessboard` support
nixnoxus Dec 4, 2021
99851e3
fix typo
nixnoxus Dec 4, 2021
3c1d8ba
rename functions "wrench.*" to "wrench:*" (#3)
nixnoxus Dec 4, 2021
e43ff07
fix crash when `wrench.enable_debug = true`
nixnoxus Dec 4, 2021
b0947f8
fix typo in description for `realchess:chessboard`
nixnoxus Dec 4, 2021
de87e79
Revert "rename functions "wrench.*" to "wrench:*" (#3)"
OgelGames Dec 5, 2021
3021731
add compatibility for `:`
OgelGames Dec 5, 2021
820b8d5
Revert "add compatibility for `:`"
OgelGames Dec 5, 2021
3a267e6
add `wrench.plus = true`
OgelGames Dec 5, 2021
d253340
fixes for lua nodes
OgelGames Dec 5, 2021
4dd385c
Update README.md
nixnoxus Dec 5, 2021
d662feb
list supported modnames and nodes
nixnoxus Dec 5, 2021
b2b48cc
Update README.md
nixnoxus Dec 5, 2021
f9da60c
fix and update translations
nixnoxus Dec 6, 2021
f71f2a3
fix luacheck warning
nixnoxus Dec 6, 2021
c16ae41
modname is always "wrench"
OgelGames Dec 6, 2021
76cbf7e
Revert "Revert "add compatibility for `:`""
nixnoxus Dec 6, 2021
83b903e
pass `pointed_thing` to `def.after_place`
OgelGames Dec 7, 2021
e3fafc6
`signs_lib` support
OgelGames Dec 7, 2021
eda2143
only override nodes once
OgelGames Dec 7, 2021
83cfbc3
mark log messages with "[wrench]"
OgelGames Dec 7, 2021
c836d97
luacheck and depends
OgelGames Dec 7, 2021
ab56941
`basic_signs` support
OgelGames Dec 7, 2021
e980721
fix glow items being dropped from signs
OgelGames Dec 7, 2021
16028e9
add wrench.description_with_configuration()
nixnoxus Dec 7, 2021
220d937
split `mesecons_*`
nixnoxus Dec 7, 2021
7d996b4
fix `mesecons_microcontroller:microcontroller*` drop
nixnoxus Dec 7, 2021
4fbc896
update german translation
nixnoxus Dec 7, 2021
c2d632b
use wrench.description_with_configuration() when `lists` and `descrip…
nixnoxus Dec 7, 2021
219023e
add `protector` support
nixnoxus Dec 7, 2021
c38f0f7
restore nodes/pipeworks.lua
nixnoxus Dec 7, 2021
1f4d352
fix spaces
nixnoxus Dec 7, 2021
9edee9d
initial api.txt
nixnoxus Dec 7, 2021
7010c44
api.txt -> API.md
nixnoxus Dec 8, 2021
2c93dff
fix basic_signs: +metas.unifont
nixnoxus Dec 8, 2021
a146201
update README.md
nixnoxus Dec 8, 2021
6cd14c0
fix signs_lib: +metas.unifont
nixnoxus Dec 8, 2021
3aadf58
Update API.md
nixnoxus Dec 8, 2021
3ac7d50
Update API.md
nixnoxus Dec 8, 2021
76d40f5
add `wrench.unregister_node` and move drop check
OgelGames Dec 9, 2021
53b485b
add `wrench.description_with_text`
OgelGames Dec 9, 2021
a56e7a8
change `has_*` to `wrench.has_*`
nixnoxus Dec 10, 2021
2170179
*fix `technic:cnc_mk2` and `technic:*_battery_box*`: +metas.channel
nixnoxus Dec 10, 2021
36e7e5b
add `technic:forcefield_emitter_*` and `technic:quarry`
nixnoxus Dec 10, 2021
2654020
fix strip_esc()
nixnoxus Dec 14, 2021
e934fad
add `wrench.description_with_channel`
nixnoxus Dec 14, 2021
3b8bf58
check `meta` and `lists` before pickup when `wrench.enable_debug = true`
nixnoxus Dec 14, 2021
6778aaa
add `digistuff` support (WIP)
nixnoxus Dec 14, 2021
2caf555
add `wrench.META_TYPE_IGNORE`
nixnoxus Dec 15, 2021
2a3c410
more `digistuff` support (WIP)
nixnoxus Dec 15, 2021
383f8be
fix: meta:to_table() before minetest.remove_node(pos)
nixnoxus Dec 17, 2021
7c2b681
even more `digistuff` support (WIP)
nixnoxus Dec 17, 2021
fe7d42a
update README.md
nixnoxus Dec 17, 2021
e21c4b0
fix digilines lcd and remove unnecessary metas
OgelGames Dec 17, 2021
dc98615
complete `digistuff` support
nixnoxus Dec 17, 2021
83fbb54
add `digiscreen` support
nixnoxus Dec 18, 2021
1c7d089
fix `bones:bones` with `mapserver_mod` (see: https://github.com/minet…
nixnoxus Jan 3, 2022
3066bfa
add misc `wrench.META_TYPE_IGNORE` keys
nixnoxus Jan 3, 2022
75094d2
add meta `internal_EU_charge_max` for technic:*_battery_box*
nixnoxus Jan 3, 2022
989fccb
add meta `tube_time` for technic:cnc_mk2
nixnoxus Jan 3, 2022
8047a6b
add `technic:power_monitor` and `technic:switching_station` when `wre…
nixnoxus Jan 3, 2022
39c1802
add `technic:supply_converter`
nixnoxus Jan 3, 2022
c0a675f
Update README.md
nixnoxus Jan 3, 2022
0ef346c
add `digiline_detector_tube_*`
nixnoxus Jan 3, 2022
fbfbd9f
add `technic:*_generator*`
nixnoxus Jan 3, 2022
f4373cc
ignore `tube_time` and `formspec` on LV base machines
nixnoxus Jan 3, 2022
5197e26
fix `technic:*_battery_box_*`: +metas.tube_time
nixnoxus Jan 3, 2022
f42ec58
add `def.lists_ignore` (used when `wrench.enable_debug = true`)
nixnoxus Jan 3, 2022
03c6bfc
fix `metas` and add `lists_ignore` for `technic:*_chest`
nixnoxus Jan 3, 2022
98706fc
move sanity checks to `wrench.pickup_node`
nixnoxus Jan 9, 2022
708286d
add misc `wrench.META_TYPE_IGNORE` keys
nixnoxus Jan 9, 2022
03a47ca
move debug.lua to debug/debug.lua
nixnoxus Jan 9, 2022
1b56bef
Update API.md
nixnoxus Jan 9, 2022
625caa2
rename `before_remove` to `before_pickup`
nixnoxus Jan 9, 2022
4974c80
Update README.md (cleanup #Contributors)
nixnoxus Jan 9, 2022
44181bc
make `debug/debug.lua` optional
nixnoxus Jan 9, 2022
29a4857
Update digistuff.lua
OgelGames Jan 17, 2022
6e619ea
fix `digistuff:detector` channel = wrench.META_TYPE_STRING
nixnoxus Jan 18, 2022
e470b46
fix `digistuff:movestone` state & active = wrench.META_TYPE_IGNORE
nixnoxus Jan 18, 2022
dc07739
Update digiscreen.lua
OgelGames Jan 21, 2022
6806711
whitespace and typo fixes in API.md
OgelGames Jan 27, 2022
85442cf
copy formspec of digistuff detector and camera
OgelGames Jan 27, 2022
495d081
Update mesecons_detector.lua
OgelGames Jan 27, 2022
ebd8cbb
fix crash when node has no inventory
nixnoxus Feb 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
unused_args = false
allow_defined_top = true
max_line_length = 999

globals = {
"technic", "minetest",
"minetest",
}

read_globals = {
string = {fields = {"split", "trim"}},
table = {fields = {"copy", "getn"}},
string = {fields = {"split"}},
table = {fields = {"copy"}},

"intllib", "ItemStack", "drawers",
}
-- Minetest
"ItemStack",

files["init.lua"].ignore = { "name", "stack" }
-- Mods
"digilines",
"drawers",
"mesecon",
"pipeworks",
"signs_lib",
"xdecor",
}
88 changes: 88 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# API

## Node registration

Schematic:
```lua
wrench.register_node(node.name, {
lists = list,
-- inventory list

lists_ignore = lists_ignore,
-- ignored and not saved inventory list

metas = table,
-- Table for node metadata:
-- name: Meta name
-- type: Data type:
-- `wrench.META_TYPE_IGNORE` ignored and not saved
-- `wrench.META_TYPE_FLOAT` for float
-- `wrench.META_TYPE_STRING` for string
-- `wrench.META_TYPE_INT` for integer

description = nil,
-- Default behavior:
-- when `lists` is not `nil`
-- `minetest.registered_nodes[node.name].description` + " with items"
-- when `lists` is `nil` and only `metas.channel` is defined
-- `minetest.registered_nodes[node.name].description` + " with channel '<CHANNEL>'"
-- when `lists` is `nil`
-- `minetest.registered_nodes[node.name].description` + " with configuration"
description = `wrench.description_with_items`,
-- Description of the node + " with items"
description = `wrench.description_with_configuration`,
-- Description of the node + " with configuration"
description = `wrench.description_with_channel`,
-- Description of the node + " with channel " + channel
description = `wrench.description_with_text`,
-- Description of the node + " with text " + text
description = function(pos, meta, node, player),
-- Function returns description

drop = nil,
-- Default dropped item is the node itself
drop = true,
-- Use `minetest.registered_nodes[node.name].drop`
drop = "default:cobble",
-- Name of dropped item

owned = nil,
-- Default: anyone can pickup this node
owned = true,
-- Only `metas["owner"]` can pickup this node

timer = nil,
-- Default
timer = true,
-- Save node timers

before_pickup = nil,
-- Default
before_pickup = function(pos, meta, node, player)
-- Function called before pickup node

after_pickup = nil,
-- default
after_pickup = function(pos, node, meta_table, player)
-- Function called after pickup node

after_place = nil,
-- Default
after_place = function(pos, player, itemstack, pointed_thing),
-- Function called after place node
})
```

Example:
```lua
wrench.register_node("bones:bones", {
lists = {"main"},
metas = {
owner = wrench.META_TYPE_STRING,
infotext = wrench.META_TYPE_STRING,
formspec = wrench.META_TYPE_STRING,
time = wrench.META_TYPE_INT,
},
owned = true,
})
```
159 changes: 159 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,161 @@
![](https://github.com/mt-mods/wrench/workflows/luacheck/badge.svg)
[![License](https://img.shields.io/badge/license-LGPLv2.0%2B-purple.svg)](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.en.html)

<!--
[![ContentDB](https://content.minetest.net/packages/mt-mods/wrench/shields/downloads/)](https://content.minetest.net/packages/mt-mods/wrench/)
-->

# Wrench

<img src="textures/technic_wrench.png"/>

The wrench tool allows you to left-click on nodes with inventories to pick them up.

This mod is a fork from wrench/ in https://github.com/mt-mods/technic

# Supported Mods and Nodes

* https://github.com/minetest/minetest_game
- bones:bones
- default:chest
- default:chest_locked
- default:furnace
- default:sign_wall_wood
- default:sign_wall_steel
- vessels:shelf
* https://github.com/minetest-mods/3d_armor
- 3d_armor_stand:armor_stand
- 3d_armor_stand:locked_armor_stand
* https://github.com/mt-mods/basic_signs
- basic_signs:sign_wall_glass
- basic_signs:sign_wall_locked
- basic_signs:sign_wall_obsidian_glass
- basic_signs:sign_wall_plastic
- basic_signs:sign_wall_steel_\*
* https://notabug.org/TenPlus1/bees
- bees:hive_wild
* https://github.com/Lokrates/Biofuel
- biofuel:refinery
* https://github.com/HybridDog/connected_chests
* https://github.com/minetest-mods/digilines
- digilines:chest
- digilines:lcd
- digilines:lightsensor
- digilines:rtc
* https://cheapiesystems.com/git/digiscreen/
* https://github.com/mt-mods/digistuff
- digistuff:advtouchscreen
- digistuff:button_\*
- digistuff:camera
- digistuff:card_reader
- digistuff:controller_programmed
- digistuff:detector
- digistuff:eeprom
- digistuff:gpu
- digistuff:ioexpander_\*
- digistuff:light_\*
- digistuff:movestone
- digistuff:nic
- digistuff:noteblock
- digistuff:panel
- digistuff:piezo
- digistuff:piston\*
- digistuff:ram
- digistuff:timer
- digistuff:touchscreen
- digistuff:wall_knob_configured
* https://github.com/minetest-mods/digtron
- digtron:battery_holder
- digtron:inventory
- digtron:fuelstore
- digtron:combined_storage
* https://github.com/minetest-mods/drawers
- drawers:wood
- drawers:acacia_wood
- drawers:aspen_wood
- drawers:junglewood
- drawers:pine_wood
* https://github.com/minetest-mods/mesecons
- mesecons_commandblock:commandblock_\*
- mesecons_detector:node_detector_\*
- mesecons_detector:object_detector_\*
- mesecons_luacontroller:luacontroller\*
- mesecons_microcontroller:microcontroller\*
* https://notabug.org/tenplus1/mobs_redo
- mobs:spawner
* https://github.com/minetest-mods/more_chests
- more_chests:cobble
- more_chests:dropbox
- more_chests:fridge
- more_chests:big_fridge
- more_chests:shared
- more_chests:secret
- more_chests:toolbox_\*
* https://github.com/mt-mods/pipeworks
- pipeworks:autocrafter
- pipeworks:deployer_\*
- pipeworks:digiline_detector_tube_\*
- pipeworks:dispenser_\*
- pipeworks:nodebreaker_\*
- pipeworks:\*filter
- pipeworks:lua_tube\*
- pipeworks:mese_sand_tube_\*
- pipeworks:mese_tube_\*
- pipeworks:teleport_tube_\*
* https://notabug.org/tenplus1/protector
- protector:chest
- protector:protect
- protector:protect2
* https://github.com/mt-mods/signs_lib
* https://github.com/mt-mods/technic
- technic:cnc\*
- technic:coal_alloy_furnace\*
- technic:\*chest\*
- technic:injector
- technic:power_monitor
- technic:supply_converter
- technic:switching_station
- technic:tool_workshop
- technic:\*_alloy_furnace\*
- technic:\*_battery_box\*
- technic:\*_centrifuge\*
- technic:\*_compressor\*
- technic:\*_electric_furnace\*
- technic:\*_extractor\*
- technic:\*_freezer\*
- technic:\*_generator\*
- technic:\*_grinder\*
* https://github.com/minetest-mods/xdecor
- realchess:chessboard
- xdecor:cabinet
- xdecor:cabinet_half
- xdecor:empty_shelf
- xdecor:multishelf
- xdecor:cauldron_\*
- xdecor:enchantment_table
- xdecor:itemframe
- xdecor:mailbox

# Settings in `minetest.conf`
```ini
# Allows the wrench to be crafted if either the 'technic' or 'default' mod is installed.
wrench.enable_crafting = true
```

# Contributors

* Nekogloop
* ShadowNinja
* BuckarooBanzay
* OgelGames
* int-ua
* S-S-X
* H-V-Smacker
* groxxda
* And many others...

# License

Unless otherwise stated, all components of this modpack are licensed under the
LGPL, V2 or later. See also the individual mod folders for their
secondary/alternate licenses, if any.
59 changes: 59 additions & 0 deletions api.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

function wrench.register_node(name, def)
assert(type(name) == "string", "wrench.register_node invalid type for name")
assert(type(def) == "table", "wrench.register_node invalid type for def")
local node_def = minetest.registered_nodes[name]
if node_def then
wrench.registered_nodes[name] = table.copy(def)
else
minetest.log("warning", "[wrench] Attempt to register unknown node: "..name)
end
end

function wrench.unregister_node(name)
assert(type(name) == "string", "wrench.unregister_node invalid type for name")
if wrench.registered_nodes[name] then
wrench.registered_nodes = nil
else
minetest.log("warning", "[wrench] Attempt to unregister unsupported node: "..name)
end
end

function wrench.blacklist_item(name)
assert(type(name) == "string", "wrench.blacklist_item invalid type for name")
local node_def = minetest.registered_items[name]
if node_def then
wrench.blacklisted_items[name] = true
else
minetest.log("warning", "[wrench] Attempt to blacklist unknown item: "..name)
end
end

minetest.register_on_mods_loaded(function()
for name, def in pairs(wrench.registered_nodes) do
local node_def = minetest.registered_nodes[name]
if node_def then
local old_after_place = node_def.after_place_node
minetest.override_item(name, {
after_place_node = function(...)
if not wrench.restore_node(...) and old_after_place then
return old_after_place(...)
end
end
})
if def.drop == true and type(node_def.drop) == "string" then
def.drop = node_def.drop
elseif def.drop and type(def.drop) ~= "string" then
minetest.log("warning", "[wrench] Ignoring invalid type for drop in definition for "..name)
def.drop = nil
end
if def.drop and not wrench.registered_nodes[def.drop] then
minetest.log("warning", "[wrench] Ignoring unsupported node for drop in definition for "..name)
def.drop = nil
end
else
minetest.log("warning", "[wrench] Registered node is now unknown: "..name)
wrench.registered_nodes[name] = nil
end
end
end)
Loading