123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- mtmock = {}
- mtmock.mod_storage = {}
- dofile('mtmock.conf')
- dofile('mocks/settings.lua')
- dofile('mocks/inventory.lua')
- dofile('mocks/player.lua')
- mtmock.settings = SettingsMock:new()
- -- bind minetest and core aliases and
- -- work with minetest alias from here on
- minetest = mtmock
- core = mtmock
- --[[ //////////////////// CORE STUBS -- BEGIN \\\\\\\\\\\\\\\\\\\\ ]]--
- function core.get_builtin_path()
- return core.SCRIPTDIR
- end
- function core.register_on_joinplayer(join_fun)
- end
- function core.register_on_leaveplayer(leave_fun)
- end
- function core.translate(textdomain, text, ...)
- return text
- end
- function core.get_translator(textdomain)
- return function(str, ...) return core.translate("", str, ...) end
- end
- function core.set_http_api_lua(fun)
- end
- --[[ \\\\\\\\\\\\\\\\\\\\ CORE STUBS -- END //////////////////// ]]--
- --[[ //////////////////// MTMOCK API -- BEGIN \\\\\\\\\\\\\\\\\\\\ ]]--
- function mtmock.add_player(pl_name, is_builder)
- player = PlayerMock:new(pl_name, is_builder)
- minetest.connected_players[pl_name] = player
- return player
- end
- --[[ \\\\\\\\\\\\\\\\\\\\ MTMOCK API -- END //////////////////// ]]--
- -- load MT's serialize functions
- dofile(core.get_builtin_path() .. 'common/serialize.lua')
- dofile(core.get_builtin_path() .. 'game/misc.lua')
- minetest.connected_players = {}
- minetest.worldpath = mtmock.WORLDDIR
- function minetest.get_worldpath()
- return minetest.worldpath
- end
- function minetest.get_connected_players()
- return minetest.connected_players
- end
- function minetest.get_player_by_name(pl_name)
- local player = minetest.connected_players[pl_name]
- return player
- end
- function minetest.log(type, msg)
- end
- function minetest.register_on_chat_message(fun)
- end
- function minetest.register_chatcommand(cmd, def)
- end
- function minetest.setting_get_pos(setting)
- if mtmock.settings[setting] then
- return mtmock.settings[setting]
- else
- return nil
- end
- end
- function minetest.get_mod_storage()
- return mtmock.mod_storage
- end
- function minetest.get_player_privs(pl_name)
- if pl_name == nil or minetest.privs == nil then return nil end
- return minetest.privs[pl_name]
- end
- function minetest.set_player_privs(pl_name, pl_privs)
- if pl_name ~= nil and minetest.privs ~= nil then
- minetest.privs[pl_name] = pl_privs
- end
- end
- return mtmock
|