-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtunables.lua
More file actions
100 lines (76 loc) · 2.25 KB
/
Copy pathtunables.lua
File metadata and controls
100 lines (76 loc) · 2.25 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
-- Game Variables
-- 1.70-3411
--------------------------------
-- Tunables
--------------------------------
TunablesI = {
["DISABLE_STAT_CAP_CHECK"] = 158,
["TURN_SNOW_ON_OFF"] = 4413,
["GB_GHOST_ORG_DURATION"] = 13117,
["GB_BRIBE_AUTHORITIES_DURATION"] = 13118,
["XM22_GUN_VAN_SLOT_WEAPON_TYPE_0"] = 33273,
}
TunablesF = {
["AI_HEALTH"] = 156,
}
local g_sMPTunables = 262145
--------------------------------
-- Functions
--------------------------------
Tunables = {}
--- @param tunable_name string
--- @param value int
function Tunables.SetInt(tunable_name, value)
GLOBAL_SET_INT(g_sMPTunables + TunablesI[tunable_name], value)
end
--- @param tunable_list_name string
--- @param value int
function Tunables.SetIntList(tunable_list_name, value)
for _, offset in pairs(TunablesI[tunable_list_name]) do
GLOBAL_SET_INT(g_sMPTunables + offset, value)
end
end
--- @param tunable_name string
--- @param value float
function Tunables.SetFloat(tunable_name, value)
GLOBAL_SET_FLOAT(g_sMPTunables + TunablesF[tunable_name], value)
end
--- @param tunable_list_name string
--- @param value float
function Tunables.SetFloatList(tunable_list_name, value)
for _, offset in pairs(TunablesF[tunable_list_name]) do
GLOBAL_SET_FLOAT(g_sMPTunables + offset, value)
end
end
--------------------------------
-- Tunable Service
--------------------------------
local TunableServiceData = {
Int = {},
Float = {}
}
TunableService = {}
function TunableService.RegisterInt(tunable_name, value)
local addr = g_sMPTunables + TunablesI[tunable_name]
GLOBAL_SET_INT(addr, value)
TunableServiceData.Int[addr] = value
end
function TunableService.RemoveInt(tunable_name)
local addr = g_sMPTunables + TunablesI[tunable_name]
TunableServiceData.Int[addr] = nil
end
function TunableService.RegisterToggle(tunable_name, toggle)
local addr = g_sMPTunables + TunablesI[tunable_name]
local value = toggle and 1 or 0
GLOBAL_SET_INT(addr, value)
if toggle then
TunableServiceData.Int[addr] = value
else
TunableServiceData.Int[addr] = nil
end
end
function TunableService.HandleInt()
for addr, value in pairs(TunableServiceData.Int) do
GLOBAL_SET_INT(addr, value)
end
end