hi Sven,
this should be what is in current build code (I am at work and only have a copy of Lua State folder, it is about a week old, so latest released build, I think)
Code: Select all
define_weapon "Force Lance" {
tier=3,
sound_fun = "FORCE_LANCE",
type = "kinetic",
power_mult=3,
drawer_type = 'force_beam',
damage_fun = dmg_range(25,35),
beam_color=("pink"),
desc = df([=[
Uses rapidly oscillating gravity fields to tear apart the target,
causing large amounts of damage without the use of particles or
projectiles that could be intercepted via energy shields. The Shield
Piercing ability of Force Lances is stronger than that of other kinetic
weapons, capable of fully bypassing both [[Battle Shields]] and
[[Force Fields]].
]=]),
shield_piercing_level = 2,
specials =set("Shield Piercing"),
-- mods = set("Rapid Fire"),
}
function WeaponProperty.shield_piercing_level(w)
if not w:special 'Shield Piercing'
return 0
end
return 1
end
so, I think what happens is that the function after Force Lance overwrites Force Lance shield_piercing_level to 1 because Force Lance has specials =set("Shield Piercing") ... I cannot upload save game at the moment, but Force Lance with this vanilla file was not piercing Force Fields and as soon as I added my "SP2" shenanigans it was piercing it ... I will try to remove specials =set("Shield Piercing") from Force Lance and just leave shield_piercing_level = 2, in Force Lance definition, then I would revert function WeaponProperty.shield_piercing_level(w) back to vanilla (i.e., remove that "SP2" if section of mine) and see if it works ... when I get home
EDIT: hmm, thinking about it more, it may not work, if Force Lance is missing specials =set("Shield Piercing"), than that function will overwrite Force Lance shield_piercing_level property to 0 ... do that function needs to exist at all ? isn't it enough to define shield_piercing_level for each weapon that needs it and be done with it ?
EDIT2: this should be able to read shield_piercing_level directly from the weapon, right ? so the function function WeaponProperty.shield_piercing_level(w) in WEAPONS.lua is not necessary ?
Code: Select all
function deal_damage(weapon, damage, ship, shield)
-- shield damage logic
--print('hrm', ..ship.resists_shield_piercing)
local shield_damage_p = 1.0-
saturate(weapon.shield_piercing_level - ship.resists_shield_piercing)
if shield_damage_p > 0
local shield_damage = round | damage*shield_damage_p
local direct_damage = damage - shield_damage
if (ship.max_shields > 0) and ship[shield]
if( weapon:special "Enveloping" )
local d0 = damage_shield(shield_damage,ship,SHIELD_NAMES[1])
local d1 = damage_shield(shield_damage,ship,SHIELD_NAMES[2])
d0=max(d0,d1)
local d1 = damage_shield(shield_damage,ship,SHIELD_NAMES[3])
d0=max(d0,d1)
local d1 = damage_shield(shield_damage,ship,SHIELD_NAMES[4])
shield_damage=max(d0,d1)
else
shield_damage=damage_shield(shield_damage,ship,shield)
end
elseif(ship.planetary_shield)
ship.planetary_shield_damage = ship.planetary_shield_damage or 0
shield_damage=damage_shield(shield_damage,ship,"planetary_shield_damage")
end
-- recombine the direct and shield damage levels
damage = direct_damage + shield_damage
end
How did YOU get a key? All right, go in.