diff --git a/planet/Objects.ocd/Goals.ocd/DeathMatch.ocd/Script.c b/planet/Objects.ocd/Goals.ocd/DeathMatch.ocd/Script.c index 6e23ddb27..bbe1e6f04 100644 --- a/planet/Objects.ocd/Goals.ocd/DeathMatch.ocd/Script.c +++ b/planet/Objects.ocd/Goals.ocd/DeathMatch.ocd/Script.c @@ -12,30 +12,30 @@ local maxkills; -local ShowBoardTime = 5; // Duration in seconds the scoreboard will be shown to a player on an event.static const ShowBoardTime = 5; // Duration in seconds the scoreboard will be shown to a player on an event. +// Duration in seconds the scoreboard will be shown to a player on an event. +local ShowBoardTime = 5; func Initialize() { - if(ObjectCount(Find_ID(GetID()), Find_Exclude(this))) - { - (FindObject(Find_ID(GetID()), Find_Exclude(this)).maxkills) += 2; - return RemoveObject(); - } maxkills = GameCall("WinKillCount"); - if(maxkills == nil || maxkills < 1) maxkills = 4; + if (maxkills == nil || maxkills < 1) + maxkills = 4; + // Assure relaunching is enabled and infinite. GetRelaunchRule()->SetDefaultRelaunchCount(nil); return _inherited(...); } -protected func RelaunchPlayer(int plr, int killer) +protected func OnClonkDeath(object clonk, int killer) { - _inherited(plr, killer, ...); + var plr = clonk->GetOwner(); + _inherited(clonk, killer, ...); // Show scoreboard for a while DoScoreboardShow(1, plr + 1); Schedule(this,Format("DoScoreboardShow(-1, %d)", plr + 1), 35 * ShowBoardTime); NotifyHUD(); return; } + public func IsFulfilled() { // Check whether someone has reached the limit. diff --git a/planet/Objects.ocd/Goals.ocd/KingOfTheHill.ocd/Script.c b/planet/Objects.ocd/Goals.ocd/KingOfTheHill.ocd/Script.c index 62738c703..3170fedd3 100644 --- a/planet/Objects.ocd/Goals.ocd/KingOfTheHill.ocd/Script.c +++ b/planet/Objects.ocd/Goals.ocd/KingOfTheHill.ocd/Script.c @@ -44,6 +44,8 @@ func Initialize() Scoreboard->SetTitle("King of the Hill"); //CalculatePosition(); ScheduleCall(this, "PostInitialize", 3); + // Assure relaunching is enabled and infinite. + GetRelaunchRule()->SetDefaultRelaunchCount(nil); return _inherited(...); } @@ -136,6 +138,7 @@ public func IsFulfilled() func OnClonkDeath(object clonk, int killer) { + _inherited(clonk, killer, ...); if (clonk->GetAlive()) return; if (GetPlayerName(clonk->GetOwner())) diff --git a/planet/Objects.ocd/Goals.ocd/LastManStanding.ocd/Script.c b/planet/Objects.ocd/Goals.ocd/LastManStanding.ocd/Script.c index 077f64ff8..86908696c 100644 --- a/planet/Objects.ocd/Goals.ocd/LastManStanding.ocd/Script.c +++ b/planet/Objects.ocd/Goals.ocd/LastManStanding.ocd/Script.c @@ -13,7 +13,6 @@ // Include modular scoreboard columns, notice the reverse order. #include Scoreboard_KillStreak #include Scoreboard_Kill -//#include Scoreboard_Death #include Scoreboard_Relaunch // Some rule default values @@ -45,9 +44,10 @@ protected func InitializePlayer(int plr) _inherited(plr, ...); } -protected func RelaunchPlayer(int plr, int killer) +protected func OnClonkDeath(object clonk, int killer) { - _inherited(plr, killer, ...); + var plr = clonk->GetOwner(); + _inherited(clonk, killer, ...); // the kill logs rule cares about logging the respawn // .. diff --git a/planet/Objects.ocd/Libraries.ocd/Scoreboard.ocd/Death.ocd/Script.c b/planet/Objects.ocd/Libraries.ocd/Scoreboard.ocd/Death.ocd/Script.c index 173ccb4e0..be7de0a0e 100644 --- a/planet/Objects.ocd/Libraries.ocd/Scoreboard.ocd/Death.ocd/Script.c +++ b/planet/Objects.ocd/Libraries.ocd/Scoreboard.ocd/Death.ocd/Script.c @@ -6,7 +6,7 @@ Make sure that the following functions return _inherited(...); * Initialize(); * InitializePlayer(int plr); - * RelaunchPlayer(int plr, int killer); + * OnClonkDeath(object clonk, int killer); * RemovePlayer(int plr); --*/ @@ -45,13 +45,14 @@ protected func InitializePlayer(int plr) return _inherited(plr, ...); } -protected func RelaunchPlayer(int plr, int killer) +protected func OnClonkDeath(object clonk, int killer) { + var plr = clonk->GetOwner(); var plrid = GetPlayerID(plr); // Modify scoreboard death count entry for this player. score_death_list[plrid]++; Scoreboard->SetPlayerData(plr, "deaths", score_death_list[plrid]); - return _inherited(plr, killer, ...); + return _inherited(clonk, killer, ...); } protected func RemovePlayer(int plr) diff --git a/planet/Objects.ocd/Libraries.ocd/Scoreboard.ocd/Kill.ocd/Script.c b/planet/Objects.ocd/Libraries.ocd/Scoreboard.ocd/Kill.ocd/Script.c index a7b581de5..0d7848f7f 100644 --- a/planet/Objects.ocd/Libraries.ocd/Scoreboard.ocd/Kill.ocd/Script.c +++ b/planet/Objects.ocd/Libraries.ocd/Scoreboard.ocd/Kill.ocd/Script.c @@ -6,7 +6,7 @@ Make sure that the following functions return _inherited(...); * Initialize(); * InitializePlayer(int plr); - * RelaunchPlayer(int plr, int killer); + * OnClonkDeath(object clonk, int killer); * RemovePlayer(int plr); --*/ @@ -35,19 +35,20 @@ protected func InitializePlayer(int plr) return _inherited(plr, ...); } -protected func RelaunchPlayer(int plr, int killer) +protected func OnClonkDeath(object clonk, int killer) { + var plr = clonk->GetOwner(); var plrid = GetPlayerID(killer); // Only if killer exists and has not committed suicide. if (killer == plr || killer == NO_OWNER) - return _inherited(plr, killer, ...); + return _inherited(clonk, killer, ...); // Only if killer and victim are on different teams. if (GetPlayerTeam(killer) && GetPlayerTeam(killer) == GetPlayerTeam(plr)) - return _inherited(plr, killer, ...); + return _inherited(clonk, killer, ...); // Modify scoreboard kill count entry for killer. score_kill_list[plrid]++; Scoreboard->SetPlayerData(killer, "kills", score_kill_list[plrid]); - return _inherited(plr, killer, ...); + return _inherited(clonk, killer, ...); } protected func RemovePlayer(int plr) diff --git a/planet/Objects.ocd/Libraries.ocd/Scoreboard.ocd/KillStreak.ocd/Script.c b/planet/Objects.ocd/Libraries.ocd/Scoreboard.ocd/KillStreak.ocd/Script.c index bd08ef644..1016c6453 100644 --- a/planet/Objects.ocd/Libraries.ocd/Scoreboard.ocd/KillStreak.ocd/Script.c +++ b/planet/Objects.ocd/Libraries.ocd/Scoreboard.ocd/KillStreak.ocd/Script.c @@ -6,7 +6,7 @@ Make sure that the following functions return _inherited(...); * Initialize(); * InitializePlayer(int plr); - * RelaunchPlayer(int plr, int killer); + * OnClonkDeath(object clonk, int killer); * RemovePlayer(int plr); --*/ @@ -35,23 +35,24 @@ protected func InitializePlayer(int plr) return _inherited(plr, ...); } -protected func RelaunchPlayer(int plr, int killer) +protected func OnClonkDeath(object clonk, int killer) { + var plr = clonk->GetOwner(); var plrid = GetPlayerID(plr); var killerid = GetPlayerID(killer); // reset scoreboard kill streak count entry for killed player. score_killstreak_list[plrid] = 0; Scoreboard->SetPlayerData(plr, "killstreaks", nil); -// Only if killer exists and has not committed suicide. + // Only if killer exists and has not committed suicide. if (plr == killer || !GetPlayerName(killer)) - return _inherited(plr, killer, ...); + return _inherited(clonk, killer, ...); // Only if killer and victim are on different teams. if (GetPlayerTeam(killer) && GetPlayerTeam(killer) == GetPlayerTeam(plr)) - return _inherited(plr, killer, ...); + return _inherited(clonk, killer, ...); // Modify scoreboard kill streak count entry for killer. score_killstreak_list[killerid]++; Scoreboard->SetPlayerData(killer, "killstreaks", score_killstreak_list[killerid]); - return _inherited(plr, killer, ...); + return _inherited(clonk, killer, ...); } protected func RemovePlayer(int plr) diff --git a/planet/Objects.ocd/Libraries.ocd/Scoreboard.ocd/Relaunch.ocd/Script.c b/planet/Objects.ocd/Libraries.ocd/Scoreboard.ocd/Relaunch.ocd/Script.c index e89018e31..00b279f6b 100644 --- a/planet/Objects.ocd/Libraries.ocd/Scoreboard.ocd/Relaunch.ocd/Script.c +++ b/planet/Objects.ocd/Libraries.ocd/Scoreboard.ocd/Relaunch.ocd/Script.c @@ -6,7 +6,7 @@ Make sure that the following functions return _inherited(...); * Initialize(); * InitializePlayer(int plr); - * RelaunchPlayer(int plr, int killer); + * OnClonkDeath(object clonk, int killer); * RemovePlayer(int plr); --*/ @@ -25,17 +25,20 @@ protected func Initialize() protected func InitializePlayer(int plr) { - if (GetRelaunchRule()->HasUnlimitedRelaunches()) return; + if (GetRelaunchRule()->HasUnlimitedRelaunches()) + return; Scoreboard->NewPlayerEntry(plr); Scoreboard->SetPlayerData(plr, "relaunches", GetRelaunchRule()->GetPlayerRelaunchCount(plr)); return _inherited(plr, ...); } -protected func RelaunchPlayer(int plr, int killer) +protected func OnClonkDeath(object clonk, int killer) { - if (GetRelaunchRule()->HasUnlimitedRelaunches()) return; + var plr = clonk->GetOwner(); + if (GetRelaunchRule()->HasUnlimitedRelaunches()) + return; Scoreboard->SetPlayerData(plr, "relaunches", GetRelaunchRule()->GetPlayerRelaunchCount(plr)); - return _inherited(plr, killer, ...); + return _inherited(clonk, killer, ...); } protected func OnPlayerRelaunch(int plr)