roads/streetsmod/init.lua

91 lines
2.9 KiB
Lua
Raw Normal View History

2013-08-10 19:23:52 +02:00
--[[
StreetsMod 1.1 by webdesigner97:
2013-12-18 07:53:49 +01:00
License : CC-BY-SA 3.0 Unported (see license.txt)
2013-08-10 19:23:52 +02:00
Readme : see readme.txt
Forum : http://bit.ly/12cPMeo
Depends : default
]]
2014-04-11 16:40:13 +02:00
-- kaeza: intllib
-- Boilerplate to support localized strings if intllib mod is installed.
2014-04-14 17:39:09 +02:00
-- local S
2014-04-11 16:40:13 +02:00
if (minetest.get_modpath("intllib")) then
dofile(minetest.get_modpath("intllib").."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname())
else
S = function ( s ) return s end
end
2013-08-10 19:23:52 +02:00
-- Create variables and tables
2014-04-11 16:40:13 +02:00
print("Streets: " .. S("Creating variables and tables..."))
2013-08-10 19:23:52 +02:00
streets = {}
2014-04-11 16:40:13 +02:00
streets.version = "1.4.4dev"
2013-08-10 19:23:52 +02:00
streets.modpath = minetest.get_modpath("streets")
streets.extendedBy = {}
2013-10-14 12:50:13 +02:00
streets.load = {
start = os.clock(),
fin = 0
}
2013-08-10 19:23:52 +02:00
-- Check for mods which change this mod's beahaviour
print("Streets: Checking installed mods...")
if minetest.get_modpath("wool") then
streets.extendedBy.wool = true
else
streets.extendedBy.wool = false
end
if minetest.get_modpath("technic") then
streets.extendedBy.technic = true
else
streets.extendedBy.technic = false
end
if minetest.get_modpath("moreblocks") then
streets.extendedBy.moreblocks = true
2013-08-10 19:23:52 +02:00
else
streets.extendedBy.moreblocks = false
2013-08-10 19:23:52 +02:00
end
if minetest.get_modpath("mesecons") then
streets.extendedBy.mesecons = true
else
streets.extendedBy.mesecons = false
end
if minetest.get_modpath("digilines") then
streets.extendedBy.digilines = true
else
streets.extendedBy.digilines = false
end
if minetest.get_modpath("prefab") then
streets.extendedBy.prefab = true
else
streets.extendedBy.prefab = false
end
2014-04-15 09:35:12 +02:00
if minetest.get_modpath("awards") then
streets.extendedBy.awards = true
else
streets.extendedBy.awards = false
end
2013-08-10 19:23:52 +02:00
2013-10-14 12:50:13 +02:00
-- Streets chatcommand
local function round(num, idp)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end
minetest.register_chatcommand("streets",{
2014-04-13 15:13:59 +02:00
description = S("Check version of your installed StreetsMod and find information"),
2013-10-14 12:50:13 +02:00
func = function(name,param)
minetest.show_formspec(name, "streets:streetsform", table.concat({
"size[10,6]",
"label[0,1;Wool installed: " .. tostring(streets.extendedBy.wool) .. "]",
"label[0,1.5;Technic installed: " .. tostring(streets.extendedBy.technic) .. "]",
"label[0,2;Moreblocks installed: " .. tostring(streets.extendedBy.moreblocks) .. "]",
"label[0,2.5;Mesecons installed: " .. tostring(streets.extendedBy.mesecons) .. "]",
"label[0,3;Digilines installed: " .. tostring(streets.extendedBy.digilines) .. "]",
"label[0,3.5;Prefab installed: " .. tostring(streets.extendedBy.prefab) .. "]",
2014-04-15 09:35:12 +02:00
"label[0,4;Awards installed: " .. tostring(streets.extendedBy.awards) .. "]",
"label[0,5;Running version: " .. streets.version .. "]",
"label[0,5.5;Load time: " .. round(streets.load.fin - streets.load.start,4) .. "s]"
2013-10-14 12:50:13 +02:00
}))
end
})
2013-08-10 19:23:52 +02:00
-- Done
2014-04-11 16:40:13 +02:00
print("Streets: " .. S("Setup completed, have fun with StreetsMod") .. " " .. streets.version .. "!")
2013-10-14 12:51:29 +02:00
streets.load.fin = os.clock()