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 17 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
17 changes: 10 additions & 7 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
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
"drawers",
"intllib",
"xdecor",
}
85 changes: 85 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,87 @@
![](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
* https://github.com/HybridDog/connected_chests
* 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/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:dispenser_*
- pipeworks:nodebreaker_*
* https://github.com/mt-mods/technic
* https://github.com/minetest-mods/xdecor
- 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 (originally technic modpack)

* kpoppel
* Nekogloop
* Nore/Ekdohibs
* ShadowNinja
* VanessaE
* BuckarooBanzay
* OgelGames
* int-ua
* S-S-X
* H-V-Smacker
* groxxda
* SwissalpS
* And many others...

# License (originally technic modpack)

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.
18 changes: 18 additions & 0 deletions functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ function wrench.pickup_node(pos, player)
data.metas[name] = meta:get_int(name)
end
end
if def.timer then
local timer = minetest.get_node_timer(pos)
local timeout = timer:get_timeout()
if timeout then
nixnoxus marked this conversation as resolved.
Show resolved Hide resolved
data.timer = {
timeout = timeout,
elapsed = timer:get_elapsed()
}
end
end
local stack = ItemStack(node.name)
local item_meta = stack:get_meta()
item_meta:set_string("data", minetest.serialize(data))
Expand Down Expand Up @@ -121,6 +131,14 @@ function wrench.restore_node(pos, player, stack)
meta:set_string(name, value)
end
end
if data.timer then
local timer = minetest.get_node_timer(pos)
if data.timer.timeout == 0 then
timer:stop()
else
timer:set(data.timer.timeout, data.timer.elapsed)
end
end
if def.after_place then
def.after_place(pos, player, stack)
end
Expand Down
5 changes: 5 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,17 @@ function wrench.blacklist_item(name)
end

local mods = {
"bones",
"connected_chests",
"default",
"digtron",
"drawers",
"more_chests",
"pipeworks",
"technic",
"technic_chests",
"technic_cnc",
"xdecor",
}

for _, modname in pairs(mods) do
Expand Down
14 changes: 13 additions & 1 deletion mod.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
name = wrench
optional_depends = technic, technic_chests, technic_worldgen, intllib, drawers, default, digtron
optional_depends = """
bones,
connected_chests,
default,
digtron,
drawers,
intllib,
pipeworks,
technic,
technic_chests,
technic_worldgen,
xdecor,
"""
13 changes: 13 additions & 0 deletions nodes/bones.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

-- Register wrench support for bones

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,
})
28 changes: 28 additions & 0 deletions nodes/connected_chests.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

-- Register wrench support for connected_chests

wrench.register_node("default:chest_connected_left", {
lists = {"main"},
})

wrench.register_node("default:chest_connected_right", {
lists = {"main"},
})

wrench.register_node("default:chest_locked_connected_left", {
lists = {"main"},
metas = {
owner = wrench.META_TYPE_STRING,
infotext = wrench.META_TYPE_STRING
},
owned = true,
})

wrench.register_node("default:chest_locked_connected_right", {
lists = {"main"},
metas = {
owner = wrench.META_TYPE_STRING,
infotext = wrench.META_TYPE_STRING
},
owned = true,
})
40 changes: 40 additions & 0 deletions nodes/more_chests.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

-- Register wrench support for more_chests

local basic_chests = {
"more_chests:cobble",
"more_chests:dropbox",
"more_chests:fridge",
"more_chests:big_fridge",
"more_chests:secret",
"more_chests:toolbox_acacia",
"more_chests:toolbox_aspen",
"more_chests:toolbox_jungle",
"more_chests:toolbox_pine",
"more_chests:toolbox_steel",
"more_chests:toolbox_wood",
}

for _,chest in pairs(basic_chests) do
wrench.register_node(chest, {
lists = {"main"},
metas = {
owner = wrench.META_TYPE_STRING,
infotext = wrench.META_TYPE_STRING,
},
owned = true,
})
end

-- Shared Chest

wrench.register_node("more_chests:shared", {
lists = {"main"},
metas = {
owner = wrench.META_TYPE_STRING,
infotext = wrench.META_TYPE_STRING,
formspec = wrench.META_TYPE_STRING,
shared = wrench.META_TYPE_STRING,
},
owned = true,
})
38 changes: 38 additions & 0 deletions nodes/pipeworks.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

-- Register wrench support for pipeworks

wrench.register_node("pipeworks:autocrafter", {
lists = {"src", "dst", "recipe", "output"},
metas = {
enabled = wrench.META_TYPE_INT,
channel = wrench.META_TYPE_STRING,
infotext = wrench.META_TYPE_STRING,
formspec = wrench.META_TYPE_STRING,
},
description = function(pos, meta, node, player)
return meta:get_string("infotext")
end,
timer = true,
})

local wielder_data = {
lists = {"main"},
metas = {
owner = wrench.META_TYPE_STRING,
infotext = wrench.META_TYPE_STRING,
formspec = wrench.META_TYPE_STRING,
},
}

-- TODO: convert *_on to *_off nodes before pickpup?

wrench.register_node("pipeworks:deployer_off", wielder_data)
wrench.register_node("pipeworks:deployer_on", wielder_data)

wrench.register_node("pipeworks:dispenser_off", wielder_data)
wrench.register_node("pipeworks:dispenser_on", wielder_data)

table.insert(wielder_data.lists, "pick")
table.insert(wielder_data.lists, "ghost_pick")
wrench.register_node("pipeworks:nodebreaker_off", wielder_data)
wrench.register_node("pipeworks:nodebreaker_on", wielder_data)
17 changes: 15 additions & 2 deletions nodes/technic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ local function register_machine_node(nodename, tier)
wrench.register_node(nodename, {lists = lists, metas = metas})
end

-- base_machines table row format: name = { extra meta fields }
local defaults = { tiers = {"LV", "MV", "HV"} }
-- base_machines table row format: name = {extra meta fields}
local defaults = {tiers = {"LV", "MV", "HV"}}
local base_machines = {
electric_furnace = defaults,
grinder = defaults,
Expand Down Expand Up @@ -91,3 +91,16 @@ for _, tier in pairs({"LV", "MV", "HV"}) do
})
end
end

-- Other machines

wrench.register_node("technic:injector", {
lists = {"main"},
metas = {
splitstacks = wrench.META_TYPE_INT,
mode = wrench.META_TYPE_STRING,
infotext = wrench.META_TYPE_STRING,
formspec = wrench.META_TYPE_STRING,
},
timer = true,
})
30 changes: 15 additions & 15 deletions nodes/technic_chests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,21 @@ end
-- Register extra nodes with color marking for gold chest

local chest_mark_colors = {
'_black',
'_blue',
'_brown',
'_cyan',
'_dark_green',
'_dark_grey',
'_green',
'_grey',
'_magenta',
'_orange',
'_pink',
'_red',
'_violet',
'_white',
'_yellow',
"_black",
"_blue",
"_brown",
"_cyan",
"_dark_green",
"_dark_grey",
"_green",
"_grey",
"_magenta",
"_orange",
"_pink",
"_red",
"_violet",
"_white",
"_yellow",
}

for i = 1, 15 do
Expand Down
Loading