aboutsummaryrefslogtreecommitdiff
path: root/shop.lua
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2020-06-07 18:34:21 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2020-06-07 18:34:21 +0200
commit20b8961640b6c22d4149f7268d403cb4609a03fb (patch)
tree0acdb70090ee8db3e77b5a5ad4573cdd13503e8f /shop.lua
parentcc84f066b001f4ea875b115ace6d533d1bc8b4f3 (diff)
downloadskycraft-20b8961640b6c22d4149f7268d403cb4609a03fb.tar.xz
New file Structure
Diffstat (limited to 'shop.lua')
-rw-r--r--shop.lua36
1 files changed, 0 insertions, 36 deletions
diff --git a/shop.lua b/shop.lua
deleted file mode 100644
index 3eb2a1a..0000000
--- a/shop.lua
+++ /dev/null
@@ -1,36 +0,0 @@
-minetest.register_on_mods_loaded(function()
- for nodename, nodedef in pairs(minetest.registered_nodes) do
- if nodename:find("mcl_signs:") then
- minetest.override_item(nodename, {
- on_rightclick = function(pos, node, player, itemstack, pointed_thing)
- if pos.y < 5000 then return end
- local text = minetest.get_meta(pos):get_string("text") or ""
- local lines = text:split("\n")
- local action, amount, price = lines[1], lines[2], lines[3]
- print(action, amount, price)
- if not (action and amount and price) then return end
- price = string.gsub(price, "%$", "")
- price = tonumber(price)
- amount = string.gsub(amount, "x", "")
- amount = tonumber(amount)
- print(action, amount, price)
- if not (amount and price) then return end
- local func, frameoffset
- if action == "Buy" then
- func, frameoffset = skycraft.buy, -1
- elseif action == "Sell" then
- func, frameoffset = skycraft.sell, 1
- else
- return
- end
- local framepos = vector.add(pos, {x = 0, y = frameoffset, z = 0})
- if minetest.get_node(framepos).name ~= "mcl_itemframes:item_frame" then return end
- local inv = minetest.get_meta(framepos):get_inventory()
- if inv:is_empty("main") then return end
- local itemstack = inv:get_stack("main", 1)
- func(player, itemstack:get_name() .. " " .. tostring(amount), price)
- end,
- })
- end
- end
-end)