make IsProjectileTarget default to true for living beings

..which eliminates the || GetOCF() & OCF_Alive everywhere. It also allows living things to explicitely disable being projectile targets.
This is a lot cleaner imo.
shapetextures
David Dormagen 2015-12-28 11:20:11 +01:00
parent 5a9a851ec9
commit 9d947c7fb2
3 changed files with 9 additions and 4 deletions

View File

@ -314,7 +314,7 @@ func CheckStrike(iTime)
Find_Exclude(Contained()),
Find_Layer(GetObjectLayer())))
{
if (obj->~IsProjectileTarget(this, Contained()) || obj->GetOCF() & OCF_Alive)
if (obj->~IsProjectileTarget(this, Contained()))
{
var effect_name=Format("HasBeenHitByAxeEffect%d", magic_number);
var axe_name=Format("HasBeenHitByAxe%d", this->ObjectNumber());

View File

@ -198,7 +198,7 @@ func CheckStrike(iTime)
Find_Exclude(Contained()),
Find_Layer(GetObjectLayer())))
{
if (obj->~IsProjectileTarget(this, Contained()) || obj->GetOCF() & OCF_Alive)
if (obj->~IsProjectileTarget(this, Contained()))
{
var effect_name=Format("HasBeenHitBySwordEffect%d", magic_number);
var sword_name=Format("HasBeenHitBySword%d", this->ObjectNumber());

View File

@ -74,8 +74,8 @@ global func FxHitCheckDoCheck(object target, proplist effect)
// CheckEnemy
//if(!CheckEnemy(obj,target)) continue;
// IsProjectileTarget or Alive will be hit
if (obj->~IsProjectileTarget(target, shooter) || obj->GetOCF() & OCF_Alive)
// IsProjectileTarget will be hit (defaults to true for OCF_Alive).
if (obj->~IsProjectileTarget(target, shooter))
{
target->~HitObject(obj);
if (!target)
@ -145,6 +145,11 @@ global func FxHitCheckTimer(object target, proplist effect, int time)
return;
}
global func IsProjectileTarget(object projectile, object shooter)
{
return GetOCF() & OCF_Alive;
}
/*
Checks whether an object is ready to take damage from this object, calling QueryCatchBlow.
*/