summaryrefslogtreecommitdiff
path: root/streetsmod/init.lua
blob: c9b78b6a74472f62527f909728f334100c725388 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
--[[
	StreetsMod 1.5 by webdesigner97:
		License : CC-BY-SA 3.0 Unported (see license.txt)
		Readme	: see readme.txt
		Forum	: http://bit.ly/12cPMeo
		Depends	: default
]]
streets	= {}

-- Kaeza intllib
	-- Boilerplate to support localized strings if intllib mod is installed.
	if minetest.get_modpath("intllib") then
		streets.S = intllib.Getter()
	else
		streets.S = function(s) return s end
	end
	
-- Create variable and tables
	print("Streets: " .. streets.S("Creating variables and tables..."))
	streets.version	= "1.5"
	streets.modpath = minetest.get_modpath("streetsmod")
	streets.extendedBy	= {}
	streets.load = {
		start = os.clock(),
		fin = 0
	}
	streets.forms = {}

-- rubenwardy: smartfs
	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: " .. streets.S("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
	else
		streets.extendedBy.moreblocks = false
	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
	if minetest.get_modpath("awards") then
		streets.extendedBy.awards = true
	else
		streets.extendedBy.awards = false
	end
	
-- 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",{
		description = streets.S("Check version of your installed StreetsMod and find information"),
		func = function(name,param)
			streets.forms.chatcmd:show(name);
		end
	})
	
-- Done	
	print("Streets: " .. streets.S("Setup completed, have fun with StreetsMod") .. " " .. streets.version .. "!")
	streets.load.fin = os.clock()