-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommon.lua
More file actions
132 lines (121 loc) · 3.51 KB
/
Common.lua
File metadata and controls
132 lines (121 loc) · 3.51 KB
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
-- *****************************************************************
-- #### ## ##### ## ##
-- ## ## ## ## ## ## ## Crysis Wars nCX
-- ## ## ## ## ###
-- ## ## ## ## ### Author: Arcziy
-- ## ## ## ## ## ## ## Version: 2.0 Public
-- ## #### ##### ## ## LastEdit: 2012-04-09
-- *****************************************************************
--Script.ReloadScript("Server/nCX/Variables.lua");
g_SignalData_point = {x=0,y=0,z=0};
g_SignalData_point2 = {x=0,y=0,z=0};
g_SignalData = {
point = g_SignalData_point,
point2 = g_SignalData_point2,
ObjectName = "",
id = NULL_ENTITY,
fValue = 0,
iValue = 0,
iValue2 = 0,
};
g_StringTemp1 = " ";
g_HitTable = {{},{},{},{},{},{},{},{},{},{},}
function new(_obj, norecurse)
if (type(_obj) == "table") then
local _newobj = {};
if (norecurse) then
for i,f in pairs(_obj) do
_newobj[i] = f;
end
else
for i,f in pairs(_obj) do
if ((type(f) == "table") and (_obj~=f)) then
_newobj[i] = new(f);
else
_newobj[i] = f;
end
end
end
return _newobj;
else
return _obj;
end
end
function merge(dst, src, recurse)
for i,v in pairs(src) do
if (type(v) ~= "function") then
if(recurse) then
if((type(v) == "table") and (v ~= src))then
if (not dst[i]) then
dst[i] = {};
end
merge(dst[i], v, recurse);
elseif (not dst[i]) then
dst[i] = v;
end
elseif (not dst[i]) then
dst[i] = v;
end
end
end
return dst;
end
function mergef(dst, src, recursive)
for i,v in pairs(src) do
if (recursive) then
if((type(v) == "table") and (v ~= src))then
if (not dst[i]) then
dst[i] = {};
end
mergef(dst[i], v, recursive);
elseif (not dst[i]) then
dst[i] = v;
end
elseif (not dst[i]) then
dst[i] = v;
end
end
return dst;
end
Script.ReloadScript("Server/Lua-Files/Utils/Math.lua");
Script.ReloadScript("Server/Lua-Files/Utils/String.lua");
Script.ReloadScript("Server/Lua-Files/Utils/EntityUtils.lua");
Script.ReloadScript("scripts/physics.lua");
--Script.ReloadScript("scripts/Tweaks.lua");
--Script.ReloadScript("Server/Lua-Files/Utils/ZeroG.lua");
Script.ReloadScript("Server/Lua-Files/Items/ItemSystemMath.lua");
--Sound.Precache("Sounds/physics:bullet_impact:mat_grass", SOUND_PRECACHE_LOAD_SOUND);
--Sound.Precache("Sounds/physics:footstep_walk:mat_grass", SOUND_PRECACHE_LOAD_SOUND);
--Sound.Precache("Sounds/physics:mat_metal_sheet:mat_dirt", SOUND_PRECACHE_LOAD_SOUND);
function myUnpack(tbl)
if (type(tbl) ~= "table") then
return ""
end
local ret = ""
for k, v in pairs(tbl) do
if (tostring(v) ~= "") then
ret = ret.. tostring(k).. "=".. tostring(v).. ", ";
end
end
return string.gsub(ret, ", $", "");
end
function hook()
local info = debug.getinfo(2)
if (info ~= nil and info.what == "Lua") then
local name = (info.name and info.name.." ") or "";
System.LogAlways(name..tostring(debug.traceback()));
local i, variables = 1, {""};
while true do
local name, value = debug.getlocal(2, i);
if (name == nil) then
break;
end
if (name ~= "(*temporary)") then
variables[tostring(name)] = value
end
i = i + 1
end
System.LogAlways(" "..info.short_src..":"..info.currentline..": "..(info.name or "unknown").."("..myUnpack(variables)..")");
end
end
--debug.sethook(hook, "c");