Skip to content

Commit c75c6f2

Browse files
authored
Merge pull request #69 from acidlabsdev/ss_stancer
feat(Vehicle): improve stancer
2 parents 0d11c15 + b7c90d1 commit c75c6f2

25 files changed

Lines changed: 609 additions & 132 deletions

README.md

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<img alt="Script Version" src="https://img.shields.io/badge/Script%20Version-v1.7.6-blue?style=for-the-badge">
44
</a>
55
<a href="https://github.com/YimMenu-Lua/Samurais-Scripts/blob/main/LICENSE">
6-
<img alt="License" src="https://img.shields.io/badge/Licence-GPL--3.0-white?style=for-the-badge">
6+
<img alt="License" src="https://img.shields.io/badge/License-GPL--3.0-white?style=for-the-badge">
77
</a>
88
<a href="https://github.com/YimMenu-Lua/Samurais-Scripts">
99
<img alt="Game Version" src="https://img.shields.io/badge/Game%20Build-latest-green?style=for-the-badge">
@@ -43,6 +43,9 @@ A modular GTA V Lua framework focused on enhancing the player's experience throu
4343
- Type `!ls` or `!dump` to dump all available commands.
4444
- All default commands are prefixed with an exclamation mark `<!>`.
4545

46+
>[!Important]
47+
> **Do not use this in YimMenuV2. It will not work.**
48+
4649
## Contributing
4750

