Skip to content

Commit 4173d30

Browse files
authored
Merge pull request YimMenu-Lua#80 from acidlabsdev/main
docs(features): document features
2 parents 1b72957 + 67841ee commit 4173d30

11 files changed

Lines changed: 526 additions & 140 deletions

File tree

.github/workflows/zip-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ jobs:
123123
changelog += `## PR #${pr.number}: ${pr.title}\n`;
124124
const body = pr.body
125125
if (body) {
126-
const lines = body.split('\n').map(line => line.trim().replace(/^-\s*/, ''));
126+
const lines = body.split('\n').map(line => line.trim());
127127
for (const line of lines) {
128128
if (line)
129-
changelog += `- ${line}\n`;
129+
changelog += `${line}\n`;
130130
}
131131
changelog += "\n";
132132
}

README.md

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,26 @@
2323
</a>
2424
</div>
2525

26+
<details>
27+
<summary>Table of Contents</summary>
28+
<ol>
29+
<li><a href="#about">About</a></li>
30+
<li>
31+
<a href="#getting-started">Getting Started</a>
32+
<ul>
33+
<li><a href="#setup">setup</a></li>
34+
<li><a href="#commands-console">Commands Console</a></li>
35+
</ul>
36+
</li>
37+
<li><a href="#contributing">Contributing</a></li>
38+
<li><a href="#documentation">Documentation</a></li>
39+
<li><a href="#features">Features</a></li>
40+
<li><a href="#faq">FAQ</a></li>
41+
<li><a href="#contact">Contact</a></li>
42+
<li><a href="#acknowledgments">Acknowledgments</a></li>
43+
</ol>
44+
</details>
45+
2646
# About
2747

