mirror of
https://github.com/mostlikely4r/construction-mod.git
synced 2026-01-19 19:24:44 +00:00
101 lines
3 KiB
C#
101 lines
3 KiB
C#
// DisplayName = Construction
|
|
|
|
//--- GAME RULES BEGIN ---
|
|
// Build
|
|
//--- GAME RULES END ---
|
|
|
|
// spam fix
|
|
function ConstructionGame::AIInit(%game) {
|
|
//call the default AIInit() function
|
|
AIInit();
|
|
}
|
|
|
|
function ConstructionGame::allowsProtectedStatics(%game) {
|
|
return true;
|
|
}
|
|
|
|
function ConstructionGame::clientMissionDropReady(%game, %client) {
|
|
messageClient(%client, 'MsgClientReady',"", %game.class);
|
|
messageClient(%client, 'MsgMissionDropInfo', '\c0You are in mission %1 (%2).', $MissionDisplayName, $MissionTypeDisplayName, $ServerName );
|
|
DefaultGame::clientMissionDropReady(%game, %client);
|
|
}
|
|
|
|
function ConstructionGame::onAIRespawn(%game, %client)
|
|
{
|
|
//add the default task
|
|
if (! %client.defaultTasksAdded)
|
|
{
|
|
%client.defaultTasksAdded = true;
|
|
%client.addTask(AIPickupItemTask);
|
|
%client.addTask(AIUseInventoryTask);
|
|
%client.addTask(AITauntCorpseTask);
|
|
%client.addTask(AIEngageTurretTask);
|
|
%client.addTask(AIDetectMineTask);
|
|
%client.addTask(AIBountyPatrolTask);
|
|
%client.bountyTask = %client.addTask(AIBountyEngageTask);
|
|
}
|
|
|
|
//set the inv flag
|
|
%client.spawnUseInv = true;
|
|
}
|
|
|
|
function ConstructionGame::updateKillScores(%game, %clVictim, %clKiller, %damageType, %implement) {
|
|
if (%game.testKill(%clVictim, %clKiller)) { //verify victim was an enemy
|
|
%game.awardScoreKill(%clKiller);
|
|
%game.awardScoreDeath(%clVictim);
|
|
}
|
|
else if (%game.testSuicide(%clVictim, %clKiller, %damageType)) //otherwise test for suicide
|
|
%game.awardScoreSuicide(%clVictim);
|
|
}
|
|
|
|
function ConstructionGame::timeLimitReached(%game) {
|
|
logEcho("game over (timelimit)");
|
|
%game.gameOver();
|
|
cycleMissions();
|
|
}
|
|
|
|
function ConstructionGame::scoreLimitReached(%game) {
|
|
logEcho("game over (scorelimit)");
|
|
%game.gameOver();
|
|
cycleMissions();
|
|
}
|
|
|
|
function ConstructionGame::gameOver(%game) {
|
|
//call the default
|
|
DefaultGame::gameOver(%game);
|
|
|
|
//send the winner message
|
|
%winner = "";
|
|
if ($teamScore[1] > $teamScore[2])
|
|
%winner = %game.getTeamName(1);
|
|
else if ($teamScore[2] > $teamScore[1])
|
|
%winner = %game.getTeamName(2);
|
|
|
|
if (%winner $= 'Storm')
|
|
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.stowins.wav" );
|
|
else if (%winner $= 'Inferno')
|
|
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.infwins.wav" );
|
|
else if (%winner $= 'Starwolf')
|
|
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.swwin.wav" );
|
|
else if (%winner $= 'Blood Eagle')
|
|
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.bewin.wav" );
|
|
else if (%winner $= 'Diamond Sword')
|
|
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.dswin.wav" );
|
|
else if (%winner $= 'Phoenix')
|
|
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.pxwin.wav" );
|
|
else
|
|
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.gameover.wav" );
|
|
|
|
messageAll('MsgClearObjHud', "");
|
|
for(%i = 0; %i < ClientGroup.getCount(); %i ++) {
|
|
%client = ClientGroup.getObject(%i);
|
|
%game.resetScore(%client);
|
|
}
|
|
for(%j = 1; %j <= %game.numTeams; %j++)
|
|
$TeamScore[%j] = 0;
|
|
}
|
|
|
|
function ConstructionGame::vehicleDestroyed(%game, %vehicle, %destroyer) {
|
|
}
|
|
|