Skip to content

Commit 5d0f96a

Browse files
authored
Merge pull request YimMenu-Lua#134 from YimMenu-Lua/next_week_update
refactor(YRV3): misc refactors
2 parents 900af4f + 72cc56a commit 5d0f96a

72 files changed

Lines changed: 2438 additions & 1365 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

SSV2/includes/backend.lua

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@ local ClearPreview = function() PreviewService:Clear() end
1616
---@field owner integer
1717
---@field alpha integer
1818

19-
---@enum eGameBranch
20-
Enums.eGameBranch = {
21-
LAGECY = 1,
22-
ENHANCED = 2,
23-
MOCK = 99,
24-
}
25-
2619
---@enum eBackendEvent
2720
Enums.eBackendEvent = {
2821
RELOAD_UNLOAD = 1,

SSV2/includes/classes/gta/CWheel.lua

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
-- * Provide a copy of or a link to the original license (GPL-3.0 or later); see LICENSE.md or <https://www.gnu.org/licenses/>.
88

99

10-
local CStructView = require("includes.classes.gta.CStructView")
11-
local fVector3 = require("fVector3")
12-
local VEC3_ZERO <const> = vec3:zero()
10+
local CStructView = require("includes.classes.gta.CStructView")
11+
local fVector3 = require("fVector3")
1312

1413

1514
--------------------------------------
@@ -19,8 +18,8 @@ local VEC3_ZERO <const> = vec3:zero()
1918
---@class CWheel : CStructBase<CWheel>
2019
---@field protected m_ptr pointer
2120
---@field private m_size uint16_t
22-
---@field m_rotation fVector3
23-
---@field m_rotation_inv fVector3 -- used to negate rotation from the previous vector
21+
---@field m_rotation_axis fVector3 -- this (and the one below) look and behave like eulers but they are confusing the hell out of me. 0x4 can either be the x or y component but it controls the wheel's yaw (rotation around z axis?? makes no sense) and 0x8 controls the roll (around x axis, also makes no sense)
22+
---@field m_constraint_axis fVector3 -- and then this one: when simulating camber, we change the roll in the above field at 0x8 and we MUST set the exact opposite of that value here at 0x10, otherwise the wheel tilts on just one side and sinks into the ground. for now we'll treat this as a collision correction or constraint vector but further insight/help would be appreciated
2423
---@field m_offset_from_body pointer<float> -- smells like a component of a vector but my alignment makes no sense!
2524
---@field m_x_offset pointer<float> // same as offset from body? // edit: this is also in a vector (x component). we currently use it for track width so I'm just gonna leave it as is at least for now
2625
---@field m_last_ground_pos fVector3
@@ -75,8 +74,8 @@ local CWheel = CStructView("CWheel", 0x020E)
7574
function CWheel.new(ptr)
7675
return setmetatable({
7776
m_ptr = ptr,
78-
m_rotation = fVector3(ptr:add(0x0000)),
79-
m_rotation_inv = fVector3(ptr:add(0x000C)),
77+
m_rotation_axis = fVector3(ptr:add(0x0000)),
78+
m_constraint_axis = fVector3(ptr:add(0x000C)),
8079
m_offset_from_body = ptr:add(0x0020),
8180
m_x_offset = ptr:add(0x0030),
8281
m_last_ground_pos = fVector3(ptr:add(0x003C)),

SSV2/includes/classes/gta/fVector3.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ local __base_fields__ <const> = {
3232
local fVector3 <const> = setmetatable({}, {
3333
__type = "fVector3",
3434
__ptr_ctor = true,
35-
__call = function(t, ...)
36-
return t.new(...)
37-
end
35+
__call = function(t, ...) return t.new(...) end
3836
})
3937

4038
---@private

SSV2/includes/data/config.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ local Config <const> = {
303303
sy_disable_rob_cd = false,
304304
sy_disable_rob_weekly_cd = false,
305305
sy_disable_tow_cd = false,
306-
safe_loop_warn_ack = false,
306+
unsafe_feats_enabled = false,
307307
},
308308
yim_actions = {
309309
auto_close_ped_window = false,

SSV2/includes/data/enums/__init__.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ local Enums <const> = {
1818
eGameLanguage = require("game_language"),
1919
eHandlingType = require("handling_type"),
2020
eLandingGearState = require("landing_gear_state"),
21+
eManagedValueDataType = require("managed_value_data_type"),
22+
eManagedValueType = require("managed_value_type"),
2123
eModelType = require("model_type"),
2224
ePedCombatAttributes = require("ped_combat_attributes"),
2325
ePedComponents = require("ped_components"),
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
-- Copyright (C) 2026 SAMURAI (xesdoog) & Contributors.
2+
-- This file is part of Samurai's Scripts.
3+
--
4+
-- Permission is hereby granted to copy, modify, and redistribute
5+
-- this code as long as you respect these conditions:
6+
-- * Credit the owner and contributors.
7+
-- * Provide a copy of or a link to the original license (GPL-3.0 or later); see LICENSE.md or <https://www.gnu.org/licenses/>.
8+
9+
10+
---@enum eManagedValueDataType
11+
local eManagedValueDataType <const> = {
12+
INT = 1,
13+
FLOAT = 2,
14+
BOOL = 3,
15+
BOOL_MASKED = 4,
16+
}
17+
18+
return eManagedValueDataType
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
-- Copyright (C) 2026 SAMURAI (xesdoog) & Contributors.
2+
-- This file is part of Samurai's Scripts.
3+
--
4+
-- Permission is hereby granted to copy, modify, and redistribute
5+
-- this code as long as you respect these conditions:
6+
-- * Credit the owner and contributors.
7+
-- * Provide a copy of or a link to the original license (GPL-3.0 or later); see LICENSE.md or <https://www.gnu.org/licenses/>.
8+
9+
10+
---@enum eManagedValueType
11+
local eManagedValueType <const> = {
12+
TUNEABLE = 0,
13+
STAT = 1,
14+
PACKED_STAT = 2,
15+
}
16+
17+
return eManagedValueType

SSV2/includes/data/globals_locals.lua

Lines changed: 133 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,44 @@ return {
156156
}
157157
}
158158
},
159+
car_wash_safe_global = {
160+
description = "car wash safe global",
161+
file = "freemode.c",
162+
LEGACY = {
163+
value = 1882572,
164+
pattern = [[Global_(\d{7})\[.*?/\*(\d{3})\*/\]\.f_(\d{3})\.f_27\.f_2 = \w+0;]],
165+
capture_group = 1,
166+
offsets = {
167+
{
168+
value = 315,
169+
capture_group = 2,
170+
description = "player id read size"
171+
},
172+
{
173+
value = 158,
174+
capture_group = 3,
175+
description = "car wash entry?"
176+
},
177+
}
178+
},
179+
ENHANCED = {
180+
value = 1882717,
181+
pattern = [[Global_(\d{7})\[.*?/\*(\d{3})\*/\]\.f_(\d{3})\.f_27\.f_2 = \w+0;]],
182+
capture_group = 1,
183+
offsets = {
184+
{
185+
value = 315,
186+
capture_group = 2,
187+
description = "player id read size"
188+
},
189+
{
190+
value = 158,
191+
capture_group = 3,
192+
description = "car wash entry?"
193+
},
194+
}
195+
}
196+
},
159197
gb_contraband_buy_local_1 = {
160198
description = "Contraband Buy Local 1",
161199
file = "gb_contraband_buy.c",
@@ -398,8 +436,34 @@ return {
398436
}
399437
}
400438
},
401-
acid_lab_sell_local = {
402-
description = "Acid Lab Sell Local",
439+
acid_lab_sell_deliveries_local = {
440+
description = "Acid Lab Deliveries. This shit is pissing me off and my dumbass doesn't know how to use scrDBG without creating a bazillion GB log file.",
441+
file = "fm_content_acid_lab_sell.c",
442+
LEGACY = {
443+
value = 144,
444+
pattern = [[if \(.*?Local_(\d{3})\.f_(\d{1}) !=.*?Local_\d{3}\.f_\d{4}\[0 /\*6\*/\]\.f_2\)]],
445+
capture_group = 1,
446+
offsets = {
447+
{
448+
value = 9,
449+
capture_group = 2
450+
}
451+
}
452+
},
453+
ENHANCED = {
454+
value = 146,
455+
pattern = [[if \(.*?Local_(\d{3})\.f_(\d{1}) !=.*?Local_\d{3}\.f_\d{4}\[0 /\*6\*/\]\.f_2\)]],
456+
capture_group = 1,
457+
offsets = {
458+
{
459+
value = 9,
460+
capture_group = 2
461+
}
462+
}
463+
}
464+
},
465+
acid_lab_sell_mission_state_local = {
466+
description = "Acid Lab Mission State",
403467
file = "fm_content_acid_lab_sell.c",
404468
LEGACY = {
405469
value = 5723,
@@ -424,7 +488,7 @@ return {
424488
}
425489
}
426490
},
427-
acid_lab_sell_bitset = {
491+
acid_lab_sell_gen_bs = {
428492
description = "Acid Lab Sell Generic Bitset",
429493
file = "fm_content_acid_lab_sell.c",
430494
LEGACY = {
@@ -875,6 +939,72 @@ return {
875939
}
876940
}
877941
},
942+
bb_sell_local = {
943+
description = "business battles sell local",
944+
file = "business_battles_sell.c",
945+
LEGACY = {
946+
value = 2386,
947+
pattern = [[if.*?Local_(\d{4})\.f_(\d{3}) -.*?Local_\d{4}\.f_(\d{3}) <= 1 && func_\d+\(28\)]],
948+
capture_group = 1,
949+
offsets = {
950+
{
951+
value = 203,
952+
capture_group = 2,
953+
description = "required deliveries"
954+
},
955+
{
956+
value = 202,
957+
capture_group = 3,
958+
description = "deliveries made"
959+
}
960+
}
961+
},
962+
ENHANCED = {
963+
value = 2388,
964+
pattern = [[if.*?Local_(\d{4})\.f_(\d{3}) -.*?Local_\d{4}\.f_(\d{3}) <= 1 && func_\d+\(28\)]],
965+
capture_group = 1,
966+
offsets = {
967+
{
968+
value = 205,
969+
capture_group = 2,
970+
description = "required deliveries"
971+
},
972+
{
973+
value = 204,
974+
capture_group = 3,
975+
description = "deliveries made"
976+
}
977+
}
978+
}
979+
},
980+
bb_sell_mission_state_offset = {
981+
description = "business battles sell mission state local",
982+
file = "business_battles_sell.c",
983+
LEGACY = {
984+
value = 25,
985+
pattern = [[if \(!NETWORK::NETWORK_IS_HOST_OF_THIS_SCRIPT\(\)\).*?\n\s+?return;.*?\n.*?\n.*?Local_\d{4}\.f_(\d{2})\s+?=\s+?\w+0;]],
986+
capture_group = 1,
987+
},
988+
ENHANCED = {
989+
value = 27,
990+
pattern = [[if \(!NETWORK::NETWORK_IS_HOST_OF_THIS_SCRIPT\(\)\).*?\n\s+?return;.*?\n.*?\n.*?Local_\d{4}\.f_(\d{2})\s+?=\s+?\w+0;]],
991+
capture_group = 1,
992+
}
993+
},
994+
bb_sell_vehicle_array_offset = {
995+
description = "business battles sell mission vehicle array",
996+
file = "business_battles_sell.c",
997+
LEGACY = {
998+
value = 32,
999+
pattern = [[Local_\d{4}\.f_(\d{2})\[i /\*42\*/\]\.f_30 = func_\d{3}\(\);]],
1000+
capture_group = 1,
1001+
},
1002+
ENHANCED = {
1003+
value = 34,
1004+
pattern = [[Local_\d{4}\.f_(\d{2})\[i /\*42\*/\]\.f_30 = func_\d{3}\(\);]],
1005+
capture_group = 1,
1006+
}
1007+
},
8781008
request_services_global = {
8791009
description = "Request Services Global. Only used for Kosatka atm, same global for all services.",
8801010
file = "am_mp_submarine.c",

SSV2/includes/data/stancer_data.lua

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ return {
2121
{
2222
key = "m_toe",
2323
axle = Enums.eWheelAxle.FRONT,
24-
read = function(w) return w.m_rotation.y end,
25-
write = function(w, v) w.m_rotation.y = v end
24+
read = function(w) return w.m_rotation_axis.y end,
25+
write = function(w, v) w.m_rotation_axis.y = v end
2626
},
2727
{
2828
key = "m_camber",
2929
axle = Enums.eWheelAxle.FRONT,
30-
read = function(w) return w.m_rotation.y end,
30+
read = function(w) return w.m_rotation_axis.y end,
3131
write = function(w, v)
32-
w.m_rotation.z = v
33-
w.m_rotation_inv.y = -v
32+
w.m_rotation_axis.z = v
33+
w.m_constraint_axis.y = -v
3434
end
3535
},
3636
{
@@ -75,16 +75,16 @@ return {
7575
{
7676
key = "m_toe",
7777
axle = Enums.eWheelAxle.REAR,
78-
read = function(w) return w.m_rotation.y end,
79-
write = function(w, v) w.m_rotation.y = v end
78+
read = function(w) return w.m_rotation_axis.y end,
79+
write = function(w, v) w.m_rotation_axis.y = v end
8080
},
8181
{
8282
key = "m_camber",
8383
axle = Enums.eWheelAxle.REAR,
84-
read = function(w) return w.m_rotation.z end,
84+
read = function(w) return w.m_rotation_axis.z end,
8585
write = function(w, v)
86-
w.m_rotation.z = v
87-
w.m_rotation_inv.y = -v
86+
w.m_rotation_axis.z = v
87+
w.m_constraint_axis.y = -v
8888
end
8989
},
9090
{

0 commit comments

Comments
 (0)