I've decided to implement it in the following way:
- Each non-heavy gun fires the same type of ammo - very lightweight so you could carry a lot of it. It greatly reduces micromanagement in squad ammo assignment.
- When the ammo leaves the gun, it becomes a special kind of ammo (pistol, rifle, shotgun pellet etc), thus making weapons unique
I do notice an issue though. no matter how I torture Evenful, the lodged in bullets do not disappear, and they are pulled out and dropped on the floor.
I tried to explicitly specify projectile types, and yet they get stuck in people.
eventful.onProjItemCheckImpact.musket = function(projectile)
if dfhack.items.getSubtypeDef(projectile.item:getType(),projectile.item:getSubtype()) ~= nil then
local ammoType = projectile.item.subtype.id
if string.find(ammoType, "_GUN_", 9) then
if ammoType == "ITEM_AMMO_GUN_GRENADES" then
musketSmoke(projectile, 6, 15)
musketSmoke(projectile, 3, 40)
elseif ammoType == "ITEM_AMMO_GUN_ROCKETS" then
destroyConstructions(projectile)
musketSmoke(projectile, 6, 45)
end
deleteProjectile(projectile)
end
if ammoType == "ITEM_AMMO_GUN_SHOTGUN" then
deleteProjectile(projectile)
elseif ammoType == "ITEM_AMMO_GUN_PISTOL" then
deleteProjectile(projectile)
elseif ammoType == "ITEM_AMMO_GUN_RIFLE" then
deleteProjectile(projectile)
end
end
end