-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Buckaroo Banzai <[email protected]>
- Loading branch information
1 parent
9714875
commit c02568e
Showing
4 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,7 @@ local mods = { | |
"digistuff", | ||
"digtron", | ||
"drawers", | ||
"fancy_vend", | ||
"easyvend", | ||
"jumpdrive", | ||
"locator", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ optional_depends = """ | |
digiscreen, | ||
digistuff, | ||
drawers, | ||
fancy_vend, | ||
easyvend, | ||
jumpdrive, | ||
locator, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
-- Register wrench support for the fancy_vend mod | ||
|
||
for _, vendor in ipairs({ | ||
"fancy_vend:player_vendor", | ||
"fancy_vend:player_depo", | ||
"fancy_vend:admin_vendor", | ||
"fancy_vend:admin_depo", | ||
}) do | ||
wrench.register_node(vendor, { | ||
lists = { "given_item", "main", "wanted_item" }, | ||
metas = { | ||
alerted = wrench.META_TYPE_STRING, | ||
configured = wrench.META_TYPE_STRING, | ||
infotext = wrench.META_TYPE_IGNORE, | ||
item = wrench.META_TYPE_STRING, | ||
log = wrench.META_TYPE_STRING, | ||
message = wrench.META_TYPE_STRING, | ||
owner = wrench.META_TYPE_STRING, | ||
settings = wrench.META_TYPE_STRING, | ||
}, | ||
after_pickup = function(pos, node, meta_table, player) | ||
local above_node_pos = table.copy(pos) | ||
above_node_pos.y = above_node_pos.y + 1 | ||
core.remove_node(above_node_pos) | ||
fancy_vend.remove_item(above_node_pos) | ||
end, | ||
after_place = function(pos) | ||
-- This happens during vendor's on_place function is being run! | ||
-- So we need to hack around that race condition. | ||
-- At this time wrench has already set the meta, so we can stash | ||
-- it from the node with fancy_vend function | ||
local settings = fancy_vend.get_vendor_settings(pos) | ||
core.after(0, function(p, s) | ||
-- Use fancy_vend's own function to apply the stashed settings | ||
fancy_vend.set_vendor_settings(p, s) | ||
fancy_vend.refresh_vendor(p) | ||
end, pos, settings) | ||
end, | ||
}) | ||
end | ||
|