Remove AI default cooks grenades
A simple mod that stops AI from cooking grenades for ~0.4 seconds before throwing, ensuring instant throws.
Overview
AI in the game uses QuickGrenadeThrowHandsController, which by default cooks grenades for ~0.4 seconds. This mod removes that for AI.
Observed Cooking Times
When logging grenade creation times from BaseGrenadeHandsController.vmethod_2(), AI cooks for ~0.4s, while players cook for 0s:
Log
[Info :CookingGrenadesAI] Bot7: 0.417
[Info :CookingGrenadesAI] Bot13: 0.416
[Info :CookingGrenadesAI] Bot11: 0.417
[Info :CookingGrenadesAI] Bot4: 0.421
[Info :CookingGrenadesAI] Bot23: 0.417
[Info :CookingGrenadesAI] Bot12: 0.419
[Info :CookingGrenadesAI] Bot10: 0.418
[Info :CookingGrenadesAI] Bot4: 0.429
[Info :CookingGrenadesAI] Bot6: 0.416
[Info :CookingGrenadesAI] Bot7: 0.417
[Info :CookingGrenadesAI] Bot10: 0.417
[Info :CookingGrenadesAI] Bot11: 0.4229999
[Info :CookingGrenadesAI] PlayerSuperior(Clone): 0 <- Player
[Info :CookingGrenadesAI] PlayerSuperior(Clone): 0 <- Player
How It Works
Resets the cooking timer to 0 before throwing via a PatchPrefix on OnDropGrenadeAction().
Default Behavior
- In StartCountdown(), the controller initializes a countdown timer from -1 to 0.
- During each update, the controller accumulates time to the timer.
- When OnDropGrenadeAction() is called to create and throw the grenade, it uses the accumulated time as the cooking duration.
Mod Behavior
This mod uses a PatchPrefix on QuickGrenadeThrowHandsController.Class1162.OnDropGrenadeAction() to reset the accumulated cooking time to 0 before the grenade is thrown, effectively eliminating the AI’s default 0.4-second cooking delay.
Visual Reference
Credits
-
Amazing .csproj Support: Huge thanks to Michael P. Starkweather and CJ for their fantastic .csproj files, which made this mod possible. Your help is truly appreciated!
-
SPT Modding Community: I referenced the source code of many mods for learning purposes while creating this mod. Sincere thanks to the community for making their mods open-source and helping me learn.
-
Grok AI: An all-knowing friend who answers any question I have.
Not quite yet...
Details
-
License
-
Source Code
-
Latest Version VirusTotal Result
https://www.virustotal.com/gui/file/d01c9bf15cca4923350804c0ce5b7f8f50b088d70b5be80159c4332c03ad615d
-
Includes AI Generated Content