4851
Contributions are what make the open source community a great place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
@@ -74,14 +77,33 @@ This project was rewritten from scratch using [SmallBase](https://github.com/xes
7477
</a>
7578
</div>
7679

80+
## FAQ
81+
82+
- **Q:** Does this support Enhanced?
83+
- **A:** Prtially. You can use [YimLuaAPI](github.com/TupoyeMenu/YimLuaAPI) to test it but stability is not guaranteed as of now.
84+
85+
- **Q:** What is YimLuaAPI and how do I use it?
86+
- **A:**
87+
- **What is it:** [YimLuaAPI](github.com/TupoyeMenu/YimLuaAPI) is a universal Lua API that works for both Legacy and Enhanced.
88+
- **How to use it:** Right now there is no release because it's still in development. If you want to try it, you have to compile it yourself. Once you have `YimLuaAPI.dll`, inject it into any GTA branch (Legacy/Enhanced), it will create a folder on first injection: `%AppData%\YimLuaAPI`. Simply place the script there and you're done. You can still use YimMenu/YimMenuV2 but the script has to only exist in YimLuaAPI.
89+
90+
- **Q:** Why can't-I run this in YimMenuV2?
91+
- **A:** There are several reasons why:
92+
- YimMenuV2 doesn't have a finished Lua API. `require` isn't even present, let alone custom bindings.
93+
- There are several versions and flavors of the Lua programming language. This project is written in [Lua 5.4](https://www.lua.org/manual/5.4/) and YimMenuV2's API uses [LuaJIT](https://luajit.org/). Explaining the difference here is not ideal but it's not only the language difference, it's also how they are embedded in each menu.
94+
95+
- **Q:** Can this be made compatible with YimMenuV2 once its API is finished?
96+
- **Short Answer:** No.
97+
- **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.
98+
7799
## Acknowledgments
78100

79-
| | |
80-
| :---: | :---: |
81-
| [Harmless](https://github.com/harmless05) | Shift-Drift |
82-
| [NiiV3AU](https://github.com/NiiV3AU) | German translations |
83-
| [gir489returns](https://github.com/gir489returns) | [Casino Pacino](https://github.com/YimMenu-Lua/Casino-Pacino) |
84-
| [tupoy-ya](https://github.com/tupoy-ya) | Several contributions and shared knowledge |
85-
| [szalikdev](https://github.com/szalikdev) | Revived the project and joined the cause |
86-
| [ShinyWasabi](https://github.com/shinywasabi) | Foundational community tooling frequently used as reference |
87-
| [UnknownCheats.me](https://unknowncheats.me) | A treasure trove of information |
101+
| Name | Contribution |
102+
| :---: | :---: |
103+
| <a href="https://github.com/harmless05"><img height="40" width="40" src="https://avatars.githubusercontent.com/harmless05"><br/>Harmless</a> | Shift-Drift |
104+
| <a href="https://github.com/NiiV3AU"><img height="40" width="40" src="https://avatars.githubusercontent.com/NiiV3AU"><br/>NiiV3AU</a> | German translations |
105+
| <a href="https://github.com/gir489returns"><img height="40" width="40" src="https://avatars.githubusercontent.com/gir489returns"><br/>gir489returns</a> | [Casino Pacino](https://github.com/YimMenu-Lua/Casino-Pacino) |
106+
| <a href="https://github.com/tupoy-ya"><img height="40" width="40" src="https://avatars.githubusercontent.com/tupoy-ya"><br/>tupoy-ya</a> | Several contributions and shared knowledge |
107+
| <a href="https://github.com/szalikdev"><img height="40" width="40" src="https://avatars.githubusercontent.com/szalikdev"><br/>szalikdev</a> | Revived the project and joined the cause |
108+
| <a href="https://github.com/shinywasabi"><img height="40" width="40" src="https://avatars.githubusercontent.com/shinywasabi"><br/>ShinyWasabi</a> | Foundational community tooling frequently used as reference |
109+
| <a href="https://unknowncheats.me"><img height="52" width="120" src="https://www.unknowncheats.me/forum/ambience/misc/forum_banner.png"><br/>UnknownCheats</a> | A treasure trove of information |

includes/classes/CVehicle.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
local CEntity = require("includes.classes.CEntity")
22
local CWheel = require("includes.classes.CWheel")
3-
local CBaseSubHandlingData = require("includes.classes.CBaseSubHandlingData")
43
local CCarHandlingData = require("includes.classes.CCarHandlingData")
54
local CBikeHandlingData = require("includes.classes.CBikeHandlingData")
65
local CFlyingHandlingData = require("includes.classes.CFlyingHandlingData")
@@ -434,6 +433,12 @@ function CVehicle:IsWheelBrokenOff(wheelIndex)
434433
return (self.m_ptr:add(0xA98):get_dword() >> (wheelIndex & 0x1F) & 1) ~= 0
435434
end
436435

436+
---@param refresh? boolean
437+
---@return CWheelDrawData
438+
function CVehicle:GetWheelDrawData(refresh)
439+
return self.m_draw_data:GetWheelDrawData(refresh)
440+
end
441+
437442
---@return float -- Wheel width or 0.f if invalid
438443
function CVehicle:GetWheelWidth()
439444
return self.m_draw_data:GetWheelWidth()

includes/classes/CVehicleDrawData.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,17 @@ function CVehicleDrawData:init(ptr)
3535
return self
3636
end
3737

38-
function CVehicleDrawData:GetWheelDrawData()
38+
---@param refresh? boolean
39+
function CVehicleDrawData:GetWheelDrawData(refresh)
40+
if (refresh) then
41+
self.m_wheel_draw_data = nil
42+
end
43+
3944
if not (self.m_wheel_draw_data and self.m_wheel_draw_data:IsValid()) then
4045
self.m_wheel_draw_data = CWheelDrawData.new(self.m_ptr:add(0x370):deref())
4146
end
4247

48+
-- cached pointer gets invalidated when you change wheels?
4349
return self.m_wheel_draw_data
4450
end
4551

includes/data/config.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,11 @@ local Config <const> = {
194194
parachute = false,
195195
steer_rear_wheels = false,
196196
steer_handbrake = false,
197+
stancer = {
198+
---@type table<string, table<integer, StanceObject>>
199+
saved_models = {},
200+
auto_apply_saved = false,
201+
},
197202
},
198203
speedometer = {
199204
enabled = false,

includes/features/Speedometer.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ function Speedometer:Draw(offset)
494494
| ImGuiWindowFlags.NoMove
495495

496496
-- RIP Paul Walker
497-
if (self._state.NOSDangerRatio >= 0.5) then
497+
if (self._state.NOSDangerRatio >= 0.8) then
498498
local window_width = radius * 1.3
499499
local pulse = 0.5 + 0.5 * math.sin(Time.now() * 12)
500500
ImGui.SetNextWindowSize(window_width, 100, ImGuiCond.Always)

includes/features/vehicle/nos.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ function NosMgr:UpdateEngineDamage()
149149
end
150150

151151
local current_speed = PV:GetSpeed()
152-
local threshold = PV:GetMaxSpeed() * 2.1
152+
local threshold = PV:GetMaxSpeed() * 1.7
153153
self.m_engine_danger_ratio = math.min(1, math.max(0, current_speed / threshold))
154154

155155
if (current_speed > threshold) then

0 commit comments

Comments
 (0)