aboutsummaryrefslogtreecommitdiff
path: root/gamemode/server/concommands.lua
blob: 47417301b61bbc24d3fb3c61ae97a6ca2d20516f (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
concommand.Add("ws_giveitem",function(pl,com,args)
	if (!IsValid(pl)) then return end
	if (!pl:IsAdmin()) then return end
	if (!args[1]) then return end

	pl:AddItem(args[1],tonumber(args[2] or 1))
end)

concommand.Add("ws_cleanup",function(ply,cmd,args)
	if(!IsValid(ply) or !pl:IsAdmin()) then return end
	cleanup = {
		"ws_arrow",
		"ws_campfire",
		"ws_grave",
		"ws_rune",
		"ws_alter",
		"ws_barrel",
		"ws_grave",
		"ws_infuser",
		"ws_item",
		"ws_npc_ambient",
		"ws_prop",
		"ws_researchtable",
		"ws_shop",
	}
	for k,v in pairs(cleanup) do
		for i,j in pairs(ents.FindByClass(v)) do
			j:Remove()
		end
	end
end

concommand.Add("ws_startnavgen",function(ply,cmd,args)
	if (IsValid(pl) and !pl:IsAdmin()) then return end
	Print("Starting nav generation")
	local I = 0
	navmesh.BeginGeneration()
	while(navmesh.IsGenerating()) do
		if(I % 100 == 0) then
			print(I .. " iterations...")
		end
		I = I + 1
	end
	navmesh.Save()
end)

--Revive a player
concommand.Add("ws_revive",function(pl,com,args)
	if (IsValid(pl) and !pl:IsAdmin()) then return end
	if (!args[1]) then return end

	for k,v in pairs(player.GetAll()) do
		if (v:Nick():lower():find(args[1]:lower()) and v:IsPigeon()) then
			v:ChatPrint("You have been resurrected from the dead by an admin!")
			v:SetHuman(true)
			v:KillSilent()
			v:EmitSound("wintersurvival2/ritual/wololo.mp3")
		end
	end
end)

--Manual generate a proprain, for debugging
concommand.Add("ws_proprain",function(ply,cmd,args)
	if (IsValid(pl) and !pl:IsAdmin()) then return end
	GAMEMODE:GeneratePropRain()
end)

--Manual reload of items + recepies, usefull for testing
concommand.Add("ws_reloaditems",function(ply,cmd,args)
	if (IsValid(pl) and !pl:IsAdmin()) then return end
	GAMEMODE:LoadItems()
end)

--Manual reload of npc's, usefull for testing
concommand.Add("ws_reloadnpcs",function(ply,cmd,args)
	if (IsValid(pl) and !pl:IsAdmin()) then return end
	GAMEMODE:LoadNPCS()
end)

--Generate a nice HTML representation of all the recepies.
concommand.Add("ws_generaterecipes",function(pl,com,args)
	if (IsValid(pl) and !pl:IsAdmin()) then return end
	local filename = "ws_recipedata.txt"
	for k,v in pairs(GAMEMODE.Recipes) do
		if not v.Recipe then continue end
		if not v.Name then continue end
		file.Append(filename,"<li>\n\t<label>\n\t\t<input type='checkbox'>\n\t\t" .. v.Name)
		for i,j in pairs(v.Recipe) do
			if(i == "Resources") then
				file.Append(filename,"\n\t<ul type='circle'>")
				for p,q in pairs(j) do
					file.Append(filename,"\n\t\t<li>" .. p .. " x " .. q .. "</li>")
				end
				file.Append(filename,"\n\t</ul>")
			elseif(i == "Tools") then
				file.Append(filename,"\n\t<ul type='square'>")
				for p,q in pairs(j) do
					file.Append(filename,"\n\t\t<li>" .. p .. " x " .. q .. "</li>")
				end
				file.Append(filename,"\n\t</ul>")
			end
		end
		file.Append(filename,"\n\t</label>\n</li>\n")
	end
end)