ExchangeClone/init.lua

33 lines
1.1 KiB
Lua
Raw Normal View History

exchangeclone = {}
2023-03-25 23:29:02 +01:00
if (not minetest.get_modpath("mcl_core")) and (not minetest.get_modpath("default")) then
error("ExchangeClone requires 'default' or 'mcl_core,' but Minetest doesn't let me mark one or the other as a dependency.")
else
2023-05-23 16:53:45 +02:00
exchangeclone.mineclone = minetest.get_modpath("mcl_core")
end
2023-05-13 21:13:22 +02:00
function exchangeclone.get_inventory_drops(pos, inventory, drops) --removes default dependency
local inv = minetest.get_meta(pos):get_inventory()
local n = #drops
for i = 1, inv:get_size(inventory) do
local stack = inv:get_stack(inventory, i)
if stack:get_count() > 0 then
drops[n+1] = stack:to_table()
n = n + 1
end
end
end
local default_path = minetest.get_modpath("exchangeclone")
2021-08-25 18:01:36 +02:00
function exchangeclone.get_item_energy(name)
2021-08-27 00:22:54 +02:00
return minetest.registered_items[name].energy_value or 1
end
2023-05-13 21:13:22 +02:00
exchangeclone.collector_interval = minetest.settings:get("exchangeclone.collector_interval") or 5
2021-08-26 14:52:15 +02:00
dofile(default_path.."/constructor.lua")
2021-08-25 18:01:36 +02:00
dofile(default_path.."/deconstructor.lua")
2021-12-30 22:45:58 +01:00
dofile(default_path.."/energy_collector.lua")
2021-08-27 00:22:54 +02:00
dofile(default_path.."/energy.lua")
2021-08-25 18:01:36 +02:00
dofile(default_path.."/orb.lua")
2023-05-23 16:53:45 +02:00
dofile(default_path.."/philosophers_stone.lua")