Disallow firendly fire in ScoreboardKillRule
parent
0baf9f8077
commit
a3def6d683
|
@ -41,6 +41,7 @@ void CScoreboard::CScoreboardKillRule::Read(CLevelParserLine* line)
|
||||||
{
|
{
|
||||||
CScoreboardRule::Read(line);
|
CScoreboardRule::Read(line);
|
||||||
CObjectCondition::Read(line);
|
CObjectCondition::Read(line);
|
||||||
|
this->friendlyFire = line->GetParam("friendlyFire")->AsBool(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScoreboard::CScoreboardObjectRule::Read(CLevelParserLine* line)
|
void CScoreboard::CScoreboardObjectRule::Read(CLevelParserLine* line)
|
||||||
|
@ -82,6 +83,8 @@ void CScoreboard::ProcessKill(CObject* target, CObject* killer)
|
||||||
killer->GetTeam() != 0 &&
|
killer->GetTeam() != 0 &&
|
||||||
rule->CheckForObject(target))
|
rule->CheckForObject(target))
|
||||||
{
|
{
|
||||||
|
if (killer->GetTeam() == target->GetTeam() && !rule->friendlyFire)
|
||||||
|
continue;
|
||||||
AddPoints(killer->GetTeam(), rule->score);
|
AddPoints(killer->GetTeam(), rule->score);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,8 @@ public:
|
||||||
class CScoreboardKillRule final : public CScoreboardRule, public CObjectCondition
|
class CScoreboardKillRule final : public CScoreboardRule, public CObjectCondition
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
bool friendlyFire = false;
|
||||||
|
|
||||||
//! Read from line in scene file
|
//! Read from line in scene file
|
||||||
void Read(CLevelParserLine* line) override;
|
void Read(CLevelParserLine* line) override;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue