forked from Mirrors/openclonk
club respects Rule_NoFriendFire and IsProjectileTarget (#1993)
Not recommended for 8.1, because there are semantic changes: The club can now also hit targets (IsProjectileTarget) while before it could only hit OCF_Alive and C4D_Object. It's similar to the sword now. Oh, and before it could also not hit livings that were stuck.master
parent
99ef4ce853
commit
29a1a21526
|
@ -176,10 +176,9 @@ func DoStrike(clonk, angle)
|
|||
var x = Sin(angle, 7);
|
||||
var y = -Cos(angle, 7);
|
||||
var found = false;
|
||||
for (var obj in FindObjects(Find_Distance(15, 0, 0), Find_Or(Find_OCF(OCF_Alive), Find_Category(C4D_Object), Find_Category(C4D_Vehicle)), Find_Exclude(clonk), Find_NoContainer(), Find_Layer(GetObjectLayer()), Sort_Distance()))
|
||||
var already_hit_effect_name = Format("CannotBeHitTwiceBy%d", this->ObjectNumber());
|
||||
for (var obj in FindObjects(Find_Distance(15, 0, 0), Find_Exclude(clonk), Find_NoContainer(), Find_Layer(GetObjectLayer()), Sort_Distance()))
|
||||
{
|
||||
if (obj->Stuck()) continue;
|
||||
|
||||
// don't hit objects behind the Clonk
|
||||
if (x < 0)
|
||||
{
|
||||
|
@ -187,21 +186,17 @@ func DoStrike(clonk, angle)
|
|||
}
|
||||
else if (obj->GetX() < GetX()) continue;
|
||||
|
||||
// vehicles are only hit if they are pseudo vehicles. Bad system - has to be changed in the future
|
||||
if (obj->GetCategory() & C4D_Vehicle)
|
||||
if (!GetEffect("HitCheck", obj)) continue;
|
||||
if (GetEffect(already_hit_effect_name, obj)) continue;
|
||||
|
||||
var en = Format("CannotBeHitTwiceBy%d", this->ObjectNumber());
|
||||
if (GetEffect(en, obj)) continue;
|
||||
|
||||
if (obj->GetOCF() & OCF_Alive)
|
||||
if (obj->~IsProjectileTarget(this, Contained()))
|
||||
{
|
||||
var damage = ClubDamage();
|
||||
ApplyWeaponBash(obj, 400, angle, clonk);
|
||||
obj->DoEnergy(-damage, true, FX_Call_EngGetPunched, clonk->GetOwner());
|
||||
WeaponDamage(obj, damage, FX_Call_EngGetPunched, true);
|
||||
}
|
||||
else
|
||||
else if (obj->GetCategory() & C4D_Object)
|
||||
{
|
||||
if (obj->Stuck()) continue;
|
||||
var div = ClubVelocityPrecision();
|
||||
if(obj->GetContact(-1)) div*=10;
|
||||
|
||||
|
@ -218,7 +213,12 @@ func DoStrike(clonk, angle)
|
|||
obj->SetYDir((obj->GetYDir(100) - Cos(angle, speed)) / 2, div);
|
||||
obj->SetController(clonk->GetController());
|
||||
}
|
||||
AddEffect(en, obj, 1, 15, nil);
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
AddEffect(already_hit_effect_name, obj, 1, 15, nil);
|
||||
found=true;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue