52 Commits

Author SHA1 Message Date
Quentin
cde5563204
lua: fix enabling/disabling (#2745) 2024-02-21 13:05:01 +01:00
Quentin
2d55470e10
lua: allow functions to be called without giving all of its args (#2744)
This makes usage of native functions that normally use pointer args easier to deal with.
2024-02-21 13:02:29 +01:00
Alice
ec7735cb3a
fixed bool_masked (#2708) 2024-02-12 18:26:07 +01:00
Arthur
96048fa0f6
feat(lua): expose the self class and add new menu events (#2656) 2024-01-28 15:18:44 +01:00
Quentin
e005640c75
fix(lua): allow natives to be called with nil strings. (#2652) 2024-01-17 11:08:35 +01:00
Andreas Maerten
8ecbdaf7c0
refactor!: repo cleanup (#2650)
- Move cmake files to dedicated cmake folder
- Move scattered python files to `scripts/` folder
- Update CMakeLists.txt to reflect changes
* feat(scripts): add README to folder
2023-12-30 16:05:18 +01:00
maybegreat48
1127e51a52
Optimizations (#2649)
* fix(Respawn): fix respawn in SP
* fix: re-enable bigobj
* fix: update creator's stack size
* fix: use BOOLs instead of bools
* fix(gitignore): hide .pyc files
2023-12-29 17:07:00 +01:00
Andreas Maerten
5324d0a244
feat(cmake): update ImGui to latest release (#2621) 2023-12-21 16:01:47 +01:00
Aure7138
8b62dadcd5
Update crossmap and natives.hpp to 3095. (#2565) 2023-12-15 16:01:57 +01:00
Andreas Maerten
2def629d3c
feat(LuaMgr): Disable and Enable scripts from UI and prevent crash when renaming the scripts/ dir. (#2493) 2023-12-13 23:19:52 +01:00
gir489
b7b901d77f
Fixed TRIGGER_SCRIPT_EVENT for 3095. (#2527) 2023-12-13 19:32:26 +01:00
gir489
a2eff686cb
Enabled strict sol for type safety and function enforcement. (#2502) 2023-12-10 12:51:29 +01:00
Quentin
bb5dfd1484
feat(lua): expose io.open (limited to scripts_config folder) (#2495) 2023-12-08 09:14:57 +01:00
Quentin
b432407dce
fix(lua): add default handler to every protected function calls, until now there was none/scuffed and nothing was getting output to the user making debugging very difficult (#2494) 2023-12-08 09:11:36 +01:00
gir489
11d48f49f9
feat(lua): added weapon and vehicle cache bindings (#2477)
* Replaced bad example in entities documentation.
* Updated Lua documentation for vehicles/weapons to allow for auto generation.
* Added Vector3 support to the Lua globals/locals class.
* Fixed a bug with get_float in globals/locals returning an int instead of a float.
* Fixed globals get_uint/set_uint using signed types for the return/parameter.
* Added unsigned int helpers to the locals Lua class.
2023-12-05 09:58:35 +01:00
gir489
f0302ab135
Added packed stats handler to the stats Lua class. (#2460) 2023-11-29 23:15:10 +01:00
maybegreat48
5d538cf53c
Rewrite AC bypass (#2430)
* fix(anticheat): rewrite AC bypass again (the old one isn't detected but this is cleaner)
* fix(chat): some chat tweaks
* fix(anticheat): fix memory leak
* feat(lua): add is_player_friend
* fix(protections): fix possible false positives with the vehicle task mismatch protection
* feat(protections): add debug logs to trace false positive
* fix(spam): add some more stuff
2023-11-19 23:20:15 +01:00
Quentin
3914ebee72
feat(lua): add tunable overloads for getting / setting values through the already joaated tunable value. (#2417) 2023-11-14 20:21:03 +01:00
Quentin
d2acc65af0
fix(lua): small lua / lau doc fixes (#2415)
* fix(lua): small lua / lau doc fixes: expose stats.get_character_index like intended. also add a bit of doc to button and sameline pages so that the user is correctly refered to the tab class doc
2023-11-14 20:20:45 +01:00
Quentin
c38e42a488
Feat(lua-doc): Make sure that the MPX -> MP0/MP1 behavior for stats function is documented. (#2251) 2023-10-13 00:14:02 +02:00
Quentin
0bb5b3bda6
feat(lua): expose take_control_of (#2249) 2023-10-13 00:13:39 +02:00
Quentin
94838af288
feat(lua): Allow lua scripts to flag modders with a custom reason if needed. (#2248) 2023-10-13 00:11:37 +02:00
Quentin
7ad35bb3d7
Fix lua explosion bypass (#2255)
* move explosion_anti_cheat_bypass to its own file

* fix(lua): make sure lua user don't get tapped by game ac when using ADD_OWNED_EXPLOSION
2023-10-12 23:34:46 +02:00
gir489
afd3a5e943
Add Garage drop-down to Spawn PV menu (#2171)
* Fixed edge case where a garage that contained only banned vehicles would show if the user was using Spawn Clone.
Refactored a large portion of the garage code to be production ready.
Formatting changes.

* Added singular garage items to the m_garage setter like the Terrorbyte.

* Fixed is_blacklisted_vehicle returning an inverted condition.
Fixed Garage drop-down not updating properly.

* Separated out m_garage's setter into a ctor function.
Replaced the 4 singular garages that use an overloaded index with a define to be able to shift them easier when new properties are added.

* Removed obsolete and incorrect player.character_slot config entry.
Removed deprecated local_player.hpp.
Added self::char_slot that is guaranteed to be correct.

* Removed extraneous semi-colon.

* Added more stuff to fillsnacks.
Removed more extraneous usages of MPPLY_LAST_MP_CHAR.

* Added the vehicle's name to player info.

* Fixed get_property_garage_size returning the incorrect size for the facility.
Fixed get_static_property_name returning the Nightclub's name instead of Nightclub Service Entrance to maintain consistency with the Mechanic.
Fixed garage_slot_iterator not starting and ending at the correct indexes.

* Shifted the singular properties down one to compensate for the new math.

* Fixed backwards math on Terrorbyte and Nightclub B1.

* Fixed garage not being updated when the player moved the vehicle.

* Fixed backwards comments.
2023-09-22 23:16:33 +02:00
Quentin
1817ee9fda
fix(lua): Fix crash when trying to reload a non-existent script. (#2151) (#2162) 2023-09-20 14:51:23 +02:00
maybegreat48
5eead0436f
Huge protection improvements and other stuff (#1963)
* feat(protections): add a fuzzer
* feat(protections): improve protections
* feat(spoofing): add warning
* feat(world): force object cleanup
* fix(weapons): fix custom weapon code
* fix(weapons): fix for #1983
2023-08-19 13:01:08 +02:00
Quentin
c54be57469
fix(lua): fix script array iterator being potentially invalidated while iterating due to new scripts that could be added and the vector getting reallocated due to it. (#1883) 2023-07-29 11:22:04 +02:00
Quentin
fb0fb191e7
fix(lua): input_float:get_value() was returning the wrong type (#1879) 2023-07-28 13:59:22 +02:00
Quentin
93966dc3b1
Feat lua stats (#1875) 2023-07-28 10:07:17 +02:00
Andreas Maerten
96493b5a22
refactor!: Modify command argument handling and move on_ method to bool_command (#1826) 2023-07-26 22:22:40 +02:00
Quentin
fa8043be2a
lua: sub folders support, check for .lua file extension, refactor and simplify internals. (#1775) 2023-07-22 13:05:43 +02:00
Quentin
093abc72da
feat(lua): Add entities.get_all_vehicles_as_handles() Add entities.get_all_peds_as_handles() Add entities.get_all_objects_as_handles() (#1795) 2023-07-21 21:21:51 +02:00
Bugisoft
74ba7b6860
Custom Sky Color and unify some stuff (#1779) 2023-07-20 22:46:32 +02:00
Quentin
69959df3ed
feat(lua): Add tab:is_selected function to check if the tab is the currently selected one in the GUI. (#1763) 2023-07-19 09:28:22 +02:00
Quentin
e1f70e84b4
fix(lua): move bindings to cpp files (#1757) 2023-07-18 13:07:33 +02:00
Quentin
9dcdf3c00f
fix(ci): tentative fix for compiler out of heap space (#1746) 2023-07-17 22:57:14 +02:00
Quentin
14f4241bd8
feat(lua): much more complete imgui bindings, allow lua imgui callbacks from outside yimmenu classic tabs through gui.add_imgui(func) but also inside yimmenu classic tabs through tab:add_imgui(func) (#1736) 2023-07-17 14:55:42 +02:00
Quentin
5a76164d43
fix(lua): better exception handling (#1734) 2023-07-16 23:32:34 +02:00
Quentin
c161ee9413
fix(lua): log not supported lua functions (#1722) 2023-07-15 22:07:10 +02:00
Quentin
f26514f8e4
fix(lua) (#1697)
- sandbox stuff.
- Fix lua scripts that could run when their lua state was destroyed, causing chaos.
2023-07-13 09:36:13 +02:00
Quentin
15745eebe1
Fix(lua / script manager): Potential fix for stack overflow when yielding from lua scripts. Fix io / os lua libs being accessible. (#1681)
* fix(script-mgr / lua): first kill all scripts, then unload lua modules: because the lua scripts depend on lua state (which is stored inside lua module instance), killing the lua module first would not allow proper cleaning because of the lua state getting destroyed while the lua script might still be running.

* fix(unloading): Why even reset the fiber pool here?

* fix(lua): don't allow for io / os lua lib to be accessed for security reasons.

* fix(lua): Potential fix for C stack overflow error by using lua coroutine yielding instead of calling fiber yield directly from lua functions.

* feat(unloading): allow to unload in the main title screen. Also revert 309c374602 due to fiber pool being potentially exhausted, we want commands to have their cleanup code ran in priority.
2023-07-11 09:24:44 +02:00
Quentin
a2609bbdc6
fix(gui): dont draw two gui separators at the top for lua only tab. (#1677) 2023-07-10 20:37:28 +02:00
Quentin
5ddf1c1d90
fix lua gui: imgui Separator between modules instead of same line which is non sense (#1672) 2023-07-10 19:01:01 +02:00
Quentin
167e1f8d54
Lua documentation: commands (#1595)
* lua api: fix command call null context

* lua doc: generate commands doc
2023-07-05 00:31:06 +02:00
Quentin
89f57a9a4c
Lua: can make new tabs from lua scripts, doc generation for available tabs to use (#1593)
* lua api: add globals.get_uint and globals.set_uint

* lua doc: remove duplicate function check as we can overload so it doesn't make sense

* lua doc gen: add support for parsing the tabs enum

* gui: custom lua tabs don't have a `func` rendering function but can still have elements to draw

* lua doc: update generated doc

* chore: code style

* chore: minor spelling mistake

* chore: code style

* gui_service: add runtime removal of tabs

* refactor: make it so that it's less likely defining tabs and their translation key in a wrong way.

* lua api: ability to add custom tabs to the gui from lua
2023-07-05 00:30:57 +02:00
Quentin
6d6848c2fb
Lua: refactor script api, more doc, add button for Open Lua Scripts Folder (#1588)
* lua manager: pass down the scripts folder to the instance instead of hard coding calls to the file manager everywhere
* lua: add open lua scripts folder button
* lua api: change script binding so that user cannot by mistake try to sleep or yield in a non script context
2023-07-03 13:01:12 +02:00
Quentin
a4d623ca74
Feat lua file watch (#1584)
* feat lua: file watcher for lua script file: reload scripts if they got changed since they were initially loaded
* feat lua auto reload: enable / disable the feature through the ui and settings
2023-07-02 22:32:46 +02:00
tupoy-ya
e4ac08496c
chore(natives.hpp)!: Updated natives to latest. (#1583)
fix(natives_gen.py): Don't save `DRAW_TEXTURED_POLY_WITH_THREE_COLOURS`.
refactor(natives_gen.py)!: Changed `NATIVE_DECL`to `static`.
2023-07-02 22:31:15 +02:00
Quentin
3bdd0796f4
Lua doc (#1552) 2023-07-02 00:59:02 +02:00
Quentin
d1e839651b
Fix lua native bindings and lua script reload (#1575)
* fix: script manager and lua scripts: change the api so that the m_scripts array is only modified in a specific safe location: before it gets ticked.
* fix script manager: don't expose the script vector directly, for multithreading safety
* fix lua manager usage: don't iterate the module array without locking, nor un/load module from a script thread
* lua script: only do actual loading of lua modules in script mgr
* lua native bindin: fix pointer parameters, out C style parameters are returned as multiple return values lua-style
2023-07-01 22:40:17 +02:00