qbcore-framework / qb-weapons

Weapon Logic Script For QB-Core :gun:
GNU General Public License v3.0
28 stars 191 forks source link

Weapon/Tint Rework #166

Closed nzkfc closed 1 year ago

nzkfc commented 1 year ago

Describe Pull request This update adds all missing weapon attachment components, MK2 tints, including consolidation of some shared parts like flashlight, compensators, muzzles etc. This also allocates some missing DLC weapons. This PR will require the following PR's to be merged in to support recoil, weapon draw, ambulance death type and inventory images.

I have personally spawned in each weapon, component, tint and skin and applied them to the weapon.

If your PR is to fix an issue mention that issue here https://github.com/qbcore-framework/qb-ambulancejob/pull/305 https://github.com/qbcore-framework/qb-core/pull/1000 https://github.com/qbcore-framework/qb-inventory/pull/447 https://github.com/qbcore-framework/qb-smallresources/pull/390

Questions (please complete the following information):

Additional notes:

  1. When applying skins/tints to weapons, it seems these apply to the weapon and save in the DB JSON for inventory, I believe some work may be needed to force the return and/or removal of previous skin/tint before a new one is applied, maybe this could be configurable so you can choose if a tint/skin removes or gives the player back the item. I'm not able to enable this change so would be happy to get assistance for this.

  2. Currently the server\main.lua uses the older QBCore.Functions.CreateUsableItem function, it would be good to change this so it loops through the table based in the config.lua file, like the change that was done with consumables in qb-smallresources. I'm again not 100% how to achieve this noting the above, so it would be great if someone wants to look into that side of it and we can merge that in with this PR. This will save people time maintaining it and adding new items, also brings it in-line with how it's done in other QB resources.

QBCore.Functions.CreateUseableItem('bat_skin1', function(source, item) TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'wepskin1') end)

A potential fix for tints could be handled by setting the index back to 0 as per nevaRaven's example: https://discord.com/channels/831626422232678481/1126449634773045290

nzkfc commented 1 year ago

Some of the finishes are mismatched, CBF going through them to fix up so closing off, if someone wants too spend the time to fix up and re-PR feel free.