forked from Mirrors/openclonk
LastManStanding: Remove relaunch functionality which is handled by Rule_Relaunch
parent
82f3883486
commit
3de5261e8a
|
@ -4,8 +4,6 @@
|
|||
|
||||
Premade goal for simple melees with relaunches.
|
||||
Callbacks made to scenario script:
|
||||
* OnPlayerRelaunch(int plr) made when the player is relaunched and at game start plr init.
|
||||
* RelaunchCount() should return the number of relaunches.
|
||||
* KillsToRelaunch() should return how many kills will earn the player an extra relaunch.
|
||||
--*/
|
||||
|
||||
|
@ -19,7 +17,6 @@
|
|||
#include Scoreboard_Relaunch
|
||||
|
||||
// Some rule default values
|
||||
local DefaultRelaunchCount = 5; // Number of relaunches.
|
||||
local DefaultKillsToRelaunch = 4; // Number of kills one needs to make before gaining a relaunch.
|
||||
local ShowBoardTime = 5; // Duration in seconds the scoreboard will be shown to a player on an event.
|
||||
|
||||
|
@ -33,14 +30,6 @@ protected func Initialize()
|
|||
|
||||
/*-- Scenario callbacks --*/
|
||||
|
||||
private func RelaunchCount()
|
||||
{
|
||||
var relaunch_cnt = GameCall("RelaunchCount");
|
||||
if (relaunch_cnt != nil)
|
||||
return relaunch_cnt;
|
||||
return DefaultRelaunchCount;
|
||||
}
|
||||
|
||||
private func KillsToRelaunch()
|
||||
{
|
||||
var kills_to_relaunch = GameCall("KillsToRelaunch");
|
||||
|
@ -53,21 +42,12 @@ private func KillsToRelaunch()
|
|||
|
||||
protected func InitializePlayer(int plr)
|
||||
{
|
||||
// First process relaunches, etc.
|
||||
_inherited(plr, ...);
|
||||
// Join plr.
|
||||
JoinPlayer(plr);
|
||||
// Scenario script callback.
|
||||
GameCall("OnPlayerRelaunch", plr, false);
|
||||
return;
|
||||
}
|
||||
|
||||
protected func RelaunchPlayer(int plr, int killer)
|
||||
{
|
||||
_inherited(plr, killer, ...);
|
||||
if (GetRelaunchCount(plr) < 0)
|
||||
return EliminatePlayer(plr);
|
||||
|
||||
// the kill logs rule cares about logging the respawn
|
||||
// ..
|
||||
|
||||
|
@ -82,50 +62,11 @@ protected func RelaunchPlayer(int plr, int killer)
|
|||
Log("$MsgRelaunchGained$", GetPlayerName(killer));
|
||||
}
|
||||
|
||||
var clonk = CreateObjectAbove(Clonk, 0, 0, plr);
|
||||
clonk->MakeCrewMember(plr);
|
||||
SetCursor(plr, clonk);
|
||||
JoinPlayer(plr);
|
||||
// Scenario script callback.
|
||||
GameCall("OnPlayerRelaunch", plr, true);
|
||||
// Show scoreboard for a while.
|
||||
DoScoreboardShow(1, plr + 1);
|
||||
Schedule(this,Format("DoScoreboardShow(-1, %d)", plr + 1), 35 * ShowBoardTime);
|
||||
return;
|
||||
}
|
||||
|
||||
protected func JoinPlayer(int plr)
|
||||
{
|
||||
var clonk = GetCrew(plr);
|
||||
clonk->DoEnergy(100000);
|
||||
var pos = FindRelaunchPos(plr);
|
||||
clonk->SetPosition(pos[0], pos[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
private func FindRelaunchPos(int plr)
|
||||
{
|
||||
var tx, ty; // Test position.
|
||||
for (var i = 0; i < 500; i++)
|
||||
{
|
||||
tx = Random(LandscapeWidth());
|
||||
ty = Random(LandscapeHeight());
|
||||
if (GBackSemiSolid(AbsX(tx), AbsY(ty)))
|
||||
continue;
|
||||
if (GBackSemiSolid(AbsX(tx+5), AbsY(ty+10)))
|
||||
continue;
|
||||
if (GBackSemiSolid(AbsX(tx+5), AbsY(ty-10)))
|
||||
continue;
|
||||
if (GBackSemiSolid(AbsX(tx-5), AbsY(ty+10)))
|
||||
continue;
|
||||
if (GBackSemiSolid(AbsX(tx-5), AbsY(ty-10)))
|
||||
continue;
|
||||
// Succes.
|
||||
return [tx, ty];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
protected func RemovePlayer(int plr)
|
||||
{
|
||||
return _inherited(plr, ...);
|
||||
|
|
Loading…
Reference in New Issue