lucasvinbr / GTA5GangMod

a mod that tries to create a gang and turf system similar to that of Gta San Andreas
MIT License
34 stars 9 forks source link

Gang vehicle mods POC #27

Closed Kassiter closed 8 months ago

Kassiter commented 1 year ago

@lucasvinbr One more thing I always wanted to have is persistent vehicle mods.

So here's a POC where currently there's an ability to add mods to player's gang vehicles only.

It was briefly tested but needs precise code review/tests

TODO:

lucasvinbr commented 1 year ago

hahaha thanks a lot, really. This feature has been requested quite a few times and I had never gotten around to adding it.

One thing, though: is it possible to target the dev branch instead of the stable one? Is it something I have to change on my end? Because the stable branch is a little outdated compared to dev

Kassiter commented 1 year ago

Done!

What's your vision on saving/re-saving same vehicles with different mods?

Also, have you considered using other storage than XML? It's getting kind of bulky with all the new stuff

Personally, I find JSON easy to iterate over and also SQLite would be a perfect option IMHO.

I understand that it would be quite a pain in a butt, but just curious

lucasvinbr commented 1 year ago

About saving vehicles with different mods, I think it's a good idea, but ideally there should be a way to randomize it if that's what the player wants, just like with peds, where we set values to -1 when we want to randomize.

About using other storage, I've never used sqlite... can it be edited manually like json and xml? I also think Json is easier to read than xml haha.

I was preparing a "2.0" version, using scripthookvdotnet 3.0 and LemonUI instead of NativeUI. Maybe it'd be a good moment to change the storage format as well?

Kassiter commented 1 year ago

About randomization: I think it would be tough cause we need to know how many N variations is there per mod does this specific car has (maybe there's an API for that)

SQLite cannot unfortunately be edited like XML or JSON. There's also a YAML format which looks (IMHO) kind of more intuitive (https://yaml.org/)

And as for the best time to change storage I honestly don't know as this is my first consistent attempt to make something with SHVDN :D

Kassiter commented 1 year ago

Also I saw the Lemon UI and it would be a cool enhancement

lucasvinbr commented 1 year ago

So, I've tested a bit and it works perfectly!

I've moved the mod applying code to after the driver spawn code, because that can sometimes fail and the vehicle is deleted. I've also added the modkits check when adding a new vehicle to a gang, so it's possible to have variations of the same vehicle in a gang.

The problem is that removing vehicles becomes more complicated... I think some new kind of menu is required now for removing vehicles, to allow the player to remove all variations of a vehicle or just the one they're in

lucasvinbr commented 1 year ago

Ok, maybe it's not working perfectly because I got a nullreferenceexception in spawnGangVehicle once during wars. It was only once, and it was after I applied the changes I mentioned, though

lucasvinbr commented 8 months ago

Ok, I've played for a while and didn't have that issue again... I'm merging this hahaha, thanks again!

Kassiter commented 8 months ago

@lucasvinbr It was a pleasure!