I guess you were not looking for binary
a) crew can be damaged
b) crew is protected from any damage
so for your request,
raise the floor value of protection against lethal
you need to use newly created ship property
ship.crew_protection little differently
if you look inside
function deal_damage in file
ship_damage.lua you see that damage is applied in stages
a) shield is damaged
b) armor is damaged
c) structure is damaged and so on
you move to next stage only if there is any carry over damage, otherwise you terminate function execution
vanilla crew damage was being executed at c) structure damage stage
if you check the file I posted in the first post, I did very small changes to
function deal_damage
I left non
Lethal weapons crew damage application at the vanilla code location, just changed it to
Code: Select all
if not(weapon:special "Kills Crew")
damage_crew(damage,ship)
end
I moved
Lethal weapons crew damage higher in the code, and also stored how much damage is applied into new variable
local kc_damage = damage, please check my modified
ship_damage.lua for details
so going back to your original request about raising the floor of protection, you can just add that newly created ship property here
Code: Select all
if weapon:special "Kills Crew"
damage_crew(2*kc_damage*((ship.armor_damage or 0)/ship.armor)*(1/(ship.crew_protection or 1)),ship)
end
with that change to my modified file, if you add to your definition of ship armor (or any other system) that
crew_protection=2, and lets say we have 15% damage to the armor, i.e.
ship.armor_damage=30 and total
ship.armor=200, you are limiting crew damage from
Lethal weapon to (30/200)*(1/2), i.e. 7.5% rather than 15% if there is no
raise the floor value of protection against lethal
hope, this is not too confusing explanation
EDIT: if a weapon exists with both
weapon:special "Armor Piercing" and
weapon:special "Kills Crew", my code would need a change at respective locations to work properly ... I think
Code: Select all
if weapon:special "Kills Crew" and not weapon:special "Armor Piercing"
damage_crew(2*kc_damage*((ship.armor_damage or 0)/ship.armor)*(1/(ship.crew_protection or 1)),ship)
end
Code: Select all
if weapon:special "Kills Crew" and weapon:special "Armor Piercing"
damage_crew(2*damage,ship)
end
if not(weapon:special "Kills Crew")
damage_crew(damage,ship)
end