Initial commit
This commit is contained in:
commit
e4e83eac98
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
41
.gitignore
vendored
Normal file
41
.gitignore
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
# Compiled Lua sources
|
||||
luac.out
|
||||
|
||||
# luarocks build files
|
||||
*.src.rock
|
||||
*.zip
|
||||
*.tar.gz
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
*.os
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
*.def
|
||||
*.exp
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 FaceDeer
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
58
init.lua
Normal file
58
init.lua
Normal file
@ -0,0 +1,58 @@
|
||||
local init = os.clock()
|
||||
minetest.log("action", "["..minetest.get_current_modname().."] loading...")
|
||||
|
||||
journal = {
|
||||
modpath = minetest.get_modpath("journal")
|
||||
}
|
||||
|
||||
dofile(journal.modpath.."/util.lua")
|
||||
dofile(journal.modpath.."/players.lua")
|
||||
dofile(journal.modpath.."/entries.lua")
|
||||
dofile(journal.modpath.."/triggers.lua")
|
||||
dofile(journal.modpath.."/form.lua")
|
||||
|
||||
-- Unified Inventory
|
||||
if minetest.get_modpath("unified_inventory") ~= nil then
|
||||
unified_inventory.register_button("journal", {
|
||||
type = "image",
|
||||
image = "default_book_written.png",
|
||||
tooltip = "journal",
|
||||
action = function(player)
|
||||
local name = player:get_player_name()
|
||||
minetest.show_formspec(name,"journal:journal_" .. name,journal.make_formspec(name))
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- sfinv_buttons
|
||||
if minetest.get_modpath("sfinv_buttons") ~= nil then
|
||||
sfinv_buttons.register_button("journal", {
|
||||
image = "default_book_written.png",
|
||||
tooltip = "your personal journal keeping track of what happens",
|
||||
title = "journal",
|
||||
action = function(player)
|
||||
local name = player:get_player_name()
|
||||
minetest.show_formspec(name,"journal:journal_" .. name,journal.make_formspec(name))
|
||||
end,
|
||||
})
|
||||
elseif minetest.get_modpath("sfinv") ~= nil then
|
||||
sfinv.register_page("journal:journal", {
|
||||
title = "journal",
|
||||
get = function(_, player, context)
|
||||
local name = player:get_player_name()
|
||||
minetest.show_formspec(name,"journal:journal_" .. name,journal.make_formspec(name))
|
||||
return sfinv.make_formspec(player, context, "button[2.5,3;3,1;open_journal;open journal]", false)
|
||||
end,
|
||||
on_player_receive_fields = function(_, player, _, fields)
|
||||
local name = player:get_player_name()
|
||||
if fields.open_journal then
|
||||
minetest.show_formspec(name,"journal:journal_" .. name,journal.make_formspec(name))
|
||||
return true
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
--ready
|
||||
local time_to_load= os.clock() - init
|
||||
journal.log.action("loaded in %.4f s", time_to_load)
|
Loading…
x
Reference in New Issue
Block a user