Merge branch 'new_file_org' into 'master'

Change file structures so that the interior modpol folder IS the portable modpol.

See merge request medlabboulder/modpol!2
This commit is contained in:
Nathan Schneider 2021-02-11 21:56:34 +00:00
commit b6ac30ee72
13 changed files with 41 additions and 6 deletions

View File

@ -15,7 +15,7 @@ modpol = {}
-- get modpol_minetest's version of directory
modpol.get_script_dir = function()
return minetest.get_modpath("modpol")
return minetest.get_modpath("modpol").."/modpol"
end
-- TKTK: Implement minetest settingtypes for this... for now, the default is to use minetest mod storage.
@ -24,7 +24,7 @@ end
-- works with cmd line: "/storage/storage-local.lua", works with Minetest 5.0 and up: "/storage/storage-mod_storage.lua"
modpol.storage_file_path = minetest.get_modpath("modpol").."/storage/storage-mod_storage.lua"
modpol.storage_file_path = minetest.get_modpath("modpol").."/modpol_minetest/storage/storage-mod_storage.lua"
-- ===================================================================
-- /init.lua
@ -35,7 +35,7 @@ modpol.storage_file_path = minetest.get_modpath("modpol").."/storage/storage-mod
-- ===================================================================
-- Load modpol system
dofile(minetest.get_modpath("modpol") .. "/modpol.lua")
dofile(minetest.get_modpath("modpol") .. "/modpol/modpol.lua")
-- ===================================================================

View File

@ -0,0 +1,35 @@
When calling modpol.lua from another file, one may wish to use
different functions than those included by default.
So far, 2 definitions need to be made BEFORE calling modpol.lua, the rest can be overwritten
after calling modpol.lua .
setup:
----------------
Define the global modpol table:
modpol = {}
the following 2 items *may* be defined, if they are not, then defaults will be used:
========================
--------------------
modpol.get_script_dir()
--------------------
type: function
defaults to: a function that can only work in linux
usage: must return the file path of the modpol directory. If modpol is in a
larger directory, such as a mod filesystem, make sure that the path returned is the "base"
modpol folder, i.e. the folder with all the original modpol files.
========================
--------------------
modpol.storage_file_path
--------------------
type: string
defaults to: topdir .. "/storage/storage-local.lua",
where topdir is the directory defined by modpol.storage_file_path
usage: if you wish to use another method of storage than that provided by default,
then you can save a filepath to the storage script here.

View File

@ -1,6 +1,6 @@
--call all files in this directory
local localdir = modpol.get_script_dir() .. "/modpol"
local localdir = modpol.topdir
--Users
dofile (localdir .. "/users/users.lua")

View File

@ -71,7 +71,7 @@ modpol.load_storage()
-- ModPol core features
dofile (topdir .. "/modpol/api.lua")
dofile (topdir .. "/api.lua")
-- ===================================================================

View File

@ -7,7 +7,7 @@
-- ===================================================================
local localdir = modpol.get_script_dir() .. "/modpol_minetest"
local localdir = minetest.get_modpath("modpol") .. "/modpol_minetest"
--Users
dofile (localdir .. "/overrides/users/users.lua")