2848
![ss](./docs/ss.png)
@@ -72,6 +92,10 @@ This project was rewritten from scratch using [SmallBase](https://github.com/xes
7292
> Some parts of the API were refactored or extended but nothing has drastically changed.
7393
> All changes introduced in this project are documented in the source.
7494
95+
## Features
96+
97+
A full list of available features and their usage [can be found here](docs/Features.md).
98+
7599
## FAQ
76100

77101
- **Q:** Does this support Enhanced?
@@ -91,6 +115,14 @@ This project was rewritten from scratch using [SmallBase](https://github.com/xes
91115
- **Short Answer:** No.
92116
- **Long Answer:** Yes, a compatibility layer can be added to accomodate for all language and API differences but is it worth the trouble and code bloat? Absolutely not. We would be better off rewriting this for V2's API.
93117

118+
## Contact
119+
120+
<div>
121+
<a href="https://discord.gg/RHBUxJ5Qhp">
122+
<img height="96" width="192" alt="Discord" src="https://substackcdn.com/image/fetch/$s_!nfCP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a41e45e-aac9-44e5-8b69-55a81058ecbf_875x280.png">
123+
</a>
124+
</div>
125+
94126
## Acknowledgments
95127

96128
| Name | Contribution |
@@ -104,11 +136,3 @@ This project was rewritten from scratch using [SmallBase](https://github.com/xes
104136
| <a href="https://github.com/durtyfree"><img height="40" width="40" alt="DurtyFree" src="https://avatars.githubusercontent.com/durtyfree"><br/>Alexander Schmid</a> | [GTA V data dumps](https://github.com/DurtyFree/gta-v-data-dumps) |
105137
| <a href="https://github.com/yimura"><img height="40" width="40" alt="Yimura" src="https://avatars.githubusercontent.com/yimura"><br/>Andreas Maerten</a> | GTA V classes (archived/removed) |
106138
| <a href="https://unknowncheats.me"><img height="40" width="40" alt="UC" src="https://avatars.githubusercontent.com/u/29552835"><br/>UnknownCheats</a> | A treasure trove of information |
107-
108-
## Contact
109-
110-
<div>
111-
<a href="https://discord.gg/RHBUxJ5Qhp">
112-
<img height="96" width="192" alt="Discord" src="https://substackcdn.com/image/fetch/$s_!nfCP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a41e45e-aac9-44e5-8b69-55a81058ecbf_875x280.png">
113-
</a>
114-
</div>

SSV2/includes/classes/Mutex.lua

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
--------------------------------------
2+
-- Class: Mutex
3+
--------------------------------------
4+
-- Simple mutual exclusion.
5+
---@class Mutex
6+
---@field protected m_locked boolean
7+
---@overload fun(): Mutex
8+
local Mutex = {}
9+
Mutex.__index = Mutex
10+
---@diagnostic disable-next-line
11+
setmetatable(Mutex, {
12+
__call = function(_)
13+
return Mutex.new()
14+
end
15+
})
16+
17+
---@return Mutex
18+
function Mutex.new()
19+
---@diagnostic disable-next-line
20+
return setmetatable({ m_locked = false }, Mutex)
21+
end
22+
23+
function Mutex:Acquire()
24+
while (self.m_locked) do
25+
yield()
26+
end
27+
28+
self.m_locked = true
29+
end
30+
31+
function Mutex:Release()
32+
self.m_locked = false
33+
end
34+
35+
-- Scoped lock.
36+
---@param func function
37+
---@param ... any
38+
---@return ...
39+
function Mutex:WithLock(func, ...)
40+
self:Acquire()
41+
local ret = { xpcall(func, function(msg)
42+
self:Release()
43+
error(msg)
44+
end, ...) }
45+
self:Release()
46+
return table.unpack(ret)
47+
end
48+
49+
return Mutex

SSV2/includes/features/vehicle/stancer.lua

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,11 @@ function Stancer:ForEach(array, fn)
285285
end
286286

287287
function Stancer:IsVehicleModelSaved()
288-
if (not self.m_cached_model) then
288+
if (not self.m_entity or not self.m_entity:IsValid()) then
289289
return false
290290
end
291291

292-
return GVars.features.vehicle.stancer.saved_models[tostring(self.m_cached_model)] ~= nil
292+
return GVars.features.vehicle.stancer.saved_models[tostring(self.m_entity:GetModelHash())] ~= nil
293293
end
294294

295295
function Stancer:ReadWheelArray()
@@ -413,7 +413,7 @@ function Stancer:AreSavedDeltasLoaded()
413413
return false
414414
end
415415

416-
local model = tostring(self.m_cached_model or self.m_entity:GetModelHash())
416+
local model = tostring(self.m_entity:GetModelHash())
417417
local saved = GVars.features.vehicle.stancer.saved_models
418418
local front_obj = saved[model][tostring(self.eWheelSide.FRONT)]
419419
local rear_obj = saved[model][tostring(self.eWheelSide.BACK)]
@@ -471,45 +471,36 @@ function Stancer:LoadSavedDeltas()
471471
return false
472472
end
473473

474-
local model = tostring(self.m_cached_model or self.m_entity:GetModelHash())
474+
local model = tostring(self.m_entity:GetModelHash())
475475
local saved = GVars.features.vehicle.stancer.saved_models
476-
local front_obj = saved[model][tostring(self.eWheelSide.FRONT)]
477-
local rear_obj = saved[model][tostring(self.eWheelSide.BACK)]
476+
local front_obj = saved[model][self.eWheelSide.FRONT]
477+
local rear_obj = saved[model][self.eWheelSide.BACK]
478478

479-
if (not front_obj or not rear_obj or next(front_obj) == nil or next(rear_obj) == nil) then
479+
if (not front_obj or not rear_obj) then
480480
return false
481481
end
482482

483483
for k, v in pairs(front_obj) do
484-
self.m_deltas[self.eWheelSide.FRONT][k] = v
484+
if (k == "m_suspension_height") then
485+
self.m_suspension_height.m_current = v
486+
else
487+
self.m_deltas[self.eWheelSide.FRONT][k] = v
488+
end
485489
end
486490

487491
for k, v in pairs(rear_obj) do
488492
self.m_deltas[self.eWheelSide.BACK][k] = v
489493
end
490494

491-
self.m_suspension_height.m_current = saved[model]["m_suspension_height"] or 0.0
492-
495+
PHYSICS.ACTIVATE_PHYSICS(self.m_entity:GetHandle())
493496
return true
494497
end
495498

496499
function Stancer:SaveCurrentVehicle()
497-
local model = self.m_cached_model or self.m_entity:GetModelHash()
498-
local __t = {
499-
[self.eWheelSide.FRONT] = StanceObject.new(),
500-
[self.eWheelSide.BACK] = StanceObject.new(),
501-
m_suspension_height = self.m_suspension_height.m_current
502-
}
503-
504-
for k, v in pairs(self.m_deltas[self.eWheelSide.FRONT]) do
505-
__t[self.eWheelSide.FRONT][k] = v
506-
end
507-
508-
for k, v in pairs(self.m_deltas[self.eWheelSide.BACK]) do
509-
__t[self.eWheelSide.BACK][k] = v
510-
end
511-
512-
GVars.features.vehicle.stancer.saved_models[tostring(model)] = table.copy(__t)
500+
local strModel = tostring(self.m_entity:GetModelHash())
501+
local saved = GVars.features.vehicle.stancer.saved_models
502+
saved[strModel] = table.copy(self.m_deltas)
503+
saved[strModel][self.eWheelSide.FRONT]["m_suspension_height"] = self.m_suspension_height.m_current
513504
end
514505

515506
---@return boolean

SSV2/includes/frontend/settings/settings_ui.lua

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ local draw_cfg_reset_window = false
77
---@type Set<string>
88
local cfg_reset_exceptions = Set.new("backend.debug_mode")
99
local cfg_exc_keys = {
10-
{ pair = Pair.new("YimActions Favorites", "features.yim_actions.favorites"), clicked = false, selected = false },
11-
{ pair = Pair.new("YimResupplier", "features.yrv3"), clicked = false, selected = false },
12-
{ pair = Pair.new("Casino Pacino", "features.dunk"), clicked = false, selected = false },
13-
{ pair = Pair.new("Keyboard Keybinds", "keyboard_keybinds"), clicked = false, selected = false },
14-
{ pair = Pair.new("Controller Keybinds", "gamepad_keybinds"), clicked = false, selected = false },
15-
{ pair = Pair.new("EntityForge Favorites", "features.entity_forge.favorites"), clicked = false, selected = false },
16-
{ pair = Pair.new("EntityForge Creations", "features.entity_forge.forged_entities"), clicked = false, selected = false },
10+
{ pair = Pair.new("Casino Pacino", "features.dunk"), clicked = false, selected = false },
11+
{ pair = Pair.new("EntityForge", "features.entity_forge"), clicked = false, selected = false },
12+
{ pair = Pair.new("YimActions", "features.yim_actions"), clicked = false, selected = false },
13+
{ pair = Pair.new("YimResupplier", "features.yrv3"), clicked = false, selected = false },
14+
{ pair = Pair.new("Controller Keybinds", "gamepad_keybinds"), clicked = false, selected = false },
15+
{ pair = Pair.new("Keyboard Keybinds", "keyboard_keybinds"), clicked = false, selected = false },
1716
}
1817

1918
local function OnConfigReset()

SSV2/includes/frontend/vehicle/stancer_ui.lua

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -273,21 +273,23 @@ return function()
273273

274274
local saved_models = GVars.features.vehicle.stancer.saved_models
275275
if (next(saved_models) ~= nil) then
276+
ImGui.SameLine()
277+
if (GUI:Button(_T("VEH_STANCE_VIEW_SAVED"))) then
278+
saved_vehs_window.should_draw = true
279+
end
280+
281+
ImGui.SameLine()
276282
GVars.features.vehicle.stancer.auto_apply_saved, auto_apply_clicked = GUI:Checkbox(
277283
_T("VEH_STANCE_AUTOAPPLY"),
278284
GVars.features.vehicle.stancer.auto_apply_saved,
279285
{ tooltip = _T("VEH_STANCE_AUTOAPPLY_TT") }
280286
)
281287

282-
if (GVars.features.vehicle.stancer.auto_apply_saved and auto_apply_clicked) then
288+
if (auto_apply_clicked and GVars.features.vehicle.stancer.auto_apply_saved) then
283289
ThreadManager:Run(function()
284290
Stancer:LoadSavedDeltas()
285291
end)
286292
end
287-
288-
if (GUI:Button(_T("VEH_STANCE_VIEW_SAVED"))) then
289-
saved_vehs_window.should_draw = true
290-
end
291293
end
292294

293295
if (saved_vehs_window.should_draw) then
@@ -323,9 +325,8 @@ return function()
323325
end
324326

325327
if (GUI:ConfirmPopup("##confirm_remove_all")) then
326-
Serializer:WithLock(function()
327-
GVars.features.vehicle.stancer.saved_models = {}
328-
end)
328+
GVars.features.vehicle.stancer.saved_models = {}
329+
saved_vehs_window.should_draw = false
329330
end
330331
end, function()
331332
saved_vehs_window.should_draw = false

SSV2/includes/frontend/vehicle/vehicle_ui.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ local function driftOptions()
113113
}
114114
)
115115

116-
ImGui.ColorEditVec3(_T("VEH_DRIFT_SMOKE_COL"), GVars.features.vehicle.drift.smoke_fx.color)
116+
if (GVars.features.vehicle.drift.smoke_fx.enabled) then
117+
ImGui.ColorEditVec3(_T("VEH_DRIFT_SMOKE_COL"), GVars.features.vehicle.drift.smoke_fx.color)
118+
end
117119
end
118120

119121
local function driftMinigameOptions()

0 commit comments

Comments
 (0)