Merge pull request #18 from MoNTE48/patch1

Fix 'Unable to register same mod storage twice' error
This commit is contained in:
Alexsandro Percy 2023-09-25 17:48:49 -03:00 committed by GitHub
commit 8e6cba2238
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -1,9 +1,11 @@
-- Minetest 5.4.1 : automobiles
local S = minetest.get_translator(minetest.get_current_modname())
automobiles_lib = {}
automobiles_lib = {
storage = minetest.get_mod_storage()
}
local storage = minetest.get_mod_storage()
local storage = automobiles_lib.storage
automobiles_lib.fuel = {['biofuel:biofuel'] = 1,['biofuel:bottle_fuel'] = 1,
['biofuel:phial_fuel'] = 0.25, ['biofuel:fuel_can'] = 10,

View File

@ -1,4 +1,4 @@
local storage = minetest.get_mod_storage()
local storage = automobiles_lib.storage
automobiles_lib.modname = minetest.get_current_modname()
local function get_formspec_by_size(self, size)
@ -94,8 +94,8 @@ function automobiles_lib.remove_inventory(self)
local pos = self.object:get_pos()
for k, v in pairs(inv_content) do
local count = 0
for i = 0,v:get_count()-1,1
do
for i = 0,v:get_count()-1,1
do
minetest.add_item({x=pos.x+math.random()-0.5,y=pos.y,z=pos.z+math.random()-0.5},v:get_name())
count = count + 1
if count >= 5 then break end
@ -177,7 +177,7 @@ function automobiles_lib.list_inventory(self)
local inventory = automobiles_lib.get_inventory(self)
if inventory then
local list = inventory.get_list("main")
minetest.chat_send_all(dump(list))
end
end