summaryrefslogtreecommitdiff
path: root/streetsmod
diff options
context:
space:
mode:
authorwebdesigner97 <Christian_D_97@gmx.de>2014-04-23 17:16:19 +0200
committerwebdesigner97 <Christian_D_97@gmx.de>2014-04-23 17:16:19 +0200
commit6bfe4a16d309d3db5d3b27e92c7272cf949d64ff (patch)
treeef91cb4da1410c5060a2b47c0c58df8e96fd4c63 /streetsmod
parent99dce9c5be8c097e5ed4c0be0ac39e78f48051a9 (diff)
downloadroads-6bfe4a16d309d3db5d3b27e92c7272cf949d64ff.tar
roads-6bfe4a16d309d3db5d3b27e92c7272cf949d64ff.tar.gz
roads-6bfe4a16d309d3db5d3b27e92c7272cf949d64ff.tar.bz2
roads-6bfe4a16d309d3db5d3b27e92c7272cf949d64ff.tar.xz
roads-6bfe4a16d309d3db5d3b27e92c7272cf949d64ff.zip
smaller fixes and cleanups
Diffstat (limited to 'streetsmod')
-rw-r--r--streetsmod/forms.lua10
-rw-r--r--streetsmod/init.lua41
2 files changed, 28 insertions, 23 deletions
diff --git a/streetsmod/forms.lua b/streetsmod/forms.lua
new file mode 100644
index 0000000..f412610
--- /dev/null
+++ b/streetsmod/forms.lua
@@ -0,0 +1,10 @@
+streets.forms.chatcmd = smartfs.create("streets:chatcmd", function(state)
+ state:size(10,6)
+ local tlist = state:element("list", { pos={x=0,y=1}, size={w=6,h=5}, name = "streets:chatcmd_modlist" } )
+ tlist:removeItem()
+ for k, v in pairs(streets.extendedBy) do
+ tlist:addItem(tostring(k) .. " " .. S("installed") .. ": " .. tostring(v))
+ end
+ state:label(6.5, 1, "streets:chatcmd_version", S("Running version") .. ": " .. streets.version)
+ state:label(6.5, 1.5, "streets:chatcmd_loadtime", S("Load time") .. ": " .. round(streets.load.fin - streets.load.start,4) .. "s")
+end) \ No newline at end of file
diff --git a/streetsmod/init.lua b/streetsmod/init.lua
index 78c3bc9..80a6ae0 100644
--- a/streetsmod/init.lua
+++ b/streetsmod/init.lua
@@ -5,6 +5,18 @@
Forum : http://bit.ly/12cPMeo
Depends : default
]]
+-- Create variables and tables
+ print("Streets: " .. S("Creating variables and tables..."))
+ streets = {}
+ streets.version = "1.4.4dev"
+ streets.modpath = minetest.get_modpath("streetsmod")
+ streets.extendedBy = {}
+ streets.load = {
+ start = os.clock(),
+ fin = 0
+ }
+ streets.forms = {}
+
-- kaeza: intllib
-- Boilerplate to support localized strings if intllib mod is installed.
-- local S
@@ -16,19 +28,12 @@
end
-- rubenwardy: smartfs
- dofile(minetest.get_modpath("streetsmod").."/libs/smartfs/smartfs.lua")
-
--- Create variables and tables
- print("Streets: " .. S("Creating variables and tables..."))
- streets = {}
- streets.version = "1.4.4dev"
- streets.modpath = minetest.get_modpath("streets")
- streets.extendedBy = {}
- streets.load = {
- start = os.clock(),
- fin = 0
- }
- streets.forms = {}
+ if not minetest.get_modpath("smartfs") then
+ dofile(streets.modpath .. "/libs/smartfs/smartfs.lua")
+ end
+
+-- Load forms
+ dofile(streets.modpath .. "/forms.lua")
-- Check for mods which change this mod's beahaviour
print("Streets: " .. S("Checking installed mods..."))
@@ -73,16 +78,6 @@
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end
- streets.forms.chatcmd = smartfs.create("streets:chatcmd", function(state)
- state:size(10,6)
- local tlist = state:element("list", { pos={x=0,y=1}, size={w=6,h=5}, name = "streets:chatcmd_modlist" } )
- tlist:removeItem()
- for k, v in pairs(streets.extendedBy) do
- tlist:addItem(tostring(k) .. " " .. S("installed") .. ": " .. tostring(v))
- end
- state:label(6.5, 1, "streets:chatcmd_version", S("Running version") .. ": " .. streets.version)
- state:label(6.5, 1.5, "streets:chatcmd_loadtime", S("Load time") .. ": " .. round(streets.load.fin - streets.load.start,4) .. "s")
- end)
minetest.register_chatcommand("streets",{
description = S("Check version of your installed StreetsMod and find information"),
func = function(name,param)