-
Notifications
You must be signed in to change notification settings - Fork 45
/
sh_boot.lua
193 lines (163 loc) · 5.81 KB
/
sh_boot.lua
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
--[[
© 2015 CloudSixteen.com do not share, re-distribute or modify
without permission of its author (kurozael@gmail.com).
Clockwork was created by Conna Wiles (also known as kurozael.)
http://cloudsixteen.com/license/clockwork.html
--]]
local AddCSLuaFile = AddCSLuaFile;
local IsValid = IsValid;
local pairs = pairs;
local pcall = pcall;
local string = string;
local table = table;
local game = game;
if (!Clockwork) then
Clockwork = GM;
else
CurrentGM = Clockwork;
table.Merge(CurrentGM, GM);
Clockwork = nil;
Clockwork = GM;
table.Merge(Clockwork, CurrentGM);
CurrentGM = nil;
end;
Clockwork.ClockworkFolder = Clockwork.ClockworkFolder or GM.Folder;
Clockwork.SchemaFolder = Clockwork.SchemaFolder or GM.Folder;
Clockwork.KernelVersion = "0.96.2";
Clockwork.KernelBuild = "beta"
Clockwork.DeveloperVersion = true;
Clockwork.Website = "http://kurozael.com";
Clockwork.Author = "kurozael";
Clockwork.Email = "kurozael@gmail.com";
Clockwork.Name = "Clockwork";
--[[ Check if we are using the right CloudAuthX version. --]]
if (SERVER and CloudAuthX.GetVersion() < 12) then
for i = 1, 3 do
Error("[CloudAuthX] Clockwork requires an updated CloudAuthX .dll or .so!\n");
end;
end;
--[[
Do not edit this function. Editing this function will cause
the schema to not function, and CloudAuthX will not
auth you.
--]]
function Clockwork:GetGameDescription()
local schemaName = self.kernel:GetSchemaGamemodeName();
return "CW: "..schemaName;
end;
AddCSLuaFile("cl_kernel.lua");
AddCSLuaFile("cl_theme.lua");
AddCSLuaFile("sh_kernel.lua");
AddCSLuaFile("sh_fixes.lua");
AddCSLuaFile("sh_enum.lua");
AddCSLuaFile("sh_boot.lua");
include("sh_enum.lua");
include("sh_fixes.lua");
include("sh_kernel.lua");
if (CLIENT) then
if (CW_SCRIPT_SHARED) then
CW_SCRIPT_SHARED = Clockwork.kernel:Deserialize(CW_SCRIPT_SHARED);
else
CW_SCRIPT_SHARED = {};
end;
if (CW_SCRIPT_SHARED.clientCode) then
RunString(CW_SCRIPT_SHARED.clientCode);
end;
end;
if (CW_SCRIPT_SHARED.schemaFolder) then
Clockwork.SchemaFolder = CW_SCRIPT_SHARED.schemaFolder;
end;
if (!game.GetWorld) then
game.GetWorld = function() return Entity(0); end;
end;
--[[ These are aliases to avoid variable name conflicts. --]]
cwPlayer, cwTeam, cwFile = player, team, file;
_player, _team, _file = player, team, file;
library, lib = cwLibrary, cwLib;
--[[ These are libraries that we want to load before any others. --]]
Clockwork.kernel:IncludePrefixed("libraries/server/sv_file.lua");
if (SERVER) then CloudAuthX.Authenticate(); end;
Clockwork.kernel:IncludeDirectory("libraries/server", true);
Clockwork.kernel:IncludeDirectory("libraries/client", true);
Clockwork.kernel:IncludeDirectory("libraries/", true);
Clockwork.kernel:IncludePrefixed("cl_theme.lua");
Clockwork.kernel:IncludeDirectory("language/", true);
Clockwork.kernel:IncludeDirectory("directory/", true);
Clockwork.kernel:IncludeDirectory("config/", true);
Clockwork.kernel:IncludePlugins("plugins/", true);
Clockwork.kernel:IncludeDirectory("system/", true);
Clockwork.kernel:IncludeDirectory("items/", true);
Clockwork.kernel:IncludeDirectory("derma/", true);
--[[ The following code is loaded by CloudAuthX. --]]
if (SERVER) then include("sv_cloudax.lua"); end;
--[[ The following code is loaded over-the-Cloud. --]]
if (SERVER and Clockwork.LoadPreSchemaExternals) then
Clockwork:LoadPreSchemaExternals();
end;
--[[ Load the schema and let any plugins know about it. --]]
Clockwork.kernel:IncludeSchema();
Clockwork.plugin:Call("ClockworkSchemaLoaded");
if (SERVER) then
MsgC(Color(0, 255, 100, 255), "[Clockwork] Schema \""..Schema:GetName().."\" ["..Clockwork.kernel:GetSchemaGamemodeVersion().."] by "..Schema:GetAuthor().." loaded!\n");
end;
--[[ The following code is loaded over-the-Cloud. --]]
if (SERVER and Clockwork.LoadPostSchemaExternals) then
Clockwork:LoadPostSchemaExternals();
end;
if (CLIENT) then
Clockwork.plugin:Call("ClockworkLoadShared", CW_SCRIPT_SHARED);
end;
Clockwork.kernel:IncludeDirectory("commands/", true);
Clockwork.player:AddCharacterData("PhysDesc", NWTYPE_STRING, "");
Clockwork.player:AddPlayerData("Language", NWTYPE_STRING, "English", true);
-- Called when the Clockwork shared variables are added.
function Clockwork:ClockworkAddSharedVars(globalVars, playerVars)
for k, v in pairs(self.player.characterData) do
playerVars:Add(k, v.nwType, v.playerOnly);
end;
for k, v in pairs(self.player.playerData) do
playerVars:Add(k, v.nwType, v.playerOnly);
end;
playerVars:Number("InvWeight", true);
playerVars:Number("InvSpace", true);
playerVars:Number("MaxHP");
playerVars:Number("MaxAP");
playerVars:Number("IsDrunk", true);
playerVars:Number("Wages", true);
playerVars:Number("Cash", true);
playerVars:Number("ActDuration");
playerVars:Number("ForceAnim");
playerVars:Number("IsRagdoll");
playerVars:Number("Faction");
playerVars:Number("Gender");
playerVars:Number("Key");
playerVars:Bool("TargetKnows", true);
playerVars:Bool("FallenOver", true);
playerVars:Bool("CharBanned", true);
playerVars:Bool("IsWepRaised");
playerVars:Bool("Initialized");
playerVars:Bool("IsJogMode");
playerVars:Bool("IsRunMode");
playerVars:String("Clothes", true);
playerVars:String("Model", true);
playerVars:String("ActName");
playerVars:String("flags");
playerVars:String("Flags");
playerVars:String("Name");
playerVars:String("icon");
playerVars:Entity("Ragdoll");
playerVars:Float("StartActTime");
globalVars:String("NoMySQL");
globalVars:String("Date");
globalVars:Number("Minute");
globalVars:Number("Hour");
globalVars:Number("Day");
end;
Clockwork.plugin:Call("ClockworkAddSharedVars",
Clockwork.kernel:GetSharedVars():Global(true),
Clockwork.kernel:GetSharedVars():Player(true)
);
Clockwork.plugin:IncludeEffects("Clockwork/framework");
Clockwork.plugin:IncludeWeapons("Clockwork/framework");
Clockwork.plugin:IncludeEntities("Clockwork/framework");
if (SERVER) then CloudAuthX.Initialize(); end;