Skip to content

Commit

Permalink
Add [currency] support (#25)
Browse files Browse the repository at this point in the history
Co-authored-by: Buckaroo Banzai <39065740+BuckarooBanzay@users.noreply.github.com>
  • Loading branch information
SwissalpS and BuckarooBanzay authored Dec 31, 2024
1 parent 03fe55a commit a869db3
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ read_globals = {
"table.indexof",
"minetest",
"ItemStack",
"barter",
"beacon",
"christmas",
"digilines",
Expand Down
1 change: 1 addition & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ local mods = {
"bones",
"christmas",
"connected_chests",
"currency",
"default",
"digibuilder",
"digilines",
Expand Down
1 change: 1 addition & 0 deletions mod.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ optional_depends = """
biofuel,
bones,
connected_chests,
currency,
christmas,
default,
digtron,
Expand Down
42 changes: 42 additions & 0 deletions nodes/currency.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

-- Register wrench support for the currency mod

wrench.register_node("currency:barter", {
lists = { "pl1", "pl2" },
metas = {
clean = wrench.META_TYPE_INT,
formspec = wrench.META_TYPE_IGNORE,
infotext = wrench.META_TYPE_IGNORE,
pl1 = wrench.META_TYPE_STRING,
pl2 = wrench.META_TYPE_STRING,
pl1step = wrench.META_TYPE_INT,
pl2step = wrench.META_TYPE_INT,
timer = wrench.META_TYPE_INT,
},
timer = true,
after_place = function(pos, player, stack, pointed)
barter.chest.update_formspec(core.get_meta(pos))
end,
})

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

-- Unkown what happens if a shop is wrenched while a user is using it.
for _, name in ipairs({ "currency:shop", "currency:shop_empty" }) do
wrench.register_node(name, {
lists = { "customers_gave", "owner_gives", "owner_wants", "stock" },
metas = {
infotext = wrench.META_TYPE_STRING,
owner = wrench.META_TYPE_STRING,
},
owned = true,
})
end

0 comments on commit a869db3

Please sign in to comment.