Brought up to date with the newest T2BoL I've located

This commit is contained in:
Robert MacGregor 2015-08-30 02:30:29 -04:00
parent 8c96cba3e1
commit accd31895e
287 changed files with 108557 additions and 107608 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,468 +1,468 @@
// DisplayName = Capture and Hold
//--- GAME RULES BEGIN ---
//Teams try to capture marked objectives
//Capturing player gets a point 12 seconds after a capture
//Hold objectives in order to score
//A team scores 2 points per second it holds an objective
//Turrets and inventory stations convert when their switch is taken
//--- GAME RULES END ---
//exec the AI scripts
exec("scripts/aiCnH.cs");
$InvBanList[CnH, "MiningTool"] = 1;
package CnHGame {
function FlipFlop::playerTouch(%data, %flipflop, %player)
{
if(%flipflop.team != %player.client.team)
{
Parent::playerTouch(%data, %flipflop, %player);
Game.startTimerPlayerFFCap(%player.client, %flipflop);
}
}
function Flipflop::objectiveInit(%data, %flipflop)
{
%flipflop.tCapThread = "";
%flipflop.tHoldThread = "";
%flipflop.pCapThread = "";
Parent::objectiveInit(%data, %flipflop);
}
};
//--------- CnH SCORING INIT ------------------
function CnHGame::initGameVars(%game)
{
%game.SCORE_PER_SUICIDE = -1;
%game.SCORE_PER_TEAMKILL = -1;
%game.SCORE_PER_DEATH = -1;
%game.SCORE_PER_KILL = 1;
%game.SCORE_PER_PLYR_FLIPFLOP_CAP = 1;
%game.SCORE_PER_TEAM_FLIPFLOP_CAP = 1;
%game.SCORE_PER_TEAM_FLIPFLOP_HOLD = 1;
%game.SCORE_PER_TURRET_KILL = 1;
%game.SCORE_PER_FLIPFLOP_DEFEND = 1;
%game.SCORE_LIMIT_PER_TOWER = 1200; //default of 1200 points per tower required to win @ 1 pt per %game.TIME_REQ_TEAM_HOLD_BONUS milliseconds
%game.TIME_REQ_PLYR_CAP_BONUS = 12 * 1000; //player must hold a switch 12 seconds to get a point for it.
%game.TIME_REQ_TEAM_CAP_BONUS = 12 * 1000; //time after touching it takes for team to get a point
%game.TIME_REQ_TEAM_HOLD_BONUS = 0.5 * 1000; //recurring time it takes team to earn a point when flipflop held
%game.RADIUS_FLIPFLOP_DEFENSE = 20; //meters
}
function CnHGame::setUpTeams(%game)
{
DefaultGame::setUpTeams(%game);
// reset the visibility of team 0 (team is still defaulted as friendly)
setSensorGroupAlwaysVisMask(0, 0);
}
//-- tracking ---
// .deaths .kills .suicides .teamKills .turretKills
// .flipFlopDefends .flipFlopsCapped
function CnHGame::startMatch(%game)
{
for(%i = 0; %i <= %game.numTeams; %i++)
$TeamScore[%i] = 0;
DefaultGame::startMatch(%game);
}
function CnHGame::checkScoreLimit(%game, %team)
{
%scoreLimit = %game.getScoreLimit();
if($TeamScore[%team] >= %scoreLimit)
%game.scoreLimitReached();
}
function CnHGame::getScoreLimit(%game)
{
%scoreLimit = MissionGroup.CnH_scoreLimit;
if(%scoreLimit $= "")
%scoreLimit = %game.getNumFlipFlops() * %game.SCORE_LIMIT_PER_TOWER;
return %scoreLimit;
}
function CnHGame::scoreLimitReached(%game)
{
logEcho("game over (scorelimit)");
%game.gameOver();
cycleMissions();
}
function CnHGame::timeLimitReached(%game)
{
logEcho("game over (timelimit)");
%game.gameOver();
cycleMissions();
}
function CnHGame::gameOver(%game)
{
//call the default
DefaultGame::gameOver(%game);
// stop all bonus timers
%game.stopScoreTimers();
//send the winner message
%winner = "";
if ($teamScore[1] > $teamScore[2])
%winner = $teamName[1];
else if ($teamScore[2] > $teamScore[1])
%winner = $teamName[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
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 ( %team = 1; %team <= %game.numTeams; %team++ )
{
$TeamScore[%team] = 0;
messageAll('MsgCnHTeamCap', "", -1, -1, -1, %team, $TeamScore[%team], %game.getScoreLimit());
}
}
function CnHGame::stopScoreTimers(%game)
{
// find all switches and cancel any timers associated with them
%ffGroup = nameToId("MissionCleanup/FlipFlops");
if(%ffGroup <= 0)
return;
for(%i = 0; %i < %ffGroup.getCount(); %i++)
{
%curFF = %ffGroup.getObject(%i);
cancel(%curFF.tHoldThread);
cancel(%curFF.pCapThread);
cancel(%curFF.tCapThread);
}
}
function CnHGame::clientMissionDropReady(%game, %client)
{
messageClient(%client, 'MsgClientReady',"", %game.class);
%scoreLimit = %game.getScoreLimit();
for(%i = 1; %i <= %game.numTeams; %i++)
{
%teamHeld = %game.countFlipsHeld(%i);
messageClient(%client, 'MsgCnHAddTeam', "", %i, $TeamName[%i], $TeamScore[%i], %scoreLimit, %teamHeld);
}
//%game.populateTeamRankArray(%client);
//messageClient(%client, 'MsgYourRankIs', "", -1);
messageClient(%client, 'MsgMissionDropInfo', '\c0You are in mission %1 (%2).', $MissionDisplayName, $MissionTypeDisplayName, $ServerName );
DefaultGame::clientMissionDropReady(%game, %client);
}
function CnHGame::assignClientTeam(%game, %client, %respawn)
{
DefaultGame::assignClientTeam(%game, %client, %respawn);
// if player's team is not on top of objective hud, switch lines
messageClient(%client, 'MsgCheckTeamLines', "", %client.team);
}
function CnHGame::getNumFlipFlops()
{
%ffGroup = nameToID("MissionCleanup/FlipFlops");
return %ffGroup.getCount();
}
function CnHGame::countFlipsHeld(%game, %team)
{
%teamHeld = 0;
// count how many flipflops each team holds
%ffSet = nameToID("MissionCleanup/FlipFlops");
if(%ffSet > 0)
{
%numFF = %ffSet.getCount();
for(%j = 0; %j < %numFF; %j++)
{
%curFF = %ffSet.getObject(%j);
if(%curFF.team == %team)
%teamHeld++;
}
}
return %teamHeld;
}
function CnHGame::countFlips(%game)
{
return true;
}
function CnHGame::equip(%game, %player)
{
for(%i =0; %i<$InventoryHudCount; %i++)
%player.client.setInventoryHudItem($InventoryHudData[%i, itemDataName], 0, 1);
%player.client.clearBackpackIcon();
//%player.setArmor("Light");
%player.setInventory(Blaster,1);
%player.setInventory(Chaingun, 1);
%player.setInventory(ChaingunAmmo, 100);
%player.setInventory(Disc,1);
%player.setInventory(DiscAmmo, 20);
%player.setInventory(TargetingLaser, 1);
%player.setInventory(Grenade,6);
%player.setInventory(Beacon, 3);
%player.setInventory(RepairKit,1);
%player.weaponCount = 3;
%player.use("Blaster");
}
//--------------- Scoring functions -----------------
function CnHGame::recalcScore(%game, %cl)
{
%killValue = %cl.kills * %game.SCORE_PER_KILL;
%deathValue = %cl.deaths * %game.SCORE_PER_DEATH;
if (%killValue - %deathValue == 0)
%killPoints = 0;
else
%killPoints = (%killValue * %killValue) / (%killValue - %deathValue);
%cl.offenseScore = %killPoints;
%cl.offenseScore += %cl.suicides * %game.SCORE_PER_SUICIDE; //-1
%cl.offenseScore += %cl.teamKills * %game.SCORE_PER_TEAMKILL; // -1
%cl.offenseScore += %cl.flipFlopsCapped * %game.SCORE_PER_PLYR_FLIPFLOP_CAP;
%cl.defenseScore = %cl.turretKills * %game.SCORE_PER_TURRET_KILL; // 1
%cl.defenseScore += %cl.flipFlopDefends * %game.SCORE_PER_FLIPFLOP_DEFEND;
%cl.score = mFloor(%cl.offenseScore + %cl.defenseScore);
//track switches held (not touched), switches defended, kills, deaths, suicides, tks
%game.recalcTeamRanks(%cl);
}
function CnHGame::updateKillScores(%game, %clVictim, %clKiller, %damageType, %implement)
{
if(%game.testTurretKill(%implement)) //check for turretkill before awarded a non client points for a kill
{
%game.awardScoreTurretKill(%clVictim, %implement);
}
else if (%game.testKill(%clVictim, %clKiller)) //verify victim was an enemy
{
%game.awardScoreKill(%clKiller);
%game.awardScoreDeath(%clVictim);
//see if we were defending a flip flop
%flipflop = %game.testPlayerFFDefend(%clVictim, %clKiller);
if (isObject(%flipflop))
%game.awardScorePlayerFFDefend(%clKiller, %flipflop);
}
else
{
if (%game.testSuicide(%clVictim, %clKiller, %damageType)) //otherwise test for suicide
{
%game.awardScoreSuicide(%clVictim);
}
else
{
if (%game.testTeamKill(%clVictim, %clKiller)) //otherwise test for a teamkill
%game.awardScoreTeamKill(%clVictim, %clKiller);
}
}
}
function CnHGame::testPlayerFFDefend(%game, %victimID, %killerID)
{
if (!isObject(%victimId) || !isObject(%killerId) || %killerId.team <= 0)
return -1;
//loop through the flipflops looking for one within range that belongs to the killer...
%ffGroup = nameToID("MissionCleanup/FlipFlops");
for (%i = 0; %i < %ffGroup.getCount(); %i++)
{
%ffObj = %ffGroup.getObject(%i);
if (VectorDist(%ffObj.position, %victimID.plyrPointOfDeath) < %game.RADIUS_FLIPFLOP_DEFENSE)
{
if (%ffObj.team == %killerID.team)
return %ffObj;
}
}
//none were found
return -1;
}
function CnHGame::awardScorePlayerFFDefend(%game, %cl, %flipflop)
{
%cl.flipFlopDefends++;
if (%game.SCORE_PER_FLIPFLOP_DEFEND != 0)
{
messageClient(%cl, 'msgFFDef', '\c0You received a %1 point bonus for defending %2.', %game.SCORE_PER_FLIPFLOP_DEFEND, %game.cleanWord(%flipflop.name));
// messageTeamExcept(%cl, 'msgFFDef', '\c0Teammate %1 received a %2 point bonus for defending %3', %cl.name, %game.SCORE_PER_FLIPFLOP_DEFEND, %game.cleanWord(%flipflop.name));
}
%game.recalcScore(%cl);
}
function CnHGame::awardScorePlayerFFCap(%game, %cl, %this)
{
if(!($missionRunning))
return;
%cl.flipFlopsCapped++;
if (%game.SCORE_PER_PLYR_FLIPFLOP_CAP != 0)
{
messageClient(%cl, 'msgFFDef', '\c0You received a %1 point bonus for holding the %2.', %game.SCORE_PER_PLYR_FLIPFLOP_CAP, %game.cleanWord(%this.name));
// messageTeamExcept(%cl, 'msgFFDef', '\c0Teammate %1 received a %2 point bonus for holding the %3', %cl.name, %game.SCORE_PER_PLYR_FLIPFLOP_CAP, %game.cleanWord(%this.name));
}
%game.recalcScore(%cl);
}
function CnHGame::awardScoreTeamFFCap(%game, %team, %this)
{
cancel(%this.tCapThread);
if(!($missionRunning))
return;
$TeamScore[%team] +=%game.SCORE_PER_TEAM_FLIPFLOP_CAP;
%sLimit = %game.getScoreLimit();
if (%game.SCORE_PER_TEAM_FLIPFLOP_CAP)
messageAll('MsgCnHTeamCap', "", -1, -1, -1, %team, $teamScore[%team], %sLimit);
if (%game.SCORE_PER_TEAM_FLIPFLOP_HOLD != 0)
%this.tHoldThread = %game.schedule(%game.TIME_REQ_TEAM_HOLD_BONUS, "awardScoreTeamFFHold", %team, %this);
%game.checkScoreLimit(%team);
}
function CnHGame::awardScoreTeamFFHold(%game, %team, %this)
{
cancel(%this.tHoldThread);
if(!($missionRunning))
return;
$TeamScore[%team] +=%game.SCORE_PER_TEAM_FLIPFLOP_HOLD;
%sLimit = %game.getScoreLimit();
if (%game.SCORE_PER_TEAM_FLIPFLOP_HOLD)
messageAll('MsgCnHTeamCap', "", $TeamName[%team], %game.SCORE_PER_TEAM_FLIPFLOP_HOLD, %game.cleanWord(%this.name), %team, $teamScore[%team], %sLimit);
// if either team's score is divisible by 100, send a console log message
if(($TeamScore[%team] / 100) == (mFloor($TeamScore[%team] / 100)))
for(%i = 1; %i <= %game.numTeams; %i++)
logEcho("team "@%i@" score "@$TeamScore[%i]);
%game.checkScoreLimit(%team);
%this.tHoldThread = %game.schedule(%game.TIME_REQ_TEAM_HOLD_BONUS, "awardScoreTeamFFHold", %team, %this);
}
function CnHGame::testValidRepair(%game, %obj)
{
return ((%obj.lastDamagedByTeam != %obj.team) && (%obj.repairedBy.team == %obj.team));
}
function CnHGame::genOnRepaired(%game, %obj, %objName)
{
if (%game.testValidRepair(%obj))
{
%repairman = %obj.repairedBy;
messageTeam(%repairman.team, 'msgGenRepaired', '\c0%1 repaired the %2 Generator!', %repairman.name, %obj.nameTag);
}
}
function CnHGame::stationOnRepaired(%game, %obj, %objName)
{
if (%game.testValidRepair(%obj))
{
%repairman = %obj.repairedBy;
messageTeam(%repairman.team, 'msgStationRepaired', '\c0%1 repaired the %2 Inventory Station!', %repairman.name, %obj.nameTag);
}
}
function CnHGame::sensorOnRepaired(%game, %obj, %objName)
{
if (%game.testValidRepair(%obj))
{
%repairman = %obj.repairedBy;
messageTeam(%repairman.team, 'msgSensorRepaired', '\c0%1 repaired the %2 Pulse Sensor!', %repairman.name, %obj.nameTag);
}
}
function CnHGame::turretOnRepaired(%game, %obj, %objName)
{
if (%game.testValidRepair(%obj))
{
%repairman = %obj.repairedBy;
messageTeam(%repairman.team, 'msgTurretRepaired', '\c0%1 repaired the %2 Turret!', %repairman.name, %obj.nameTag);
}
}
function CnHGame::vStationOnRepaired(%game, %obj, %objName)
{
if (%game.testValidRepair(%obj))
{
%repairman = %obj.repairedBy;
messageTeam(%repairman.team, 'msgTurretRepaired', '\c0%1 repaired the %2 Vehicle Station!', %repairman.name, %obj.nameTag);
}
}
function CnHGame::startTimerPlayerFFCap(%game, %cl, %this)
{
cancel(%this.pCapThread); //stop the last owner from collecting a cap bonus
%this.pCapThread = %game.schedule(%game.TIME_REQ_PLYR_CAP_BONUS, "awardScorePlayerFFCap", %cl, %this);
cancel(%this.tCapThread); //stop the old owners from collecting any cap bonus
cancel(%this.tHoldThread); //stop the old owners from collecting any hold bonus
%this.tCapThread = %game.schedule(%game.TIME_REQ_TEAM_CAP_BONUS, "awardScoreTeamFFCap", %cl.team, %this);
}
function CnHGame::startTimerTeamFFCap(%game, %team, %this, %time)
{
%this.tCapThread = %game.schedule(%time, "awardScoreTeamFFCap", %team, %this);
}
//------------------------------------------------------------------------
function CnHGame::resetScore(%game, %client)
{
%client.offenseScore = 0;
%client.kills = 0;
%client.deaths = 0;
%client.suicides = 0;
%client.teamKills = 0;
%client.flipFlopsCapped = 0;
%client.defenseScore = 0;
%client.turretKills = 0;
%client.flipFlopDefends = 0;
%client.score = 0;
for ( %team = 1; %team <= %game.numTeams; %team++ )
if($TeamScore[%team] != 0)
$TeamScore[%team] = 0;
}
function CnHGame::applyConcussion(%game, %player)
{
}
// DisplayName = Capture and Hold
//--- GAME RULES BEGIN ---
//Teams try to capture marked objectives
//Capturing player gets a point 12 seconds after a capture
//Hold objectives in order to score
//A team scores 2 points per second it holds an objective
//Turrets and inventory stations convert when their switch is taken
//--- GAME RULES END ---
//exec the AI scripts
exec("scripts/aiCnH.cs");
$InvBanList[CnH, "MiningTool"] = 1;
package CnHGame {
function FlipFlop::playerTouch(%data, %flipflop, %player)
{
if(%flipflop.team != %player.client.team)
{
Parent::playerTouch(%data, %flipflop, %player);
Game.startTimerPlayerFFCap(%player.client, %flipflop);
}
}
function Flipflop::objectiveInit(%data, %flipflop)
{
%flipflop.tCapThread = "";
%flipflop.tHoldThread = "";
%flipflop.pCapThread = "";
Parent::objectiveInit(%data, %flipflop);
}
};
//--------- CnH SCORING INIT ------------------
function CnHGame::initGameVars(%game)
{
%game.SCORE_PER_SUICIDE = -1;
%game.SCORE_PER_TEAMKILL = -1;
%game.SCORE_PER_DEATH = -1;
%game.SCORE_PER_KILL = 1;
%game.SCORE_PER_PLYR_FLIPFLOP_CAP = 1;
%game.SCORE_PER_TEAM_FLIPFLOP_CAP = 1;
%game.SCORE_PER_TEAM_FLIPFLOP_HOLD = 1;
%game.SCORE_PER_TURRET_KILL = 1;
%game.SCORE_PER_FLIPFLOP_DEFEND = 1;
%game.SCORE_LIMIT_PER_TOWER = 1200; //default of 1200 points per tower required to win @ 1 pt per %game.TIME_REQ_TEAM_HOLD_BONUS milliseconds
%game.TIME_REQ_PLYR_CAP_BONUS = 12 * 1000; //player must hold a switch 12 seconds to get a point for it.
%game.TIME_REQ_TEAM_CAP_BONUS = 12 * 1000; //time after touching it takes for team to get a point
%game.TIME_REQ_TEAM_HOLD_BONUS = 0.5 * 1000; //recurring time it takes team to earn a point when flipflop held
%game.RADIUS_FLIPFLOP_DEFENSE = 20; //meters
}
function CnHGame::setUpTeams(%game)
{
DefaultGame::setUpTeams(%game);
// reset the visibility of team 0 (team is still defaulted as friendly)
setSensorGroupAlwaysVisMask(0, 0);
}
//-- tracking ---
// .deaths .kills .suicides .teamKills .turretKills
// .flipFlopDefends .flipFlopsCapped
function CnHGame::startMatch(%game)
{
for(%i = 0; %i <= %game.numTeams; %i++)
$TeamScore[%i] = 0;
DefaultGame::startMatch(%game);
}
function CnHGame::checkScoreLimit(%game, %team)
{
%scoreLimit = %game.getScoreLimit();
if($TeamScore[%team] >= %scoreLimit)
%game.scoreLimitReached();
}
function CnHGame::getScoreLimit(%game)
{
%scoreLimit = MissionGroup.CnH_scoreLimit;
if(%scoreLimit $= "")
%scoreLimit = %game.getNumFlipFlops() * %game.SCORE_LIMIT_PER_TOWER;
return %scoreLimit;
}
function CnHGame::scoreLimitReached(%game)
{
logEcho("game over (scorelimit)");
%game.gameOver();
cycleMissions();
}
function CnHGame::timeLimitReached(%game)
{
logEcho("game over (timelimit)");
%game.gameOver();
cycleMissions();
}
function CnHGame::gameOver(%game)
{
//call the default
DefaultGame::gameOver(%game);
// stop all bonus timers
%game.stopScoreTimers();
//send the winner message
%winner = "";
if ($teamScore[1] > $teamScore[2])
%winner = $teamName[1];
else if ($teamScore[2] > $teamScore[1])
%winner = $teamName[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
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 ( %team = 1; %team <= %game.numTeams; %team++ )
{
$TeamScore[%team] = 0;
messageAll('MsgCnHTeamCap', "", -1, -1, -1, %team, $TeamScore[%team], %game.getScoreLimit());
}
}
function CnHGame::stopScoreTimers(%game)
{
// find all switches and cancel any timers associated with them
%ffGroup = nameToId("MissionCleanup/FlipFlops");
if(%ffGroup <= 0)
return;
for(%i = 0; %i < %ffGroup.getCount(); %i++)
{
%curFF = %ffGroup.getObject(%i);
cancel(%curFF.tHoldThread);
cancel(%curFF.pCapThread);
cancel(%curFF.tCapThread);
}
}
function CnHGame::clientMissionDropReady(%game, %client)
{
messageClient(%client, 'MsgClientReady',"", %game.class);
%scoreLimit = %game.getScoreLimit();
for(%i = 1; %i <= %game.numTeams; %i++)
{
%teamHeld = %game.countFlipsHeld(%i);
messageClient(%client, 'MsgCnHAddTeam', "", %i, $TeamName[%i], $TeamScore[%i], %scoreLimit, %teamHeld);
}
//%game.populateTeamRankArray(%client);
//messageClient(%client, 'MsgYourRankIs', "", -1);
messageClient(%client, 'MsgMissionDropInfo', '\c0You are in mission %1 (%2).', $MissionDisplayName, $MissionTypeDisplayName, $ServerName );
DefaultGame::clientMissionDropReady(%game, %client);
}
function CnHGame::assignClientTeam(%game, %client, %respawn)
{
DefaultGame::assignClientTeam(%game, %client, %respawn);
// if player's team is not on top of objective hud, switch lines
messageClient(%client, 'MsgCheckTeamLines', "", %client.team);
}
function CnHGame::getNumFlipFlops()
{
%ffGroup = nameToID("MissionCleanup/FlipFlops");
return %ffGroup.getCount();
}
function CnHGame::countFlipsHeld(%game, %team)
{
%teamHeld = 0;
// count how many flipflops each team holds
%ffSet = nameToID("MissionCleanup/FlipFlops");
if(%ffSet > 0)
{
%numFF = %ffSet.getCount();
for(%j = 0; %j < %numFF; %j++)
{
%curFF = %ffSet.getObject(%j);
if(%curFF.team == %team)
%teamHeld++;
}
}
return %teamHeld;
}
function CnHGame::countFlips(%game)
{
return true;
}
function CnHGame::equip(%game, %player)
{
for(%i =0; %i<$InventoryHudCount; %i++)
%player.client.setInventoryHudItem($InventoryHudData[%i, itemDataName], 0, 1);
%player.client.clearBackpackIcon();
//%player.setArmor("Light");
%player.setInventory(Blaster,1);
%player.setInventory(Chaingun, 1);
%player.setInventory(ChaingunAmmo, 100);
%player.setInventory(Disc,1);
%player.setInventory(DiscAmmo, 20);
%player.setInventory(TargetingLaser, 1);
%player.setInventory(Grenade,6);
%player.setInventory(Beacon, 3);
%player.setInventory(RepairKit,1);
%player.weaponCount = 3;
%player.use("Blaster");
}
//--------------- Scoring functions -----------------
function CnHGame::recalcScore(%game, %cl)
{
%killValue = %cl.kills * %game.SCORE_PER_KILL;
%deathValue = %cl.deaths * %game.SCORE_PER_DEATH;
if (%killValue - %deathValue == 0)
%killPoints = 0;
else
%killPoints = (%killValue * %killValue) / (%killValue - %deathValue);
%cl.offenseScore = %killPoints;
%cl.offenseScore += %cl.suicides * %game.SCORE_PER_SUICIDE; //-1
%cl.offenseScore += %cl.teamKills * %game.SCORE_PER_TEAMKILL; // -1
%cl.offenseScore += %cl.flipFlopsCapped * %game.SCORE_PER_PLYR_FLIPFLOP_CAP;
%cl.defenseScore = %cl.turretKills * %game.SCORE_PER_TURRET_KILL; // 1
%cl.defenseScore += %cl.flipFlopDefends * %game.SCORE_PER_FLIPFLOP_DEFEND;
%cl.score = mFloor(%cl.offenseScore + %cl.defenseScore);
//track switches held (not touched), switches defended, kills, deaths, suicides, tks
%game.recalcTeamRanks(%cl);
}
function CnHGame::updateKillScores(%game, %clVictim, %clKiller, %damageType, %implement)
{
if(%game.testTurretKill(%implement)) //check for turretkill before awarded a non client points for a kill
{
%game.awardScoreTurretKill(%clVictim, %implement);
}
else if (%game.testKill(%clVictim, %clKiller)) //verify victim was an enemy
{
%game.awardScoreKill(%clKiller);
%game.awardScoreDeath(%clVictim);
//see if we were defending a flip flop
%flipflop = %game.testPlayerFFDefend(%clVictim, %clKiller);
if (isObject(%flipflop))
%game.awardScorePlayerFFDefend(%clKiller, %flipflop);
}
else
{
if (%game.testSuicide(%clVictim, %clKiller, %damageType)) //otherwise test for suicide
{
%game.awardScoreSuicide(%clVictim);
}
else
{
if (%game.testTeamKill(%clVictim, %clKiller)) //otherwise test for a teamkill
%game.awardScoreTeamKill(%clVictim, %clKiller);
}
}
}
function CnHGame::testPlayerFFDefend(%game, %victimID, %killerID)
{
if (!isObject(%victimId) || !isObject(%killerId) || %killerId.team <= 0)
return -1;
//loop through the flipflops looking for one within range that belongs to the killer...
%ffGroup = nameToID("MissionCleanup/FlipFlops");
for (%i = 0; %i < %ffGroup.getCount(); %i++)
{
%ffObj = %ffGroup.getObject(%i);
if (VectorDist(%ffObj.position, %victimID.plyrPointOfDeath) < %game.RADIUS_FLIPFLOP_DEFENSE)
{
if (%ffObj.team == %killerID.team)
return %ffObj;
}
}
//none were found
return -1;
}
function CnHGame::awardScorePlayerFFDefend(%game, %cl, %flipflop)
{
%cl.flipFlopDefends++;
if (%game.SCORE_PER_FLIPFLOP_DEFEND != 0)
{
messageClient(%cl, 'msgFFDef', '\c0You received a %1 point bonus for defending %2.', %game.SCORE_PER_FLIPFLOP_DEFEND, %game.cleanWord(%flipflop.name));
// messageTeamExcept(%cl, 'msgFFDef', '\c0Teammate %1 received a %2 point bonus for defending %3', %cl.name, %game.SCORE_PER_FLIPFLOP_DEFEND, %game.cleanWord(%flipflop.name));
}
%game.recalcScore(%cl);
}
function CnHGame::awardScorePlayerFFCap(%game, %cl, %this)
{
if(!($missionRunning))
return;
%cl.flipFlopsCapped++;
if (%game.SCORE_PER_PLYR_FLIPFLOP_CAP != 0)
{
messageClient(%cl, 'msgFFDef', '\c0You received a %1 point bonus for holding the %2.', %game.SCORE_PER_PLYR_FLIPFLOP_CAP, %game.cleanWord(%this.name));
// messageTeamExcept(%cl, 'msgFFDef', '\c0Teammate %1 received a %2 point bonus for holding the %3', %cl.name, %game.SCORE_PER_PLYR_FLIPFLOP_CAP, %game.cleanWord(%this.name));
}
%game.recalcScore(%cl);
}
function CnHGame::awardScoreTeamFFCap(%game, %team, %this)
{
cancel(%this.tCapThread);
if(!($missionRunning))
return;
$TeamScore[%team] +=%game.SCORE_PER_TEAM_FLIPFLOP_CAP;
%sLimit = %game.getScoreLimit();
if (%game.SCORE_PER_TEAM_FLIPFLOP_CAP)
messageAll('MsgCnHTeamCap', "", -1, -1, -1, %team, $teamScore[%team], %sLimit);
if (%game.SCORE_PER_TEAM_FLIPFLOP_HOLD != 0)
%this.tHoldThread = %game.schedule(%game.TIME_REQ_TEAM_HOLD_BONUS, "awardScoreTeamFFHold", %team, %this);
%game.checkScoreLimit(%team);
}
function CnHGame::awardScoreTeamFFHold(%game, %team, %this)
{
cancel(%this.tHoldThread);
if(!($missionRunning))
return;
$TeamScore[%team] +=%game.SCORE_PER_TEAM_FLIPFLOP_HOLD;
%sLimit = %game.getScoreLimit();
if (%game.SCORE_PER_TEAM_FLIPFLOP_HOLD)
messageAll('MsgCnHTeamCap', "", $TeamName[%team], %game.SCORE_PER_TEAM_FLIPFLOP_HOLD, %game.cleanWord(%this.name), %team, $teamScore[%team], %sLimit);
// if either team's score is divisible by 100, send a console log message
if(($TeamScore[%team] / 100) == (mFloor($TeamScore[%team] / 100)))
for(%i = 1; %i <= %game.numTeams; %i++)
logEcho("team "@%i@" score "@$TeamScore[%i]);
%game.checkScoreLimit(%team);
%this.tHoldThread = %game.schedule(%game.TIME_REQ_TEAM_HOLD_BONUS, "awardScoreTeamFFHold", %team, %this);
}
function CnHGame::testValidRepair(%game, %obj)
{
return ((%obj.lastDamagedByTeam != %obj.team) && (%obj.repairedBy.team == %obj.team));
}
function CnHGame::genOnRepaired(%game, %obj, %objName)
{
if (%game.testValidRepair(%obj))
{
%repairman = %obj.repairedBy;
messageTeam(%repairman.team, 'msgGenRepaired', '\c0%1 repaired the %2 Generator!', %repairman.name, %obj.nameTag);
}
}
function CnHGame::stationOnRepaired(%game, %obj, %objName)
{
if (%game.testValidRepair(%obj))
{
%repairman = %obj.repairedBy;
messageTeam(%repairman.team, 'msgStationRepaired', '\c0%1 repaired the %2 Inventory Station!', %repairman.name, %obj.nameTag);
}
}
function CnHGame::sensorOnRepaired(%game, %obj, %objName)
{
if (%game.testValidRepair(%obj))
{
%repairman = %obj.repairedBy;
messageTeam(%repairman.team, 'msgSensorRepaired', '\c0%1 repaired the %2 Pulse Sensor!', %repairman.name, %obj.nameTag);
}
}
function CnHGame::turretOnRepaired(%game, %obj, %objName)
{
if (%game.testValidRepair(%obj))
{
%repairman = %obj.repairedBy;
messageTeam(%repairman.team, 'msgTurretRepaired', '\c0%1 repaired the %2 Turret!', %repairman.name, %obj.nameTag);
}
}
function CnHGame::vStationOnRepaired(%game, %obj, %objName)
{
if (%game.testValidRepair(%obj))
{
%repairman = %obj.repairedBy;
messageTeam(%repairman.team, 'msgTurretRepaired', '\c0%1 repaired the %2 Vehicle Station!', %repairman.name, %obj.nameTag);
}
}
function CnHGame::startTimerPlayerFFCap(%game, %cl, %this)
{
cancel(%this.pCapThread); //stop the last owner from collecting a cap bonus
%this.pCapThread = %game.schedule(%game.TIME_REQ_PLYR_CAP_BONUS, "awardScorePlayerFFCap", %cl, %this);
cancel(%this.tCapThread); //stop the old owners from collecting any cap bonus
cancel(%this.tHoldThread); //stop the old owners from collecting any hold bonus
%this.tCapThread = %game.schedule(%game.TIME_REQ_TEAM_CAP_BONUS, "awardScoreTeamFFCap", %cl.team, %this);
}
function CnHGame::startTimerTeamFFCap(%game, %team, %this, %time)
{
%this.tCapThread = %game.schedule(%time, "awardScoreTeamFFCap", %team, %this);
}
//------------------------------------------------------------------------
function CnHGame::resetScore(%game, %client)
{
%client.offenseScore = 0;
%client.kills = 0;
%client.deaths = 0;
%client.suicides = 0;
%client.teamKills = 0;
%client.flipFlopsCapped = 0;
%client.defenseScore = 0;
%client.turretKills = 0;
%client.flipFlopDefends = 0;
%client.score = 0;
for ( %team = 1; %team <= %game.numTeams; %team++ )
if($TeamScore[%team] != 0)
$TeamScore[%team] = 0;
}
function CnHGame::applyConcussion(%game, %player)
{
}

View file

@ -1,380 +1,380 @@
// --------------------------------------------------------
// Deathmatch mission type
// --------------------------------------------------------
// DisplayName = Deathmatch
//--- GAME RULES BEGIN ---
//There aren't many rules...
//Kill
//Don't get killed
//Points are scored for each kill you make and subtracted each time you die
//--- GAME RULES END ---
$InvBanList[DM, "TurretOutdoorDeployable"] = 1;
$InvBanList[DM, "TurretIndoorDeployable"] = 1;
$InvBanList[DM, "ElfBarrelPack"] = 1;
$InvBanList[DM, "MortarBarrelPack"] = 1;
$InvBanList[DM, "PlasmaBarrelPack"] = 1;
$InvBanList[DM, "AABarrelPack"] = 1;
$InvBanList[DM, "MissileBarrelPack"] = 1;
$InvBanList[DM, "Mine"] = 1;
$InvBanList[DM, "MiningTool"] = 1;
function DMGame::setUpTeams(%game)
{
%group = nameToID("MissionGroup/Teams");
if(%group == -1)
return;
// create a team0 if it does not exist
%team = nameToID("MissionGroup/Teams/team0");
if(%team == -1)
{
%team = new SimGroup("team0");
%group.add(%team);
}
// 'team0' is not counted as a team here
%game.numTeams = 0;
while(%team != -1)
{
// create drop set and add all spawnsphere objects into it
%dropSet = new SimSet("TeamDrops" @ %game.numTeams);
MissionCleanup.add(%dropSet);
%spawns = nameToID("MissionGroup/Teams/team" @ %game.numTeams @ "/SpawnSpheres");
if(%spawns != -1)
{
%count = %spawns.getCount();
for(%i = 0; %i < %count; %i++)
%dropSet.add(%spawns.getObject(%i));
}
// set the 'team' field for all the objects in this team
%team.setTeam(0);
clearVehicleCount(%team+1);
// get next group
%team = nameToID("MissionGroup/Teams/team" @ %game.numTeams + 1);
if (%team != -1)
%game.numTeams++;
}
// set the number of sensor groups (including team0) that are processed
setSensorGroupCount(%game.numTeams + 1);
%game.numTeams = 1;
// allow teams 1->31 to listen to each other (team 0 can only listen to self)
for(%i = 1; %i < 32; %i++)
setSensorGroupListenMask(%i, 0xfffffffe);
}
function DMGame::initGameVars(%game)
{
%game.SCORE_PER_KILL = 1;
%game.SCORE_PER_DEATH = -1;
%game.SCORE_PER_SUICIDE = -1;
}
exec("scripts/aiDeathMatch.cs");
function DMGame::allowsProtectedStatics(%game)
{
return true;
}
function DMGame::equip(%game, %player)
{
for(%i =0; %i<$InventoryHudCount; %i++)
%player.client.setInventoryHudItem($InventoryHudData[%i, itemDataName], 0, 1);
%player.client.clearBackpackIcon();
//%player.setArmor("Light");
%player.setInventory(RepairKit, 1);
%player.setInventory("Disc", 1);
%player.setInventory("DiscAmmo", 15);
%player.setInventory("TargetingLaser", 1);
%player.weaponCount = 1;
if (%player.client.race $= "Draakan") //Also defined in DefaultGame.cs, but this overrides it.
%player.setInventory(Flamer,1);
// do we want to give players a disc launcher instead? GJL: Yes we do!
%player.use("Disc");
}
function DMGame::pickPlayerSpawn(%game, %client, %respawn)
{
// all spawns come from team 1
return %game.pickTeamSpawn(1);
}
function DMGame::clientJoinTeam( %game, %client, %team, %respawn )
{
%game.assignClientTeam( %client );
// Spawn the player:
%game.spawnPlayer( %client, %respawn );
}
function DMGame::assignClientTeam(%game, %client)
{
for(%i = 1; %i < 32; %i++)
$DMTeamArray[%i] = false;
%maxSensorGroup = 0;
%count = ClientGroup.getCount();
for(%i = 0; %i < %count; %i++)
{
%cl = ClientGroup.getObject(%i);
if(%cl != %client)
{
$DMTeamArray[%cl.team] = true;
if (%cl.team > %maxSensorGroup)
%maxSensorGroup = %cl.team;
}
}
//now loop through the team array, looking for an empty team
for(%i = 1; %i < 32; %i++)
{
if (! $DMTeamArray[%i])
{
%client.team = %i;
if (%client.team > %maxSensorGroup)
%maxSensorGroup = %client.team;
break;
}
}
// set player's skin pref here
setTargetSkin(%client.target, %client.skin);
// Let everybody know you are no longer an observer:
messageAll( 'MsgClientJoinTeam', '\c1%1 has joined the fray.', %client.name, "", %client, 1 );
updateCanListenState( %client );
//now set the max number of sensor groups...
setSensorGroupCount(%maxSensorGroup + 1);
}
function DMGame::clientMissionDropReady(%game, %client)
{
messageClient(%client, 'MsgClientReady',"", %game.class);
messageClient(%client, 'MsgYourScoreIs', "", 0);
messageClient(%client, 'MsgDMPlayerDies', "", 0);
messageClient(%client, 'MsgDMKill', "", 0);
%game.resetScore(%client);
messageClient(%client, 'MsgMissionDropInfo', '\c0You are in mission %1 (%2).', $MissionDisplayName, $MissionTypeDisplayName, $ServerName );
DefaultGame::clientMissionDropReady(%game, %client);
}
function DMGame::AIHasJoined(%game, %client)
{
//let everyone know the player has joined the game
//messageAllExcept(%client, -1, 'MsgClientJoinTeam', '%1 has joined the fray.', %client.name, "", %client, 1 );
}
function DMGame::checkScoreLimit(%game, %client)
{
//there's no score limit in DM
}
function DMGame::createPlayer(%game, %client, %spawnLoc, %respawn)
{
DefaultGame::createPlayer(%game, %client, %spawnLoc, %respawn);
%client.setSensorGroup(%client.team);
}
function DMGame::resetScore(%game, %client)
{
%client.deaths = 0;
%client.kills = 0;
%client.score = 0;
%client.efficiency = 0.0;
%client.suicides = 0;
}
function DMGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLoc)
{
cancel(%clVictim.player.alertThread);
DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLoc);
}
function DMGame::updateKillScores(%game, %clVictim, %clKiller, %damageType, %implement)
{
if (%game.testKill(%clVictim, %clKiller)) //verify victim was an enemy
{
%game.awardScoreKill(%clKiller);
messageClient(%clKiller, 'MsgDMKill', "", %clKiller.kills);
%game.awardScoreDeath(%clVictim);
}
else if (%game.testSuicide(%clVictim, %clKiller, %damageType)) //otherwise test for suicide
%game.awardScoreSuicide(%clVictim);
messageClient(%clVictim, 'MsgDMPlayerDies', "", %clVictim.deaths + %clVictim.suicides);
}
function DMGame::recalcScore(%game, %client)
{
%killValue = %client.kills * %game.SCORE_PER_KILL;
%deathValue = %client.deaths * %game.SCORE_PER_DEATH;
%suicideValue = %client.suicides * %game.SCORE_PER_SUICIDE;
if (%killValue - %deathValue == 0)
%client.efficiency = %suicideValue;
else
%client.efficiency = ((%killValue * %killValue) / (%killValue - %deathValue)) + %suicideValue;
%client.score = mFloatLength(%client.efficiency, 1);
messageClient(%client, 'MsgYourScoreIs', "", %client.score);
%game.recalcTeamRanks(%client);
%game.checkScoreLimit(%client);
}
function DMGame::timeLimitReached(%game)
{
logEcho("game over (timelimit)");
%game.gameOver();
cycleMissions();
}
function DMGame::scoreLimitReached(%game)
{
logEcho("game over (scorelimit)");
%game.gameOver();
cycleMissions();
}
function DMGame::gameOver(%game)
{
//call the default
DefaultGame::gameOver(%game);
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.gameover.wav" );
cancel(%game.timeThread);
messageAll('MsgClearObjHud', "");
for(%i = 0; %i < ClientGroup.getCount(); %i ++) {
%client = ClientGroup.getObject(%i);
%game.resetScore(%client);
}
}
function DMGame::enterMissionArea(%game, %playerData, %player)
{
%player.client.outOfBounds = false;
messageClient(%player.client, 'EnterMissionArea', '\c1You are back in the mission area.');
logEcho(%player.client.nameBase@" (pl "@%player@"/cl "@%player.client@") entered mission area");
cancel(%player.alertThread);
}
function DMGame::leaveMissionArea(%game, %playerData, %player)
{
if(%player.getState() $= "Dead")
return;
%player.client.outOfBounds = true;
messageClient(%player.client, 'LeaveMissionArea', '\c1You have left the mission area. Return or take damage.~wfx/misc/warning_beep.wav');
logEcho(%player.client.nameBase@" (pl "@%player@"/cl "@%player.client@") left mission area");
%player.alertThread = %game.schedule(1000, "DMAlertPlayer", 3, %player);
}
function DMGame::DMAlertPlayer(%game, %count, %player)
{
// MES - I commented below line out because it prints a blank line to chat window
//messageClient(%player.client, 'MsgDMLeftMisAreaWarn', '~wfx/misc/red_alert.wav');
if(%count > 1)
%player.alertThread = %game.schedule(1000, "DMAlertPlayer", %count - 1, %player);
else
%player.alertThread = %game.schedule(1000, "MissionAreaDamage", %player);
}
function DMGame::MissionAreaDamage(%game, %player)
{
if(%player.getState() !$= "Dead") {
%player.setDamageFlash(0.1);
%prevHurt = %player.getDamageLevel();
%player.setDamageLevel(%prevHurt + 0.05);
%player.alertThread = %game.schedule(1000, "MissionAreaDamage", %player);
}
else
%game.onClientKilled(%player.client, 0, $DamageType::OutOfBounds);
}
function DMGame::updateScoreHud(%game, %client, %tag)
{
// Clear the header:
messageClient( %client, 'SetScoreHudHeader', "", "" );
// Send the subheader:
messageClient(%client, 'SetScoreHudSubheader', "", '<tab:15,235,340,415>\tPLAYER\tRATING\tKILLS\tDEATHS');
for (%index = 0; %index < $TeamRank[0, count]; %index++)
{
//get the client info
%cl = $TeamRank[0, %index];
//get the score
%clScore = mFloatLength( %cl.efficiency, 1 );
%clKills = mFloatLength( %cl.kills, 0 );
%clDeaths = mFloatLength( %cl.deaths + %cl.suicides, 0 );
%clStyle = %cl == %client ? "<color:dcdcdc>" : "";
//if the client is not an observer, send the message
if (%client.team != 0)
{
messageClient( %client, 'SetLineHud', "", %tag, %index, '%5<tab:20, 450>\t<clip:200>%1</clip><rmargin:280><just:right>%2<rmargin:370><just:right>%3<rmargin:460><just:right>%4',
%cl.name, %clScore, %clKills, %clDeaths, %clStyle );
}
//else for observers, create an anchor around the player name so they can be observed
else
{
messageClient( %client, 'SetLineHud', "", %tag, %index, '%5<tab:20, 450>\t<clip:200><a:gamelink\t%6>%1</a></clip><rmargin:280><just:right>%2<rmargin:370><just:right>%3<rmargin:460><just:right>%4',
%cl.name, %clScore, %clKills, %clDeaths, %clStyle, %cl );
}
}
// Tack on the list of observers:
%observerCount = 0;
for (%i = 0; %i < ClientGroup.getCount(); %i++)
{
%cl = ClientGroup.getObject(%i);
if (%cl.team == 0)
%observerCount++;
}
if (%observerCount > 0)
{
messageClient( %client, 'SetLineHud', "", %tag, %index, "");
%index++;
messageClient(%client, 'SetLineHud', "", %tag, %index, '<tab:10, 310><spush><font:Univers Condensed:22>\tOBSERVERS (%1)<rmargin:260><just:right>TIME<spop>', %observerCount);
%index++;
for (%i = 0; %i < ClientGroup.getCount(); %i++)
{
%cl = ClientGroup.getObject(%i);
//if this is an observer
if (%cl.team == 0)
{
%obsTime = getSimTime() - %cl.observerStartTime;
%obsTimeStr = %game.formatTime(%obsTime, false);
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:20, 310>\t<clip:150>%1</clip><rmargin:260><just:right>%2',
%cl.name, %obsTimeStr );
%index++;
}
}
}
//clear the rest of Hud so we don't get old lines hanging around...
messageClient( %client, 'ClearHud', "", %tag, %index );
}
function DMGame::applyConcussion(%game, %player)
{
}
// --------------------------------------------------------
// Deathmatch mission type
// --------------------------------------------------------
// DisplayName = Deathmatch
//--- GAME RULES BEGIN ---
//There aren't many rules...
//Kill
//Don't get killed
//Points are scored for each kill you make and subtracted each time you die
//--- GAME RULES END ---
$InvBanList[DM, "TurretOutdoorDeployable"] = 1;
$InvBanList[DM, "TurretIndoorDeployable"] = 1;
$InvBanList[DM, "ElfBarrelPack"] = 1;
$InvBanList[DM, "MortarBarrelPack"] = 1;
$InvBanList[DM, "PlasmaBarrelPack"] = 1;
$InvBanList[DM, "AABarrelPack"] = 1;
$InvBanList[DM, "MissileBarrelPack"] = 1;
$InvBanList[DM, "Mine"] = 1;
$InvBanList[DM, "MiningTool"] = 1;
function DMGame::setUpTeams(%game)
{
%group = nameToID("MissionGroup/Teams");
if(%group == -1)
return;
// create a team0 if it does not exist
%team = nameToID("MissionGroup/Teams/team0");
if(%team == -1)
{
%team = new SimGroup("team0");
%group.add(%team);
}
// 'team0' is not counted as a team here
%game.numTeams = 0;
while(%team != -1)
{
// create drop set and add all spawnsphere objects into it
%dropSet = new SimSet("TeamDrops" @ %game.numTeams);
MissionCleanup.add(%dropSet);
%spawns = nameToID("MissionGroup/Teams/team" @ %game.numTeams @ "/SpawnSpheres");
if(%spawns != -1)
{
%count = %spawns.getCount();
for(%i = 0; %i < %count; %i++)
%dropSet.add(%spawns.getObject(%i));
}
// set the 'team' field for all the objects in this team
%team.setTeam(0);
clearVehicleCount(%team+1);
// get next group
%team = nameToID("MissionGroup/Teams/team" @ %game.numTeams + 1);
if (%team != -1)
%game.numTeams++;
}
// set the number of sensor groups (including team0) that are processed
setSensorGroupCount(%game.numTeams + 1);
%game.numTeams = 1;
// allow teams 1->31 to listen to each other (team 0 can only listen to self)
for(%i = 1; %i < 32; %i++)
setSensorGroupListenMask(%i, 0xfffffffe);
}
function DMGame::initGameVars(%game)
{
%game.SCORE_PER_KILL = 1;
%game.SCORE_PER_DEATH = -1;
%game.SCORE_PER_SUICIDE = -1;
}
exec("scripts/aiDeathMatch.cs");
function DMGame::allowsProtectedStatics(%game)
{
return true;
}
function DMGame::equip(%game, %player)
{
for(%i =0; %i<$InventoryHudCount; %i++)
%player.client.setInventoryHudItem($InventoryHudData[%i, itemDataName], 0, 1);
%player.client.clearBackpackIcon();
//%player.setArmor("Light");
%player.setInventory(RepairKit, 1);
%player.setInventory("Disc", 1);
%player.setInventory("DiscAmmo", 15);
%player.setInventory("TargetingLaser", 1);
%player.weaponCount = 1;
if (%player.client.race $= "Draakan") //Also defined in DefaultGame.cs, but this overrides it.
%player.setInventory(Flamer,1);
// do we want to give players a disc launcher instead? GJL: Yes we do!
%player.use("Disc");
}
function DMGame::pickPlayerSpawn(%game, %client, %respawn)
{
// all spawns come from team 1
return %game.pickTeamSpawn(1);
}
function DMGame::clientJoinTeam( %game, %client, %team, %respawn )
{
%game.assignClientTeam( %client );
// Spawn the player:
%game.spawnPlayer( %client, %respawn );
}
function DMGame::assignClientTeam(%game, %client)
{
for(%i = 1; %i < 32; %i++)
$DMTeamArray[%i] = false;
%maxSensorGroup = 0;
%count = ClientGroup.getCount();
for(%i = 0; %i < %count; %i++)
{
%cl = ClientGroup.getObject(%i);
if(%cl != %client)
{
$DMTeamArray[%cl.team] = true;
if (%cl.team > %maxSensorGroup)
%maxSensorGroup = %cl.team;
}
}
//now loop through the team array, looking for an empty team
for(%i = 1; %i < 32; %i++)
{
if (! $DMTeamArray[%i])
{
%client.team = %i;
if (%client.team > %maxSensorGroup)
%maxSensorGroup = %client.team;
break;
}
}
// set player's skin pref here
setTargetSkin(%client.target, %client.skin);
// Let everybody know you are no longer an observer:
messageAll( 'MsgClientJoinTeam', '\c1%1 has joined the fray.', %client.name, "", %client, 1 );
updateCanListenState( %client );
//now set the max number of sensor groups...
setSensorGroupCount(%maxSensorGroup + 1);
}
function DMGame::clientMissionDropReady(%game, %client)
{
messageClient(%client, 'MsgClientReady',"", %game.class);
messageClient(%client, 'MsgYourScoreIs', "", 0);
messageClient(%client, 'MsgDMPlayerDies', "", 0);
messageClient(%client, 'MsgDMKill', "", 0);
%game.resetScore(%client);
messageClient(%client, 'MsgMissionDropInfo', '\c0You are in mission %1 (%2).', $MissionDisplayName, $MissionTypeDisplayName, $ServerName );
DefaultGame::clientMissionDropReady(%game, %client);
}
function DMGame::AIHasJoined(%game, %client)
{
//let everyone know the player has joined the game
//messageAllExcept(%client, -1, 'MsgClientJoinTeam', '%1 has joined the fray.', %client.name, "", %client, 1 );
}
function DMGame::checkScoreLimit(%game, %client)
{
//there's no score limit in DM
}
function DMGame::createPlayer(%game, %client, %spawnLoc, %respawn)
{
DefaultGame::createPlayer(%game, %client, %spawnLoc, %respawn);
%client.setSensorGroup(%client.team);
}
function DMGame::resetScore(%game, %client)
{
%client.deaths = 0;
%client.kills = 0;
%client.score = 0;
%client.efficiency = 0.0;
%client.suicides = 0;
}
function DMGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLoc)
{
cancel(%clVictim.player.alertThread);
DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLoc);
}
function DMGame::updateKillScores(%game, %clVictim, %clKiller, %damageType, %implement)
{
if (%game.testKill(%clVictim, %clKiller)) //verify victim was an enemy
{
%game.awardScoreKill(%clKiller);
messageClient(%clKiller, 'MsgDMKill', "", %clKiller.kills);
%game.awardScoreDeath(%clVictim);
}
else if (%game.testSuicide(%clVictim, %clKiller, %damageType)) //otherwise test for suicide
%game.awardScoreSuicide(%clVictim);
messageClient(%clVictim, 'MsgDMPlayerDies', "", %clVictim.deaths + %clVictim.suicides);
}
function DMGame::recalcScore(%game, %client)
{
%killValue = %client.kills * %game.SCORE_PER_KILL;
%deathValue = %client.deaths * %game.SCORE_PER_DEATH;
%suicideValue = %client.suicides * %game.SCORE_PER_SUICIDE;
if (%killValue - %deathValue == 0)
%client.efficiency = %suicideValue;
else
%client.efficiency = ((%killValue * %killValue) / (%killValue - %deathValue)) + %suicideValue;
%client.score = mFloatLength(%client.efficiency, 1);
messageClient(%client, 'MsgYourScoreIs', "", %client.score);
%game.recalcTeamRanks(%client);
%game.checkScoreLimit(%client);
}
function DMGame::timeLimitReached(%game)
{
logEcho("game over (timelimit)");
%game.gameOver();
cycleMissions();
}
function DMGame::scoreLimitReached(%game)
{
logEcho("game over (scorelimit)");
%game.gameOver();
cycleMissions();
}
function DMGame::gameOver(%game)
{
//call the default
DefaultGame::gameOver(%game);
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.gameover.wav" );
cancel(%game.timeThread);
messageAll('MsgClearObjHud', "");
for(%i = 0; %i < ClientGroup.getCount(); %i ++) {
%client = ClientGroup.getObject(%i);
%game.resetScore(%client);
}
}
function DMGame::enterMissionArea(%game, %playerData, %player)
{
%player.client.outOfBounds = false;
messageClient(%player.client, 'EnterMissionArea', '\c1You are back in the mission area.');
logEcho(%player.client.nameBase@" (pl "@%player@"/cl "@%player.client@") entered mission area");
cancel(%player.alertThread);
}
function DMGame::leaveMissionArea(%game, %playerData, %player)
{
if(%player.getState() $= "Dead")
return;
%player.client.outOfBounds = true;
messageClient(%player.client, 'LeaveMissionArea', '\c1You have left the mission area. Return or take damage.~wfx/misc/warning_beep.wav');
logEcho(%player.client.nameBase@" (pl "@%player@"/cl "@%player.client@") left mission area");
%player.alertThread = %game.schedule(1000, "DMAlertPlayer", 3, %player);
}
function DMGame::DMAlertPlayer(%game, %count, %player)
{
// MES - I commented below line out because it prints a blank line to chat window
//messageClient(%player.client, 'MsgDMLeftMisAreaWarn', '~wfx/misc/red_alert.wav');
if(%count > 1)
%player.alertThread = %game.schedule(1000, "DMAlertPlayer", %count - 1, %player);
else
%player.alertThread = %game.schedule(1000, "MissionAreaDamage", %player);
}
function DMGame::MissionAreaDamage(%game, %player)
{
if(%player.getState() !$= "Dead") {
%player.setDamageFlash(0.1);
%prevHurt = %player.getDamageLevel();
%player.setDamageLevel(%prevHurt + 0.05);
%player.alertThread = %game.schedule(1000, "MissionAreaDamage", %player);
}
else
%game.onClientKilled(%player.client, 0, $DamageType::OutOfBounds);
}
function DMGame::updateScoreHud(%game, %client, %tag)
{
// Clear the header:
messageClient( %client, 'SetScoreHudHeader', "", "" );
// Send the subheader:
messageClient(%client, 'SetScoreHudSubheader', "", '<tab:15,235,340,415>\tPLAYER\tRATING\tKILLS\tDEATHS');
for (%index = 0; %index < $TeamRank[0, count]; %index++)
{
//get the client info
%cl = $TeamRank[0, %index];
//get the score
%clScore = mFloatLength( %cl.efficiency, 1 );
%clKills = mFloatLength( %cl.kills, 0 );
%clDeaths = mFloatLength( %cl.deaths + %cl.suicides, 0 );
%clStyle = %cl == %client ? "<color:dcdcdc>" : "";
//if the client is not an observer, send the message
if (%client.team != 0)
{
messageClient( %client, 'SetLineHud', "", %tag, %index, '%5<tab:20, 450>\t<clip:200>%1</clip><rmargin:280><just:right>%2<rmargin:370><just:right>%3<rmargin:460><just:right>%4',
%cl.name, %clScore, %clKills, %clDeaths, %clStyle );
}
//else for observers, create an anchor around the player name so they can be observed
else
{
messageClient( %client, 'SetLineHud', "", %tag, %index, '%5<tab:20, 450>\t<clip:200><a:gamelink\t%6>%1</a></clip><rmargin:280><just:right>%2<rmargin:370><just:right>%3<rmargin:460><just:right>%4',
%cl.name, %clScore, %clKills, %clDeaths, %clStyle, %cl );
}
}
// Tack on the list of observers:
%observerCount = 0;
for (%i = 0; %i < ClientGroup.getCount(); %i++)
{
%cl = ClientGroup.getObject(%i);
if (%cl.team == 0)
%observerCount++;
}
if (%observerCount > 0)
{
messageClient( %client, 'SetLineHud', "", %tag, %index, "");
%index++;
messageClient(%client, 'SetLineHud', "", %tag, %index, '<tab:10, 310><spush><font:Univers Condensed:22>\tOBSERVERS (%1)<rmargin:260><just:right>TIME<spop>', %observerCount);
%index++;
for (%i = 0; %i < ClientGroup.getCount(); %i++)
{
%cl = ClientGroup.getObject(%i);
//if this is an observer
if (%cl.team == 0)
{
%obsTime = getSimTime() - %cl.observerStartTime;
%obsTimeStr = %game.formatTime(%obsTime, false);
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:20, 310>\t<clip:150>%1</clip><rmargin:260><just:right>%2',
%cl.name, %obsTimeStr );
%index++;
}
}
}
//clear the rest of Hud so we don't get old lines hanging around...
messageClient( %client, 'ClearHud', "", %tag, %index );
}
function DMGame::applyConcussion(%game, %player)
{
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,238 +1,238 @@
//------------------------------------------------------------------------------
// A lil sumthin by Alviss
// For C&C
//------------------------------------------------------------------------------
// Execution
//------------------------------------------------------------------------------
// This clears the building index's in one swoop
function BuildingManagerInit()
{
if (isObject(BuildingManager))
BuildingManager.Delete();
new ScriptObject(BuildingManager) {};
}
//------------------------------------------------------------------------------
exec("scripts/Importer/BuildingDatablocks.cs");
exec("scripts/Importer/BuildingGroups.cs");
exec("scripts/Importer/Buildings/ConstructionYard.cs");
exec("scripts/Importer/Converter.cs");
// adding the buildings
//------------------------------------------------------------------------------
// Functions
//------------------------------------------------------------------------------
function exebuild()
{
exec("scripts/functionality/Building.cs");
}
function LoadCCBuilding(%client, %building, %center)
{
%team = %client.team;
// This is used to keep duplicate buildings from joining the same group
// So, like, we don't have 3 group's named PowerPlant.
// EDIT: I realize it wouldn't matter now, but i'm too lazy to remove all my work
BuildingManager.BuildingInc[%building, %team]++;
switch$(%building)
{
case "ConYard":
Build_ConstructionYard(%client, %center, %team);
case "PowerPlant":
Build_PowerPlant(%client, %center, %team);
}
// set a timer to unify the building
NametoId("MissionCleanup/Buildings"@%team@"/"@%building @ BuildingManager.BuildingInc[%building, %team]).Schedule(2000, "UnifyBuildings");
// it uses a timer because none of the objects have the required parameters set yet, plus it's a good idea
// to wait until all the pieces are loaded.
}
//------------------------------------------------------------------------------
// CCMod Package
//------------------------------------------------------------------------------
package CCMod
{
//------------------------------------------
// echos and logs the exec call
function exec(%target)
{
// LogEvent(%target);
//error("Count : " @ DatablockGroup.getCount());
parent::exec(%target);
}
//------------------------------------------
// So you don't get a lame red spam wall in the console.
function setTargetSensorGroup(%target, %team)
{
if (%target <= 0)
return;
parent::setTargetSensorGroup(%target, %team);
}
//------------------------------------------
// So you don't get a lame red spam wall in the console.
function setTargetName(%target, %name)
{
if (%target <= 0)
return;
parent::setTargetName(%target, %name);
}
//------------------------------------------
// to capture the MCV when it deploys
function StaticShapeData::OnAdd(%data, %obj)
{
// it's a building piece.
if (StrStr(%data.GetName(), "BuildingBlock") != -1)
{
if (%obj.TheFloor && %obj.type $= "ConYard")
{
$CCGame::MCV[%obj.team] = %obj;
}
}
Parent::OnAdd(%data, %obj);
}
//------------------------------------------
// door functions
function StaticShapeData::OnCollision(%data, %obj)
{
// DoorCode
if (%obj.IsDoor)
{
%obj.ClosePosition = %obj.GetPosition();
%obj.SetPosition("0 0 -100");
schedule(2000, 0, "eval", %obj@".SetPosition("@%obj@".ClosePosition);");
}
}
//------------------------------------------
// captures incoming damage
function StaticShapeData::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType)
{
// it's a building piece.
if (StrStr(%data.GetName(), "BuildingBlock") != -1)
GrabBaseDamageCall(%data, %targetObject, %sourceObject, %position, %amount, %damageType);
else
parent::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType);
}
//------------------------------------------
// captures incoming destroyed call
function StaticShapeData::onDestroyed(%this,%obj,%prevState)
{
$BuildingCount[%obj.type, %obj.team]--;
$Power[%obj.team] -= $Power[%obj.team];
CheckPowerGoodLevel(%obj.team);
// $TeamDeployedCount[%obj.team, AdvGuardTurretBasePack]--;
}
};
if (!isActivePackage(CCMod))
ActivatePackage(CCMod);
//------------------------------------------------------------------------------
// Support Functions
//------------------------------------------------------------------------------
function addToBuildingGroup(%object)
{
%TeamGroup = nameToID("Buildings"@%object.team);
if (%TeamGroup <= 0)
{
%TeamGroup = new SimGroup("Buildings"@%object.team);
MissionCleanup.add(%TeamGroup);
}
%index = BuildingManager.BuildingInc[%object.Type, %object.team];
%BuildingsGroup = nameToID("Buildings"@%object.team@"/"@%object.Type @ %index);
if ($CCTypeToName[%object.Type, %object.team] !$= %object.Type)
{
setTargetName(%object.target,addTaggedString($CCTypeToName[%object.Type, %object.team]));
}
if (%BuildingsGroup <= 0)
{
%BuildingsGroup = new SimGroup(%object.Type @ %index);
%TeamGroup.add(%BuildingsGroup);
}
%BuildingsGroup.Index = %index;
%BuildingsGroup.add(%object);
}
//------------------------------------------------------------------------------
function ShapeBase::SightObject(%player, %range)
{
if (%range $= "")
%range = 100;
%pos = %player.getEyePoint();
%vec = %player.getEyeVector();
%targetpos = vectoradd(%pos, vectorscale(%vec, %range));
%ray = containerraycast(%pos, %targetpos, $typemasks::StaticShapeObjectType, %player);
return getword(%ray, 0);
}
//------------------------------------------------------------------------------
function ShapeBase::SightPos(%player, %range)
{
if (%range $= "")
%range = 100;
%pos = %player.getEyePoint();
%vec = %player.getEyeVector();
%targetpos = vectoradd(%pos, vectorscale(%vec, %range));
%ray = containerraycast(%pos, %targetpos, $typemasks::StaticShapeObjectType | $typemasks::TerrainObjectType, %player);
return getwords(%ray, 1,3);
}
//------------------------------------------------------------------------------
function ShapeBase::getEyePoint(%player)
{
%eyePt = getWords(%player.getEyeTransform(), 0, 2);
return %eyePt;
}
//------------------------------------------------------------------------------
function SimObject::setPosition(%obj, %pos)
{
%rot = getWords(%obj.getTransform(), 3, 6);
%trans = %pos@" "@%rot;
%obj.setTransform(%trans);
}
//------------------------------------------------------------------------------
// A lil sumthin by Alviss
// For C&C
//------------------------------------------------------------------------------
// Execution
//------------------------------------------------------------------------------
// This clears the building index's in one swoop
function BuildingManagerInit()
{
if (isObject(BuildingManager))
BuildingManager.Delete();
new ScriptObject(BuildingManager) {};
}
//------------------------------------------------------------------------------
exec("scripts/Importer/BuildingDatablocks.cs");
exec("scripts/Importer/BuildingGroups.cs");
exec("scripts/Importer/Buildings/ConstructionYard.cs");
exec("scripts/Importer/Converter.cs");
// adding the buildings
//------------------------------------------------------------------------------
// Functions
//------------------------------------------------------------------------------
function exebuild()
{
exec("scripts/functionality/Building.cs");
}
function LoadCCBuilding(%client, %building, %center)
{
%team = %client.team;
// This is used to keep duplicate buildings from joining the same group
// So, like, we don't have 3 group's named PowerPlant.
// EDIT: I realize it wouldn't matter now, but i'm too lazy to remove all my work
BuildingManager.BuildingInc[%building, %team]++;
switch$(%building)
{
case "ConYard":
Build_ConstructionYard(%client, %center, %team);
case "PowerPlant":
Build_PowerPlant(%client, %center, %team);
}
// set a timer to unify the building
NametoId("MissionCleanup/Buildings"@%team@"/"@%building @ BuildingManager.BuildingInc[%building, %team]).Schedule(2000, "UnifyBuildings");
// it uses a timer because none of the objects have the required parameters set yet, plus it's a good idea
// to wait until all the pieces are loaded.
}
//------------------------------------------------------------------------------
// CCMod Package
//------------------------------------------------------------------------------
package CCMod
{
//------------------------------------------
// echos and logs the exec call
function exec(%target)
{
// LogEvent(%target);
//error("Count : " @ DatablockGroup.getCount());
parent::exec(%target);
}
//------------------------------------------
// So you don't get a lame red spam wall in the console.
function setTargetSensorGroup(%target, %team)
{
if (%target <= 0)
return;
parent::setTargetSensorGroup(%target, %team);
}
//------------------------------------------
// So you don't get a lame red spam wall in the console.
function setTargetName(%target, %name)
{
if (%target <= 0)
return;
parent::setTargetName(%target, %name);
}
//------------------------------------------
// to capture the MCV when it deploys
function StaticShapeData::OnAdd(%data, %obj)
{
// it's a building piece.
if (StrStr(%data.GetName(), "BuildingBlock") != -1)
{
if (%obj.TheFloor && %obj.type $= "ConYard")
{
$CCGame::MCV[%obj.team] = %obj;
}
}
Parent::OnAdd(%data, %obj);
}
//------------------------------------------
// door functions
function StaticShapeData::OnCollision(%data, %obj)
{
// DoorCode
if (%obj.IsDoor)
{
%obj.ClosePosition = %obj.GetPosition();
%obj.SetPosition("0 0 -100");
schedule(2000, 0, "eval", %obj@".SetPosition("@%obj@".ClosePosition);");
}
}
//------------------------------------------
// captures incoming damage
function StaticShapeData::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType)
{
// it's a building piece.
if (StrStr(%data.GetName(), "BuildingBlock") != -1)
GrabBaseDamageCall(%data, %targetObject, %sourceObject, %position, %amount, %damageType);
else
parent::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType);
}
//------------------------------------------
// captures incoming destroyed call
function StaticShapeData::onDestroyed(%this,%obj,%prevState)
{
$BuildingCount[%obj.type, %obj.team]--;
$Power[%obj.team] -= $Power[%obj.team];
CheckPowerGoodLevel(%obj.team);
// $TeamDeployedCount[%obj.team, AdvGuardTurretBasePack]--;
}
};
if (!isActivePackage(CCMod))
ActivatePackage(CCMod);
//------------------------------------------------------------------------------
// Support Functions
//------------------------------------------------------------------------------
function addToBuildingGroup(%object)
{
%TeamGroup = nameToID("Buildings"@%object.team);
if (%TeamGroup <= 0)
{
%TeamGroup = new SimGroup("Buildings"@%object.team);
MissionCleanup.add(%TeamGroup);
}
%index = BuildingManager.BuildingInc[%object.Type, %object.team];
%BuildingsGroup = nameToID("Buildings"@%object.team@"/"@%object.Type @ %index);
if ($CCTypeToName[%object.Type, %object.team] !$= %object.Type)
{
setTargetName(%object.target,addTaggedString($CCTypeToName[%object.Type, %object.team]));
}
if (%BuildingsGroup <= 0)
{
%BuildingsGroup = new SimGroup(%object.Type @ %index);
%TeamGroup.add(%BuildingsGroup);
}
%BuildingsGroup.Index = %index;
%BuildingsGroup.add(%object);
}
//------------------------------------------------------------------------------
function ShapeBase::SightObject(%player, %range)
{
if (%range $= "")
%range = 100;
%pos = %player.getEyePoint();
%vec = %player.getEyeVector();
%targetpos = vectoradd(%pos, vectorscale(%vec, %range));
%ray = containerraycast(%pos, %targetpos, $typemasks::StaticShapeObjectType, %player);
return getword(%ray, 0);
}
//------------------------------------------------------------------------------
function ShapeBase::SightPos(%player, %range)
{
if (%range $= "")
%range = 100;
%pos = %player.getEyePoint();
%vec = %player.getEyeVector();
%targetpos = vectoradd(%pos, vectorscale(%vec, %range));
%ray = containerraycast(%pos, %targetpos, $typemasks::StaticShapeObjectType | $typemasks::TerrainObjectType, %player);
return getwords(%ray, 1,3);
}
//------------------------------------------------------------------------------
function ShapeBase::getEyePoint(%player)
{
%eyePt = getWords(%player.getEyeTransform(), 0, 2);
return %eyePt;
}
//------------------------------------------------------------------------------
function SimObject::setPosition(%obj, %pos)
{
%rot = getWords(%obj.getTransform(), 3, 6);
%trans = %pos@" "@%rot;
%obj.setTransform(%trans);
}

View file

@ -1,133 +1,133 @@
//------------------------------------------------------------------------------
// A lil sumthin by Alviss
// Datablock script with all the building datablocks.
//------------------------------------------------------------------------------
// Datablock
//------------------------------------------------------------------------------
datablock StaticShapeData(BuildingBlock0) : StaticShapeDamageProfile
{
className = "BuildingPiece";
shapeFile = "Pmiscf.dts";
maxDamage = 20;
destroyedLevel = 20;
disabledLevel = 19;
isShielded = true;
energyPerDamagePoint = 240;
maxEnergy = 50;
rechargeRate = 0.25;
explosion = HandGrenadeExplosion;
expDmgRadius = 3.0;
expDamage = 0.1;
expImpulse = 200.0;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Building Piece';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
needsPower = false;
};
datablock StaticShapeData(BuildingBlock1) : BuildingBlock0
{
shapeFile = "smiscf.dts";
};
datablock StaticShapeData(BuildingBlock2) : BuildingBlock0
{
shapeFile = "stackable2l.dts";
};
datablock StaticShapeData(BuildingBlock3) : BuildingBlock0
{
shapeFile = "stackable2m.dts";
};
datablock StaticShapeData(BuildingBlock4) : BuildingBlock0
{
shapeFile = "stackable3l.dts";
};
datablock StaticShapeData(BuildingBlock5) : BuildingBlock0
{
shapeFile = "stackable4m.dts";
};
datablock StaticShapeData(BuildingBlock6) : BuildingBlock0
{
shapeFile = "Xmiscf.dts";
};
//--------------------
// Hack to turn item names into the Type names
// We won't need them once all the buildings are converted.
//
// Words like, Deployable, BasePack, Turret
// are all removed from the item name, and then referenced the this table.
//$CCItemToType[PowerPlant] = "PowerPlant";
//$CCItemToType[Barracks] = "Barracks";
//$CCItemToType[TiberiumRefinery] = "Tiberium";
//$CCItemToType[CommCenter] = "CommCenter";
//$CCItemToType[GTower] = "GuardTower";
//$CCItemToType[WeaponsFactory] = "WarFact";
//$CCItemToType[GunTurret] = "Gun"; // < lol
//$CCItemToType[NPA] = "LaserBatt";
//$CCItemToType[AdvPowerPlant] = "AdvPowerPlant";
//$CCItemToType[EnrichGenerator] = "Enrich";
//$CCItemToType[AdvGuard] = "AdvGuard";
//$CCItemToType[AABat] = "AABat";
//$CCItemToType[IonControl] = "IonControl";
//$CCItemToType[Obelisk] = "Obelisk";
//$CCItemToType[SAM] = "SAMSite";
//$CCItemToType[TempOfNod] = "TempleOfNod";
//$CCItemToType[PEC] = "ParticleEC";
$CCItemToType[PowerPlantDeployable] = "PowerPlant";
$CCItemToType[BarracksDeployable] = "Barracks";
$CCItemToType[TiberiumRefinery] = "Tiberium";
$CCItemToType[CommCenterDeployable] = "CommCenter";
$CCItemToType[GTowerTurretBasePack] = "GuardTower";
$CCItemToType[WeaponsFactoryDeployable] = "WarFact";
$CCItemToType[TurretBasePack] = "Gun"; // < lol
$CCItemToType[NPATurretBasePack] = "LaserBatt";
$CCItemToType[AdvPowerPlantDeployable] = "AdvPowerPlant";
$CCItemToType[EnrichGeneratorDeployable] = "Enrich";
$CCItemToType[AdvGuardTurretBasePack] = "AdvGuard";
$CCItemToType[AABatTurretBasePack] = "AABat";
$CCItemToType[IonControlDeployable] = "IonControl";
$CCItemToType[ObeliskTurretBasePack] = "Obelisk";
$CCItemToType[SAMTurretBasePack] = "SAMSite";
$CCItemToType[TempleOfNod] = "TempleOfNod";
$CCItemToType[PECTurretBasePack] = "ParticleEC";
$CCTypeToItem[PowerPlant] = "PowerPlantDeployable";
$CCTypeToItem[Barracks] = "BarracksDeployable";
$CCTypeToItem[Tiberium] = "TiberiumRefineryDeployable";
$CCTypeToItem[CommCenter] = "CommCenterDeployable";
$CCTypeToItem[GuardTower] = "GTowerTurretBasePack";
$CCTypeToItem[WarFact] = "WeaponsFactoryDeployable";
$CCTypeToItem[Gun] = "TurretBasePack"; // < lol
$CCTypeToItem[LaserBatt] = "NPATurretBasePack";
$CCTypeToItem[AdvPowerPlant] = "AdvPowerPlantDeployable";
$CCTypeToItem[Enrich] = "EnrichGeneratorDeployable";
$CCTypeToItem[AdvGuard] = "AdvGuardTurretBasePack";
$CCTypeToItem[AABat] = "AABatTurretBasePack";
$CCTypeToItem[IonControl] = "IonControlDeployable";
$CCTypeToItem[Obelisk] = "ObeliskTurretBasePack";
$CCTypeToItem[SAMSite] = "SAMTurretBasePack";
$CCTypeToItem[TempOfNod] = "TempleOfNod";
$CCTypeToItem[ParticleEC] = "PECTurretBasePack";
//------------------------------------------------------------------------------
// A lil sumthin by Alviss
// Datablock script with all the building datablocks.
//------------------------------------------------------------------------------
// Datablock
//------------------------------------------------------------------------------
datablock StaticShapeData(BuildingBlock0) : StaticShapeDamageProfile
{
className = "BuildingPiece";
shapeFile = "Pmiscf.dts";
maxDamage = 20;
destroyedLevel = 20;
disabledLevel = 19;
isShielded = true;
energyPerDamagePoint = 240;
maxEnergy = 50;
rechargeRate = 0.25;
explosion = HandGrenadeExplosion;
expDmgRadius = 3.0;
expDamage = 0.1;
expImpulse = 200.0;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Building Piece';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
needsPower = false;
};
datablock StaticShapeData(BuildingBlock1) : BuildingBlock0
{
shapeFile = "smiscf.dts";
};
datablock StaticShapeData(BuildingBlock2) : BuildingBlock0
{
shapeFile = "stackable2l.dts";
};
datablock StaticShapeData(BuildingBlock3) : BuildingBlock0
{
shapeFile = "stackable2m.dts";
};
datablock StaticShapeData(BuildingBlock4) : BuildingBlock0
{
shapeFile = "stackable3l.dts";
};
datablock StaticShapeData(BuildingBlock5) : BuildingBlock0
{
shapeFile = "stackable4m.dts";
};
datablock StaticShapeData(BuildingBlock6) : BuildingBlock0
{
shapeFile = "Xmiscf.dts";
};
//--------------------
// Hack to turn item names into the Type names
// We won't need them once all the buildings are converted.
//
// Words like, Deployable, BasePack, Turret
// are all removed from the item name, and then referenced the this table.
//$CCItemToType[PowerPlant] = "PowerPlant";
//$CCItemToType[Barracks] = "Barracks";
//$CCItemToType[TiberiumRefinery] = "Tiberium";
//$CCItemToType[CommCenter] = "CommCenter";
//$CCItemToType[GTower] = "GuardTower";
//$CCItemToType[WeaponsFactory] = "WarFact";
//$CCItemToType[GunTurret] = "Gun"; // < lol
//$CCItemToType[NPA] = "LaserBatt";
//$CCItemToType[AdvPowerPlant] = "AdvPowerPlant";
//$CCItemToType[EnrichGenerator] = "Enrich";
//$CCItemToType[AdvGuard] = "AdvGuard";
//$CCItemToType[AABat] = "AABat";
//$CCItemToType[IonControl] = "IonControl";
//$CCItemToType[Obelisk] = "Obelisk";
//$CCItemToType[SAM] = "SAMSite";
//$CCItemToType[TempOfNod] = "TempleOfNod";
//$CCItemToType[PEC] = "ParticleEC";
$CCItemToType[PowerPlantDeployable] = "PowerPlant";
$CCItemToType[BarracksDeployable] = "Barracks";
$CCItemToType[TiberiumRefinery] = "Tiberium";
$CCItemToType[CommCenterDeployable] = "CommCenter";
$CCItemToType[GTowerTurretBasePack] = "GuardTower";
$CCItemToType[WeaponsFactoryDeployable] = "WarFact";
$CCItemToType[TurretBasePack] = "Gun"; // < lol
$CCItemToType[NPATurretBasePack] = "LaserBatt";
$CCItemToType[AdvPowerPlantDeployable] = "AdvPowerPlant";
$CCItemToType[EnrichGeneratorDeployable] = "Enrich";
$CCItemToType[AdvGuardTurretBasePack] = "AdvGuard";
$CCItemToType[AABatTurretBasePack] = "AABat";
$CCItemToType[IonControlDeployable] = "IonControl";
$CCItemToType[ObeliskTurretBasePack] = "Obelisk";
$CCItemToType[SAMTurretBasePack] = "SAMSite";
$CCItemToType[TempleOfNod] = "TempleOfNod";
$CCItemToType[PECTurretBasePack] = "ParticleEC";
$CCTypeToItem[PowerPlant] = "PowerPlantDeployable";
$CCTypeToItem[Barracks] = "BarracksDeployable";
$CCTypeToItem[Tiberium] = "TiberiumRefineryDeployable";
$CCTypeToItem[CommCenter] = "CommCenterDeployable";
$CCTypeToItem[GuardTower] = "GTowerTurretBasePack";
$CCTypeToItem[WarFact] = "WeaponsFactoryDeployable";
$CCTypeToItem[Gun] = "TurretBasePack"; // < lol
$CCTypeToItem[LaserBatt] = "NPATurretBasePack";
$CCTypeToItem[AdvPowerPlant] = "AdvPowerPlantDeployable";
$CCTypeToItem[Enrich] = "EnrichGeneratorDeployable";
$CCTypeToItem[AdvGuard] = "AdvGuardTurretBasePack";
$CCTypeToItem[AABat] = "AABatTurretBasePack";
$CCTypeToItem[IonControl] = "IonControlDeployable";
$CCTypeToItem[Obelisk] = "ObeliskTurretBasePack";
$CCTypeToItem[SAMSite] = "SAMTurretBasePack";
$CCTypeToItem[TempOfNod] = "TempleOfNod";
$CCTypeToItem[ParticleEC] = "PECTurretBasePack";

View file

@ -1,153 +1,153 @@
//------------------------------------------------------------------------------
// A lil sumthin by Alviss
// For C&C
//------------------------------------------------------------------------------
$CCBuildingHealth["ConYard"] = 750;
$CCBuildingHealth["PowerPlant"] = 250;
$CCBuildingHealth["AdvPowerPlant"] = 500;
$CCBuildingHealth["Barracks"] = 300;
//------------------------------------------------------------------------------
// SimGroup Functions
//------------------------------------------------------------------------------
function SimGroup::UnifyBuildings(%group)
{
// get the max health, have to remove the Index suffix
%group.MaxHp = $CCBuildingHealth[ StrReplace(%group.getName(), %group.Index, "") ];
// give all the pieces the nameplate of the building
for (%i = 0; %i < %group.GetCount(); %i++)
{
%obj = %group.GetObject(%i);
if (%obj.GetTarget() == -1)
{
// best function i've ever learned. :)
%target = CreateTarget(%obj, "", "", "", "", %obj.team, "");
%obj.SetTarget(%target);
}
%name = $CCTypeToName[%obj.Type, %obj.Team];
setTargetName(%obj.getTarget(), AddTaggedString(%name));
}
// let all the pieces know the change.
%group.SetHealth(%group.MaxHp);
}
//------------------------------------------------------------------------------
function SimGroup::SetHealth(%group, %Hp)
{
%group.Hp = %hp;
if (%hp <= 0)
{
%group.DestroyBuilding();
return;
}
%percent = %hp / %group.MaxHp;
echo(%percent);
for (%i = 0; %i < %group.GetCount(); %i++)
{
%obj = %group.GetObject(%i);
%max = %obj.getDatablock().maxDamage;
%obj.SetDamageLevel( %max - (%percent * %max) );
}
}
//------------------------------------------------------------------------------
function SimGroup::DestroyBuilding(%group)
{
%type = StrReplace(%group.getName(), %group.Index, "");
for (%i = 0; %i < %group.GetCount(); %i++)
{
%obj = %group.GetObject(%i);
%team = %obj.team;
// set the health to zero, so it explodes
%obj.SetDamageLevel( 0 );
schedule(1000, 0, Killit, %obj);
}
$BuildingCount[%type, %team]--;
if (%type $= "ConYard")
{
Game.gameOver();
CycleMissions();
}
if (%type $= "PowerPlant")
{
$TeamDeployedCount[%team, $CCTypeToItem[%type]]--;
$Power[%team] -= 250;
CheckPowerLowLevel(%team);
}
if (%type $= "AdvPowerPlant")
{
$TeamDeployedCount[%team, $CCTypeToItem[%type]]--;
$Power[%team] -= 500;
CheckPowerLowLevel(%team);
}
}
//------------------------------------------------------------------------------
// SimObject Functions
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// This function intercepts incoming damage calls and subtracts the dmg from the building MaxHp
function GrabBaseDamageCall(%data, %targetObject, %sourceObject, %position, %amount, %damageType)
{
if (!$TeamDamage)
{
if (isObject(%sourceObject))
{
//see if the object is being shot by a friendly
if(%sourceObject.getDataBlock().catagory $= "Vehicles")
%attackerTeam = getVehicleAttackerTeam(%sourceObject);
else
%attackerTeam = %sourceObject.team;
}
if (%attackerTeam == %targetObject.team)
return;
}
%damageScale = %data.damageScale[%damageType];
if (%damageScale !$= "")
%amount *= %damageScale;
if (%targetObject.getTarget() != -1)
{
%building = %targetObject.getGroup();
if (isObject(%building))
{
%building.SetHealth(%building.HP - %amount);
}
}
}
//------------------------------------------------------------------------------
// A lil sumthin by Alviss
// For C&C
//------------------------------------------------------------------------------
$CCBuildingHealth["ConYard"] = 750;
$CCBuildingHealth["PowerPlant"] = 250;
$CCBuildingHealth["AdvPowerPlant"] = 500;
$CCBuildingHealth["Barracks"] = 300;
//------------------------------------------------------------------------------
// SimGroup Functions
//------------------------------------------------------------------------------
function SimGroup::UnifyBuildings(%group)
{
// get the max health, have to remove the Index suffix
%group.MaxHp = $CCBuildingHealth[ StrReplace(%group.getName(), %group.Index, "") ];
// give all the pieces the nameplate of the building
for (%i = 0; %i < %group.GetCount(); %i++)
{
%obj = %group.GetObject(%i);
if (%obj.GetTarget() == -1)
{
// best function i've ever learned. :)
%target = CreateTarget(%obj, "", "", "", "", %obj.team, "");
%obj.SetTarget(%target);
}
%name = $CCTypeToName[%obj.Type, %obj.Team];
setTargetName(%obj.getTarget(), AddTaggedString(%name));
}
// let all the pieces know the change.
%group.SetHealth(%group.MaxHp);
}
//------------------------------------------------------------------------------
function SimGroup::SetHealth(%group, %Hp)
{
%group.Hp = %hp;
if (%hp <= 0)
{
%group.DestroyBuilding();
return;
}
%percent = %hp / %group.MaxHp;
echo(%percent);
for (%i = 0; %i < %group.GetCount(); %i++)
{
%obj = %group.GetObject(%i);
%max = %obj.getDatablock().maxDamage;
%obj.SetDamageLevel( %max - (%percent * %max) );
}
}
//------------------------------------------------------------------------------
function SimGroup::DestroyBuilding(%group)
{
%type = StrReplace(%group.getName(), %group.Index, "");
for (%i = 0; %i < %group.GetCount(); %i++)
{
%obj = %group.GetObject(%i);
%team = %obj.team;
// set the health to zero, so it explodes
%obj.SetDamageLevel( 0 );
schedule(1000, 0, Killit, %obj);
}
$BuildingCount[%type, %team]--;
if (%type $= "ConYard")
{
Game.gameOver();
CycleMissions();
}
if (%type $= "PowerPlant")
{
$TeamDeployedCount[%team, $CCTypeToItem[%type]]--;
$Power[%team] -= 250;
CheckPowerLowLevel(%team);
}
if (%type $= "AdvPowerPlant")
{
$TeamDeployedCount[%team, $CCTypeToItem[%type]]--;
$Power[%team] -= 500;
CheckPowerLowLevel(%team);
}
}
//------------------------------------------------------------------------------
// SimObject Functions
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// This function intercepts incoming damage calls and subtracts the dmg from the building MaxHp
function GrabBaseDamageCall(%data, %targetObject, %sourceObject, %position, %amount, %damageType)
{
if (!$TeamDamage)
{
if (isObject(%sourceObject))
{
//see if the object is being shot by a friendly
if(%sourceObject.getDataBlock().catagory $= "Vehicles")
%attackerTeam = getVehicleAttackerTeam(%sourceObject);
else
%attackerTeam = %sourceObject.team;
}
if (%attackerTeam == %targetObject.team)
return;
}
%damageScale = %data.damageScale[%damageType];
if (%damageScale !$= "")
%amount *= %damageScale;
if (%targetObject.getTarget() != -1)
{
%building = %targetObject.getGroup();
if (isObject(%building))
{
%building.SetHealth(%building.HP - %amount);
}
}
}

View file

@ -1,133 +1,133 @@
//------------------------------
// Construction Mod save file to C&C Building file converter script.
// A lil sumthin by Alviss
// 24/06/09
//------------------------------
function ccConvertSave(%sender,%args)
{
// %name = "Conv_test";
//%Fullname = "Convertion_test";
%name = GetWord(%args, 0);
%fullname = GetWords(%args, 1);
%obj = %sender.player.SightObject(100);
// this is our flag to set as the bottom-most piece
%obj.TheFloor = 1;
ConvertSave(%sender, %name, %Fullname, %obj);
}
//----------------------------------------------------
// function to convert all the pieces in a server into a new save format
function ConvertSave(%client, %name, %Fullname, %floor)
{
// %floor is the bottom-msot piece
%start = %floor.getPosition();
%tHeight = getTerrainHeight(%start);
%start = GetWords(%start, 0, 1) SPC 0;
%nf = new fileobject() {};
%nf.OpenforWrite(%Fullname@".cs");
%nf.WriteLine("//------------------------------------------------------------------------------");
%nf.WriteLine("// Saved By "@%client.namebase);
%nf.WriteLine("");
%dgroup = nametoId("deployables");
%nf.WriteLine("function Build_"@%Fullname@"(%client, %center, %team)");
%nf.WriteLine("{");
%nf.WriteLine(" if (%team $= \"\")");
%nf.WriteLine(" %team = 1;");
//%nf.WriteLine("schedule(2000, 0, \"eval\", \"$Building = "\"\"";\");");
//%nf.WriteLine("%datablock = (%team == 1) ? \"BuildingBlock0\" : \"BuildingBlock6\";");
%nf.WriteLine("%offset = VectorSub(GetWords(%center, 0, 1) SPC GetWord(%center, 2), \""@%start@"\");");
%nf.WriteLine("");
for (%i = 0; %i < %dgroup.GetCount(); %i++)
{
%obj = %dGroup.getObject(%i);
%db = %obj.getDataBlock().getname();
if (%obj.team == %client.team && %db !$= "")
{
// BD mod
%newline = "%building = new (StaticShape) () {datablock = "@%db@";";
// position mod
%pos = %obj.getPosition();
%z = GetWord(%pos, 2) - %tHeight;
%pos = GetWords(%pos, 0, 1) SPC %z;
%newline = %newline @ "Position = VectorAdd(\""@%pos@"\", %offset);";
// Rotation mod (modifed by Dark Dragon DX to fix rotation issue)
// %rot = %obj.getRotation();
%rot = getWords(%obj.getTransform(), 3, 6);
// %newline = %newline @ "Rotation = \""@%rot@"\";";
// Scale mod
%Scale = %obj.Scale;
%newline = %newline @ "Scale = \""@%Scale@"\";";
// Floor mod
if (%obj.TheFloor)
{
%newline = %newline @ "TheFloor = \"true\";";
%obj.TheFloor = "";
}
// type mod
%newline = %newline @ "Type = \""@%name@"\";";
// Team mod
%newline = %newline @ "team = %team;};";
// Unification
%newline = %newline @ "addToDeployGroup(%obj);";
// write
%nf.WriteLine(%newline);
%nf.WriteLine("%building.setRotation(\x22"@%rot@"\x22);");
}
}
%nf.WriteLine("}");
%nf.Close();
%nf.Delete();
}
$CC_ConvTable["DeployedSpine"] = "%datablock"; // white/black pads are team based
$CC_ConvTable["DeployedSpine2"] = "%datablock"; // white/black pads are team based
$CC_ConvTable["DeployedSpine5"] = "\"BuildingBlock1\""; // brown pad
$CC_ConvTable["DeployedCrate8"] = "\"BuildingBlock5\""; // Recycle Unit
$CC_ConvTable["DeployedCrate4"] = "\"BuildingBlock2\""; // Quantum Battery
$CC_ConvTable["DeployedCrate3"] = "\"BuildingBlock3\""; // 4 tubes
$CC_ConvTable["DeployedCrate7"] = "\"BuildingBlock4\""; // Mag Cooler
$CC_ConvTable["DeployedCrate9"] = "\"BuildingBlock5\""; // Cylinder
//------------------------------
// Construction Mod save file to C&C Building file converter script.
// A lil sumthin by Alviss
// 24/06/09
//------------------------------
function ccConvertSave(%sender,%args)
{
// %name = "Conv_test";
//%Fullname = "Convertion_test";
%name = GetWord(%args, 0);
%fullname = GetWords(%args, 1);
%obj = %sender.player.SightObject(100);
// this is our flag to set as the bottom-most piece
%obj.TheFloor = 1;
ConvertSave(%sender, %name, %Fullname, %obj);
}
//----------------------------------------------------
// function to convert all the pieces in a server into a new save format
function ConvertSave(%client, %name, %Fullname, %floor)
{
// %floor is the bottom-msot piece
%start = %floor.getPosition();
%tHeight = getTerrainHeight(%start);
%start = GetWords(%start, 0, 1) SPC 0;
%nf = new fileobject() {};
%nf.OpenforWrite(%Fullname@".cs");
%nf.WriteLine("//------------------------------------------------------------------------------");
%nf.WriteLine("// Saved By "@%client.namebase);
%nf.WriteLine("");
%dgroup = nametoId("deployables");
%nf.WriteLine("function Build_"@%Fullname@"(%client, %center, %team)");
%nf.WriteLine("{");
%nf.WriteLine(" if (%team $= \"\")");
%nf.WriteLine(" %team = 1;");
//%nf.WriteLine("schedule(2000, 0, \"eval\", \"$Building = "\"\"";\");");
//%nf.WriteLine("%datablock = (%team == 1) ? \"BuildingBlock0\" : \"BuildingBlock6\";");
%nf.WriteLine("%offset = VectorSub(GetWords(%center, 0, 1) SPC GetWord(%center, 2), \""@%start@"\");");
%nf.WriteLine("");
for (%i = 0; %i < %dgroup.GetCount(); %i++)
{
%obj = %dGroup.getObject(%i);
%db = %obj.getDataBlock().getname();
if (%obj.team == %client.team && %db !$= "")
{
// BD mod
%newline = "%building = new (StaticShape) () {datablock = "@%db@";";
// position mod
%pos = %obj.getPosition();
%z = GetWord(%pos, 2) - %tHeight;
%pos = GetWords(%pos, 0, 1) SPC %z;
%newline = %newline @ "Position = VectorAdd(\""@%pos@"\", %offset);";
// Rotation mod (modifed by Dark Dragon DX to fix rotation issue)
// %rot = %obj.getRotation();
%rot = getWords(%obj.getTransform(), 3, 6);
// %newline = %newline @ "Rotation = \""@%rot@"\";";
// Scale mod
%Scale = %obj.Scale;
%newline = %newline @ "Scale = \""@%Scale@"\";";
// Floor mod
if (%obj.TheFloor)
{
%newline = %newline @ "TheFloor = \"true\";";
%obj.TheFloor = "";
}
// type mod
%newline = %newline @ "Type = \""@%name@"\";";
// Team mod
%newline = %newline @ "team = %team;};";
// Unification
%newline = %newline @ "addToDeployGroup(%obj);";
// write
%nf.WriteLine(%newline);
%nf.WriteLine("%building.setRotation(\x22"@%rot@"\x22);");
}
}
%nf.WriteLine("}");
%nf.Close();
%nf.Delete();
}
$CC_ConvTable["DeployedSpine"] = "%datablock"; // white/black pads are team based
$CC_ConvTable["DeployedSpine2"] = "%datablock"; // white/black pads are team based
$CC_ConvTable["DeployedSpine5"] = "\"BuildingBlock1\""; // brown pad
$CC_ConvTable["DeployedCrate8"] = "\"BuildingBlock5\""; // Recycle Unit
$CC_ConvTable["DeployedCrate4"] = "\"BuildingBlock2\""; // Quantum Battery
$CC_ConvTable["DeployedCrate3"] = "\"BuildingBlock3\""; // 4 tubes
$CC_ConvTable["DeployedCrate7"] = "\"BuildingBlock4\""; // Mag Cooler
$CC_ConvTable["DeployedCrate9"] = "\"BuildingBlock5\""; // Cylinder

View file

@ -1,387 +1,387 @@
//--------------------------------------------------------
function QueryServers( %searchCriteria )
{
GMJ_Browser.lastQuery = %searchCriteria;
LaunchGame( "JOIN" );
}
//--------------------------------------------------------
function QueryOnlineServers()
{
QueryServers("Master");
}
//--------------------------------------------------------
// Launch gui functions
//--------------------------------------------------------
function PlayOffline()
{
$FirstLaunch = true;
setNetPort(0);
$PlayingOnline = false;
Canvas.setContent(LaunchGui);
}
//--------------------------------------------------------
function OnlineLogIn()
{
$FirstLaunch = true;
setNetPort(0);
$PlayingOnline = true;
FilterEditGameType.clear();
FilterEditMissionType.clear();
queryMasterGameTypes();
// Start the Email checking...
EmailGui.checkSchedule = schedule( 5000, 0, CheckEmail, true );
// Load the player database...
%guid = getField( WONGetAuthInfo(), 3 );
if ( %guid > 0 )
loadPlayerDatabase( "prefs/pyrdb" @ %guid );
Canvas.setContent(LaunchGui);
}
//--------------------------------------------------------
function LaunchToolbarMenu::onSelect(%this, %id, %text)
{
switch(%id)
{
case 0:
LaunchGame();
case 1: // Start Training Mission
LaunchTraining();
case 2:
LaunchNews();
case 3:
LaunchForums();
case 4:
LaunchEmail();
case 5: // Join Chat Room
Canvas.pushDialog(JoinChatDlg);
case 6:
LaunchBrowser();
case 7: // Options
Canvas.pushDialog(OptionsDlg);
case 8: // Play Recording
Canvas.pushDialog(RecordingsDlg);
case 9: // Quit
if(isObject($IRCClient.tcp))
IRCClient::quit();
LaunchTabView.closeAllTabs();
if (!isDemo())
quit();
else
Canvas.setContent(DemoEndGui);
//case 10: // Log Off
// LaunchTabView.closeAllTabs();
// PlayOffline();
//case 11: // Log On
// LaunchTabView.closeAllTabs();
// OnlineLogIn();
case 12:
LaunchCredits();
case 13:
Canvas.setContent(RPGBrowserGui);
}
}
//--------------------------------------------------------
function LaunchToolbarDlg::onWake(%this)
{
// Play the shell hum:
if ( $HudHandle[shellScreen] $= "" )
$HudHandle[shellScreen] = alxPlay( ShellScreenHumSound, 0, 0, 0 );
LaunchToolbarMenu.clear();
if ( isDemo() )
{
LaunchToolbarMenu.add( 1, "CAMPAIGN" );
LaunchToolbarMenu.add( 0, "GAME" );
LaunchToolbarMenu.add( 2, "NEWS" );
LaunchToolbarMenu.add( 13, "MOD BROWSER" );
}
else if ( $PlayingOnline )
{
LaunchToolbarMenu.add( 0, "GAME" );
LaunchToolbarMenu.add( 4, "EMAIL" );
LaunchToolbarMenu.add( 5, "CHAT" );
LaunchToolbarMenu.add( 6, "BROWSER" );
LaunchToolbarMenu.add( 13, "MOD BROWSER" );
}
else
{
LaunchToolbarMenu.add( 1, "CAMPAIGN" );
LaunchToolbarMenu.add( 0, "LAN GAME" );
LaunchToolbarMenu.add( 13, "MOD BROWSER" );
}
LaunchToolbarMenu.addSeparator();
LaunchToolbarMenu.add( 7, "SETTINGS" );
if ( !isDemo() )
LaunchToolbarMenu.add( 8, "RECORDINGS" );
LaunchToolbarMenu.add( 12, "CREDITS" );
LaunchToolbarMenu.addSeparator();
LaunchToolbarMenu.add( 9, "QUIT" );
%on = false;
for ( %tab = 0; %tab < LaunchTabView.tabCount(); %tab++ )
{
if ( LaunchTabView.isTabActive( %tab ) )
{
%on = true;
break;
}
}
LaunchToolbarCloseButton.setVisible( %on );
}
//----------------------------------------------------------------------------
// Launch Tab Group functions:
//----------------------------------------------------------------------------
function OpenLaunchTabs( %gotoWarriorSetup )
{
if ( LaunchTabView.tabCount() > 0 || !$FirstLaunch )
return;
$FirstLaunch = "";
// Set up all of the launch bar tabs:
if ( isDemo() )
{
LaunchTabView.addLaunchTab( "CAMPAIGN", TrainingGui );
LaunchTabView.addLaunchTab( "GAME", GameGui );
LaunchTabView.addLaunchTab( "NEWS", NewsGui );
LaunchTabView.addLaunchTab( "FORUMS", "", true );
LaunchTabView.addLaunchTab( "EMAIL", "", true );
LaunchTabView.addLaunchTab( "CHAT", "", true );
LaunchTabView.addLaunchTab( "BROWSER", "", true );
%launchGui = NewsGui;
}
else if ( $PlayingOnline )
{
LaunchTabView.addLaunchTab( "GAME", GameGui );
LaunchTabView.addLaunchTab( "EMAIL", EmailGui );
LaunchTabView.addLaunchTab( "CHAT", ChatGui );
LaunchTabView.addLaunchTab( "BROWSER", TribeandWarriorBrowserGui);
switch$ ( $pref::Shell::LaunchGui )
{
case "News": %launchGui = NewsGui;
case "Forums": %launchGui = ForumsGui;
case "Email": %launchGui = EmailGui;
case "Chat": %launchGui = ChatGui;
case "Browser": %launchGui = TribeandWarriorBrowserGui;
case "Mod Browser": %launchGui = RPGBrowserGui;
default: %launchGui = GameGui;
}
}
else
{
LaunchTabView.addLaunchTab( "CAMPAIGN", TrainingGui );
LaunchTabView.addLaunchTab( "LAN GAME", GameGui );
%launchGui = TrainingGui;
}
if ( %gotoWarriorSetup )
LaunchGame( "WARRIOR" );
else
LaunchTabView.viewTab( "", %launchGui, 0 );
if ( $IssueVoodooWarning && !$pref::SawVoodooWarning )
{
$pref::SawVoodooWarning = 1;
schedule( 0, 0, MessageBoxOK, "WARNING", "A Voodoo card has been detected. If you experience any graphical oddities, you should try the WickedGl drivers available at www.wicked3d.com" );
}
}
//--------------------------------------------------------
function LaunchTabView::addLaunchTab( %this, %text, %gui, %makeInactive )
{
%tabCount = %this.tabCount();
%this.gui[%tabCount] = %gui;
%this.key[%tabCount] = 0;
%this.addTab( %tabCount, %text );
if ( %makeInactive )
%this.setTabActive( %tabCount, false );
}
//--------------------------------------------------------
function LaunchTabView::onSelect( %this, %id, %text )
{
// Ignore the ID - it can't be trusted.
%tab = %this.getSelectedTab();
if ( isObject( %this.gui[%tab] ) )
{
Canvas.setContent( %this.gui[%tab] );
%this.gui[%tab].setKey( %this.key[%tab] );
%this.lastTab = %tab;
}
}
//--------------------------------------------------------
function LaunchTabView::viewLastTab( %this )
{
if ( %this.tabCount() == 0 || %this.lastTab $= "" )
return;
%this.setSelectedByIndex( %this.lastTab );
}
//--------------------------------------------------------
function LaunchTabView::viewTab( %this, %text, %gui, %key )
{
%tabCount = %this.tabCount();
for ( %tab = 0; %tab < %tabCount; %tab++ )
if ( %this.gui[%tab] $= %gui && %this.key[%tab] $= %key )
break;
if ( %tab == %tabCount )
{
// Add a new tab:
%this.gui[%tab] = %gui;
%this.key[%tab] = %key;
// WARNING! This id may not be unique and therefore should
// not be relied on! Use index instead!
%this.addTab( %tab, %text );
}
if ( %this.getSelectedTab() != %tab )
%this.setSelectedByIndex( %tab );
}
//--------------------------------------------------------
function LaunchTabView::closeCurrentTab( %this )
{
%tab = %this.getSelectedTab();
%this.closeTab( %this.gui[%tab], %this.key[%tab] );
}
//--------------------------------------------------------
function LaunchTabView::closeTab( %this, %gui, %key )
{
%tabCount = %this.tabCount();
%activeCount = 0;
for ( %i = 0; %i < %tabCount; %i++ )
{
if ( %this.gui[%i] $= %gui && %this.key[%i] $= %key )
%tab = %i;
else if ( %this.isTabActive( %i ) )
%activeCount++;
}
if ( %tab == %tabCount )
return;
for( %i = %tab; %i < %tabCount; %i++ )
{
%this.gui[%i] = %this.gui[%i+1];
%this.key[%i] = %this.key[%i+1];
}
%this.removeTabByIndex( %tab );
%gui.onClose( %key );
if ( %activeCount == 0 )
{
%this.lastTab = "";
Canvas.setContent( LaunchGui );
}
}
//--------------------------------------------------------
function LaunchTabView::closeAllTabs( %this )
{
%tabCount = %this.tabCount();
for ( %i = 0; %i < %tabCount; %i++ )
{
if ( isObject( %this.gui[%i] ) )
%this.gui[%i].onClose( %this.key[%i] );
%this.gui[%i] = "";
%this.key[%i] = "";
}
%this.clear();
}
//----------------------------------------------------------------------------
// LaunchGui functions:
//----------------------------------------------------------------------------
function LaunchGui::onAdd(%this)
{
%this.getWarrior = true;
}
//----------------------------------------------------------------------------
function LaunchGui::onWake(%this)
{
$enableDirectInput = "0";
deactivateDirectInput();
Canvas.pushDialog(LaunchToolbarDlg);
if ( !$FirstLaunch )
LaunchTabView.viewLastTab();
if ( !isDemo() )
checkNamesAndAliases();
else
OpenLaunchTabs();
}
//----------------------------------------------------------------------------
function LaunchGui::onSleep(%this)
{
//alxStop($HudHandle['shellScreen']);
Canvas.popDialog( LaunchToolbarDlg );
}
//----------------------------------------------------------------------------
function checkNamesAndAliases()
{
%gotoWarriorSetup = false;
if ( $PlayingOnline )
{
// When first launching, make sure we have a valid warrior:
if ( LaunchGui.getWarrior )
{
%cert = WONGetAuthInfo();
if ( %cert !$= "" )
{
LaunchGui.getWarrior = "";
if ( %cert $= "" )
%warrior = $CreateAccountWarriorName;
else
%warrior = getField( %cert, 0 );
%warriorIdx = -1;
for ( %i = 0; %i < $pref::Player::count; %i++ )
{
if ( %warrior $= getField( $pref::Player[%i], 0 ) )
{
%warriorIdx = %i;
break;
}
}
if ( %warriorIdx == -1 )
{
// Create new warrior:
$pref::Player[$pref::Player::Count] = %warrior @ "\tHuman Male\tbeagle\tMale1";
$pref::Player::Current = $pref::Player::Count;
$pref::Player::Count++;
%gotoWarriorSetup = true;
}
}
else
MessageBoxOK( "WARNING", "Failed to get account information. You may need to quit the game and log in again." );
}
}
else if ( $pref::Player::Count == 0 )
{
%gotoWarriorSetup = true;
}
OpenLaunchTabs( %gotoWarriorSetup );
}
//--------------------------------------------------------
function QueryServers( %searchCriteria )
{
GMJ_Browser.lastQuery = %searchCriteria;
LaunchGame( "JOIN" );
}
//--------------------------------------------------------
function QueryOnlineServers()
{
QueryServers("Master");
}
//--------------------------------------------------------
// Launch gui functions
//--------------------------------------------------------
function PlayOffline()
{
$FirstLaunch = true;
setNetPort(0);
$PlayingOnline = false;
Canvas.setContent(LaunchGui);
}
//--------------------------------------------------------
function OnlineLogIn()
{
$FirstLaunch = true;
setNetPort(0);
$PlayingOnline = true;
FilterEditGameType.clear();
FilterEditMissionType.clear();
queryMasterGameTypes();
// Start the Email checking...
EmailGui.checkSchedule = schedule( 5000, 0, CheckEmail, true );
// Load the player database...
%guid = getField( WONGetAuthInfo(), 3 );
if ( %guid > 0 )
loadPlayerDatabase( "prefs/pyrdb" @ %guid );
Canvas.setContent(LaunchGui);
}
//--------------------------------------------------------
function LaunchToolbarMenu::onSelect(%this, %id, %text)
{
switch(%id)
{
case 0:
LaunchGame();
case 1: // Start Training Mission
LaunchTraining();
case 2:
LaunchNews();
case 3:
LaunchForums();
case 4:
LaunchEmail();
case 5: // Join Chat Room
Canvas.pushDialog(JoinChatDlg);
case 6:
LaunchBrowser();
case 7: // Options
Canvas.pushDialog(OptionsDlg);
case 8: // Play Recording
Canvas.pushDialog(RecordingsDlg);
case 9: // Quit
if(isObject($IRCClient.tcp))
IRCClient::quit();
LaunchTabView.closeAllTabs();
if (!isDemo())
quit();
else
Canvas.setContent(DemoEndGui);
//case 10: // Log Off
// LaunchTabView.closeAllTabs();
// PlayOffline();
//case 11: // Log On
// LaunchTabView.closeAllTabs();
// OnlineLogIn();
case 12:
LaunchCredits();
case 13:
Canvas.setContent(RPGBrowserGui);
}
}
//--------------------------------------------------------
function LaunchToolbarDlg::onWake(%this)
{
// Play the shell hum:
if ( $HudHandle[shellScreen] $= "" )
$HudHandle[shellScreen] = alxPlay( ShellScreenHumSound, 0, 0, 0 );
LaunchToolbarMenu.clear();
if ( isDemo() )
{
LaunchToolbarMenu.add( 1, "CAMPAIGN" );
LaunchToolbarMenu.add( 0, "GAME" );
LaunchToolbarMenu.add( 2, "NEWS" );
LaunchToolbarMenu.add( 13, "MOD BROWSER" );
}
else if ( $PlayingOnline )
{
LaunchToolbarMenu.add( 0, "GAME" );
LaunchToolbarMenu.add( 4, "EMAIL" );
LaunchToolbarMenu.add( 5, "CHAT" );
LaunchToolbarMenu.add( 6, "BROWSER" );
LaunchToolbarMenu.add( 13, "MOD BROWSER" );
}
else
{
LaunchToolbarMenu.add( 1, "CAMPAIGN" );
LaunchToolbarMenu.add( 0, "LAN GAME" );
LaunchToolbarMenu.add( 13, "MOD BROWSER" );
}
LaunchToolbarMenu.addSeparator();
LaunchToolbarMenu.add( 7, "SETTINGS" );
if ( !isDemo() )
LaunchToolbarMenu.add( 8, "RECORDINGS" );
LaunchToolbarMenu.add( 12, "CREDITS" );
LaunchToolbarMenu.addSeparator();
LaunchToolbarMenu.add( 9, "QUIT" );
%on = false;
for ( %tab = 0; %tab < LaunchTabView.tabCount(); %tab++ )
{
if ( LaunchTabView.isTabActive( %tab ) )
{
%on = true;
break;
}
}
LaunchToolbarCloseButton.setVisible( %on );
}
//----------------------------------------------------------------------------
// Launch Tab Group functions:
//----------------------------------------------------------------------------
function OpenLaunchTabs( %gotoWarriorSetup )
{
if ( LaunchTabView.tabCount() > 0 || !$FirstLaunch )
return;
$FirstLaunch = "";
// Set up all of the launch bar tabs:
if ( isDemo() )
{
LaunchTabView.addLaunchTab( "CAMPAIGN", TrainingGui );
LaunchTabView.addLaunchTab( "GAME", GameGui );
LaunchTabView.addLaunchTab( "NEWS", NewsGui );
LaunchTabView.addLaunchTab( "FORUMS", "", true );
LaunchTabView.addLaunchTab( "EMAIL", "", true );
LaunchTabView.addLaunchTab( "CHAT", "", true );
LaunchTabView.addLaunchTab( "BROWSER", "", true );
%launchGui = NewsGui;
}
else if ( $PlayingOnline )
{
LaunchTabView.addLaunchTab( "GAME", GameGui );
LaunchTabView.addLaunchTab( "EMAIL", EmailGui );
LaunchTabView.addLaunchTab( "CHAT", ChatGui );
LaunchTabView.addLaunchTab( "BROWSER", TribeandWarriorBrowserGui);
switch$ ( $pref::Shell::LaunchGui )
{
case "News": %launchGui = NewsGui;
case "Forums": %launchGui = ForumsGui;
case "Email": %launchGui = EmailGui;
case "Chat": %launchGui = ChatGui;
case "Browser": %launchGui = TribeandWarriorBrowserGui;
case "Mod Browser": %launchGui = RPGBrowserGui;
default: %launchGui = GameGui;
}
}
else
{
LaunchTabView.addLaunchTab( "CAMPAIGN", TrainingGui );
LaunchTabView.addLaunchTab( "LAN GAME", GameGui );
%launchGui = TrainingGui;
}
if ( %gotoWarriorSetup )
LaunchGame( "WARRIOR" );
else
LaunchTabView.viewTab( "", %launchGui, 0 );
if ( $IssueVoodooWarning && !$pref::SawVoodooWarning )
{
$pref::SawVoodooWarning = 1;
schedule( 0, 0, MessageBoxOK, "WARNING", "A Voodoo card has been detected. If you experience any graphical oddities, you should try the WickedGl drivers available at www.wicked3d.com" );
}
}
//--------------------------------------------------------
function LaunchTabView::addLaunchTab( %this, %text, %gui, %makeInactive )
{
%tabCount = %this.tabCount();
%this.gui[%tabCount] = %gui;
%this.key[%tabCount] = 0;
%this.addTab( %tabCount, %text );
if ( %makeInactive )
%this.setTabActive( %tabCount, false );
}
//--------------------------------------------------------
function LaunchTabView::onSelect( %this, %id, %text )
{
// Ignore the ID - it can't be trusted.
%tab = %this.getSelectedTab();
if ( isObject( %this.gui[%tab] ) )
{
Canvas.setContent( %this.gui[%tab] );
%this.gui[%tab].setKey( %this.key[%tab] );
%this.lastTab = %tab;
}
}
//--------------------------------------------------------
function LaunchTabView::viewLastTab( %this )
{
if ( %this.tabCount() == 0 || %this.lastTab $= "" )
return;
%this.setSelectedByIndex( %this.lastTab );
}
//--------------------------------------------------------
function LaunchTabView::viewTab( %this, %text, %gui, %key )
{
%tabCount = %this.tabCount();
for ( %tab = 0; %tab < %tabCount; %tab++ )
if ( %this.gui[%tab] $= %gui && %this.key[%tab] $= %key )
break;
if ( %tab == %tabCount )
{
// Add a new tab:
%this.gui[%tab] = %gui;
%this.key[%tab] = %key;
// WARNING! This id may not be unique and therefore should
// not be relied on! Use index instead!
%this.addTab( %tab, %text );
}
if ( %this.getSelectedTab() != %tab )
%this.setSelectedByIndex( %tab );
}
//--------------------------------------------------------
function LaunchTabView::closeCurrentTab( %this )
{
%tab = %this.getSelectedTab();
%this.closeTab( %this.gui[%tab], %this.key[%tab] );
}
//--------------------------------------------------------
function LaunchTabView::closeTab( %this, %gui, %key )
{
%tabCount = %this.tabCount();
%activeCount = 0;
for ( %i = 0; %i < %tabCount; %i++ )
{
if ( %this.gui[%i] $= %gui && %this.key[%i] $= %key )
%tab = %i;
else if ( %this.isTabActive( %i ) )
%activeCount++;
}
if ( %tab == %tabCount )
return;
for( %i = %tab; %i < %tabCount; %i++ )
{
%this.gui[%i] = %this.gui[%i+1];
%this.key[%i] = %this.key[%i+1];
}
%this.removeTabByIndex( %tab );
%gui.onClose( %key );
if ( %activeCount == 0 )
{
%this.lastTab = "";
Canvas.setContent( LaunchGui );
}
}
//--------------------------------------------------------
function LaunchTabView::closeAllTabs( %this )
{
%tabCount = %this.tabCount();
for ( %i = 0; %i < %tabCount; %i++ )
{
if ( isObject( %this.gui[%i] ) )
%this.gui[%i].onClose( %this.key[%i] );
%this.gui[%i] = "";
%this.key[%i] = "";
}
%this.clear();
}
//----------------------------------------------------------------------------
// LaunchGui functions:
//----------------------------------------------------------------------------
function LaunchGui::onAdd(%this)
{
%this.getWarrior = true;
}
//----------------------------------------------------------------------------
function LaunchGui::onWake(%this)
{
$enableDirectInput = "0";
deactivateDirectInput();
Canvas.pushDialog(LaunchToolbarDlg);
if ( !$FirstLaunch )
LaunchTabView.viewLastTab();
if ( !isDemo() )
checkNamesAndAliases();
else
OpenLaunchTabs();
}
//----------------------------------------------------------------------------
function LaunchGui::onSleep(%this)
{
//alxStop($HudHandle['shellScreen']);
Canvas.popDialog( LaunchToolbarDlg );
}
//----------------------------------------------------------------------------
function checkNamesAndAliases()
{
%gotoWarriorSetup = false;
if ( $PlayingOnline )
{
// When first launching, make sure we have a valid warrior:
if ( LaunchGui.getWarrior )
{
%cert = WONGetAuthInfo();
if ( %cert !$= "" )
{
LaunchGui.getWarrior = "";
if ( %cert $= "" )
%warrior = $CreateAccountWarriorName;
else
%warrior = getField( %cert, 0 );
%warriorIdx = -1;
for ( %i = 0; %i < $pref::Player::count; %i++ )
{
if ( %warrior $= getField( $pref::Player[%i], 0 ) )
{
%warriorIdx = %i;
break;
}
}
if ( %warriorIdx == -1 )
{
// Create new warrior:
$pref::Player[$pref::Player::Count] = %warrior @ "\tHuman Male\tbeagle\tMale1";
$pref::Player::Current = $pref::Player::Count;
$pref::Player::Count++;
%gotoWarriorSetup = true;
}
}
else
MessageBoxOK( "WARNING", "Failed to get account information. You may need to quit the game and log in again." );
}
}
else if ( $pref::Player::Count == 0 )
{
%gotoWarriorSetup = true;
}
OpenLaunchTabs( %gotoWarriorSetup );
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,247 +1,247 @@
// don't want this executing when building graphs
if($OFFLINE_NAV_BUILD)
return;
// Script for Training
//===================================================================================
//error("Training 1 script");
// package and callbacks
activatePackage(Training);
// variables
$numberOfEnemies[1] = 1;
$numberOfEnemies[2] = 2;
$numberOfEnemies[3] = 3;
$numberOfTeammates = 0; //Raptor, Komodo Dragon and Sharp Tooth - Don't spawn them automatically though
$missionBotSkill[1] = 0.0;
$missionBotSkill[2] = 0.4;
$missionBotSkill[3] = 0.7;
package Training {
//BEGIN TRAINING PACKAGE =======================================================================
function SinglePlayerGame::initGameVars(%game)
{
echo("initializing training1 game vars");
}
function MP3Audio::play(%this)
{
//too bad...no mp3 in training
}
function toggleCommanderMap(%val)
{
if ( %val )
messageClient($player, 0, $player.miscMsg[noCC]);
}
function toggleTaskListDlg( %val )
{
if ( %val )
messageClient( $player, 0, $player.miscMsg[noTaskListDlg] );
}
function toggleInventoryHud( %val )
{
if ( %val )
messageClient( $player, 0, $player.miscMsg[noInventoryHUD] );
}
function toggleNetDisplayHud( %val )
{
// Hello, McFly? This is training! There's no net in training!
}
function voiceCapture( %val )
{
// Uh, who do you think you are talking to?
}
function giveall()
{
error("When the going gets tough...wussies like you start cheating!");
messageClient($player, 0, "Cheating eh? What\'s next? Camping?");
}
function getTeammateGlobals()
{
//No console errors
}
function openingSpiel()
{
}
// get the ball rolling
//------------------------------------------------------------------------------
function startCurrentMission()
{
playGui.add(outerChatHud);
$Player.player.setTransform(PlayerSpawn.getPosition() SPC "0 0 1 3.97136");
//Raptor (Trainer)
$Bot1 = aiConnectByName("Raptor",1);
$Bot1.race = "Draakan";
$Bot1.sex = "A";
setVoice($Bot1, "Derm3");
setSkin($Bot1, "Gecko");
$Bot1.player.setArmor("LIGHT");
$Bot1.player.setTransform(RaptorSpawn.getPosition());
$Bot1.aimAt($player.player.getPosition());
//Sharp Tooth
$Bot2 = aiConnectByName("Sharp Tooth",1);
$Bot2.race = "Draakan";
$Bot2.sex = "A";
setVoice($Bot2, "Derm3");
setSkin($Bot2, "Gecko");
$Bot2.player.setArmor("LIGHT");
$Bot2.player.setTransform(Spawn01.getPosition());
$Bot2.aimAt($Bot1.player.getPosition());
//Komodo Dragon
$Bot3 = aiConnectByName("Komodo Dragon",1);
$Bot3.race = "Draakan";
$Bot3.sex = "A";
setVoice($Bot3, "Derm3");
setSkin($Bot3, "Gecko");
$Bot3.player.setArmor("LIGHT");
$Bot3.player.setTransform(Spawn02.getPosition());
$Bot3.aimAt($Bot1.player.getPosition());
//Start our texts!
openingSpiel();
$DoneIntro = false;
}
//------------------------------------------------------------------------------
function SinglePlayerGame::equip(%game, %player)
{
//ya start with nothing...NOTHING!
%player.clearInventory();
for(%i =0; %i<$InventoryHudCount; %i++)
%player.client.setInventoryHudItem($InventoryHudData[%i, itemDataName], 0, 1);
%player.client.clearBackpackIcon();
%set = %player.client.equipment;
echo("using default equipment");
%player.setArmor("Light");
%player.setInventory(RepairKit,1);
%player.setInventory(Chaingun, 1);
%player.setInventory(ChaingunAmmo, 100);
%player.setInventory(Disc,1);
%player.setInventory(DiscAmmo, 20);
%player.setInventory(Shocklance, 1);
%player.setInventory(AmmoPack, 1);
//DefaultGame.cs does not assign flamer..
%player.setInventory(flamer, 1);
%player.weaponCount = 4;
%player.use(Chaingun);
}
function PlayGui::onWake(%this)
{
parent::onWake(%this);
if (!$DoneIntro)
{
lockArmorHack(1);
ServerConnection.setBlackOut(false, 1000);
$DoneIntro = true;
}
}
function singlePlayerGame::onAIRespawn(%game, %client)
{
// DONT add the default tasks
//error("default tasks not added");
}
function singlePlayerGame::playerSpawned(%game, %player)
{
parent::playerSpawned(%game, %player);
}
function singlePlayerGame::gameOver(%game)
{
//enable the voice chat menu again...
if (isObject(training1BlockMap))
{
training1BlockMap.pop();
training1BlockMap.delete();
}
if(HelpTextGui.isVisible())
helpTextGui.setVisible(false);
//re-enable the use of the settings button...
SinglePlayerEscSettingsBtn.setActive(1);
Parent::gameOver();
}
function trainingPreloads() //Load any skins..
{
navGraph.preload("skins/Gecko.lbioderm", true);
navGraph.preload("skins/base.lbioderm", true);
navGraph.preload("skins/Horde.lbioderm", false);
navGraph.preload("skins/sensor_pulse_large", true);
navGraph.preload("skins/base.hmale", false);
navGraph.preload("skins/beagle.hmale", false);
navGraph.preload("skins/base.mmale", false);
navGraph.preload("skins/beagle.mmale", false);
navGraph.preload("skins/base.lmale", false);
navGraph.preload("skins/swolf.mmale", false);
navGraph.preload("skins/beagle.lmale", false);
}
function SinglePlayerGame::missionLoadDone(%game)
{
Parent::missionLoadDone(%game);
trainingPreloads();
}
function serverCmdBuildClientTask(%client, %task, %team)
{
// player shouldnt be able to use the voice commands to do anything
}
function openingSpiel() //Not sure how T2 originally handled the training.. but it's temporary
{
updateTrainingObjectiveHud(obj1);
schedule(1000,0,"setActionThread",$bot1.player,"cel1",0);
schedule(3000,0,"setActionThread",$bot2.player,"cel1",0);
schedule(3000,0,"setActionThread",$bot3.player,"cel1",0);
schedule(3000,0,"setActionThread",$player.player,"cel1",0);
doText(TR_01, 3200);
doText(TR_02, 3500);
doText(TR_03, 3800);
doText(TR_04, 4100);
doText(TR_05, 4400);
schedule(4400,0,"lockArmorHack",false); //Got to release our hack for it to work..
schedule(4400,0,"updateTrainingObjectiveHud",obj2);
}
function lockArmorHack(%bool)
{
if (%bool)
{
movemap.pop();
}
else
moveMap.push();
//$player.player.setMoveState(true);
//$player.player.schedule(1000,"setMoveState", false);
}
};
function setActionThread(%player,%anim,%bool)
{
%player.setActionThread(%anim,%bool);
}
// don't want this executing when building graphs
if($OFFLINE_NAV_BUILD)
return;
// Script for Training
//===================================================================================
//error("Training 1 script");
// package and callbacks
activatePackage(Training);
// variables
$numberOfEnemies[1] = 1;
$numberOfEnemies[2] = 2;
$numberOfEnemies[3] = 3;
$numberOfTeammates = 0; //Raptor, Komodo Dragon and Sharp Tooth - Don't spawn them automatically though
$missionBotSkill[1] = 0.0;
$missionBotSkill[2] = 0.4;
$missionBotSkill[3] = 0.7;
package Training {
//BEGIN TRAINING PACKAGE =======================================================================
function SinglePlayerGame::initGameVars(%game)
{
echo("initializing training1 game vars");
}
function MP3Audio::play(%this)
{
//too bad...no mp3 in training
}
function toggleCommanderMap(%val)
{
if ( %val )
messageClient($player, 0, $player.miscMsg[noCC]);
}
function toggleTaskListDlg( %val )
{
if ( %val )
messageClient( $player, 0, $player.miscMsg[noTaskListDlg] );
}
function toggleInventoryHud( %val )
{
if ( %val )
messageClient( $player, 0, $player.miscMsg[noInventoryHUD] );
}
function toggleNetDisplayHud( %val )
{
// Hello, McFly? This is training! There's no net in training!
}
function voiceCapture( %val )
{
// Uh, who do you think you are talking to?
}
function giveall()
{
error("When the going gets tough...wussies like you start cheating!");
messageClient($player, 0, "Cheating eh? What\'s next? Camping?");
}
function getTeammateGlobals()
{
//No console errors
}
function openingSpiel()
{
}
// get the ball rolling
//------------------------------------------------------------------------------
function startCurrentMission()
{
playGui.add(outerChatHud);
$Player.player.setTransform(PlayerSpawn.getPosition() SPC "0 0 1 3.97136");
//Raptor (Trainer)
$Bot1 = aiConnectByName("Raptor",1);
$Bot1.race = "Draakan";
$Bot1.sex = "A";
setVoice($Bot1, "Derm3");
setSkin($Bot1, "Gecko");
$Bot1.player.setArmor("LIGHT");
$Bot1.player.setTransform(RaptorSpawn.getPosition());
$Bot1.aimAt($player.player.getPosition());
//Sharp Tooth
$Bot2 = aiConnectByName("Sharp Tooth",1);
$Bot2.race = "Draakan";
$Bot2.sex = "A";
setVoice($Bot2, "Derm3");
setSkin($Bot2, "Gecko");
$Bot2.player.setArmor("LIGHT");
$Bot2.player.setTransform(Spawn01.getPosition());
$Bot2.aimAt($Bot1.player.getPosition());
//Komodo Dragon
$Bot3 = aiConnectByName("Komodo Dragon",1);
$Bot3.race = "Draakan";
$Bot3.sex = "A";
setVoice($Bot3, "Derm3");
setSkin($Bot3, "Gecko");
$Bot3.player.setArmor("LIGHT");
$Bot3.player.setTransform(Spawn02.getPosition());
$Bot3.aimAt($Bot1.player.getPosition());
//Start our texts!
openingSpiel();
$DoneIntro = false;
}
//------------------------------------------------------------------------------
function SinglePlayerGame::equip(%game, %player)
{
//ya start with nothing...NOTHING!
%player.clearInventory();
for(%i =0; %i<$InventoryHudCount; %i++)
%player.client.setInventoryHudItem($InventoryHudData[%i, itemDataName], 0, 1);
%player.client.clearBackpackIcon();
%set = %player.client.equipment;
echo("using default equipment");
%player.setArmor("Light");
%player.setInventory(RepairKit,1);
%player.setInventory(Chaingun, 1);
%player.setInventory(ChaingunAmmo, 100);
%player.setInventory(Disc,1);
%player.setInventory(DiscAmmo, 20);
%player.setInventory(Shocklance, 1);
%player.setInventory(AmmoPack, 1);
//DefaultGame.cs does not assign flamer..
%player.setInventory(flamer, 1);
%player.weaponCount = 4;
%player.use(Chaingun);
}
function PlayGui::onWake(%this)
{
parent::onWake(%this);
if (!$DoneIntro)
{
lockArmorHack(1);
ServerConnection.setBlackOut(false, 1000);
$DoneIntro = true;
}
}
function singlePlayerGame::onAIRespawn(%game, %client)
{
// DONT add the default tasks
//error("default tasks not added");
}
function singlePlayerGame::playerSpawned(%game, %player)
{
parent::playerSpawned(%game, %player);
}
function singlePlayerGame::gameOver(%game)
{
//enable the voice chat menu again...
if (isObject(training1BlockMap))
{
training1BlockMap.pop();
training1BlockMap.delete();
}
if(HelpTextGui.isVisible())
helpTextGui.setVisible(false);
//re-enable the use of the settings button...
SinglePlayerEscSettingsBtn.setActive(1);
Parent::gameOver();
}
function trainingPreloads() //Load any skins..
{
navGraph.preload("skins/Gecko.lbioderm", true);
navGraph.preload("skins/base.lbioderm", true);
navGraph.preload("skins/Horde.lbioderm", false);
navGraph.preload("skins/sensor_pulse_large", true);
navGraph.preload("skins/base.hmale", false);
navGraph.preload("skins/beagle.hmale", false);
navGraph.preload("skins/base.mmale", false);
navGraph.preload("skins/beagle.mmale", false);
navGraph.preload("skins/base.lmale", false);
navGraph.preload("skins/swolf.mmale", false);
navGraph.preload("skins/beagle.lmale", false);
}
function SinglePlayerGame::missionLoadDone(%game)
{
Parent::missionLoadDone(%game);
trainingPreloads();
}
function serverCmdBuildClientTask(%client, %task, %team)
{
// player shouldnt be able to use the voice commands to do anything
}
function openingSpiel() //Not sure how T2 originally handled the training.. but it's temporary
{
updateTrainingObjectiveHud(obj1);
schedule(1000,0,"setActionThread",$bot1.player,"cel1",0);
schedule(3000,0,"setActionThread",$bot2.player,"cel1",0);
schedule(3000,0,"setActionThread",$bot3.player,"cel1",0);
schedule(3000,0,"setActionThread",$player.player,"cel1",0);
doText(TR_01, 3200);
doText(TR_02, 3500);
doText(TR_03, 3800);
doText(TR_04, 4100);
doText(TR_05, 4400);
schedule(4400,0,"lockArmorHack",false); //Got to release our hack for it to work..
schedule(4400,0,"updateTrainingObjectiveHud",obj2);
}
function lockArmorHack(%bool)
{
if (%bool)
{
movemap.pop();
}
else
moveMap.push();
//$player.player.setMoveState(true);
//$player.player.schedule(1000,"setMoveState", false);
}
};
function setActionThread(%player,%anim,%bool)
{
%player.setActionThread(%anim,%bool);
}

View file

@ -1,313 +1,313 @@
//------------------------------------------------------------------------------
//
// TrainingGui.cs
//
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
function LaunchTraining()
{
LaunchTabView.viewTab( "CAMPAIGN", TrainingGui, 0 );
}
//------------------------------------------------------------------------------
function TrainingGui::onWake( %this )
{
Canvas.pushDialog( LaunchToolbarDlg );
//Reset the list
TrainingMissionList.clear();
if ($Pref::Campaign !$= "")
TrainingSelectMenu.onSelect(TrainingSelectMenu.findText($Pref::Campaign),$Pref::Campaign);
else
TrainingSelectMenu.onSelect(0,TrainingSelectMenu.getText());
TrainingMissionList.sort( 1 );
TrainingMissionList.setSelectedRow( 0 );
if ( $pref::TrainingDifficulty > 0 && $pref::TrainingDifficulty < 4 )
TrainingDifficultyMenu.setSelected( $pref::TrainingDifficulty );
else
TrainingDifficultyMenu.setSelected( 1 );
}
//------------------------------------------------------------------------------
function TrainingGui::onSleep( %this )
{
%this.stopBriefing();
Canvas.popDialog(LaunchToolbarDlg);
}
//------------------------------------------------------------------------------
function TrainingGui::updateList( %this )
{
%cam = $Pref::Campaign;
%dir = "Data/Campaigns/";
%file = %dir @ %cam @ ".txt";
if (!IsFile(%file))
return false;
TrainingMissionList.clear();
TrainingBriefingText.setValue( "" );
TrainingPic.setBitmap( "" );
TrainingPicFrame.setVisible( false );
if (!IsObject(CampaignLoader))
new ScriptObject(CampaignLoader) { class = "BasicDataParser"; };
CampaignLoader.empty();
CampaignLoader.load(%file);
%campaign = CampainLoader.get("Campaign",0);
%count = %campaign.element("MissionCount");
//Before we do the loopy stuff, we should check if there's a specific training mission first
%mission = %campaign.element("Practice");
%text = %campaign.element("PracticeText");
if (%text != -1 && %mission != -1)
TrainingMissionList.addRow( 0, %text TAB %mission );
%settings = CampainLoader.get("Settings",0);
for (%i = 1; %i <= %count; %i++)
{
%mission = %campain.element("Mission" @ %i);
%text = %campaign.element("MissionText" @ %i);
TrainingMissionList.addRow( %i, %text TAB %mission );
//Now the mission list is where we need it, find the player settings..
$Training::Name[%Mission] = %settings.element("Name");
$Training::Race[%Mission] = %settings.element("Race");
$Training::Sex[%Mission] = %settings.element("Sex");
$Training::Voice[%Mission] = %settings.element("Voice");
$Training::VoicePitch[%Mission] = %settings.element("VoicePitch");
$Training::Skin[%Mission] = %settings.element("Skin");
$Training::EnemySkin[%Mission] = %settings.element("EnemySkin");
$Training::EnemyName[%Mission] = %settings.element("EnemyName");
$Training::EnemyTeam[%Mission] = %settings.element("EnemyTeam");
$Training::PlayerTeam[%Mission] = %settings.element("PlayerTeam");
$Training::StartLives[%Mission] = %settings.element("StartLives");
$Training::EnemyRace[%Mission] = %settings.element("EnemyRace");
}
}
//------------------------------------------------------------------------------
function TrainingGui::setKey( %this )
{
}
//------------------------------------------------------------------------------
function TrainingGui::onClose( %this )
{
}
//------------------------------------------------------------------------------
function TrainingDifficultyMenu::onAdd( %this )
{
%this.add( "Easy", 1 );
%this.add( "Medium", 2 );
%this.add( "Hard", 3 );
}
//------------------------------------------------------------------------------
function TrainingDifficultyMenu::onSelect( %this, %id, %text )
{
$pref::TrainingDifficulty = %id;
}
//------------------------------------------------------------------------------
function TrainingSelectMenu::onAdd( %this )
{
//Uber Dynamic Campaign Listing :)
%path = "Data/Campaigns/*.dat";
%count = 0;
if (!IsObject(CampaignLoader))
new ScriptObject(CampaignLoader) { class = "BasicDataParser"; };
CampaignLoader.empty();
CampaignLoader.load(%file);
for( %file = findFirstFile( %path ); %file !$= ""; %file = findNextFile( %path ) )
{
CampaignLoader.load(%file);
%this.add( CampaignLoader.get("Campaign",%count).element("Name"), %count);
%count++;
}
}
//------------------------------------------------------------------------------
function TrainingSelectMenu::onSelect( %this, %id, %text )
{
$Pref::Campaign = %text;
%row = TrainingMissionList.getSelectedID() - 1;
TrainingGui.updateList();
TrainingGui.stopBriefing();
TrainingSelectMenu.setText(%text); //Make sure our text is assigned..
if ($Pref::Campaign $= %text)
TrainingMissionList.setSelectedRow(%row);
else
TrainingMissionList.setSelectedRow(0);
}
//------------------------------------------------------------------------------
function TrainingMissionList::onSelect( %this, %id, %text )
{
TrainingGui.stopBriefing();
%fileName = "missions/" @ getField( %text, 1 ) @ ".mis";
%file = new FileObject();
%state = 0;
if ( %file.openForRead( %fileName ) )
{
// Get the mission briefing text:
while ( !%file.isEOF() )
{
%line = %file.readLine();
if ( %state == 0 && %line $= "//--- MISSION BRIEFING BEGIN ---" )
%state = 1;
else if ( %state > 0 && %line $= "//--- MISSION BRIEFING END ---" )
break;
else if ( %state == 1 )
{
%briefText = %briefText @ getSubStr( %line, 2, 1000 );
%state = 2;
}
else if ( %state == 2 )
%briefText = %briefText NL getSubStr( %line, 2, 1000 );
}
// Get the mission briefing WAV file:
while ( !%file.isEOF() )
{
%line = %file.readLine();
if ( getSubStr( %line, 0, 17 ) $= "// BriefingWAV = " )
{
%briefWAV = getSubStr( %line, 17, 1000 );
break;
}
}
// Get the bitmap name:
while ( !%file.isEOF() )
{
%line = %file.readLine();
if ( getSubStr( %line, 0, 12 ) $= "// Bitmap = " )
{
%briefPic = getSubStr( %line, 12, 1000 );
break;
}
}
%file.close();
}
else
error( "Failed to open Single Player mission file " @ %fileName @ "!" );
if (!isDemo())
%bmp = "gui/" @ %briefPic @ ".png";
else
%bmp = "gui/" @ %briefPic @ ".bm8";
if ( isFile( "textures/" @ %bmp ) )
{
TrainingPic.setBitmap( %bmp );
TrainingPicFrame.setVisible( true );
}
else
{
TrainingPic.setBitmap( "" );
TrainingPicFrame.setVisible( false );
}
TrainingPlayBtn.setActive( %briefWAV !$= "" );
TrainingBriefingText.setValue( %briefText );
TrainingBriefingScroll.scrollToTop();
TrainingGui.WAVBase = firstWord( %briefWAV );
TrainingGui.WAVCount = restWords( %briefWAV );
%file.delete();
return true;
}
//------------------------------------------------------------------------------
function TrainingPlayTgl::onAction( %this )
{
if ( %this.getValue() )
{
if ( TrainingMissionList.getSelectedId() != -1 )
TrainingGui.startBriefing();
}
else
TrainingGui.stopBriefing();
}
//--------------------------------------------------------
function TrainingGui::toggleBriefing( %this )
{
if ( %this.soundHandle $= "" )
{
%this.startBriefing();
alxMusicFadeout($Pref::Audio::MusicVolume);
}
else
%this.stopBriefing();
}
//--------------------------------------------------------
function TrainingGui::startBriefing( %this )
{
%this.stopBriefing();
if ( %this.WAVBase !$= "" )
{
%this.instance = %this.instance $= "" ? 0 : %this.instance;
%this.playNextBriefWAV( %this.WAVBase, 0, %this.WAVCount, %this.instance );
}
}
//--------------------------------------------------------
function TrainingGui::playNextBriefWAV( %this, %wavBase, %id, %count, %instance )
{
if ( %instance == %this.instance )
{
if ( %id < %count )
{
%wav = "voice/Training/Briefings/" @ %wavBase @ ".brief0" @ ( %id + 1 ) @ ".wav";
%this.soundHandle = alxCreateSource( AudioGui, %wav );
alxPlay( %this.soundHandle );
// Schedule the next WAV:
%delay = alxGetWaveLen( %wav ) + 500;
%this.schedule( %delay, playNextBriefWAV, %wavBase, %id + 1, %count, %instance );
}
else
{
// We're all done!
%this.soundHandle = "";
}
}
}
//--------------------------------------------------------
function TrainingGui::stopBriefing( %this )
{
if ( %this.soundHandle !$= "" )
{
alxStop( %this.soundHandle );
%this.soundHandle = "";
%this.instance++;
}
}
//--------------------------------------------------------
function TrainingGui::startTraining( %this )
{
MessagePopup( "STARTING MISSION", "Initializing, please wait..." );
Canvas.repaint();
cancelServerQuery();
%file = getField( TrainingMissionList.getValue(), 1 );
$ServerName = "Single Player Training";
$HostGameType = "SinglePlayer";
CreateServer( %file, "SinglePlayer" );
alxMusicFadeout($Pref::Audio::MusicVolume);
localConnect( $Training::Name[%file], $Training::Race[%file] SPC $Training::Sex[%file], $Training::Skin[%file], $Training::Voice[%file] );
}
//------------------------------------------------------------------------------
//
// TrainingGui.cs
//
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
function LaunchTraining()
{
LaunchTabView.viewTab( "CAMPAIGN", TrainingGui, 0 );
}
//------------------------------------------------------------------------------
function TrainingGui::onWake( %this )
{
Canvas.pushDialog( LaunchToolbarDlg );
//Reset the list
TrainingMissionList.clear();
if ($Pref::Campaign !$= "")
TrainingSelectMenu.onSelect(TrainingSelectMenu.findText($Pref::Campaign),$Pref::Campaign);
else
TrainingSelectMenu.onSelect(0,TrainingSelectMenu.getText());
TrainingMissionList.sort( 1 );
TrainingMissionList.setSelectedRow( 0 );
if ( $pref::TrainingDifficulty > 0 && $pref::TrainingDifficulty < 4 )
TrainingDifficultyMenu.setSelected( $pref::TrainingDifficulty );
else
TrainingDifficultyMenu.setSelected( 1 );
}
//------------------------------------------------------------------------------
function TrainingGui::onSleep( %this )
{
%this.stopBriefing();
Canvas.popDialog(LaunchToolbarDlg);
}
//------------------------------------------------------------------------------
function TrainingGui::updateList( %this )
{
%cam = $Pref::Campaign;
%dir = "Data/Campaigns/";
%file = %dir @ %cam @ ".txt";
if (!IsFile(%file))
return false;
TrainingMissionList.clear();
TrainingBriefingText.setValue( "" );
TrainingPic.setBitmap( "" );
TrainingPicFrame.setVisible( false );
if (!IsObject(CampaignLoader))
new ScriptObject(CampaignLoader) { class = "BasicDataParser"; };
CampaignLoader.empty();
CampaignLoader.load(%file);
%campaign = CampainLoader.get("Campaign",0);
%count = %campaign.element("MissionCount");
//Before we do the loopy stuff, we should check if there's a specific training mission first
%mission = %campaign.element("Practice");
%text = %campaign.element("PracticeText");
if (%text != -1 && %mission != -1)
TrainingMissionList.addRow( 0, %text TAB %mission );
%settings = CampainLoader.get("Settings",0);
for (%i = 1; %i <= %count; %i++)
{
%mission = %campain.element("Mission" @ %i);
%text = %campaign.element("MissionText" @ %i);
TrainingMissionList.addRow( %i, %text TAB %mission );
//Now the mission list is where we need it, find the player settings..
$Training::Name[%Mission] = %settings.element("Name");
$Training::Race[%Mission] = %settings.element("Race");
$Training::Sex[%Mission] = %settings.element("Sex");
$Training::Voice[%Mission] = %settings.element("Voice");
$Training::VoicePitch[%Mission] = %settings.element("VoicePitch");
$Training::Skin[%Mission] = %settings.element("Skin");
$Training::EnemySkin[%Mission] = %settings.element("EnemySkin");
$Training::EnemyName[%Mission] = %settings.element("EnemyName");
$Training::EnemyTeam[%Mission] = %settings.element("EnemyTeam");
$Training::PlayerTeam[%Mission] = %settings.element("PlayerTeam");
$Training::StartLives[%Mission] = %settings.element("StartLives");
$Training::EnemyRace[%Mission] = %settings.element("EnemyRace");
}
}
//------------------------------------------------------------------------------
function TrainingGui::setKey( %this )
{
}
//------------------------------------------------------------------------------
function TrainingGui::onClose( %this )
{
}
//------------------------------------------------------------------------------
function TrainingDifficultyMenu::onAdd( %this )
{
%this.add( "Easy", 1 );
%this.add( "Medium", 2 );
%this.add( "Hard", 3 );
}
//------------------------------------------------------------------------------
function TrainingDifficultyMenu::onSelect( %this, %id, %text )
{
$pref::TrainingDifficulty = %id;
}
//------------------------------------------------------------------------------
function TrainingSelectMenu::onAdd( %this )
{
//Uber Dynamic Campaign Listing :)
%path = "Data/Campaigns/*.dat";
%count = 0;
if (!IsObject(CampaignLoader))
new ScriptObject(CampaignLoader) { class = "BasicDataParser"; };
CampaignLoader.empty();
CampaignLoader.load(%file);
for( %file = findFirstFile( %path ); %file !$= ""; %file = findNextFile( %path ) )
{
CampaignLoader.load(%file);
%this.add( CampaignLoader.get("Campaign",%count).element("Name"), %count);
%count++;
}
}
//------------------------------------------------------------------------------
function TrainingSelectMenu::onSelect( %this, %id, %text )
{
$Pref::Campaign = %text;
%row = TrainingMissionList.getSelectedID() - 1;
TrainingGui.updateList();
TrainingGui.stopBriefing();
TrainingSelectMenu.setText(%text); //Make sure our text is assigned..
if ($Pref::Campaign $= %text)
TrainingMissionList.setSelectedRow(%row);
else
TrainingMissionList.setSelectedRow(0);
}
//------------------------------------------------------------------------------
function TrainingMissionList::onSelect( %this, %id, %text )
{
TrainingGui.stopBriefing();
%fileName = "missions/" @ getField( %text, 1 ) @ ".mis";
%file = new FileObject();
%state = 0;
if ( %file.openForRead( %fileName ) )
{
// Get the mission briefing text:
while ( !%file.isEOF() )
{
%line = %file.readLine();
if ( %state == 0 && %line $= "//--- MISSION BRIEFING BEGIN ---" )
%state = 1;
else if ( %state > 0 && %line $= "//--- MISSION BRIEFING END ---" )
break;
else if ( %state == 1 )
{
%briefText = %briefText @ getSubStr( %line, 2, 1000 );
%state = 2;
}
else if ( %state == 2 )
%briefText = %briefText NL getSubStr( %line, 2, 1000 );
}
// Get the mission briefing WAV file:
while ( !%file.isEOF() )
{
%line = %file.readLine();
if ( getSubStr( %line, 0, 17 ) $= "// BriefingWAV = " )
{
%briefWAV = getSubStr( %line, 17, 1000 );
break;
}
}
// Get the bitmap name:
while ( !%file.isEOF() )
{
%line = %file.readLine();
if ( getSubStr( %line, 0, 12 ) $= "// Bitmap = " )
{
%briefPic = getSubStr( %line, 12, 1000 );
break;
}
}
%file.close();
}
else
error( "Failed to open Single Player mission file " @ %fileName @ "!" );
if (!isDemo())
%bmp = "gui/" @ %briefPic @ ".png";
else
%bmp = "gui/" @ %briefPic @ ".bm8";
if ( isFile( "textures/" @ %bmp ) )
{
TrainingPic.setBitmap( %bmp );
TrainingPicFrame.setVisible( true );
}
else
{
TrainingPic.setBitmap( "" );
TrainingPicFrame.setVisible( false );
}
TrainingPlayBtn.setActive( %briefWAV !$= "" );
TrainingBriefingText.setValue( %briefText );
TrainingBriefingScroll.scrollToTop();
TrainingGui.WAVBase = firstWord( %briefWAV );
TrainingGui.WAVCount = restWords( %briefWAV );
%file.delete();
return true;
}
//------------------------------------------------------------------------------
function TrainingPlayTgl::onAction( %this )
{
if ( %this.getValue() )
{
if ( TrainingMissionList.getSelectedId() != -1 )
TrainingGui.startBriefing();
}
else
TrainingGui.stopBriefing();
}
//--------------------------------------------------------
function TrainingGui::toggleBriefing( %this )
{
if ( %this.soundHandle $= "" )
{
%this.startBriefing();
alxMusicFadeout($Pref::Audio::MusicVolume);
}
else
%this.stopBriefing();
}
//--------------------------------------------------------
function TrainingGui::startBriefing( %this )
{
%this.stopBriefing();
if ( %this.WAVBase !$= "" )
{
%this.instance = %this.instance $= "" ? 0 : %this.instance;
%this.playNextBriefWAV( %this.WAVBase, 0, %this.WAVCount, %this.instance );
}
}
//--------------------------------------------------------
function TrainingGui::playNextBriefWAV( %this, %wavBase, %id, %count, %instance )
{
if ( %instance == %this.instance )
{
if ( %id < %count )
{
%wav = "voice/Training/Briefings/" @ %wavBase @ ".brief0" @ ( %id + 1 ) @ ".wav";
%this.soundHandle = alxCreateSource( AudioGui, %wav );
alxPlay( %this.soundHandle );
// Schedule the next WAV:
%delay = alxGetWaveLen( %wav ) + 500;
%this.schedule( %delay, playNextBriefWAV, %wavBase, %id + 1, %count, %instance );
}
else
{
// We're all done!
%this.soundHandle = "";
}
}
}
//--------------------------------------------------------
function TrainingGui::stopBriefing( %this )
{
if ( %this.soundHandle !$= "" )
{
alxStop( %this.soundHandle );
%this.soundHandle = "";
%this.instance++;
}
}
//--------------------------------------------------------
function TrainingGui::startTraining( %this )
{
MessagePopup( "STARTING MISSION", "Initializing, please wait..." );
Canvas.repaint();
cancelServerQuery();
%file = getField( TrainingMissionList.getValue(), 1 );
$ServerName = "Single Player Training";
$HostGameType = "SinglePlayer";
CreateServer( %file, "SinglePlayer" );
alxMusicFadeout($Pref::Audio::MusicVolume);
localConnect( $Training::Name[%file], $Training::Race[%file] SPC $Training::Sex[%file], $Training::Skin[%file], $Training::Voice[%file] );
}

View file

@ -1,429 +1,429 @@
// These have been secured against all those wanna-be-hackers.
$VoteMessage["VoteAdminPlayer"] = "Admin Player";
$VoteMessage["VoteKickPlayer"] = "Kick Player";
$VoteMessage["VoteLockServer"] = "Lock Server";
$VoteMessage["VoteGlobal"] = "Global Chat";
$VoteMessage["VoteProgressiveMode"] = "Toggle Progressive Mode";
$VoteMessage["BanPlayer"] = "Ban Player";
$VoteMessage["VoteChangeMission"] = "change the mission to";
$VoteMessage["VoteTeamDamage", 0] = "enable team damage";
$VoteMessage["VoteTeamDamage", 1] = "disable team damage";
$VoteMessage["VoteTournamentMode"] = "change the server to";
$VoteMessage["VoteFFAMode"] = "change the server to";
$VoteMessage["VoteChangeTimeLimit"] = "change the time limit to";
$VoteMessage["VoteMatchStart"] = "start the match";
$VoteMessage["VoteGreedMode", 0] = "enable Hoard Mode";
$VoteMessage["VoteGreedMode", 1] = "disable Hoard Mode";
$VoteMessage["VoteHoardMode", 0] = "enable Greed Mode";
$VoteMessage["VoteHoardMode", 1] = "disable Greed Mode";
function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %playerVote)
{
// z0dd - ZOD, 9/29/02. Removed T2 demo code from here
// haha - who gets the last laugh... No admin for you!
if( %typeName $= "VoteAdminPlayer" && !$Host::allowAdminPlayerVotes )
if( !%client.isSuperAdmin ) // z0dd - ZOD, 5/12/02. Allow Supers to do whatever the hell they want
return;
if ($CurrentMissionType $= "RPG") //Don't screw with the gamemode..
switch$(%typeName)
{
case "VoteChangeTimeLimit": return;
case "VoteTournamentMode": return;
case "VoteTeamDamage": return;
case "MakeObserver": return;
case "VoteProgressiveMode": return;
}
%typePass = true;
// if not a valid vote, turn back.
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteTeamDamage" )
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteHoardMode" )
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteGreedMode" )
%typePass = false;
if(( $VoteMessage[ %typeName, $TeamDamage ] $= "" && %typeName $= "VoteTeamDamage" ))
%typePass = false;
if( !%typePass )
return; // -> bye ;)
// ------------------------------------
// z0dd - ZOD, 10/03/02. Fixed ban code
//if( %typeName $= "BanPlayer" )
// if( !%client.isSuperAdmin )
// return; // -> bye ;)
if( %typeName $= "BanPlayer" )
{
if( !%client.isSuperAdmin )
{
return; // -> bye ;)
}
else
{
ban( %arg1, %client );
return;
}
}
// ------------------------------------
%isAdmin = ( %client.isAdmin || %client.isSuperAdmin );
// z0dd - ZOD, 4/7/02. Get the Admins name.
if(%isAdmin)
$AdminName = %client.name;
// keep these under the server's control. I win.
if( !%playerVote )
%actionMsg = $VoteMessage[ %typeName ];
else if( %typeName $= "VoteTeamDamage" || %typeName $= "VoteGreedMode" || %typeName $= "VoteHoardMode" )
%actionMsg = $VoteMessage[ %typeName, $TeamDamage ];
else
%actionMsg = $VoteMessage[ %typeName ];
if( !%client.canVote && !%isAdmin )
return;
if ( ( !%isAdmin || ( %arg1.isAdmin && ( %client != %arg1 ) ) ) && // z0dd - ZOD, 4/7/02. Allow SuperAdmins to kick Admins
!( ( %typeName $= "VoteKickPlayer" ) && %client.isSuperAdmin ) ) // z0dd - ZOD, 4/7/02. Allow SuperAdmins to kick Admins
{
%teamSpecific = false;
%gender = (%client.sex $= "Male" ? 'he' : 'she');
if ( Game.scheduleVote $= "" )
{
%clientsVoting = 0;
//send a message to everyone about the vote...
if ( %playerVote )
{
%teamSpecific = ( %typeName $= "VoteKickPlayer" ) && ( Game.numTeams > 1 );
%kickerIsObs = %client.team == 0;
%kickeeIsObs = %arg1.team == 0;
%sameTeam = %client.team == %arg1.team;
if( %kickeeIsObs )
{
%teamSpecific = false;
%sameTeam = false;
}
if(( !%sameTeam && %teamSpecific) && %typeName !$= "VoteAdminPlayer")
{
messageClient(%client, '', '\c2Player votes must be team based.');
return;
}
// kicking is team specific
if( %typeName $= "VoteKickPlayer" )
{
if(%arg1.isSuperAdmin)
{
messageClient(%client, '', '\c2You can not %1 %2, %3 is a Super Admin!', %actionMsg, %arg1.name, %gender);
return;
}
Game.kickClient = %arg1;
Game.kickClientName = %arg1.name;
Game.kickGuid = %arg1.guid;
Game.kickTeam = %arg1.team;
if(%teamSpecific)
{
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
{
%cl = ClientGroup.getObject( %idx );
if (%cl.team == %client.team && !%cl.isAIControlled())
{
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, %actionMsg, %arg1.name);
%clientsVoting++;
}
}
}
else
{
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
{
%cl = ClientGroup.getObject( %idx );
if ( !%cl.isAIControlled() )
{
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, %actionMsg, %arg1.name);
%clientsVoting++;
}
}
}
}
else
{
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
{
%cl = ClientGroup.getObject( %idx );
if ( !%cl.isAIControlled() )
{
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, %actionMsg, %arg1.name);
%clientsVoting++;
}
}
}
}
else if ( %typeName $= "VoteChangeMission" )
{
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
{
%cl = ClientGroup.getObject( %idx );
if ( !%cl.isAIControlled() )
{
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3 (%4).', %client.name, %actionMsg, %arg1, %arg2 );
%clientsVoting++;
}
}
}
else if (%arg1 !$= 0)
{
if (%arg2 !$= 0)
{
if(%typeName $= "VoteTournamentMode")
{
%admin = getAdmin();
if(%admin > 0)
{
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
{
%cl = ClientGroup.getObject( %idx );
if ( !%cl.isAIControlled() )
{
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 Tournament Mode (%3).', %client.name, %actionMsg, %arg1);
%clientsVoting++;
}
}
}
else
{
messageClient( %client, 'clientMsg', 'There must be a server admin to play in Tournament Mode.');
return;
}
}
else
{
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
{
%cl = ClientGroup.getObject( %idx );
if ( !%cl.isAIControlled() )
{
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3 %4.', %client.name, %actionMsg, %arg1, %arg2);
%clientsVoting++;
}
}
}
}
else
{
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
{
%cl = ClientGroup.getObject( %idx );
if ( !%cl.isAIControlled() )
{
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, %actionMsg, %arg1);
%clientsVoting++;
}
}
}
}
else
{
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
{
%cl = ClientGroup.getObject( %idx );
if ( !%cl.isAIControlled() )
{
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2.', %client.name, %actionMsg);
%clientsVoting++;
}
}
}
// open the vote hud for all clients that will participate in this vote
if(%teamSpecific)
{
for ( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ )
{
%cl = ClientGroup.getObject( %clientIndex );
if(%cl.team == %client.team && !%cl.isAIControlled())
messageClient(%cl, 'openVoteHud', "", %clientsVoting, ($Host::VotePassPercent / 100));
}
}
else
{
for ( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ )
{
%cl = ClientGroup.getObject( %clientIndex );
if ( !%cl.isAIControlled() )
messageClient(%cl, 'openVoteHud', "", %clientsVoting, ($Host::VotePassPercent / 100));
}
}
clearVotes();
Game.voteType = %typeName;
Game.scheduleVote = schedule( ($Host::VoteTime * 1000), 0, "calcVotes", %typeName, %arg1, %arg2, %arg3, %arg4 );
%client.vote = true;
messageAll('addYesVote', "");
if(!%client.team == 0)
clearBottomPrint(%client);
}
else
messageClient( %client, 'voteAlreadyRunning', '\c2A vote is already in progress.' );
}
else
{
if ( Game.scheduleVote !$= "" && Game.voteType $= %typeName )
{
messageAll('closeVoteHud', "");
cancel(Game.scheduleVote);
Game.scheduleVote = "";
}
// if this is a superAdmin, don't kick or ban
if(%arg1 != %client)
{
if(!%arg1.isSuperAdmin)
{
// Set up kick/ban values:
if ( %typeName $= "VoteBanPlayer" || %typeName $= "VoteKickPlayer" )
{
Game.kickClient = %arg1;
Game.kickClientName = %arg1.name;
Game.kickGuid = %arg1.guid;
Game.kickTeam = %arg1.team;
}
//Tinman - PURE servers can't call "eval"
//Mark - True, but neither SHOULD a normal server
// - thanks Ian Hardingham
//if (!isPureServer())
// eval( "Game." @ %typeName @ "(true,\"" @ %arg1 @ "\",\"" @ %arg2 @ "\",\"" @ %arg3 @ "\",\"" @ %arg4 @ "\");" );
//else
Game.evalVote(%typeName, true, %arg1, %arg2, %arg3, %arg4);
}
else
messageClient(%client, '', '\c2You can not %1 %2, %3 is a Super Admin!', %actionMsg, %arg1.name, %gender);
}
}
%client.canVote = false;
%client.rescheduleVote = schedule( ($Host::voteSpread * 1000) + ($Host::voteTime * 1000) , 0, "resetVotePrivs", %client );
}
function resetVotePrivs( %client )
{
//messageClient( %client, '', 'You may now start a new vote.');
%client.canVote = true;
%client.rescheduleVote = "";
}
function serverCmdSetPlayerVote(%client, %vote)
{
// players can only vote once
if( %client.vote $= "" )
{
%client.vote = %vote;
if(%client.vote == 1)
messageAll('addYesVote', "");
else
messageAll('addNoVote', "");
commandToClient(%client, 'voteSubmitted', %vote);
}
}
function calcVotes(%typeName, %arg1, %arg2, %arg3, %arg4)
{
if(%typeName $= "voteMatchStart")
if($MatchStarted || $countdownStarted)
return;
for ( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ )
{
%cl = ClientGroup.getObject( %clientIndex );
messageClient(%cl, 'closeVoteHud', "");
if ( %cl.vote !$= "" )
{
if ( %cl.vote )
{
Game.votesFor[%cl.team]++;
Game.totalVotesFor++;
}
else
{
Game.votesAgainst[%cl.team]++;
Game.totalVotesAgainst++;
}
}
else
{
Game.votesNone[%cl.team]++;
Game.totalVotesNone++;
}
}
//Tinman - PURE servers can't call "eval"
//Mark - True, but neither SHOULD a normal server
// - thanks Ian Hardingham
//if (!isPureServer())
// eval( "Game." @ %typeName @ "(false,\"" @ %arg1 @ "\",\"" @ %arg2 @ "\",\"" @ %arg3 @ "\",\"" @ %arg4 @ "\");" );
//else
Game.evalVote(%typeName, false, %arg1, %arg2, %arg3, %arg4);
Game.scheduleVote = "";
Game.kickClient = "";
clearVotes();
}
function clearVotes()
{
for(%clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++)
{
%client = ClientGroup.getObject(%clientIndex);
%client.vote = "";
messageClient(%client, 'clearVoteHud', "");
}
for(%team = 1; %team < 5; %team++)
{
Game.votesFor[%team] = 0;
Game.votesAgainst[%team] = 0;
Game.votesNone[%team] = 0;
Game.totalVotesFor = 0;
Game.totalVotesAgainst = 0;
Game.totalVotesNone = 0;
}
}
// Tournament mode Stuff-----------------------------------
function setModeFFA( %mission, %missionType )
{
if( $Host::TournamentMode )
{
$Host::TournamentMode = false;
if( isObject( Game ) )
Game.gameOver();
loadMission(%mission, %missionType, false);
}
}
function setModeTournament( %mission, %missionType )
{
if( !$Host::TournamentMode )
{
$Host::TournamentMode = true;
if( isObject( Game ) )
Game.gameOver();
loadMission(%mission, %missionType, false);
}
}
// These have been secured against all those wanna-be-hackers.
$VoteMessage["VoteAdminPlayer"] = "Admin Player";
$VoteMessage["VoteKickPlayer"] = "Kick Player";
$VoteMessage["VoteLockServer"] = "Lock Server";
$VoteMessage["VoteGlobal"] = "global Chat";
$VoteMessage["VoteProgressiveMode"] = "Toggle Progressive Mode";
$VoteMessage["BanPlayer"] = "Ban Player";
$VoteMessage["VoteChangeMission"] = "change the mission to";
$VoteMessage["VoteTeamDamage", 0] = "enable team damage";
$VoteMessage["VoteTeamDamage", 1] = "disable team damage";
$VoteMessage["VoteTournamentMode"] = "change the server to";
$VoteMessage["VoteFFAMode"] = "change the server to";
$VoteMessage["VoteChangeTimeLimit"] = "change the time limit to";
$VoteMessage["VoteMatchStart"] = "start the match";
$VoteMessage["VoteGreedMode", 0] = "enable Hoard Mode";
$VoteMessage["VoteGreedMode", 1] = "disable Hoard Mode";
$VoteMessage["VoteHoardMode", 0] = "enable Greed Mode";
$VoteMessage["VoteHoardMode", 1] = "disable Greed Mode";
function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %playerVote)
{
// z0dd - ZOD, 9/29/02. Removed T2 demo code from here
// haha - who gets the last laugh... No admin for you!
if( %typeName $= "VoteAdminPlayer" && !$Host::allowAdminPlayerVotes )
if( !%client.isSuperAdmin ) // z0dd - ZOD, 5/12/02. Allow Supers to do whatever the hell they want
return;
if ($CurrentMissionType $= "RPG") //Don't screw with the gamemode..
switch$(%typeName)
{
case "VoteChangeTimeLimit": return;
case "VoteTournamentMode": return;
case "VoteTeamDamage": return;
case "MakeObserver": return;
case "VoteProgressiveMode": return;
}
%typePass = true;
// if not a valid vote, turn back.
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteTeamDamage" )
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteHoardMode" )
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteGreedMode" )
%typePass = false;
if(( $VoteMessage[ %typeName, $TeamDamage ] $= "" && %typeName $= "VoteTeamDamage" ))
%typePass = false;
if( !%typePass )
return; // -> bye ;)
// ------------------------------------
// z0dd - ZOD, 10/03/02. Fixed ban code
//if( %typeName $= "BanPlayer" )
// if( !%client.isSuperAdmin )
// return; // -> bye ;)
if( %typeName $= "BanPlayer" )
{
if( !%client.isSuperAdmin )
{
return; // -> bye ;)
}
else
{
ban( %arg1, %client );
return;
}
}
// ------------------------------------
%isAdmin = ( %client.isAdmin || %client.isSuperAdmin );
// z0dd - ZOD, 4/7/02. Get the Admins name.
if(%isAdmin)
$AdminName = %client.name;
// keep these under the server's control. I win.
if( !%playerVote )
%actionMsg = $VoteMessage[ %typeName ];
else if( %typeName $= "VoteTeamDamage" || %typeName $= "VoteGreedMode" || %typeName $= "VoteHoardMode" )
%actionMsg = $VoteMessage[ %typeName, $TeamDamage ];
else
%actionMsg = $VoteMessage[ %typeName ];
if( !%client.canVote && !%isAdmin )
return;
if ( ( !%isAdmin || ( %arg1.isAdmin && ( %client != %arg1 ) ) ) && // z0dd - ZOD, 4/7/02. Allow SuperAdmins to kick Admins
!( ( %typeName $= "VoteKickPlayer" ) && %client.isSuperAdmin ) ) // z0dd - ZOD, 4/7/02. Allow SuperAdmins to kick Admins
{
%teamSpecific = false;
%gender = (%client.sex $= "Male" ? 'he' : 'she');
if ( Game.scheduleVote $= "" )
{
%clientsVoting = 0;
//send a message to everyone about the vote...
if ( %playerVote )
{
%teamSpecific = ( %typeName $= "VoteKickPlayer" ) && ( Game.numTeams > 1 );
%kickerIsObs = %client.team == 0;
%kickeeIsObs = %arg1.team == 0;
%sameTeam = %client.team == %arg1.team;
if( %kickeeIsObs )
{
%teamSpecific = false;
%sameTeam = false;
}
if(( !%sameTeam && %teamSpecific) && %typeName !$= "VoteAdminPlayer")
{
messageClient(%client, '', '\c2Player votes must be team based.');
return;
}
// kicking is team specific
if( %typeName $= "VoteKickPlayer" )
{
if(%arg1.isSuperAdmin)
{
messageClient(%client, '', '\c2You can not %1 %2, %3 is a Super Admin!', %actionMsg, %arg1.name, %gender);
return;
}
Game.kickClient = %arg1;
Game.kickClientName = %arg1.name;
Game.kickGuid = %arg1.guid;
Game.kickTeam = %arg1.team;
if(%teamSpecific)
{
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
{
%cl = ClientGroup.getObject( %idx );
if (%cl.team == %client.team && !%cl.isAIControlled())
{
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, %actionMsg, %arg1.name);
%clientsVoting++;
}
}
}
else
{
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
{
%cl = ClientGroup.getObject( %idx );
if ( !%cl.isAIControlled() )
{
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, %actionMsg, %arg1.name);
%clientsVoting++;
}
}
}
}
else
{
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
{
%cl = ClientGroup.getObject( %idx );
if ( !%cl.isAIControlled() )
{
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, %actionMsg, %arg1.name);
%clientsVoting++;
}
}
}
}
else if ( %typeName $= "VoteChangeMission" )
{
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
{
%cl = ClientGroup.getObject( %idx );
if ( !%cl.isAIControlled() )
{
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3 (%4).', %client.name, %actionMsg, %arg1, %arg2 );
%clientsVoting++;
}
}
}
else if (%arg1 !$= 0)
{
if (%arg2 !$= 0)
{
if(%typeName $= "VoteTournamentMode")
{
%admin = getAdmin();
if(%admin > 0)
{
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
{
%cl = ClientGroup.getObject( %idx );
if ( !%cl.isAIControlled() )
{
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 Tournament Mode (%3).', %client.name, %actionMsg, %arg1);
%clientsVoting++;
}
}
}
else
{
messageClient( %client, 'clientMsg', 'There must be a server admin to play in Tournament Mode.');
return;
}
}
else
{
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
{
%cl = ClientGroup.getObject( %idx );
if ( !%cl.isAIControlled() )
{
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3 %4.', %client.name, %actionMsg, %arg1, %arg2);
%clientsVoting++;
}
}
}
}
else
{
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
{
%cl = ClientGroup.getObject( %idx );
if ( !%cl.isAIControlled() )
{
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, %actionMsg, %arg1);
%clientsVoting++;
}
}
}
}
else
{
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
{
%cl = ClientGroup.getObject( %idx );
if ( !%cl.isAIControlled() )
{
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2.', %client.name, %actionMsg);
%clientsVoting++;
}
}
}
// open the vote hud for all clients that will participate in this vote
if(%teamSpecific)
{
for ( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ )
{
%cl = ClientGroup.getObject( %clientIndex );
if(%cl.team == %client.team && !%cl.isAIControlled())
messageClient(%cl, 'openVoteHud', "", %clientsVoting, ($Host::VotePassPercent / 100));
}
}
else
{
for ( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ )
{
%cl = ClientGroup.getObject( %clientIndex );
if ( !%cl.isAIControlled() )
messageClient(%cl, 'openVoteHud', "", %clientsVoting, ($Host::VotePassPercent / 100));
}
}
clearVotes();
Game.voteType = %typeName;
Game.scheduleVote = schedule( ($Host::VoteTime * 1000), 0, "calcVotes", %typeName, %arg1, %arg2, %arg3, %arg4 );
%client.vote = true;
messageAll('addYesVote', "");
if(!%client.team == 0)
clearBottomPrint(%client);
}
else
messageClient( %client, 'voteAlreadyRunning', '\c2A vote is already in progress.' );
}
else
{
if ( Game.scheduleVote !$= "" && Game.voteType $= %typeName )
{
messageAll('closeVoteHud', "");
cancel(Game.scheduleVote);
Game.scheduleVote = "";
}
// if this is a superAdmin, don't kick or ban
if(%arg1 != %client)
{
if(!%arg1.isSuperAdmin)
{
// Set up kick/ban values:
if ( %typeName $= "VoteBanPlayer" || %typeName $= "VoteKickPlayer" )
{
Game.kickClient = %arg1;
Game.kickClientName = %arg1.name;
Game.kickGuid = %arg1.guid;
Game.kickTeam = %arg1.team;
}
//Tinman - PURE servers can't call "eval"
//Mark - True, but neither SHOULD a normal server
// - thanks Ian Hardingham
//if (!isPureServer())
// eval( "Game." @ %typeName @ "(true,\"" @ %arg1 @ "\",\"" @ %arg2 @ "\",\"" @ %arg3 @ "\",\"" @ %arg4 @ "\");" );
//else
Game.evalVote(%typeName, true, %arg1, %arg2, %arg3, %arg4);
}
else
messageClient(%client, '', '\c2You can not %1 %2, %3 is a Super Admin!', %actionMsg, %arg1.name, %gender);
}
}
%client.canVote = false;
%client.rescheduleVote = schedule( ($Host::voteSpread * 1000) + ($Host::voteTime * 1000) , 0, "resetVotePrivs", %client );
}
function resetVotePrivs( %client )
{
//messageClient( %client, '', 'You may now start a new vote.');
%client.canVote = true;
%client.rescheduleVote = "";
}
function serverCmdSetPlayerVote(%client, %vote)
{
// players can only vote once
if( %client.vote $= "" )
{
%client.vote = %vote;
if(%client.vote == 1)
messageAll('addYesVote', "");
else
messageAll('addNoVote', "");
commandToClient(%client, 'voteSubmitted', %vote);
}
}
function calcVotes(%typeName, %arg1, %arg2, %arg3, %arg4)
{
if(%typeName $= "voteMatchStart")
if($MatchStarted || $countdownStarted)
return;
for ( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ )
{
%cl = ClientGroup.getObject( %clientIndex );
messageClient(%cl, 'closeVoteHud', "");
if ( %cl.vote !$= "" )
{
if ( %cl.vote )
{
Game.votesFor[%cl.team]++;
Game.totalVotesFor++;
}
else
{
Game.votesAgainst[%cl.team]++;
Game.totalVotesAgainst++;
}
}
else
{
Game.votesNone[%cl.team]++;
Game.totalVotesNone++;
}
}
//Tinman - PURE servers can't call "eval"
//Mark - True, but neither SHOULD a normal server
// - thanks Ian Hardingham
//if (!isPureServer())
// eval( "Game." @ %typeName @ "(false,\"" @ %arg1 @ "\",\"" @ %arg2 @ "\",\"" @ %arg3 @ "\",\"" @ %arg4 @ "\");" );
//else
Game.evalVote(%typeName, false, %arg1, %arg2, %arg3, %arg4);
Game.scheduleVote = "";
Game.kickClient = "";
clearVotes();
}
function clearVotes()
{
for(%clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++)
{
%client = ClientGroup.getObject(%clientIndex);
%client.vote = "";
messageClient(%client, 'clearVoteHud', "");
}
for(%team = 1; %team < 5; %team++)
{
Game.votesFor[%team] = 0;
Game.votesAgainst[%team] = 0;
Game.votesNone[%team] = 0;
Game.totalVotesFor = 0;
Game.totalVotesAgainst = 0;
Game.totalVotesNone = 0;
}
}
// Tournament mode Stuff-----------------------------------
function setModeFFA( %mission, %missionType )
{
if( $Host::TournamentMode )
{
$Host::TournamentMode = false;
if( isObject( Game ) )
Game.gameOver();
loadMission(%mission, %missionType, false);
}
}
function setModeTournament( %mission, %missionType )
{
if( !$Host::TournamentMode )
{
$Host::TournamentMode = true;
if( isObject( Game ) )
Game.gameOver();
loadMission(%mission, %missionType, false);
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,279 +1,279 @@
function aiConnectByIndex(%index, %team)
{
if (%index < 0 || $BotProfile[%index, name] $= "")
return;
if (%team $= "")
%team = -1;
//initialize the profile, if required
if ($BotProfile[%index, skill] $= "")
$BotProfile[%index, skill] = 0.5;
if ($BotProfile[%index, race] $= "")
$BotProfile[%index, race] = "Human";
if ($BotProfile[%index, Sex] $= "")
$BotProfile[%index, Sex] = "Male";
if ($BotProfile[%index, Voice] $= "")
$BotProfile[%index, Voice] = "Bot1";
%skin[0] = "BaseBot";
%skin[1] = "BaseBBot";
if ($BotProfile[%index, Skin] $= '')
$BotProfile[%index, Skin] = %skin[getRandom(0,1)];
$BotProfile[%index, Skin] = addTaggedString($BotProfile[%index, Skin]);
//$BotProfile[%index, Voice] = addTaggedString($BotProfile[%index, Voice]);
%client = aiConnect($BotProfile[%index, name], %team, $BotProfile[%index, skill], $BotProfile[%index, offense], $BotProfile[%index, voice], $BotProfile[%index, voicePitch]);
%client.skin = $BotProfile[%index, skin];
%client.race = $BotProfile[%index, race];
%client.sex = $BotProfile[%index, sex];
%client.voice = $BotProfile[%index, voice];
//Make sure our voices and skins are set
setSkin(%client,getTaggedString(%client.skin)); //Yay.. bots are not ugly anymore!
setVoice(%client,%client.voice);
%client.player.setArmor(%client.armor);
return %client;
}
function aiConnectByName(%name, %team)
{
if (%name $= "")
return;
if (%team $= "")
%team = -1;
%foundIndex = -1;
%index = 0;
while ($BotProfile[%index, name] !$= "")
{
if ($BotProfile[%index, name] $= %name)
{
%foundIndex = %index;
break;
}
else
%index++;
}
//see if we found our bot
if (%foundIndex >= 0)
return aiConnectByIndex(%foundIndex, %team);
//else add a new bot profile
else
{
$BotProfile[%index, name] = %name;
return aiConnectByIndex(%index, %team);
}
}
function aiBotAlreadyConnected(%name)
{
%count = ClientGroup.getCount();
for (%i = 0; %i < %count; %i++)
{
%client = ClientGroup.getObject(%i);
if (%name $= getTaggedString(%client.name))
return true;
}
return false;
}
function aiConnectMultiple(%numToConnect, %minSkill, %maxSkill, %team)
{
//validate the args
if (%numToConnect <= 0)
return;
if (%maxSkill < 0)
%maxSkill = 0;
if (%minSkill >= %maxSkill)
%minSkill = %maxSkill - 0.01;
if (%team $= "")
%team = -1;
//loop through the profiles, and set the flags and initialize
%numBotsAlreadyConnected = 0;
%index = 0;
while ($BotProfile[%index, name] !$= "")
{
//initialize the profile if required
if ($BotProfile[%index, skill] $= "")
$BotProfile[%index, skill] = 0.5;
//if the bot is already playing, it shouldn't be reselected
if (aiBotAlreadyConnected($BotProfile[%index, name]))
{
$BotProfile[%index, canSelect] = false;
%numBotsAlreadyConnected++;
}
else
$BotProfile[%index, canSelect] = true;
%index++;
}
//make sure we're not trying to add more bots than we have...
if (%numToConnect > (%index - %numBotsAlreadyConnected))
%numToConnect = (%index - %numBotsAlreadyConnected);
//build the array of possible candidates...
%index = 0;
%tableCount = 0;
while ($BotProfile[%index, name] !$= "")
{
%botSkill = $BotProfile[%index, skill];
//see if the skill is within range
if ($BotProfile[%index, canSelect] && %botSkill >= %minSkill && %botSkill <= %maxSkill)
{
$BotSelectTable[%tableCount] = %index;
%tableCount++;
$BotProfile[%index, canSelect] = false;
}
//check the next bot
%index++;
}
//if we didn't find enough bots, we'll have to search the rest of the profiles...
%searchMinSkill = %minSkill;
while ((%tableCount < %numToConnect) && (%searchMinSkill > 0))
{
%index = 0;
while ($BotProfile[%index, name] !$= "")
{
%botSkill = $BotProfile[%index, skill];
//see if the skill is within range
if ($BotProfile[%index, canSelect] && %botSkill >= (%searchMinSkill - 0.1) && %botSkill <= %searchMinSkill)
{
$BotSelectTable[%tableCount] = %index;
%tableCount++;
$BotProfile[%index, canSelect] = false;
}
//check the next bot
%index++;
}
//now lower the search min Skill, and take another pass at a lower skill level
%searchMinSkill = %searchMinSkill - 0.1;
}
//if we're still short of bots, search the higher skill levels
%searchMaxSkill = %maxSkill;
while ((%tableCount < %numToConnect) && (%searchMaxSkill < 1.0))
{
%index = 0;
while ($BotProfile[%index, name] !$= "")
{
%botSkill = $BotProfile[%index, skill];
//see if the skill is within range
if ($BotProfile[%index, canSelect] && %botSkill >= %searchMaxSkill && %botSkill <= (%searchMaxSkill + 0.1))
{
$BotSelectTable[%tableCount] = %index;
%tableCount++;
$BotProfile[%index, canSelect] = false;
}
//check the next bot
%index++;
}
//now raise the search max Skill, and take another pass at a higher skill level
%searchMaxSkill = %searchMaxSkill + 0.1;
}
//since the numToConnect was capped at the table size, we should have enough bots in the
//table to fulfill the quota
//loop through five times, picking random indices, and adding them until we've added enough
%numBotsConnected = 0;
for (%i = 0; %i < 5; %i++)
{
for (%j = 0; %j < %numToConnect; %j++)
{
%selectedIndex = mFloor(getRandom() * (%tableCount - 0.1));
if ($BotSelectTable[%selectedIndex] >= 0)
{
//connect the bot
%botClient = aiConnectByIndex($BotSelectTable[%selectedIndex], %team);
%numBotsConnected++;
//adjust the skill level, if required
%botSkill = %botClient.getSkillLevel();
if (%botSkill < %minSkill || %botSkill > %maxSkill)
{
%newSkill = %minSKill + (getRandom() * (%maxSkill - %minSkill));
%botClient.setSkillLevel(%newSkill);
}
//clear the table entry to avoid connecting duplicates
$BotSelectTable[%selectedIndex] = -1;
//see if we've connected enough
if (%numBotsConnected == %numToConnect)
return;
}
}
}
//at this point, we've looped though the table, and kept hitting duplicates, search the table sequentially
for (%i = 0; %i < %tableCount; %i++)
{
if ($BotSelectTable[%i] >= 0)
{
//connect the bot
%botClient = aiConnectByIndex($BotSelectTable[%i], %team);
%numBotsConnected++;
//adjust the skill level, if required
%botSkill = %botClient.getSkillLevel();
if (%botSkill < %minSkill || %botSkill > %maxSkill)
{
%newSkill = %minSKill + (getRandom() * (%maxSkill - %minSkill));
%botClient.setSkillLevel(%newSkill);
}
//clear the table entry to avoid connecting duplicates
$BotSelectTable[%i] = -1;
//see if we've connected enough
if (%numBotsConnected == %numToConnect)
return;
}
}
}
function aiReloadProfiles()
{
if (!IsObject(BotProfiles))
new ScriptObject(BotProfiles) { class = "BasicDataParser"; };
BotProfiles.empty();
BotProfiles.load("prefs/Bot Profiles.conf");
%count = BotProfiles.count("Bot");
for (%i = 0; %i < %count; %i++)
{
%Entry = BotProfiles.get("Bot",%i);
$BotProfile[%i, name] = %Entry.element("Name");
$BotProfile[%i, skill] = %Entry.element("skill");
$BotProfile[%i, offense] = %Entry.element("offense");
$BotProfile[%i, voicePitch] = %Entry.element("voicePitch");
$BotProfile[%i, race] = %Entry.element("race");
$BotProfile[%i, skin] = %Entry.element("skin");
$BotProfile[%i, voice] = %Entry.element("voice");
$BotProfile[%i, sex] = %Entry.element("sex");
}
$BotProfile::Count = %count;
warn("scripts/aiBotProfiles.cs: Loaded" SPC %count SPC "bot profiles.");
return true;
}
function aiConnectByIndex(%index, %team)
{
if (%index < 0 || $BotProfile[%index, name] $= "")
return;
if (%team $= "")
%team = -1;
//initialize the profile, if required
if ($BotProfile[%index, skill] $= "")
$BotProfile[%index, skill] = 0.5;
if ($BotProfile[%index, race] $= "")
$BotProfile[%index, race] = "Human";
if ($BotProfile[%index, Sex] $= "")
$BotProfile[%index, Sex] = "Male";
if ($BotProfile[%index, Voice] $= "")
$BotProfile[%index, Voice] = "Bot1";
%skin[0] = "BaseBot";
%skin[1] = "BaseBBot";
if ($BotProfile[%index, Skin] $= '')
$BotProfile[%index, Skin] = %skin[getRandom(0,1)];
$BotProfile[%index, Skin] = addTaggedString($BotProfile[%index, Skin]);
//$BotProfile[%index, Voice] = addTaggedString($BotProfile[%index, Voice]);
%client = aiConnect($BotProfile[%index, name], %team, $BotProfile[%index, skill], $BotProfile[%index, offense], $BotProfile[%index, voice], $BotProfile[%index, voicePitch]);
%client.skin = $BotProfile[%index, skin];
%client.race = $BotProfile[%index, race];
%client.sex = $BotProfile[%index, sex];
%client.voice = $BotProfile[%index, voice];
//Make sure our voices and skins are set
setSkin(%client,getTaggedString(%client.skin)); //Yay.. bots are not ugly anymore!
setVoice(%client,%client.voice);
%client.player.setArmor(%client.armor);
return %client;
}
function aiConnectByName(%name, %team)
{
if (%name $= "")
return;
if (%team $= "")
%team = -1;
%foundIndex = -1;
%index = 0;
while ($BotProfile[%index, name] !$= "")
{
if ($BotProfile[%index, name] $= %name)
{
%foundIndex = %index;
break;
}
else
%index++;
}
//see if we found our bot
if (%foundIndex >= 0)
return aiConnectByIndex(%foundIndex, %team);
//else add a new bot profile
else
{
$BotProfile[%index, name] = %name;
return aiConnectByIndex(%index, %team);
}
}
function aiBotAlreadyConnected(%name)
{
%count = ClientGroup.getCount();
for (%i = 0; %i < %count; %i++)
{
%client = ClientGroup.getObject(%i);
if (%name $= getTaggedString(%client.name))
return true;
}
return false;
}
function aiConnectMultiple(%numToConnect, %minSkill, %maxSkill, %team)
{
//validate the args
if (%numToConnect <= 0)
return;
if (%maxSkill < 0)
%maxSkill = 0;
if (%minSkill >= %maxSkill)
%minSkill = %maxSkill - 0.01;
if (%team $= "")
%team = -1;
//loop through the profiles, and set the flags and initialize
%numBotsAlreadyConnected = 0;
%index = 0;
while ($BotProfile[%index, name] !$= "")
{
//initialize the profile if required
if ($BotProfile[%index, skill] $= "")
$BotProfile[%index, skill] = 0.5;
//if the bot is already playing, it shouldn't be reselected
if (aiBotAlreadyConnected($BotProfile[%index, name]))
{
$BotProfile[%index, canSelect] = false;
%numBotsAlreadyConnected++;
}
else
$BotProfile[%index, canSelect] = true;
%index++;
}
//make sure we're not trying to add more bots than we have...
if (%numToConnect > (%index - %numBotsAlreadyConnected))
%numToConnect = (%index - %numBotsAlreadyConnected);
//build the array of possible candidates...
%index = 0;
%tableCount = 0;
while ($BotProfile[%index, name] !$= "")
{
%botSkill = $BotProfile[%index, skill];
//see if the skill is within range
if ($BotProfile[%index, canSelect] && %botSkill >= %minSkill && %botSkill <= %maxSkill)
{
$BotSelectTable[%tableCount] = %index;
%tableCount++;
$BotProfile[%index, canSelect] = false;
}
//check the next bot
%index++;
}
//if we didn't find enough bots, we'll have to search the rest of the profiles...
%searchMinSkill = %minSkill;
while ((%tableCount < %numToConnect) && (%searchMinSkill > 0))
{
%index = 0;
while ($BotProfile[%index, name] !$= "")
{
%botSkill = $BotProfile[%index, skill];
//see if the skill is within range
if ($BotProfile[%index, canSelect] && %botSkill >= (%searchMinSkill - 0.1) && %botSkill <= %searchMinSkill)
{
$BotSelectTable[%tableCount] = %index;
%tableCount++;
$BotProfile[%index, canSelect] = false;
}
//check the next bot
%index++;
}
//now lower the search min Skill, and take another pass at a lower skill level
%searchMinSkill = %searchMinSkill - 0.1;
}
//if we're still short of bots, search the higher skill levels
%searchMaxSkill = %maxSkill;
while ((%tableCount < %numToConnect) && (%searchMaxSkill < 1.0))
{
%index = 0;
while ($BotProfile[%index, name] !$= "")
{
%botSkill = $BotProfile[%index, skill];
//see if the skill is within range
if ($BotProfile[%index, canSelect] && %botSkill >= %searchMaxSkill && %botSkill <= (%searchMaxSkill + 0.1))
{
$BotSelectTable[%tableCount] = %index;
%tableCount++;
$BotProfile[%index, canSelect] = false;
}
//check the next bot
%index++;
}
//now raise the search max Skill, and take another pass at a higher skill level
%searchMaxSkill = %searchMaxSkill + 0.1;
}
//since the numToConnect was capped at the table size, we should have enough bots in the
//table to fulfill the quota
//loop through five times, picking random indices, and adding them until we've added enough
%numBotsConnected = 0;
for (%i = 0; %i < 5; %i++)
{
for (%j = 0; %j < %numToConnect; %j++)
{
%selectedIndex = mFloor(getRandom() * (%tableCount - 0.1));
if ($BotSelectTable[%selectedIndex] >= 0)
{
//connect the bot
%botClient = aiConnectByIndex($BotSelectTable[%selectedIndex], %team);
%numBotsConnected++;
//adjust the skill level, if required
%botSkill = %botClient.getSkillLevel();
if (%botSkill < %minSkill || %botSkill > %maxSkill)
{
%newSkill = %minSKill + (getRandom() * (%maxSkill - %minSkill));
%botClient.setSkillLevel(%newSkill);
}
//clear the table entry to avoid connecting duplicates
$BotSelectTable[%selectedIndex] = -1;
//see if we've connected enough
if (%numBotsConnected == %numToConnect)
return;
}
}
}
//at this point, we've looped though the table, and kept hitting duplicates, search the table sequentially
for (%i = 0; %i < %tableCount; %i++)
{
if ($BotSelectTable[%i] >= 0)
{
//connect the bot
%botClient = aiConnectByIndex($BotSelectTable[%i], %team);
%numBotsConnected++;
//adjust the skill level, if required
%botSkill = %botClient.getSkillLevel();
if (%botSkill < %minSkill || %botSkill > %maxSkill)
{
%newSkill = %minSKill + (getRandom() * (%maxSkill - %minSkill));
%botClient.setSkillLevel(%newSkill);
}
//clear the table entry to avoid connecting duplicates
$BotSelectTable[%i] = -1;
//see if we've connected enough
if (%numBotsConnected == %numToConnect)
return;
}
}
}
function aiReloadProfiles()
{
if (!IsObject(BotProfiles))
new ScriptObject(BotProfiles) { class = "BasicDataParser"; };
BotProfiles.empty();
BotProfiles.load("prefs/Bot Profiles.conf");
%count = BotProfiles.count("Bot");
for (%i = 0; %i < %count; %i++)
{
%Entry = BotProfiles.get("Bot",%i);
$BotProfile[%i, name] = %Entry.element("Name");
$BotProfile[%i, skill] = %Entry.element("skill");
$BotProfile[%i, offense] = %Entry.element("offense");
$BotProfile[%i, voicePitch] = %Entry.element("voicePitch");
$BotProfile[%i, race] = %Entry.element("race");
$BotProfile[%i, skin] = %Entry.element("skin");
$BotProfile[%i, voice] = %Entry.element("voice");
$BotProfile[%i, sex] = %Entry.element("sex");
}
$BotProfile::Count = %count;
warn("scripts/aiBotProfiles.cs: Loaded" SPC %count SPC "bot profiles.");
return true;
}
aiReloadProfiles();

View file

@ -1,25 +1,25 @@
function DMGame::AIInit(%game)
{
//call the default AIInit() function
AIInit();
}
function DMGame::onAIRespawn(%game, %client)
{
//add the default task
if (! %client.defaultTasksAdded)
{
%client.defaultTasksAdded = true;
%client.addTask(AIEngageTask);
%client.addTask(AIPickupItemTask);
%client.addTask(AIUseInventoryTask);
%client.addTask(AITauntCorpseTask);
%client.addTask(AIEngageTurretTask);
%client.addtask(AIDetectMineTask);
%client.addTask(AIPatrolTask);
}
//set the inv flag
%client.spawnUseInv = true;
}
function DMGame::AIInit(%game)
{
//call the default AIInit() function
AIInit();
}
function DMGame::onAIRespawn(%game, %client)
{
//add the default task
if (! %client.defaultTasksAdded)
{
%client.defaultTasksAdded = true;
%client.addTask(AIEngageTask);
%client.addTask(AIPickupItemTask);
%client.addTask(AIUseInventoryTask);
%client.addTask(AITauntCorpseTask);
%client.addTask(AIEngageTurretTask);
%client.addtask(AIDetectMineTask);
%client.addTask(AIPatrolTask);
}
//set the inv flag
%client.spawnUseInv = true;
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,26 +1,26 @@
function BOLGame::AIInit(%game)
{
//call the default AIInit() function
AIInit();
}
function BOLGame::onAIRespawn(%game, %client)
{
//add the default task
if (! %client.defaultTasksAdded)
{
%client.defaultTasksAdded = true;
%client.addTask(AIEngageTask);
%client.addTask(AIPickupItemTask);
// %client.addTask(AIUseInventoryTask); They spawn with the stuff they need
%client.addTask(AITauntCorpseTask);
%client.addTask(AIEngageTurretTask);
%client.addtask(AIDetectMineTask);
// %client.addTask(AIPatrolTask); They don't move unless told to
}
//set the inv flag
%client.spawnUseInv = true;
}
function BOLGame::AIInit(%game)
{
//call the default AIInit() function
AIInit();
}
function BOLGame::onAIRespawn(%game, %client)
{
//add the default task
if (! %client.defaultTasksAdded)
{
%client.defaultTasksAdded = true;
%client.addTask(AIEngageTask);
%client.addTask(AIPickupItemTask);
// %client.addTask(AIUseInventoryTask); They spawn with the stuff they need
%client.addTask(AITauntCorpseTask);
%client.addTask(AIEngageTurretTask);
%client.addtask(AIDetectMineTask);
// %client.addTask(AIPatrolTask); They don't move unless told to
}
//set the inv flag
%client.spawnUseInv = true;
}

File diff suppressed because it is too large Load diff

View file

@ -1,117 +1,117 @@
////////////////////////////////////////
// AI functions for Clan Practice CTF //
// z0dd - ZOD, 4/25/02 //
////////////////////////////////////////
function PracticeCTFGame::onAIRespawn(%game, %client)
{
//add the default task
if (! %client.defaultTasksAdded)
{
%client.defaultTasksAdded = true;
%client.addTask(AIEngageTask);
%client.addTask(AIPickupItemTask);
%client.addTask(AITauntCorpseTask);
%client.addtask(AIEngageTurretTask);
%client.addtask(AIDetectMineTask);
}
}
function PracticeCTFGame::AIInit(%game)
{
// load external objectives files
loadObjectives();
for (%i = 1; %i <= %game.numTeams; %i++)
{
if (!isObject($ObjectiveQ[%i]))
{
$ObjectiveQ[%i] = new AIObjectiveQ();
MissionCleanup.add($ObjectiveQ[%i]);
}
error("team " @ %i @ " objectives load...");
$ObjectiveQ[%i].clear();
AIInitObjectives(%i, %game);
}
//call the default AIInit() function
AIInit();
}
function PracticeCTFGame::AIplayerCaptureFlipFlop(%game, %player, %flipFlop)
{
}
function PracticeCTFGame::AIplayerTouchEnemyFlag(%game, %player, %flag)
{
}
function PracticeCTFGame::AIplayerTouchOwnFlag(%game, %player, %flag)
{
}
function PracticeCTFGame::AIflagCap(%game, %player, %flag)
{
//signal the flag cap event
AIRespondToEvent(%player.client, 'EnemyFlagCaptured', %player.client);
// MES - changed above line - did not pass args in correct order
}
function PracticeCTFGame::AIplayerDroppedFlag(%game, %player, %flag)
{
}
function PracticeCTFGame::AIflagReset(%game, %flag)
{
}
function PracticeCTFGame::onAIDamaged(%game, %clVictim, %clAttacker, %damageType, %implement)
{
if (%clAttacker && %clAttacker != %clVictim && %clAttacker.team == %clVictim.team)
{
schedule(250, %clVictim, "AIPlayAnimSound", %clVictim, %clAttacker.player.getWorldBoxCenter(), "wrn.watchit", -1, -1, 0);
//clear the "lastDamageClient" tag so we don't turn on teammates... unless it's uberbob!
%clVictim.lastDamageClient = -1;
}
}
function PracticeCTFGame::onAIKilledClient(%game, %clVictim, %clAttacker, %damageType, %implement)
{
if (%clVictim.team != %clAttacker.team)
DefaultGame::onAIKilledClient(%game, %clVictim, %clAttacker, %damageType, %implement);
}
function PracticeCTFGame::onAIKilled(%game, %clVictim, %clAttacker, %damageType, %implement)
{
DefaultGame::onAIKilled(%game, %clVictim, %clAttacker, %damageType, %implement);
}
function PracticeCTFGame::onAIFriendlyFire(%game, %clVictim, %clAttacker, %damageType, %implement)
{
if (%clAttacker && %clAttacker.team == %clVictim.team && %clAttacker != %clVictim && !%clVictim.isAIControlled())
{
// The Bot is only a little sorry:
if ( getRandom() > 0.9 )
AIMessageThread("ChatSorry", %clAttacker, %clVictim);
}
}
function PracticeCTFGame::AIHalfTime(%game)
{
//clear all the bots, and clean up all the sets, objective qs, etc...
AIMissionEnd();
//reset everything from scratch
%game.aiInit();
//respawn all the bots
for (%i = 0; %i < ClientGroup.getCount(); %i++)
{
%cl = ClientGroup.getObject(%i);
if (%cl.isAIControlled())
onAIRespawn(%cl);
}
}
////////////////////////////////////////
// AI functions for Clan Practice CTF //
// z0dd - ZOD, 4/25/02 //
////////////////////////////////////////
function PracticeCTFGame::onAIRespawn(%game, %client)
{
//add the default task
if (! %client.defaultTasksAdded)
{
%client.defaultTasksAdded = true;
%client.addTask(AIEngageTask);
%client.addTask(AIPickupItemTask);
%client.addTask(AITauntCorpseTask);
%client.addtask(AIEngageTurretTask);
%client.addtask(AIDetectMineTask);
}
}
function PracticeCTFGame::AIInit(%game)
{
// load external objectives files
loadObjectives();
for (%i = 1; %i <= %game.numTeams; %i++)
{
if (!isObject($ObjectiveQ[%i]))
{
$ObjectiveQ[%i] = new AIObjectiveQ();
MissionCleanup.add($ObjectiveQ[%i]);
}
error("team " @ %i @ " objectives load...");
$ObjectiveQ[%i].clear();
AIInitObjectives(%i, %game);
}
//call the default AIInit() function
AIInit();
}
function PracticeCTFGame::AIplayerCaptureFlipFlop(%game, %player, %flipFlop)
{
}
function PracticeCTFGame::AIplayerTouchEnemyFlag(%game, %player, %flag)
{
}
function PracticeCTFGame::AIplayerTouchOwnFlag(%game, %player, %flag)
{
}
function PracticeCTFGame::AIflagCap(%game, %player, %flag)
{
//signal the flag cap event
AIRespondToEvent(%player.client, 'EnemyFlagCaptured', %player.client);
// MES - changed above line - did not pass args in correct order
}
function PracticeCTFGame::AIplayerDroppedFlag(%game, %player, %flag)
{
}
function PracticeCTFGame::AIflagReset(%game, %flag)
{
}
function PracticeCTFGame::onAIDamaged(%game, %clVictim, %clAttacker, %damageType, %implement)
{
if (%clAttacker && %clAttacker != %clVictim && %clAttacker.team == %clVictim.team)
{
schedule(250, %clVictim, "AIPlayAnimSound", %clVictim, %clAttacker.player.getWorldBoxCenter(), "wrn.watchit", -1, -1, 0);
//clear the "lastDamageClient" tag so we don't turn on teammates... unless it's uberbob!
%clVictim.lastDamageClient = -1;
}
}
function PracticeCTFGame::onAIKilledClient(%game, %clVictim, %clAttacker, %damageType, %implement)
{
if (%clVictim.team != %clAttacker.team)
DefaultGame::onAIKilledClient(%game, %clVictim, %clAttacker, %damageType, %implement);
}
function PracticeCTFGame::onAIKilled(%game, %clVictim, %clAttacker, %damageType, %implement)
{
DefaultGame::onAIKilled(%game, %clVictim, %clAttacker, %damageType, %implement);
}
function PracticeCTFGame::onAIFriendlyFire(%game, %clVictim, %clAttacker, %damageType, %implement)
{
if (%clAttacker && %clAttacker.team == %clVictim.team && %clAttacker != %clVictim && !%clVictim.isAIControlled())
{
// The Bot is only a little sorry:
if ( getRandom() > 0.9 )
AIMessageThread("ChatSorry", %clAttacker, %clVictim);
}
}
function PracticeCTFGame::AIHalfTime(%game)
{
//clear all the bots, and clean up all the sets, objective qs, etc...
AIMissionEnd();
//reset everything from scratch
%game.aiInit();
//respawn all the bots
for (%i = 0; %i < ClientGroup.getCount(); %i++)
{
%cl = ClientGroup.getObject(%i);
if (%cl.isAIControlled())
onAIRespawn(%cl);
}
}

View file

@ -1,26 +1,26 @@
function RPGGame::AIInit(%game)
{
//call the default AIInit() function
AIInit();
}
function RPGGame::onAIRespawn(%game, %client)
{
//add the default task
if (! %client.defaultTasksAdded)
{
%client.defaultTasksAdded = true;
%client.addTask(AIEngageTask);
%client.addTask(AIPickupItemTask);
// %client.addTask(AIUseInventoryTask); They spawn with the stuff they need
%client.addTask(AITauntCorpseTask);
%client.addTask(AIEngageTurretTask);
%client.addtask(AIDetectMineTask);
// %client.addTask(AIPatrolTask); They don't move unless told to
}
//set the inv flag
%client.spawnUseInv = true;
}
function RPGGame::AIInit(%game)
{
//call the default AIInit() function
AIInit();
}
function RPGGame::onAIRespawn(%game, %client)
{
//add the default task
if (! %client.defaultTasksAdded)
{
%client.defaultTasksAdded = true;
%client.addTask(AIEngageTask);
%client.addTask(AIPickupItemTask);
// %client.addTask(AIUseInventoryTask); They spawn with the stuff they need
%client.addTask(AITauntCorpseTask);
%client.addTask(AIEngageTurretTask);
%client.addtask(AIDetectMineTask);
// %client.addTask(AIPatrolTask); They don't move unless told to
}
//set the inv flag
%client.spawnUseInv = true;
}

View file

@ -1,44 +1,44 @@
// --------------------------------------------------------
// aiSurvival.cs
// AI scripts for bots in the Survival gamemode
// Copyright (c) 2012 The DarkDragonDX
// ========================================================
function SVGame::AIInit(%game)
{
//call the default AIInit() function
AIInit();
return true;
}
function SVGame::onAIRespawn(%game, %client)
{
//add the default task
if (! %client.defaultTasksAdded)
{
%client.defaultTasksAdded = true;
%client.addTask(AIEngageTask);
%client.addTask(AIPickupItemTask);
// %client.addTask(AITauntCorpseTask);
%client.addTask(AIEngageTurretTask);
// %client.addtask(AIDetectMineTask);
%client.addTask(AIPatrolTask);
}
%client.setSkillLevel(99);
%client.hide();
%client.hideClientInList();
//Now, force the bot to choose a player
%count = clientGroup.getCount();
%rnd = getRandom(0,%count);
%rndcl = clientGroup.getObject(%rnd);
%client.stepEngage(%rndcl);
Game.aiCount++;
//set the inv flag
%client.spawnUseInv = true;
return true;
// --------------------------------------------------------
// aiSurvival.cs
// AI scripts for bots in the Survival gamemode
// Copyright (c) 2012 The DarkDragonDX
// ========================================================
function SVGame::AIInit(%game)
{
//call the default AIInit() function
AIInit();
return true;
}
function SVGame::onAIRespawn(%game, %client)
{
//add the default task
if (! %client.defaultTasksAdded)
{
%client.defaultTasksAdded = true;
%client.addTask(AIEngageTask);
%client.addTask(AIPickupItemTask);
// %client.addTask(AITauntCorpseTask);
%client.addTask(AIEngageTurretTask);
// %client.addtask(AIDetectMineTask);
%client.addTask(AIPatrolTask);
}
%client.setSkillLevel(99);
%client.hide();
%client.hideClientInList();
//Now, force the bot to choose a player
%count = clientGroup.getCount();
%rnd = getRandom(0,%count);
%rndcl = clientGroup.getObject(%rnd);
%client.stepEngage(%rndcl);
Game.aiCount++;
//set the inv flag
%client.spawnUseInv = true;
return true;
}

View file

@ -1,76 +1,76 @@
// #autoload
// #name = Fix Remap
// #version = 1.0
// #category = Fix
// #warrior = WegBert
// #status = beta
function redoBrokenMapping( %actionMap, %device, %action, %cmd, %newIndex )
{
%actionMap.bind( %device, %action, %cmd );
//OP_RemapList.setRowById( %oldIndex, buildFullMapString( %oldIndex ) );
OP_RemapList.setRowById( %newIndex, buildFullMapString( %newIndex ) );
}
package FixRemapLoad {
function RemapInputCtrl::onInputEvent( %this, %device, %action )
{
Parent::onInputEvent( %this, %device, %action );
// prevMapIndex would equal -1 under the following circumstances:
//
// 1. User installed a third-party script which added a remap entry to the list.
// The user removed that script and is trying to rebind a key that was
// previously bound to that script. With the remap entry missing, the system
// fails, because the function bound to the key has no $RemapCmd.
//
// 2. User installed a third-party script which did not add a remap entry to the
// list, but instead replaced an existing command with a third-party one
// (for example, the HappyThrow script upon being run for the first time
// rebinds the user's grenade key from the default function, throwGrenade, to
// throwGrenadeNew). The script may still be installed, but the user is trying
// to rebind the key bound to the third-party function. This third-party function,
// although perfectly valid and existing, has no $RemapCmd.
//
// To counter these problems, the script will warn the user that the function may or
// may not exist. It will allow the user to choose whether they still want to rebind
// the key or not. If they do, the script will proceed with the remapping that the
// original fon complained about.
if (%this.mode !$= "consoleKey")
{
switch$ ( OP_ControlsPane.group )
{
case "Observer":
%actionMap = observerMap;
%cmd = $ObsRemapCmd[%this.index];
default:
%actionMap = moveMap;
%cmd = $RemapCmd[%this.index];
}
%prevMap = %actionMap.getCommand( %device, %action );
if (%prevMap !$= %cmd && %prevMap !$= "")
{
%mapName = getMapDisplayName( %device, %action );
%prevMapIndex = findRemapCmdIndex( %prevMap );
if (%prevMapIndex == -1)
{
// The OK dialog has probably popped up now, so turn it off. We've got the situation
// under control.
if (MessageBoxOKDlg.isAwake())
Canvas.popDialog(MessageBoxOKDlg);
MessageBoxYesNo( "FIXREMAP WARNING",
"\"" @ %mapName @ "\" is bound to the function \"" @ %prevMap @ "\"! The function may exist in a user script. See FixRemap.txt in your T2 autoexec dir for more details. Do you still want to undo this mapping?",
"redoBrokenMapping(" @ %actionMap @ ", " @ %device @ ", \"" @ %action @ "\", \"" @ %cmd @ "\", " @ %this.index @ ");", "" );
}
}
}
}
};
activatePackage(FixRemapLoad);
// #autoload
// #name = Fix Remap
// #version = 1.0
// #category = Fix
// #warrior = WegBert
// #status = beta
function redoBrokenMapping( %actionMap, %device, %action, %cmd, %newIndex )
{
%actionMap.bind( %device, %action, %cmd );
//OP_RemapList.setRowById( %oldIndex, buildFullMapString( %oldIndex ) );
OP_RemapList.setRowById( %newIndex, buildFullMapString( %newIndex ) );
}
package FixRemapLoad {
function RemapInputCtrl::onInputEvent( %this, %device, %action )
{
Parent::onInputEvent( %this, %device, %action );
// prevMapIndex would equal -1 under the following circumstances:
//
// 1. User installed a third-party script which added a remap entry to the list.
// The user removed that script and is trying to rebind a key that was
// previously bound to that script. With the remap entry missing, the system
// fails, because the function bound to the key has no $RemapCmd.
//
// 2. User installed a third-party script which did not add a remap entry to the
// list, but instead replaced an existing command with a third-party one
// (for example, the HappyThrow script upon being run for the first time
// rebinds the user's grenade key from the default function, throwGrenade, to
// throwGrenadeNew). The script may still be installed, but the user is trying
// to rebind the key bound to the third-party function. This third-party function,
// although perfectly valid and existing, has no $RemapCmd.
//
// To counter these problems, the script will warn the user that the function may or
// may not exist. It will allow the user to choose whether they still want to rebind
// the key or not. If they do, the script will proceed with the remapping that the
// original fon complained about.
if (%this.mode !$= "consoleKey")
{
switch$ ( OP_ControlsPane.group )
{
case "Observer":
%actionMap = observerMap;
%cmd = $ObsRemapCmd[%this.index];
default:
%actionMap = moveMap;
%cmd = $RemapCmd[%this.index];
}
%prevMap = %actionMap.getCommand( %device, %action );
if (%prevMap !$= %cmd && %prevMap !$= "")
{
%mapName = getMapDisplayName( %device, %action );
%prevMapIndex = findRemapCmdIndex( %prevMap );
if (%prevMapIndex == -1)
{
// The OK dialog has probably popped up now, so turn it off. We've got the situation
// under control.
if (MessageBoxOKDlg.isAwake())
Canvas.popDialog(MessageBoxOKDlg);
MessageBoxYesNo( "FIXREMAP WARNING",
"\"" @ %mapName @ "\" is bound to the function \"" @ %prevMap @ "\"! The function may exist in a user script. See FixRemap.txt in your T2 autoexec dir for more details. Do you still want to undo this mapping?",
"redoBrokenMapping(" @ %actionMap @ ", " @ %device @ ", \"" @ %action @ "\", \"" @ %cmd @ "\", " @ %this.index @ ");", "" );
}
}
}
}
};
activatePackage(FixRemapLoad);

View file

@ -1,30 +1,42 @@
// #autoload
// #name = GUIML Workaround
// #version = 2.0
// #date = March 1st, 2010
// #category = Fix
// #author = Dark Dragon DX
// #warrior = DarkDragonDX
// #email = DarkDragonDX@Hotmail.com
// #description = Adds a failSafe for the <a:command> tag. Mainly for players that use mods with interactive GUIML elements.
package GUIMLPackage
{
function toggleEditor(%make)
{
parent::toggleEditor(%make); //Call parent function
if (!isActivePackage(GUIMLWorkaround))
activatePackage(GUIMLWorkaround);
}
};
activatePackage(GUIMLPackage);
//Seperate package to activate our new code
package GUIMLWorkaround
{
function GuiMLTextCtrl::onURL(%this, %url)
{
//parent::onURL(%this, %url);
commandToServer('ProcessGameLink',getField(%url,1));
}
};
// #autoload
// #name = GUIML Workaround
// #version = 3.0
// #date = November 22nd, 2012
// #category = Fix
// #author = Robert MacGregor
// #warrior = DarkDragonDX
// #email = DarkDragonDX@Hotmail.com
// #description = Repairs broken functionality with certain GUIML elements after the T2 mission editor has been initialised. And in some cases, where they misbehave for no known reason.
// Separate Package just to ensure the code is "injected" at the right time
package GUIMLInjection
{
// Takes care of opening the F2 menu on certain server/client combinations not working properly
function ScoreScreen::onWake(%this)
{
parent::onWake(%this);
if (!isActivePackage(GUIMLWorkaround))
activatePackage(GUIMLWorkaround);
}
// Takes care of if we just launch the editor but never use the F2 menu; clicking a link in say a server desc
function toggleEditor(%make)
{
parent::toggleEditor(%make);
if (!isActivePackage(GUIMLWorkaround))
activatePackage(GUIMLWorkaround);
}
};
activatePackage(GUIMLInjection);
//Seperate package to activate our new code
package GUIMLWorkaround
{
function GuiMLTextCtrl::onURL(%this, %url)
{
if (getField(%url,0) $= "wwwlink")
parent::onURL(%this, getField(%url, 1)); // Opens a web browser window as it should
else
commandToServer('ProcessGameLink',getField(%url, 1), getField(%url, 2), getField(%url, 3), getField(%url, 4), getField(%url, 5));
}
};

File diff suppressed because it is too large Load diff

View file

@ -1,33 +1,33 @@
// #autoload
// #name = Terrain UE Prevent
// #version = 1.0
// #date = Saturday, July 25, 2009
// #category = Fix
// #author = Dark Dragon DX
// #warrior = DarkDragonDX
// #email = DarkDragonDX@Hotmail.com
// #description = A "prevention" for when you open the command Circuit on a map without terrain and UE. (Like ANTS)
package TerrainFix
{
function toggleCommanderMap(%val)
{
%count = ServerConnection.getCount();
for (%i = 0; %i < %count; %i++) //Search for my terrain..
{
%obj = ServerConnection.getObject(%i); //Get the object
if (%obj != -1) //No console spam
if (%obj.getClassName() $= "TerrainBlock") //Is it terrain?
{
parent::toggleCommanderMap(%val); //Win
return true;
}
}
messageBoxOk("Error","Unable to open command circuit, no terrain exists."); //Tell me
return false;
}
};
activatePackage(TerrainFix);
// #autoload
// #name = Terrain UE Prevent
// #version = 1.0
// #date = Saturday, July 25, 2009
// #category = Fix
// #author = Dark Dragon DX
// #warrior = DarkDragonDX
// #email = DarkDragonDX@Hotmail.com
// #description = A "prevention" for when you open the command Circuit on a map without terrain and UE. (Like ANTS)
package TerrainFix
{
function toggleCommanderMap(%val)
{
%count = ServerConnection.getCount();
for (%i = 0; %i < %count; %i++) //Search for my terrain..
{
%obj = ServerConnection.getObject(%i); //Get the object
if (%obj != -1) //No console spam
if (%obj.getClassName() $= "TerrainBlock") //Is it terrain?
{
parent::toggleCommanderMap(%val); //Win
return true;
}
}
messageBoxOk("Error","Unable to open command circuit, no terrain exists."); //Tell me
return false;
}
};
activatePackage(TerrainFix);

View file

@ -1,28 +1,28 @@
// #autoload
// #name = cleanDSO
// #version = 1.0
// #date = December 21, 2001
// #author = Paul Tousignant
// #warrior = UberGuy (FT)
// #email = uberguy@skyreach.cas.nwu.edu
// #web = http://scripts.tribalwar.com/uberguy
// #description = Remove all your *.dso files every time you exit T2.
// #status = beta
package noDso {
function quit() {
%cnt = 0;
%tmpObj = new ScriptObject() {};
for(%file = findFirstFile("*.dso"); %file !$= ""; %file = findNextFile("*.dso")) {
%tmpObj.file[%cnt++] = %file;
}
for (%i=0; %i<%cnt; %i++) {
deleteFile(%tmpObj.file[%i]);
}
%tmpObj.delete();
return parent::quit();
}
};
activatePackage(noDso);
// #autoload
// #name = cleanDSO
// #version = 1.0
// #date = December 21, 2001
// #author = Paul Tousignant
// #warrior = UberGuy (FT)
// #email = uberguy@skyreach.cas.nwu.edu
// #web = http://scripts.tribalwar.com/uberguy
// #description = Remove all your *.dso files every time you exit T2.
// #status = beta
package noDso {
function quit() {
%cnt = 0;
%tmpObj = new ScriptObject() {};
for(%file = findFirstFile("*.dso"); %file !$= ""; %file = findNextFile("*.dso")) {
%tmpObj.file[%cnt++] = %file;
}
for (%i=0; %i<%cnt; %i++) {
deleteFile(%tmpObj.file[%i]);
}
%tmpObj.delete();
return parent::quit();
}
};
activatePackage(noDso);

View file

@ -1,67 +1,67 @@
// #autoload
// #name = Debug Log
// #version = 1.0
// #category = Utility
// #warrior = DarkDragonDX
// #description = Adds a debug log.
package debugLog
{
function echo(%arg1, %arg2, %arg3, %arg4, %arg5, %arg6, %arg7, %arg8, %arg9, %arg10)
{
if (!IsObject(DebugLogger))
{
new FileObject(DebugLogger);
DebugLogger.lineCount = 0;
DebugLogger.openForWrite("debugLog.txt");
}
if (DebugLogger.lineCount >= 10)
{
DebugLogger.close();
DebugLogger.openForAppend("debugLog.txt");
}
DebugLogger.writeLine(%arg1 @ %arg2 @ %arg3 @ %arg4 @ %arg5 @ %arg6 @ %arg7 @ %arg8 @ %arg9 @ %arg10);
DebugLogger.lineCount++;
parent::echo(%arg1, %arg2, %arg3, %arg4, %arg5, %arg6, %arg7, %arg8, %arg9, %arg10);
return true;
}
function error(%arg1, %arg2, %arg3, %arg4, %arg5, %arg6, %arg7, %arg8, %arg9, %arg10)
{
if (!IsObject(DebugLogger))
{
new FileObject(DebugLogger);
DebugLogger.lineCount = 0;
DebugLogger.openForWrite("debugLog.txt");
}
if (DebugLogger.lineCount >= 10)
{
DebugLogger.close();
DebugLogger.openForAppend("debugLog.txt");
}
DebugLogger.writeLine("Error: " @ %arg1 @ %arg2 @ %arg3 @ %arg4 @ %arg5 @ %arg6 @ %arg7 @ %arg8 @ %arg9 @ %arg10);
DebugLogger.lineCount++;
parent::error(%arg1, %arg2, %arg3, %arg4, %arg5, %arg6, %arg7, %arg8, %arg9, %arg10);
return true;
}
function warning(%arg1, %arg2, %arg3, %arg4, %arg5, %arg6, %arg7, %arg8, %arg9, %arg10)
{
if (!IsObject(DebugLogger))
{
new FileObject(DebugLogger);
DebugLogger.lineCount = 0;
DebugLogger.openForWrite("debugLog.txt");
}
if (DebugLogger.lineCount >= 10)
{
DebugLogger.close();
DebugLogger.openForAppend("debugLog.txt");
}
DebugLogger.writeLine("Warning: " @ %arg1 @ %arg2 @ %arg3 @ %arg4 @ %arg5 @ %arg6 @ %arg7 @ %arg8 @ %arg9 @ %arg10);
DebugLogger.lineCount++;
parent::warning(%arg1, %arg2, %arg3, %arg4, %arg5, %arg6, %arg7, %arg8, %arg9, %arg10);
return true;
}
};
// #autoload
// #name = Debug Log
// #version = 1.0
// #category = Utility
// #warrior = DarkDragonDX
// #description = Adds a debug log.
package debugLog
{
function echo(%arg1, %arg2, %arg3, %arg4, %arg5, %arg6, %arg7, %arg8, %arg9, %arg10)
{
if (!IsObject(DebugLogger))
{
new FileObject(DebugLogger);
DebugLogger.lineCount = 0;
DebugLogger.openForWrite("debugLog.txt");
}
if (DebugLogger.lineCount >= 10)
{
DebugLogger.close();
DebugLogger.openForAppend("debugLog.txt");
}
DebugLogger.writeLine(%arg1 @ %arg2 @ %arg3 @ %arg4 @ %arg5 @ %arg6 @ %arg7 @ %arg8 @ %arg9 @ %arg10);
DebugLogger.lineCount++;
parent::echo(%arg1, %arg2, %arg3, %arg4, %arg5, %arg6, %arg7, %arg8, %arg9, %arg10);
return true;
}
function error(%arg1, %arg2, %arg3, %arg4, %arg5, %arg6, %arg7, %arg8, %arg9, %arg10)
{
if (!IsObject(DebugLogger))
{
new FileObject(DebugLogger);
DebugLogger.lineCount = 0;
DebugLogger.openForWrite("debugLog.txt");
}
if (DebugLogger.lineCount >= 10)
{
DebugLogger.close();
DebugLogger.openForAppend("debugLog.txt");
}
DebugLogger.writeLine("Error: " @ %arg1 @ %arg2 @ %arg3 @ %arg4 @ %arg5 @ %arg6 @ %arg7 @ %arg8 @ %arg9 @ %arg10);
DebugLogger.lineCount++;
parent::error(%arg1, %arg2, %arg3, %arg4, %arg5, %arg6, %arg7, %arg8, %arg9, %arg10);
return true;
}
function warning(%arg1, %arg2, %arg3, %arg4, %arg5, %arg6, %arg7, %arg8, %arg9, %arg10)
{
if (!IsObject(DebugLogger))
{
new FileObject(DebugLogger);
DebugLogger.lineCount = 0;
DebugLogger.openForWrite("debugLog.txt");
}
if (DebugLogger.lineCount >= 10)
{
DebugLogger.close();
DebugLogger.openForAppend("debugLog.txt");
}
DebugLogger.writeLine("Warning: " @ %arg1 @ %arg2 @ %arg3 @ %arg4 @ %arg5 @ %arg6 @ %arg7 @ %arg8 @ %arg9 @ %arg10);
DebugLogger.lineCount++;
parent::warning(%arg1, %arg2, %arg3, %arg4, %arg5, %arg6, %arg7, %arg8, %arg9, %arg10);
return true;
}
};
activatePackage(debugLog);

View file

@ -1,45 +1,45 @@
//
// xPack-T2-CTF-Maps.vl2 update file.
// MiniVStationX
// Adapted from the original station code by
// Tim 'Zear' Hammock
//
// This file created to address code changes in base++
// To handle issues with certain maps from the xPack Map Pack
// that move the vehicle stations and scale the vehicle pads.
//
// z0dd - ZOD, 4/25/02
package MiniVStationX
{
function StationVehiclePad::createStationVehicle(%data, %obj)
{
Parent::createStationVehicle(%data, %obj);
schedule(250, 0, "moveVStationX");
}
};
function moveVStationX()
{
if($CurrentMission $= "Raindance_x")
{
nametoid(team1vehiclestation).station.setTransform("-180.737 264.173 73.9045 0 0 -0.999913 0.0206931");
nametoid(team1vehiclestation).station.trigger.setTransform("-180.737 264.173 73.9045 0 0 -0.999913 0.0206931");
nametoid(team2vehiclestation).station.setTransform("-44.2395 -559.427 62.578 0 0 1 3.13932");
nametoid(team2vehiclestation).station.trigger.setTransform("-44.2395 -559.427 62.578 0 0 1 3.13932");
}
else if($CurrentMission $= "Rollercoaster_x")
{
nametoid(team1vehiclestation).station.setTransform("357.822 57.4137 157.373 0 0 1 1.752");
nametoid(team1vehiclestation).station.trigger.setTransform("357.822 57.4137 157.373 0 0 1 1.68703");
nametoid(team2vehiclestation).station.setTransform("-401.698 7.81527 156.566 0 0 -1 1.48");
nametoid(team2vehiclestation).station.trigger.setTransform("-401.698 7.81527 156.566 0 0 -1 1.54951");
(nametoid(team1flag)+ 1).setTransform("0 0 0 0 0 0 0");
(nametoid(team2flag)+ 1).setTransform("0 0 0 0 0 0 0");
}
else
return;
}
activatePackage(MiniVStationX);
//
// xPack-T2-CTF-Maps.vl2 update file.
// MiniVStationX
// Adapted from the original station code by
// Tim 'Zear' Hammock
//
// This file created to address code changes in base++
// To handle issues with certain maps from the xPack Map Pack
// that move the vehicle stations and scale the vehicle pads.
//
// z0dd - ZOD, 4/25/02
package MiniVStationX
{
function StationVehiclePad::createStationVehicle(%data, %obj)
{
Parent::createStationVehicle(%data, %obj);
schedule(250, 0, "moveVStationX");
}
};
function moveVStationX()
{
if($CurrentMission $= "Raindance_x")
{
nametoid(team1vehiclestation).station.setTransform("-180.737 264.173 73.9045 0 0 -0.999913 0.0206931");
nametoid(team1vehiclestation).station.trigger.setTransform("-180.737 264.173 73.9045 0 0 -0.999913 0.0206931");
nametoid(team2vehiclestation).station.setTransform("-44.2395 -559.427 62.578 0 0 1 3.13932");
nametoid(team2vehiclestation).station.trigger.setTransform("-44.2395 -559.427 62.578 0 0 1 3.13932");
}
else if($CurrentMission $= "Rollercoaster_x")
{
nametoid(team1vehiclestation).station.setTransform("357.822 57.4137 157.373 0 0 1 1.752");
nametoid(team1vehiclestation).station.trigger.setTransform("357.822 57.4137 157.373 0 0 1 1.68703");
nametoid(team2vehiclestation).station.setTransform("-401.698 7.81527 156.566 0 0 -1 1.48");
nametoid(team2vehiclestation).station.trigger.setTransform("-401.698 7.81527 156.566 0 0 -1 1.54951");
(nametoid(team1flag)+ 1).setTransform("0 0 0 0 0 0 0");
(nametoid(team2flag)+ 1).setTransform("0 0 0 0 0 0 0");
}
else
return;
}
activatePackage(MiniVStationX);

View file

@ -1,53 +1,53 @@
// #autoload
// #name = Safe Mode
// #version = 1.0
// #date = Tuesday, January 12, 2010
// #author = Dark Dragon DX
// #warrior = DarkDragonDX
// #email = DarkDragonDX@Hotmail.com
// #web = http://www.the-Construct.net
// #description = Adds a new command-line to Tribes 2 for shortcuts: -safeMode
// #status = Release
package SafeModeOverrides
{
function TCPObject::onLine(){ return true;}
function TCPObject::connect(){ return true; }
function TCPObject::disconnect(){ return true; }
function TCPObject::listen(){ return true; }
function TCPObject::send(){ return true; }
function HTTPObject::onLine(){ return true; }
function HTTPObject::connect(){ return true; }
function HTTPObject::disconnect(){ return true; }
function HTTPObject::listen(){ return true; }
function HTTPObject::send(){ return true;}
function HTTPObject::post(){ return true; }
function SecureHTTPObject::onLine(){ return true; }
function SecureHTTPObject::connect(){ return true; }
function SecureHTTPObject::disconnect(){ return true; }
function SecureHTTPObject::listen(){ return true; }
function SecureHTTPObject::send(){ return true; }
function SecureHTTPObject::post(){ return true; }
};
package SafeMode
{
function DispatchLaunchMode()
{
parent::DispatchLaunchMode();
// check T2 command line arguments
for(%i = 1; %i < $Game::argc ; %i++)
{
%arg = $Game::argv[%i];
%nextArg = $Game::argv[%i+1];
%hasNextArg = $Game::argc - %i > 1;
if( !stricmp(%arg, "-Safemode")) //If enabled, cuts off all TCP & HTTP object connections, preventing UE's when running T2 without internet
activatePackage(SafeModeOverrides);
}
}
};
// #autoload
// #name = Safe Mode
// #version = 1.0
// #date = Tuesday, January 12, 2010
// #author = Dark Dragon DX
// #warrior = DarkDragonDX
// #email = DarkDragonDX@Hotmail.com
// #web = http://www.the-Construct.net
// #description = Adds a new command-line to Tribes 2 for shortcuts: -safeMode
// #status = Release
package SafeModeOverrides
{
function TCPObject::onLine(){ return true;}
function TCPObject::connect(){ return true; }
function TCPObject::disconnect(){ return true; }
function TCPObject::listen(){ return true; }
function TCPObject::send(){ return true; }
function HTTPObject::onLine(){ return true; }
function HTTPObject::connect(){ return true; }
function HTTPObject::disconnect(){ return true; }
function HTTPObject::listen(){ return true; }
function HTTPObject::send(){ return true;}
function HTTPObject::post(){ return true; }
function SecureHTTPObject::onLine(){ return true; }
function SecureHTTPObject::connect(){ return true; }
function SecureHTTPObject::disconnect(){ return true; }
function SecureHTTPObject::listen(){ return true; }
function SecureHTTPObject::send(){ return true; }
function SecureHTTPObject::post(){ return true; }
};
package SafeMode
{
function DispatchLaunchMode()
{
parent::DispatchLaunchMode();
// check T2 command line arguments
for(%i = 1; %i < $Game::argc ; %i++)
{
%arg = $Game::argv[%i];
%nextArg = $Game::argv[%i+1];
%hasNextArg = $Game::argc - %i > 1;
if( !stricmp(%arg, "-Safemode")) //If enabled, cuts off all TCP & HTTP object connections, preventing UE's when running T2 without internet
activatePackage(SafeModeOverrides);
}
}
};
activatePackage(SafeMode);

View file

@ -1,37 +1,37 @@
// #autoload
// #name = Static Waypoint Fix
// #version = 1.0
// #category = Fix
// #warrior = Jsut
// #description = Fixes static waypoints in the command circuit.
package JsutStaticWaypointFix
{
function CommanderTree::processCommand(%this, %command, %target, %typeTag)
{
parent::processCommand(%this, %command, %target, %typeTag);
// special case?
if(%typeTag < 0)
{
switch$(getTaggedString(%command))
{
// waypoints: tree owns the waypoint targets
case "CreateWayPoint":
%target.settext(%this.currentWaypointID);
return;
}
}
}
};
activatePackage(JsutStaticWaypointFix);
// #autoload
// #name = Static Waypoint Fix
// #version = 1.0
// #category = Fix
// #warrior = Jsut
// #description = Fixes static waypoints in the command circuit.
package JsutStaticWaypointFix
{
function CommanderTree::processCommand(%this, %command, %target, %typeTag)
{
parent::processCommand(%this, %command, %target, %typeTag);
// special case?
if(%typeTag < 0)
{
switch$(getTaggedString(%command))
{
// waypoints: tree owns the waypoint targets
case "CreateWayPoint":
%target.settext(%this.currentWaypointID);
return;
}
}
}
};
activatePackage(JsutStaticWaypointFix);

722
scripts/camera.cs Normal file
View file

@ -0,0 +1,722 @@
$Camera::movementSpeed = 40;
datablock CameraData(Observer)
{
mode = "observerStatic";
firstPersonOnly = true;
};
datablock CameraData(CommanderCamera)
{
mode = "observerStatic";
firstPersonOnly = true;
};
function CommanderCamera::onTrigger( %data, %obj, %trigger, %state )
{
// no need to do anything here.
}
function Observer::onTrigger(%data,%obj,%trigger,%state)
{
// state = 0 means that a trigger key was released
if (%state == 0)
return;
//first, give the game the opportunity to prevent the observer action
if (!Game.ObserverOnTrigger(%data, %obj, %trigger, %state))
return;
//now observer functions if you press the "throw"
if (%trigger >= 4)
return;
//trigger types: 0:fire 1:altTrigger 2:jump 3:jet 4:throw
%client = %obj.getControllingClient();
if (%client == 0)
return;
switch$ (%obj.mode)
{
case "justJoined":
if (isDemo())
clearCenterPrint(%client);
//press FIRE
if (%trigger == 0)
{
// clear intro message
clearBottomPrint( %client );
//spawn the player
commandToClient(%client, 'setHudMode', 'Standard');
Game.assignClientTeam(%client);
Game.spawnPlayer( %client, $MatchStarted );
if( $MatchStarted )
{
%client.camera.setFlyMode();
%client.setControlObject( %client.player );
}
else
{
%client.camera.getDataBlock().setMode( %client.camera, "pre-game", %client.player );
%client.setControlObject( %client.camera );
}
}
//press JET
else if (%trigger == 3)
{
//cycle throw the static observer spawn points
%markerObj = Game.pickObserverSpawn(%client, true);
%transform = %markerObj.getTransform();
%obj.setTransform(%transform);
%obj.setFlyMode();
}
//press JUMP
else if (%trigger == 2)
{
//switch the observer mode to observing clients
if (isObject(%client.observeFlyClient))
serverCmdObserveClient(%client, %client.observeFlyClient);
else
serverCmdObserveClient(%client, -1);
displayObserverHud(%client, %client.observeClient);
messageClient(%client.observeClient, 'Observer', '\c1%1 is now observing you.', %client.name);
}
case "playerDeath":
// Attached to a dead player - spawn regardless of trigger type
if(!%client.waitRespawn && getSimTime() > %client.suicideRespawnTime)
{
commandToClient(%client, 'setHudMode', 'Standard');
Game.spawnPlayer( %client, true );
%client.camera.setFlyMode();
%client.setControlObject(%client.player);
}
case "PreviewMode":
if (%trigger == 0)
{
commandToClient(%client, 'setHudMode', 'Standard');
if( %client.lastTeam )
Game.clientJoinTeam( %client, %client.lastTeam );
else
{
Game.assignClientTeam( %client, true );
// Spawn the player:
Game.spawnPlayer( %client, false );
}
%client.camera.setFlyMode();
%client.setControlObject( %client.player );
}
case "toggleCameraFly":
// this is the default camera mode
case "observerFly":
// Free-flying observer camera
if (%trigger == 0)
{
if( !$Host::TournamentMode && $MatchStarted )
{
// reset observer params
clearBottomPrint(%client);
commandToClient(%client, 'setHudMode', 'Standard');
if( %client.lastTeam !$= "" && %client.lastTeam != 0 && Game.numTeams > 1)
{
Game.clientJoinTeam( %client, %client.lastTeam, $MatchStarted );
%client.camera.setFlyMode();
%client.setControlObject( %client.player );
}
else
{
Game.assignClientTeam( %client );
// Spawn the player:
Game.spawnPlayer( %client, true );
%client.camera.setFlyMode();
%client.setControlObject( %client.player );
ClearBottomPrint( %client );
}
}
else if( !$Host::TournamentMode )
{
clearBottomPrint(%client);
Game.assignClientTeam( %client );
// Spawn the player:
Game.spawnPlayer( %client, false );
%client.camera.getDataBlock().setMode( %client.camera, "pre-game", %client.player );
%client.setControlObject( %client.camera );
}
}
//press JET
else if (%trigger == 3)
{
%markerObj = Game.pickObserverSpawn(%client, true);
%transform = %markerObj.getTransform();
%obj.setTransform(%transform);
%obj.setFlyMode();
}
//press JUMP
else if (%trigger == 2)
{
//switch the observer mode to observing clients
if (isObject(%client.observeFlyClient))
serverCmdObserveClient(%client, %client.observeFlyClient);
else
serverCmdObserveClient(%client, -1);
observerFollowUpdate( %client, %client.observeClient, false );
displayObserverHud(%client, %client.observeClient);
messageClient(%client.observeClient, 'Observer', '\c1%1 is now observing you.', %client.name);
}
case "observerStatic":
// Non-moving observer camera
%next = (%trigger == 3 ? true : false);
%markerObj = Game.pickObserverSpawn(%client, %next);
%transform = %markerObj.getTransform();
%obj.setTransform(%transform);
%obj.setFlyMode();
case "observerStaticNoNext":
// Non-moving, non-cycling observer camera
case "observerTimeout":
// Player didn't respawn quickly enough
if (%trigger == 0)
{
clearBottomPrint(%client);
commandToClient(%client, 'setHudMode', 'Standard');
if( %client.lastTeam )
Game.clientJoinTeam( %client, %client.lastTeam, true );
else
{
Game.assignClientTeam( %client );
// Spawn the player:
Game.spawnPlayer( %client, true );
}
%client.camera.setFlyMode();
%client.setControlObject( %client.player );
}
//press JET
else if (%trigger == 3)
{
%markerObj = Game.pickObserverSpawn(%client, true);
%transform = %markerObj.getTransform();
%obj.setTransform(%transform);
%obj.setFlyMode();
}
//press JUMP
else if (%trigger == 2)
{
//switch the observer mode to observing clients
if (isObject(%client.observeFlyClient))
serverCmdObserveClient(%client, %client.observeFlyClient);
else
serverCmdObserveClient(%client, -1);
// update the observer list for this client
observerFollowUpdate( %client, %client.observeClient, false );
displayObserverHud(%client, %client.observeClient);
messageClient(%client.observeClient, 'Observer', '\c1%1 is now observing you.', %client.name);
}
case "observerFollow":
// Observer attached to a moving object (assume player for now...)
//press FIRE - cycle to next client
if (%trigger == 0)
{
%nextClient = findNextObserveClient(%client);
%prevObsClient = %client.observeClient;
if (%nextClient > 0 && %nextClient != %client.observeClient)
{
// update the observer list for this client
observerFollowUpdate( %client, %nextClient, true );
//set the new object
%transform = %nextClient.player.getTransform();
if( !%nextClient.isMounted() )
{
%obj.setOrbitMode(%nextClient.player, %transform, 0.5, 4.5, 4.5);
%client.observeClient = %nextClient;
}
else
{
%mount = %nextClient.player.getObjectMount();
if( %mount.getDataBlock().observeParameters $= "" )
%params = %transform;
else
%params = %mount.getDataBlock().observeParameters;
%obj.setOrbitMode(%mount, %mount.getTransform(), getWord( %params, 0 ), getWord( %params, 1 ), getWord( %params, 2 ));
%client.observeClient = %nextClient;
}
//send the message(s)
displayObserverHud(%client, %nextClient);
messageClient(%nextClient, 'Observer', '\c1%1 is now observing you.', %client.name);
messageClient(%prevObsClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name);
}
}
//press JET - cycle to prev client
else if (%trigger == 3)
{
%prevClient = findPrevObserveClient(%client);
%prevObsClient = %client.observeClient;
if (%prevClient > 0 && %prevClient != %client.observeClient)
{
// update the observer list for this client
observerFollowUpdate( %client, %prevClient, true );
//set the new object
%transform = %prevClient.player.getTransform();
if( !%prevClient.isMounted() )
{
%obj.setOrbitMode(%prevClient.player, %transform, 0.5, 4.5, 4.5);
%client.observeClient = %prevClient;
}
else
{
%mount = %prevClient.player.getObjectMount();
if( %mount.getDataBlock().observeParameters $= "" )
%params = %transform;
else
%params = %mount.getDataBlock().observeParameters;
%obj.setOrbitMode(%mount, %mount.getTransform(), getWord( %params, 0 ), getWord( %params, 1 ), getWord( %params, 2 ));
%client.observeClient = %prevClient;
}
//send the message(s)
displayObserverHud(%client, %prevClient);
messageClient(%prevClient, 'Observer', '\c1%1 is now observing you.', %client.name);
messageClient(%prevObsClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name);
}
}
//press JUMP
else if (%trigger == 2)
{
// update the observer list for this client
observerFollowUpdate( %client, -1, false );
//toggle back to observer fly mode
%obj.mode = "observerFly";
%obj.setFlyMode();
updateObserverFlyHud(%client);
messageClient(%client.observeClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name);
}
case "pre-game":
if(!$Host::TournamentMode || $CountdownStarted)
return;
if(%client.notReady)
{
%client.notReady = "";
MessageAll( 0, '\c1%1 is READY.', %client.name );
if(%client.notReadyCount < 3)
centerprint( %client, "\nWaiting for match start (FIRE if not ready)", 0, 3);
else
centerprint( %client, "\nWaiting for match start", 0, 3);
}
else
{
%client.notReadyCount++;
if(%client.notReadyCount < 4)
{
%client.notReady = true;
MessageAll( 0, '\c1%1 is not READY.', %client.name );
centerprint( %client, "\nPress FIRE when ready.", 0, 3 );
}
return;
}
CheckTourneyMatchStart();
}
}
function Observer::setMode(%data, %obj, %mode, %targetObj)
{
if(%mode $= "")
return;
%client = %obj.getControllingClient();
switch$ (%mode) {
case "justJoined":
commandToClient(%client, 'setHudMode', 'Observer');
%markerObj = Game.pickObserverSpawn(%client, true);
%transform = %markerObj.getTransform();
%obj.setTransform(%transform);
%obj.setFlyMode();
case "pre-game":
commandToClient(%client, 'setHudMode', 'Observer');
%obj.setOrbitMode( %targetObj, %targetObj.getTransform(), 0.5, 4.5, 4.5);
case "observerFly":
// Free-flying observer camera
commandToClient(%client, 'setHudMode', 'Observer');
%markerObj = Game.pickObserverSpawn(%client, true);
%transform = %markerObj.getTransform();
%obj.setTransform(%transform);
%obj.setFlyMode();
case "observerStatic" or "observerStaticNoNext":
// Non-moving observer camera
%markerObj = Game.pickObserverSpawn(%client, true);
%transform = %markerObj.getTransform();
%obj.setTransform(%transform);
case "observerFollow":
// Observer attached to a moving object (assume player for now...)
%transform = %targetObj.getTransform();
if( !%targetObj.isMounted() )
%obj.setOrbitMode(%targetObj, %transform, 0.5, 4.5, 4.5);
else
{
%mount = %targetObj.getObjectMount();
if( %mount.getDataBlock().observeParameters $= "" )
%params = %transform;
else
%params = %mount.getDataBlock().observeParameters;
%obj.setOrbitMode(%mount, %mount.getTransform(), getWord( %params, 0 ), getWord( %params, 1 ), getWord( %params, 2 ));
}
case "observerTimeout":
commandToClient(%client, 'setHudMode', 'Observer');
%markerObj = Game.pickObserverSpawn(%client, true);
%transform = %markerObj.getTransform();
%obj.setTransform(%transform);
%obj.setFlyMode();
}
%obj.mode = %mode;
}
function findNextObserveClient(%client)
{
%index = -1;
%count = ClientGroup.getCount();
if (%count <= 1)
return -1;
for (%i = 0; %i < %count; %i++)
{
%cl = ClientGroup.getObject(%i);
if (%cl == %client.observeClient)
{
%index = %i;
break;
}
}
//now find the next client (note, if not found, %index still == -1)
%index++;
if (%index >= %count)
%index = 0;
%newClient = -1;
for (%i = %index; %i < %count; %i++)
{
%cl = ClientGroup.getObject(%i);
if (%cl != %client && %cl.player > 0)
{
%newClient = %cl;
break;
}
}
//if we didn't find anyone, search from the beginning again
if (%newClient < 0)
{
for (%i = 0; %i < %count; %i++)
{
%cl = ClientGroup.getObject(%i);
if (%cl != %client && %cl.player > 0)
{
%newClient = %cl;
break;
}
}
}
//if we still haven't found anyone (new), give up..
if (%newClient < 0 || %newClient.player == %player)
return -1;
}
function findPrevObserveClient(%client)
{
%index = -1;
%count = ClientGroup.getCount();
if (%count <= 1)
return -1;
for (%i = 0; %i < %count; %i++)
{
%cl = ClientGroup.getObject(%i);
if (%cl == %client.observeClient)
{
%index = %i;
break;
}
}
//now find the prev client
%index--;
if (%index < 0)
%index = %count - 1;
%newClient = -1;
for (%i = %index; %i >= 0; %i--)
{
%cl = ClientGroup.getObject(%i);
if (%cl != %client && %cl.player > 0)
{
%newClient = %cl;
break;
}
}
//if we didn't find anyone, search from the end again
if (%newClient < 0)
{
for (%i = %count - 1; %i >= 0; %i--)
{
%cl = ClientGroup.getObject(%i);
if (%cl != %client && %cl.player > 0)
{
%newClient = %cl;
break;
}
}
}
//if we still haven't found anyone (new), give up..
if (%newClient < 0 || %newClient.player == %player)
return -1;
}
function observeClient(%client)
{
if( $testcheats )
{
//pass in -1 to choose any client...
commandToServer('observeClient', %client);
}
}
function serverCmdObserveClient(%client, %target)
{
//clear the observer fly mode var...
%client.observeFlyClient = -1;
//cancel any scheduled update
cancel(%client.obsHudSchedule);
// must be an observer when observing other clients
if( %client.getControlObject() != %client.camera)
return;
//can't observer yourself
if (%client == %target)
return;
%count = ClientGroup.getCount();
//can't go into observer mode if you're the only client
if (%count <= 1)
return;
//make sure the target actually exists
if (%target > 0)
{
%found = false;
for (%i = 0; %i < %count; %i++)
{
%cl = ClientGroup.getObject(%i);
if (%cl == %target)
{
%found = true;
break;
}
}
if (!%found)
return;
}
else
{
%client.observeClient = -1;
%target = findNextObserveClient(%client);
if (%target <= 0)
return;
}
//send the message
if (%client.camera.mode !$= "observerFollow")
{
if (isObject(%client.player))
%client.player.scriptKill(0);
//messageAllExcept(%client, -1, 'ClientNowObserver', '\c1%1 is now an observer.', %client.name);
//messageClient(%client, 'YouNowObserver', '\c1You are now observing %1.', %target.name);
}
%client.camera.getDataBlock().setMode(%client.camera, "observerFollow", %target.player);
%client.setControlObject(%client.camera);
//tag is used if a client who is being observed dies...
%client.observeClient = %target;
}
function observerFollowUpdate( %client, %nextClient, %cycle )
{
%Oclient = %client.observeClient;
if( %Oclient $= "" )
return;
// changed to observer fly...
if( %nextClient == -1 )
{
// find us in their observer list and remove, then reshuffle the list...
for( %i = 0; %i < %Oclient.observeCount; %i++ )
{
if( %Oclient.observers[%i] == %client )
{
%Oclient.observeCount--;
%Oclient.observers[%i] = %Oclient.observers[%Oclient.observeCount];
%Oclient.observers[%Oclient.observeCount] = "";
break;
}
}
return; // were done..
}
// changed from observer fly to observer follow...
if( !%cycle && %nextClient != -1 )
{
// if nobody is observing this guy, initialize their observer count...
if( %nextClient.observeCount $= "" )
%nextClient.observeCount = 0;
// add us to their list of observers...
%nextClient.observers[%nextClient.observeCount] = %client;
%nextClient.observeCount++;
return; // were done.
}
if( %nextClient != -1 )
{
// cycling to the next client...
for( %i = 0; %i < %Oclient.observeCount; %i++ )
{
// first remove us from our prev client's list...
if( %Oclient.observers[%i] == %client )
{
%Oclient.observeCount--;
%Oclient.observers[%i] = %Oclient.observers[%Oclient.observeCount];
%Oclient.observers[%Oclient.observeCount] = "";
break; // screw you guys, i'm goin home!
}
}
// if nobody is observing this guy, initialize their observer count...
if( %nextClient.observeCount $= "" )
%nextClient.observeCount = 0;
// now add us to the new clients list...
%nextClient.observeCount++;
%nextClient.observers[%nextClient.observeCount - 1] = %client;
}
}
function updateObserverFlyHud(%client)
{
if (!isObject(%client))
return;
//just in case there are two threads going...
cancel(%client.obsHudSchedule);
%client.observeFlyClient = -1;
//make sure the client is supposed to be in observer fly mode...
if (!isObject(%client) || %client.team != 0 || %client.getControlObject() != %client.camera || %client.camera.mode $= "observerFollow")
return;
//get various info about the player's eye
%srcEyeTransform = %client.camera.getTransform();
%srcEyePoint = firstWord(%srcEyeTransform) @ " " @ getWord(%srcEyeTransform, 1) @ " " @ getWord(%srcEyeTransform, 2);
%srcEyeVector = MatrixMulVector("0 0 0 " @ getWords(%srcEyeTransform, 3, 6), "0 1 0");
%srcEyeVector = VectorNormalize(%srcEyeVector);
//see if there's an enemy near our defense location...
%clientCount = 0;
%count = ClientGroup.getCount();
%viewedClient = -1;
%clientDot = -1;
for(%i = 0; %i < %count; %i++)
{
%cl = ClientGroup.getObject(%i);
//make sure we find an AI who's alive and not the client
if (%cl != %client && isObject(%cl.player))
{
//make sure the player is within range
%clPos = %cl.player.getWorldBoxCenter();
%distance = VectorDist(%clPos, %srcEyePoint);
if (%distance <= 30)
{
//create the vector from the client to the client
%clVector = VectorNormalize(VectorSub(%clPos, %srcEyePoint));
//see if the dot product is greater than our current, and greater than 0.6
%dot = VectorDot(%clVector, %srcEyeVector);
if (%dot > 0.6 && %dot > %clientDot)
{
//make sure we're not looking through walls...
%mask = $TypeMasks::TerrainObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::StaticShapeObjectType;
%losResult = containerRayCast(%srcEyePoint, %clPos, %mask);
%losObject = GetWord(%losResult, 0);
if (!isObject(%losObject))
{
%viewedClient = %cl;
%clientDot = %dot;
}
}
}
}
}
if (isObject(%viewedClient))
displayObserverHud(%client, 0, %viewedClient);
else
displayObserverHud(%client, 0);
%client.observeFlyClient = %viewedClient;
//schedule the next...
%client.obsHudSchedule = schedule(500, %client, updateObserverFlyHud, %client);
}

View file

@ -1,233 +1,233 @@
//------------------------------------------------------------------------------
//
// chatMenuHud.cs
//
//------------------------------------------------------------------------------
if ( isFile( "prefs/customVoiceBinds.cs" ) )
$defaultVoiceBinds = false;
else
$defaultVoiceBinds = true;
// Load in all of the installed chat items:
exec( "scripts/cannedChatItems.cs" );
//------------------------------------------------------------------------------
// Chat menu loading function:
new SimSet( ChatMenuList ); // Store all of the chat menu maps here so that we can delete them later:
function activateChatMenu( %filename )
{
if ( isFile( %filename ) || isFile( %filename @ ".dso" ) )
{
// Clear the old chat menu:
ChatMenuList.clear();
// Create the root of the new menu:
$RootChatMenu = new ActionMap();
ChatMenuList.add( $RootChatMenu );
$CurrentChatMenu = $RootChatMenu;
$CurrentChatMenu.optionCount = 0;
$CurrentChatMenu.bindCmd(keyboard, escape, "cancelChatMenu();", "");
// Build the new chat menu:
exec( %filename );
}
else
error( "Chat menu file \"" @ %filename @ "\" not found!" );
}
//------------------------------------------------------------------------------
// Chat menu building functions:
function startChatMenu(%heading)
{
%key = firstWord(%heading);
%text = restWords(%heading);
%menu = new ActionMap();
ChatMenuList.add( %menu );
%cm = $CurrentChatMenu;
%cm.bindCmd(keyboard, %key, "setChatMenu(\"" @ %text @ "\", " @ %menu @ ");", "");
%cm.option[%cm.optionCount] = %key @ ": " @ %text;
%cm.command[%cm.optionCount] = %menu; // Save this off here for later...
%cm.isMenu[%cm.optionCount] = 1;
%cm.optionCount++;
%menu.parent = %cm;
%menu.bindCmd(keyboard, escape, "cancelChatMenu();", "");
%menu.optionCount = 0;
$CurrentChatMenu = %menu;
}
function endChatMenu()
{
$CurrentChatMenu = $CurrentChatMenu.parent;
}
function addChat(%keyDesc, %command)
{
%key = firstWord(%keyDesc);
%text = restWords(%keyDesc);
%cm = $CurrentChatMenu;
%cm.bindCmd(keyboard, %key, "issueChatCmd(" @ %cm @ "," @ %cm.optionCount @ ");", "");
%cm.option[%cm.optionCount] = %key @ ": " @ %text;
%cm.command[%cm.optionCount] = %command;
%cm.isMenu[%cm.optionCount] = 0;
%cm.optionCount++;
}
//------------------------------------------------------------------------------
// Chat menu hud functions:
$ChatMenuHudLineCount = 0;
function activateChatMenuHud( %make )
{
if(%make && !TaskHudDlg.isVisible())
showChatMenuHud();
}
function showChatMenuHud()
{
Canvas.pushDialog(ChatMenuHudDlg);
ChatMenuHudDlg.setVisible(true);
setChatMenu(Root, $RootChatMenu);
}
function cancelChatMenu()
{
$CurrentChatMenu.pop();
$CurrentChatMenu = $RootChatMenu;
Canvas.popDialog(ChatMenuHudDlg);
ChatMenuHudDlg.setVisible(false);
}
function setChatMenu( %name, %menu )
{
for ( %i = 0; %i < $ChatMenuHudLineCount; %i++ )
chatMenuHud.remove( $ChatMenuHudText[%i] );
$ChatMenuHudLineCount = %menu.optionCount + 1;
chatMenuHud.extent = "170" SPC ( $ChatMenuHudLineCount * 15 ) + 8;
// First add the menu title line:
$ChatMenuHudText[0] = new GuiTextCtrl()
{
profile = "GuiHudVoiceMenuProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "5 3";
extent = "165 20";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
text = "\c2" @ %name @ " Menu:";
};
chatMenuHud.add( $ChatMenuHudText[0] );
// Now add all of the menu options:
for ( %option = 0; %option < %menu.optionCount; %option++ )
{
%yOffset = ( %option * 15 ) + 18;
if ( %menu.isMenu[%option] == 1 )
{
$ChatMenuHudText[%option + 1] = new GuiTextCtrl()
{
profile = "GuiHudVoiceMenuProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "5 " @ %yOffset;
extent = "165 20";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
text = " " @ %menu.option[%option];
};
}
else
{
$ChatMenuHudText[%option + 1] = new GuiTextCtrl()
{
profile = "GuiHudVoiceCommandProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "5 " @ %yOffset;
extent = "165 20";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
text = " " @ %menu.option[%option];
};
}
chatMenuHud.add( $ChatMenuHudText[%option + 1] );
}
//bind "anykey" to closing the chat menu, so if you press an invalid entry, you don't accidently
//open the commander map or something...
%menu.bindCmd(keyboard, "anykey", "cancelChatMenu();", "");
// Pop the old menu map and push the new menu's map:
$CurrentChatMenu.pop();
$CurrentChatMenu = %menu;
%menu.push();
}
function issueChatCmd( %menu, %index )
{
processChatItemCallbacks( %menu.command[%index] );
commandToServer( 'CannedChat', %menu.command[%index], false );
cancelChatMenu();
}
//------------------------------------------------------------------------------
// Canned chat handler:
function serverCmdCannedChat( %client, %command, %fromAI )
{
%cmdCode = getWord( %command, 0 );
%cmdId = getSubStr( %cmdCode, 1, strlen( %command ) - 1 );
%cmdString = getWord( %command, 1 );
if ( %cmdString $= "" )
%cmdString = getTaggedString( %cmdCode );
if ( !isObject( $ChatTable[%cmdId] ) )
{
error( %cmdString @ " is not a recognized canned chat command." );
return;
}
%chatItem = $ChatTable[%cmdId];
//if there is text
if (%chatItem.text !$= "" || !%chatItem.play3D)
{
%message = %chatItem.text @ "~w" @ %chatItem.audioFile;
if ( %chatItem.teamOnly )
cannedChatMessageTeam( %client, %client.team, '\c3%1: %2', %client.name, %message, %chatItem.defaultKeys );
else
cannedChatMessageAll( %client, '\c4%1: %2', %client.name, %message, %chatItem.defaultKeys );
}
//if no text, see if the audio is to be played in 3D...
else if ( %chatItem.play3D && %client.player )
playTargetAudio(%client.target, addTaggedString(%chatItem.audioFile), AudioClosest3d, true);
if ( %chatItem.animation !$= "" )
PlayAnim(%client, %chatItem.animation); // z0dd - ZOD, 8/15/02. Remove client direct requests to start animations. Was: serverCmdPlayAnim
// Let the AI respond to the canned chat messages (from humans only)
if (!%fromAI)
CreateVoiceServerTask(%client, %cmdCode);
}
if ( $defaultVoiceBinds )
activateChatMenu( "scripts/voiceBinds.cs" );
else
activateChatMenu( "prefs/customVoiceBinds.cs" );
//------------------------------------------------------------------------------
//
// chatMenuHud.cs
//
//------------------------------------------------------------------------------
if ( isFile( "prefs/customVoiceBinds.cs" ) )
$defaultVoiceBinds = false;
else
$defaultVoiceBinds = true;
// Load in all of the installed chat items:
exec( "scripts/cannedChatItems.cs" );
//------------------------------------------------------------------------------
// Chat menu loading function:
new SimSet( ChatMenuList ); // Store all of the chat menu maps here so that we can delete them later:
function activateChatMenu( %filename )
{
if ( isFile( %filename ) || isFile( %filename @ ".dso" ) )
{
// Clear the old chat menu:
ChatMenuList.clear();
// Create the root of the new menu:
$RootChatMenu = new ActionMap();
ChatMenuList.add( $RootChatMenu );
$CurrentChatMenu = $RootChatMenu;
$CurrentChatMenu.optionCount = 0;
$CurrentChatMenu.bindCmd(keyboard, escape, "cancelChatMenu();", "");
// Build the new chat menu:
exec( %filename );
}
else
error( "Chat menu file \"" @ %filename @ "\" not found!" );
}
//------------------------------------------------------------------------------
// Chat menu building functions:
function startChatMenu(%heading)
{
%key = firstWord(%heading);
%text = restWords(%heading);
%menu = new ActionMap();
ChatMenuList.add( %menu );
%cm = $CurrentChatMenu;
%cm.bindCmd(keyboard, %key, "setChatMenu(\"" @ %text @ "\", " @ %menu @ ");", "");
%cm.option[%cm.optionCount] = %key @ ": " @ %text;
%cm.command[%cm.optionCount] = %menu; // Save this off here for later...
%cm.isMenu[%cm.optionCount] = 1;
%cm.optionCount++;
%menu.parent = %cm;
%menu.bindCmd(keyboard, escape, "cancelChatMenu();", "");
%menu.optionCount = 0;
$CurrentChatMenu = %menu;
}
function endChatMenu()
{
$CurrentChatMenu = $CurrentChatMenu.parent;
}
function addChat(%keyDesc, %command)
{
%key = firstWord(%keyDesc);
%text = restWords(%keyDesc);
%cm = $CurrentChatMenu;
%cm.bindCmd(keyboard, %key, "issueChatCmd(" @ %cm @ "," @ %cm.optionCount @ ");", "");
%cm.option[%cm.optionCount] = %key @ ": " @ %text;
%cm.command[%cm.optionCount] = %command;
%cm.isMenu[%cm.optionCount] = 0;
%cm.optionCount++;
}
//------------------------------------------------------------------------------
// Chat menu hud functions:
$ChatMenuHudLineCount = 0;
function activateChatMenuHud( %make )
{
if(%make && !TaskHudDlg.isVisible())
showChatMenuHud();
}
function showChatMenuHud()
{
Canvas.pushDialog(ChatMenuHudDlg);
ChatMenuHudDlg.setVisible(true);
setChatMenu(Root, $RootChatMenu);
}
function cancelChatMenu()
{
$CurrentChatMenu.pop();
$CurrentChatMenu = $RootChatMenu;
Canvas.popDialog(ChatMenuHudDlg);
ChatMenuHudDlg.setVisible(false);
}
function setChatMenu( %name, %menu )
{
for ( %i = 0; %i < $ChatMenuHudLineCount; %i++ )
chatMenuHud.remove( $ChatMenuHudText[%i] );
$ChatMenuHudLineCount = %menu.optionCount + 1;
chatMenuHud.extent = "170" SPC ( $ChatMenuHudLineCount * 15 ) + 8;
// First add the menu title line:
$ChatMenuHudText[0] = new GuiTextCtrl()
{
profile = "GuiHudVoiceMenuProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "5 3";
extent = "165 20";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
text = "\c2" @ %name @ " Menu:";
};
chatMenuHud.add( $ChatMenuHudText[0] );
// Now add all of the menu options:
for ( %option = 0; %option < %menu.optionCount; %option++ )
{
%yOffset = ( %option * 15 ) + 18;
if ( %menu.isMenu[%option] == 1 )
{
$ChatMenuHudText[%option + 1] = new GuiTextCtrl()
{
profile = "GuiHudVoiceMenuProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "5 " @ %yOffset;
extent = "165 20";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
text = " " @ %menu.option[%option];
};
}
else
{
$ChatMenuHudText[%option + 1] = new GuiTextCtrl()
{
profile = "GuiHudVoiceCommandProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "5 " @ %yOffset;
extent = "165 20";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
text = " " @ %menu.option[%option];
};
}
chatMenuHud.add( $ChatMenuHudText[%option + 1] );
}
//bind "anykey" to closing the chat menu, so if you press an invalid entry, you don't accidently
//open the commander map or something...
%menu.bindCmd(keyboard, "anykey", "cancelChatMenu();", "");
// Pop the old menu map and push the new menu's map:
$CurrentChatMenu.pop();
$CurrentChatMenu = %menu;
%menu.push();
}
function issueChatCmd( %menu, %index )
{
processChatItemCallbacks( %menu.command[%index] );
commandToServer( 'CannedChat', %menu.command[%index], false );
cancelChatMenu();
}
//------------------------------------------------------------------------------
// Canned chat handler:
function serverCmdCannedChat( %client, %command, %fromAI )
{
%cmdCode = getWord( %command, 0 );
%cmdId = getSubStr( %cmdCode, 1, strlen( %command ) - 1 );
%cmdString = getWord( %command, 1 );
if ( %cmdString $= "" )
%cmdString = getTaggedString( %cmdCode );
if ( !isObject( $ChatTable[%cmdId] ) )
{
error( %cmdString @ " is not a recognized canned chat command." );
return;
}
%chatItem = $ChatTable[%cmdId];
//if there is text
if (%chatItem.text !$= "" || !%chatItem.play3D)
{
%message = %chatItem.text @ "~w" @ %chatItem.audioFile;
if ( %chatItem.teamOnly )
cannedChatMessageTeam( %client, %client.team, '\c3%1: %2', %client.name, %message, %chatItem.defaultKeys );
else
cannedChatMessageAll( %client, '\c4%1: %2', %client.name, %message, %chatItem.defaultKeys );
}
//if no text, see if the audio is to be played in 3D...
else if ( %chatItem.play3D && %client.player )
playTargetAudio(%client.target, addTaggedString(%chatItem.audioFile), AudioClosest3d, true);
if ( %chatItem.animation !$= "" )
PlayAnim(%client, %chatItem.animation); // z0dd - ZOD, 8/15/02. Remove client direct requests to start animations. Was: serverCmdPlayAnim
// Let the AI respond to the canned chat messages (from humans only)
if (!%fromAI)
CreateVoiceServerTask(%client, %cmdCode);
}
if ( $defaultVoiceBinds )
activateChatMenu( "scripts/voiceBinds.cs" );
else
activateChatMenu( "prefs/customVoiceBinds.cs" );

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,225 +1,225 @@
//------------------------------------------------------------------------------
//
// commonDialogs.cs
//
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// MessageBox OK dialog:
//------------------------------------------------------------------------------
function MessageBoxOK( %title, %message, %callback )
{
MBOKFrame.setTitle( %title );
MBOKText.setText( "<just:center>" @ %message );
//MessageBoxOKDlg.callback = %callback;
MBOKButton.command = %callback SPC "Canvas.popDialog(MessageBoxOKDlg);";
Canvas.pushDialog( MessageBoxOKDlg );
}
//------------------------------------------------------------------------------
function MessageBoxOKDlg::onWake( %this )
{
}
//------------------------------------------------------------------------------
function MessageBoxOKDlg::onSleep( %this )
{
%this.callback = "";
}
//------------------------------------------------------------------------------
// MessageBox OK/Cancel dialog:
//------------------------------------------------------------------------------
function MessageBoxOKCancel( %title, %message, %callback, %cancelCallback )
{
MBOKCancelFrame.setTitle( %title );
MBOKCancelText.setText( "<just:center>" @ %message );
//MessageBoxOKCancelDlg.callback = %callback;
//MessageBoxOKCancelDlg.cancelCallback = %cancelCallback;
MBOKCancelButtonOK.command = %callback SPC "Canvas.popDialog(MessageBoxOKCancelDlg);";
MBOKCancelButtonCancel.command = %cancelCallback SPC "Canvas.popDialog(MessageBoxOKCancelDlg);";
Canvas.pushDialog( MessageBoxOKCancelDlg );
}
//------------------------------------------------------------------------------
function MessageBoxOKCancelDlg::onWake( %this )
{
}
//------------------------------------------------------------------------------
function MessageBoxOKCancelDlg::onSleep( %this )
{
%this.callback = "";
}
//------------------------------------------------------------------------------
// MessageBox Yes/No dialog:
//------------------------------------------------------------------------------
function MessageBoxYesNo( %title, %message, %yesCallback, %noCallback )
{
MBYesNoFrame.setTitle( %title );
MBYesNoText.setText( "<just:center>" @ %message );
//MessageBoxYesNoDlg.yesCallBack = %yesCallback;
//MessageBoxYesNoDlg.noCallback = %noCallBack;
MBYesNoButtonYes.command = %yesCallback SPC "Canvas.popDialog(MessageBoxYesNoDlg);";
MBYesNoButtonNo.command = %noCallback SPC "Canvas.popDialog(MessageBoxYesNoDlg);";
Canvas.pushDialog( MessageBoxYesNoDlg );
}
//------------------------------------------------------------------------------
function MessageBoxYesNoDlg::onWake( %this )
{
}
//------------------------------------------------------------------------------
function MessageBoxYesNoDlg::onSleep( %this )
{
%this.yesCallback = "";
%this.noCallback = "";
}
//------------------------------------------------------------------------------
// Message popup dialog:
//------------------------------------------------------------------------------
function MessagePopup( %title, %message, %delay )
{
// Currently two lines max.
MessagePopFrame.setTitle( %title );
MessagePopText.setText( "<just:center>" @ %message );
Canvas.pushDialog( MessagePopupDlg );
if ( %delay !$= "" )
schedule( %delay, 0, CloseMessagePopup );
}
//------------------------------------------------------------------------------
function CloseMessagePopup()
{
Canvas.popDialog( MessagePopupDlg );
}
//------------------------------------------------------------------------------
// MessageBox LAN Account dialog:
//------------------------------------------------------------------------------
function LANAccountDone()
{
if ($Pref::LANAccount::Name $= "" || $Pref::LANAccount::Password $= "")
return;
canvas.popDialog(LANAccountCreationDLG);
if (!$ChangeSettings)
messageBoxOk("Success","Your Local Area Network (LAN) account has been created.");
else
messageBoxOk("Success","Your Local Area Network (LAN) account has been modified. Progress on any T2Bol server will be lost.");
$Pref::LANAccount::GUID = stripNonNumericCharacters(textToHash($Pref::LANAccount::Name @ $Pref::LANAccount::Password));
}
//------------------------------------------------------------------------------
// Pick Team dialog:
//------------------------------------------------------------------------------
function PickTeamDlg::onWake( %this )
{
}
//------------------------------------------------------------------------------
function PickTeamDlg::onSleep( %this )
{
}
//------------------------------------------------------------------------------
// ex: ShellGetLoadFilename( "stuff\*.*", isLoadable, loadStuff );
// -- only adds files that pass isLoadable
// -- calls 'loadStuff(%filename)' on dblclick or ok
//------------------------------------------------------------------------------
function ShellGetLoadFilename( %title, %fileSpec, %validate, %callback )
{
$loadFileCommand = %callback @ "( getField( LOAD_FileList.getValue(), 0 ) );";
LOAD_FileList.altCommand = $loadFileCommand SPC "Canvas.popDialog(ShellLoadFileDlg);";
LOAD_LoadBtn.command = $loadFileCommand SPC "Canvas.popDialog(ShellLoadFileDlg);";
if ( %title $= "" )
LOAD_Title.setTitle( "LOAD FILE" );
else
LOAD_Title.setTitle( %title );
LOAD_LoadBtn.setActive( false );
Canvas.pushDialog( ShellLoadFileDlg );
fillLoadSaveList( LOAD_FileList, %fileSpec, %validate, false );
}
//------------------------------------------------------------------------------
function fillLoadSaveList( %ctrl, %fileSpec, %validate, %isSave )
{
%ctrl.clear();
%id = 0;
for ( %file = findFirstFile( %fileSpec ); %file !$= ""; %file = findNextFile( %fileSpec ) )
{
if ( %validate $= "" || call( %validate, %file ) )
{
%ctrl.addRow( %id, fileBase( %file ) TAB %file );
if ( %isSave )
{
if ( !isWriteableFileName( "base/" @ %file ) )
%ctrl.setRowActive( %id, false );
}
%id++;
}
}
%ctrl.sort( 0 );
}
//------------------------------------------------------------------------------
function LOAD_FileList::onSelect( %this, %id, %text )
{
LOAD_LoadBtn.setActive( true );
}
//------------------------------------------------------------------------------
// ex: ShellGetSaveFilename( "stuff\*.*", isLoadable, saveStuff, currentName );
// -- only adds files to list that pass isLoadable
// -- calls 'saveStuff(%filename)' on dblclick or ok
//------------------------------------------------------------------------------
function ShellGetSaveFilename( %title, %fileSpec, %validate, %callback, %current )
{
SAVE_FileName.setValue( %current );
$saveFileCommand = "if ( SAVE_FileName.getValue() !$= \"\" ) " @ %callback @ "( SAVE_FileName.getValue() );";
SAVE_FileName.altCommand = $saveFileCommand SPC "Canvas.popDialog(ShellSaveFileDlg);";
SAVE_SaveBtn.command = $saveFileCommand SPC "Canvas.popDialog(ShellSaveFileDlg);";
if ( %title $= "" )
SAVE_Title.setTitle( "SAVE FILE" );
else
SAVE_Title.setTitle( %title );
// Right now this validation stuff is worthless...
//SAVE_SaveBtn.setActive( isWriteableFileName( "base/" @ %current @ $loadSaveExt ) );
Canvas.pushDialog( ShellSaveFileDlg );
fillLoadSaveList( SAVE_FileList, %fileSpec, %validate, true );
}
//------------------------------------------------------------------------------
function SAVE_FileList::onSelect( %this, %id, %text )
{
if ( %this.isRowActive( %id ) )
SAVE_FileName.setValue( getField( %this.getValue(), 0 ) );
}
//------------------------------------------------------------------------------
function SAVE_FileList::onDoubleClick( %this )
{
%id = %this.getSelectedId();
if ( %this.isRowActive( %id ) )
{
error("D'oh - double clicking is broken for PURE/DEMO executables");
eval( $saveFileCommand );
Canvas.popDialog( ShellSaveFileDlg );
}
}
//------------------------------------------------------------------------------
function SAVE_FileName::checkValid( %this )
{
// Right now this validation stuff is worthless...
//SAVE_SaveBtn.setActive( isWriteableFileName( "base/" @ %this.getValue() @ $loadSaveExt ) );
}
//------------------------------------------------------------------------------
//
// commonDialogs.cs
//
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// MessageBox OK dialog:
//------------------------------------------------------------------------------
function MessageBoxOK( %title, %message, %callback )
{
MBOKFrame.setTitle( %title );
MBOKText.setText( "<just:center>" @ %message );
//MessageBoxOKDlg.callback = %callback;
MBOKButton.command = %callback SPC "Canvas.popDialog(MessageBoxOKDlg);";
Canvas.pushDialog( MessageBoxOKDlg );
}
//------------------------------------------------------------------------------
function MessageBoxOKDlg::onWake( %this )
{
}
//------------------------------------------------------------------------------
function MessageBoxOKDlg::onSleep( %this )
{
%this.callback = "";
}
//------------------------------------------------------------------------------
// MessageBox OK/Cancel dialog:
//------------------------------------------------------------------------------
function MessageBoxOKCancel( %title, %message, %callback, %cancelCallback )
{
MBOKCancelFrame.setTitle( %title );
MBOKCancelText.setText( "<just:center>" @ %message );
//MessageBoxOKCancelDlg.callback = %callback;
//MessageBoxOKCancelDlg.cancelCallback = %cancelCallback;
MBOKCancelButtonOK.command = %callback SPC "Canvas.popDialog(MessageBoxOKCancelDlg);";
MBOKCancelButtonCancel.command = %cancelCallback SPC "Canvas.popDialog(MessageBoxOKCancelDlg);";
Canvas.pushDialog( MessageBoxOKCancelDlg );
}
//------------------------------------------------------------------------------
function MessageBoxOKCancelDlg::onWake( %this )
{
}
//------------------------------------------------------------------------------
function MessageBoxOKCancelDlg::onSleep( %this )
{
%this.callback = "";
}
//------------------------------------------------------------------------------
// MessageBox Yes/No dialog:
//------------------------------------------------------------------------------
function MessageBoxYesNo( %title, %message, %yesCallback, %noCallback )
{
MBYesNoFrame.setTitle( %title );
MBYesNoText.setText( "<just:center>" @ %message );
//MessageBoxYesNoDlg.yesCallBack = %yesCallback;
//MessageBoxYesNoDlg.noCallback = %noCallBack;
MBYesNoButtonYes.command = %yesCallback SPC "Canvas.popDialog(MessageBoxYesNoDlg);";
MBYesNoButtonNo.command = %noCallback SPC "Canvas.popDialog(MessageBoxYesNoDlg);";
Canvas.pushDialog( MessageBoxYesNoDlg );
}
//------------------------------------------------------------------------------
function MessageBoxYesNoDlg::onWake( %this )
{
}
//------------------------------------------------------------------------------
function MessageBoxYesNoDlg::onSleep( %this )
{
%this.yesCallback = "";
%this.noCallback = "";
}
//------------------------------------------------------------------------------
// Message popup dialog:
//------------------------------------------------------------------------------
function MessagePopup( %title, %message, %delay )
{
// Currently two lines max.
MessagePopFrame.setTitle( %title );
MessagePopText.setText( "<just:center>" @ %message );
Canvas.pushDialog( MessagePopupDlg );
if ( %delay !$= "" )
schedule( %delay, 0, CloseMessagePopup );
}
//------------------------------------------------------------------------------
function CloseMessagePopup()
{
Canvas.popDialog( MessagePopupDlg );
}
//------------------------------------------------------------------------------
// MessageBox LAN Account dialog:
//------------------------------------------------------------------------------
function LANAccountDone()
{
if ($Pref::LANAccount::Name $= "" || $Pref::LANAccount::Password $= "")
return;
canvas.popDialog(LANAccountCreationDLG);
if (!$ChangeSettings)
messageBoxOk("Success","Your Local Area Network (LAN) account has been created.");
else
messageBoxOk("Success","Your Local Area Network (LAN) account has been modified. Progress on any T2Bol server will be lost.");
$Pref::LANAccount::GUID = stripNonNumericCharacters(textToHash($Pref::LANAccount::Name @ $Pref::LANAccount::Password));
}
//------------------------------------------------------------------------------
// Pick Team dialog:
//------------------------------------------------------------------------------
function PickTeamDlg::onWake( %this )
{
}
//------------------------------------------------------------------------------
function PickTeamDlg::onSleep( %this )
{
}
//------------------------------------------------------------------------------
// ex: ShellGetLoadFilename( "stuff\*.*", isLoadable, loadStuff );
// -- only adds files that pass isLoadable
// -- calls 'loadStuff(%filename)' on dblclick or ok
//------------------------------------------------------------------------------
function ShellGetLoadFilename( %title, %fileSpec, %validate, %callback )
{
$loadFileCommand = %callback @ "( getField( LOAD_FileList.getValue(), 0 ) );";
LOAD_FileList.altCommand = $loadFileCommand SPC "Canvas.popDialog(ShellLoadFileDlg);";
LOAD_LoadBtn.command = $loadFileCommand SPC "Canvas.popDialog(ShellLoadFileDlg);";
if ( %title $= "" )
LOAD_Title.setTitle( "LOAD FILE" );
else
LOAD_Title.setTitle( %title );
LOAD_LoadBtn.setActive( false );
Canvas.pushDialog( ShellLoadFileDlg );
fillLoadSaveList( LOAD_FileList, %fileSpec, %validate, false );
}
//------------------------------------------------------------------------------
function fillLoadSaveList( %ctrl, %fileSpec, %validate, %isSave )
{
%ctrl.clear();
%id = 0;
for ( %file = findFirstFile( %fileSpec ); %file !$= ""; %file = findNextFile( %fileSpec ) )
{
if ( %validate $= "" || call( %validate, %file ) )
{
%ctrl.addRow( %id, fileBase( %file ) TAB %file );
if ( %isSave )
{
if ( !isWriteableFileName( "base/" @ %file ) )
%ctrl.setRowActive( %id, false );
}
%id++;
}
}
%ctrl.sort( 0 );
}
//------------------------------------------------------------------------------
function LOAD_FileList::onSelect( %this, %id, %text )
{
LOAD_LoadBtn.setActive( true );
}
//------------------------------------------------------------------------------
// ex: ShellGetSaveFilename( "stuff\*.*", isLoadable, saveStuff, currentName );
// -- only adds files to list that pass isLoadable
// -- calls 'saveStuff(%filename)' on dblclick or ok
//------------------------------------------------------------------------------
function ShellGetSaveFilename( %title, %fileSpec, %validate, %callback, %current )
{
SAVE_FileName.setValue( %current );
$saveFileCommand = "if ( SAVE_FileName.getValue() !$= \"\" ) " @ %callback @ "( SAVE_FileName.getValue() );";
SAVE_FileName.altCommand = $saveFileCommand SPC "Canvas.popDialog(ShellSaveFileDlg);";
SAVE_SaveBtn.command = $saveFileCommand SPC "Canvas.popDialog(ShellSaveFileDlg);";
if ( %title $= "" )
SAVE_Title.setTitle( "SAVE FILE" );
else
SAVE_Title.setTitle( %title );
// Right now this validation stuff is worthless...
//SAVE_SaveBtn.setActive( isWriteableFileName( "base/" @ %current @ $loadSaveExt ) );
Canvas.pushDialog( ShellSaveFileDlg );
fillLoadSaveList( SAVE_FileList, %fileSpec, %validate, true );
}
//------------------------------------------------------------------------------
function SAVE_FileList::onSelect( %this, %id, %text )
{
if ( %this.isRowActive( %id ) )
SAVE_FileName.setValue( getField( %this.getValue(), 0 ) );
}
//------------------------------------------------------------------------------
function SAVE_FileList::onDoubleClick( %this )
{
%id = %this.getSelectedId();
if ( %this.isRowActive( %id ) )
{
error("D'oh - double clicking is broken for PURE/DEMO executables");
eval( $saveFileCommand );
Canvas.popDialog( ShellSaveFileDlg );
}
}
//------------------------------------------------------------------------------
function SAVE_FileName::checkValid( %this )
{
// Right now this validation stuff is worthless...
//SAVE_SaveBtn.setActive( isWriteableFileName( "base/" @ %this.getValue() @ $loadSaveExt ) );
}

View file

@ -1,133 +1,133 @@
function LaunchCredits(%val)
{
canvas.showBOLCredits = %val;
Canvas.setContent(CreditsGui);
}
function cancelCredits()
{
//delete the action map
CreditsActionMap.pop();
//kill the schedules
cancel($CreditsScrollSchedule);
cancel($CreditsSlideShow);
canvas.showBOLCredits = false;
//kill the music & start menu music
alxMusicFadeout($pref::audio::musicvolume);
schedule(mfloor(8000*$pref::audio::musicvolume),0,"alxPlayMusic","T2BOL/music/menu.mp3");
//load the launch gui back...
Canvas.setContent(LaunchGui);
//delete the contents of the ML ctrl so as to free up memory...
Credits_Text.setText("");
}
function CreditsGui::onWake(%this)
{
//create an action map to use "esc" to exit the credits screen...
if (!isObject(CreditsActionMap))
{
new ActionMap(CreditsActionMap);
CreditsActionMap.bindCmd(keyboard, anykey, "cancelCredits();", "");
CreditsActionMap.bindCmd(keyboard, space, "cancelCredits();", "");
CreditsActionMap.bindCmd(keyboard, escape, "cancelCredits();", "");
CreditsActionMap.bindCmd(mouse, button0, "$CreditsPaused = true;", "$CreditsPaused = false;");
CreditsActionMap.bindCmd(mouse, button1, "$CreditsSpeedUp = true;", "$CreditsSpeedUp = false;");
if (!isDemo())
CreditsActionMap.bindCmd(mouse, button2, "creditsNextPic();", "");
}
CreditsActionMap.push();
//build the ML text ctrl...
if (!canvas.showBOLCredits)
exec("scripts/creditsText_default.cs");
else
exec("scripts/creditsText.cs");
if (!isDemo())
{
$CreditsPicIndex = 1;
CREDITS_Pic.setBitmap("gui/Cred_" @ $CreditsPicIndex @ ".png");
}
else
CREDITS_Pic.setBitmap("gui/Cred_1.bm8");
//start the credits from the beginning
$CreditsOffset = 0.0;
%screenHeight = getWord(getResolution(), 1);
Credits_Text.resize(getWord(Credits_Text.position, 0),
mFloor(%screenHeight / 2) - 125,
getWord(Credits_Text.extent, 0),
getWord(Credits_Text.extent, 1));
//start the scrolling
$CreditsPaused = false;
$CreditsSpeedUp = false;
$CreditsScrollSchedule = schedule(3500, 0, scrollTheCredits);
//start cycling the bitmaps
if (!isDemo())
$CreditsSlideShow = schedule(5000, 0, creditsNextPic);
//start some music
alxPlayMusic("T2BOL/music/TribesHymn.mp3");
//alxMusicFadein(0); //Not really needed since the default music has a little bit of a delay before starting
}
function addCreditsLine(%text, %lastLine)
{
CREDITS_Text.addText(%text @ "\n", %lastline);
}
function scrollTheCredits()
{
//make sure we're not paused
if (!$CreditsPaused)
{
//if we've scrolled off the top, set the position back down to the bottom
%parentCtrl = CREDITS_Text.getGroup();
if (getWord(Credits_Text.position, 1) + getWord(Credits_Text.extent, 1) < 0)
{
Credits_Text.position = getWord(Credits_Text.position, 0) SPC getWord(%parentCtrl.extent, 1);
$CreditsOffset = getWord(Credits_Text.position, 1);
}
if ($CreditsSpeedUp)
%valueToScroll = 10;
else
%valueToScroll = 1;
//scroll the control up a bit
Credits_Text.resize(getWord(Credits_Text.position, 0),
getWord(Credits_Text.position, 1) - %valueToScroll,
getWord(Credits_Text.extent, 0),
getWord(Credits_Text.extent, 1));
}
//schedule the next scroll...
$CreditsScrollSchedule = schedule(10, 0, scrollTheCredits);
}
function creditsNextPic()
{
//no slide show in the demo...
if (isDemo())
return;
cancel($CreditsSlideShow);
if (!$CreditsPaused)
{
$CreditsPicIndex += 1;
if ($CreditsPicIndex > 46)
$CreditsPicindex = 1;
//set the bitmap
CREDITS_Pic.setBitmap("gui/Cred_" @ $CreditsPicIndex @ ".png");
}
//schedule the next bitmap
$CreditsSlideShow = schedule(5000, 0, creditsNextPic);
}
function LaunchCredits(%val)
{
canvas.showBOLCredits = %val;
Canvas.setContent(CreditsGui);
}
function cancelCredits()
{
//delete the action map
CreditsActionMap.pop();
//kill the schedules
cancel($CreditsScrollSchedule);
cancel($CreditsSlideShow);
canvas.showBOLCredits = false;
//kill the music & start menu music
alxMusicFadeout($pref::audio::musicvolume);
schedule(mfloor(8000*$pref::audio::musicvolume),0,"alxPlayMusic","T2BOL/music/menu.mp3");
//load the launch gui back...
Canvas.setContent(LaunchGui);
//delete the contents of the ML ctrl so as to free up memory...
Credits_Text.setText("");
}
function CreditsGui::onWake(%this)
{
//create an action map to use "esc" to exit the credits screen...
if (!isObject(CreditsActionMap))
{
new ActionMap(CreditsActionMap);
CreditsActionMap.bindCmd(keyboard, anykey, "cancelCredits();", "");
CreditsActionMap.bindCmd(keyboard, space, "cancelCredits();", "");
CreditsActionMap.bindCmd(keyboard, escape, "cancelCredits();", "");
CreditsActionMap.bindCmd(mouse, button0, "$CreditsPaused = true;", "$CreditsPaused = false;");
CreditsActionMap.bindCmd(mouse, button1, "$CreditsSpeedUp = true;", "$CreditsSpeedUp = false;");
if (!isDemo())
CreditsActionMap.bindCmd(mouse, button2, "creditsNextPic();", "");
}
CreditsActionMap.push();
//build the ML text ctrl...
if (!canvas.showBOLCredits)
exec("scripts/creditsText_default.cs");
else
exec("scripts/creditsText.cs");
if (!isDemo())
{
$CreditsPicIndex = 1;
CREDITS_Pic.setBitmap("gui/Cred_" @ $CreditsPicIndex @ ".png");
}
else
CREDITS_Pic.setBitmap("gui/Cred_1.bm8");
//start the credits from the beginning
$CreditsOffset = 0.0;
%screenHeight = getWord(getResolution(), 1);
Credits_Text.resize(getWord(Credits_Text.position, 0),
mFloor(%screenHeight / 2) - 125,
getWord(Credits_Text.extent, 0),
getWord(Credits_Text.extent, 1));
//start the scrolling
$CreditsPaused = false;
$CreditsSpeedUp = false;
$CreditsScrollSchedule = schedule(3500, 0, scrollTheCredits);
//start cycling the bitmaps
if (!isDemo())
$CreditsSlideShow = schedule(5000, 0, creditsNextPic);
//start some music
alxPlayMusic("T2BOL/music/TribesHymn.mp3");
//alxMusicFadein(0); //Not really needed since the default music has a little bit of a delay before starting
}
function addCreditsLine(%text, %lastLine)
{
CREDITS_Text.addText(%text @ "\n", %lastline);
}
function scrollTheCredits()
{
//make sure we're not paused
if (!$CreditsPaused)
{
//if we've scrolled off the top, set the position back down to the bottom
%parentCtrl = CREDITS_Text.getGroup();
if (getWord(Credits_Text.position, 1) + getWord(Credits_Text.extent, 1) < 0)
{
Credits_Text.position = getWord(Credits_Text.position, 0) SPC getWord(%parentCtrl.extent, 1);
$CreditsOffset = getWord(Credits_Text.position, 1);
}
if ($CreditsSpeedUp)
%valueToScroll = 10;
else
%valueToScroll = 1;
//scroll the control up a bit
Credits_Text.resize(getWord(Credits_Text.position, 0),
getWord(Credits_Text.position, 1) - %valueToScroll,
getWord(Credits_Text.extent, 0),
getWord(Credits_Text.extent, 1));
}
//schedule the next scroll...
$CreditsScrollSchedule = schedule(10, 0, scrollTheCredits);
}
function creditsNextPic()
{
//no slide show in the demo...
if (isDemo())
return;
cancel($CreditsSlideShow);
if (!$CreditsPaused)
{
$CreditsPicIndex += 1;
if ($CreditsPicIndex > 46)
$CreditsPicindex = 1;
//set the bitmap
CREDITS_Pic.setBitmap("gui/Cred_" @ $CreditsPicIndex @ ".png");
}
//schedule the next bitmap
$CreditsSlideShow = schedule(5000, 0, creditsNextPic);
}

View file

@ -1,15 +1,15 @@
// Replacement code for the original T2 credits?
if (!isFile("data/creditsText.txt"))
exec("scripts/creditsText_default.cs");
else
{
%read = new fileObject();
%read.openForRead("data/creditsText.txt");
while (!%read.isEOF())
{
%line = %read.readline();
addCreditsLine(%line);
}
%read.detach();
// Replacement code for the original T2 credits?
if (!isFile("data/creditsText.txt"))
exec("scripts/creditsText_default.cs");
else
{
%read = new fileObject();
%read.openForRead("data/creditsText.txt");
while (!%read.isEOF())
{
%line = %read.readline();
addCreditsLine(%line);
}
%read.detach();
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,403 +1,403 @@
/////////////////////////////////////////////////////////////////////////////////////////////////
// %1 = Victim's name //
// %2 = Victim's gender (value will be either "him" or "her") //
// %3 = Victim's possessive gender (value will be either "his" or "her") //
// %4 = Killer's name //
// %5 = Killer's gender (value will be either "him" or "her") //
// %6 = Killer's possessive gender (value will be either "his" or "her") //
// %7 = implement that killed the victim (value is the object number of the bullet, disc, etc) //
// %10 = Victim gender (value will be either "he" or "she") //
// %11 = Killer gender (value will be either "he" or "she") //
/////////////////////////////////////////////////////////////////////////////////////////////////
$DeathMessageCampingCount = 1;
$DeathMessageCamping[0] = '\c0%1 was killed for camping near the Nexus.';
//Out of Bounds deaths
$DeathMessageOOBCount = 2;
$DeathMessageOOB[0] = '\c0%1 was killed for loitering outside the mission area.';
$DeathMessageOOB[1] = '\c0%1 was eaten by a Grue.';
$DeathMessageLavaCount = 4;
$DeathMessageLava[0] = '\c0%1\'s last thought before falling into the lava : \'Oops\'.';
$DeathMessageLava[1] = '\c0%1 makes the supreme sacrifice to the lava gods.';
$DeathMessageLava[2] = '\c0%1 looks surprised by the lava - but only briefly.';
$DeathMessageLava[3] = '\c0%1 wimps out by jumping into the lava and trying to make it look like an accident.';
$DeathMessageLightningCount = 3;
$DeathMessageLightning[0] = '\c0%1 was killed by lightning!';
$DeathMessageLightning[1] = '\c0%1 caught a lightning bolt!';
$DeathMessageLightning[2] = '\c0%1 stuck %3 finger in Mother Nature\'s light socket.';
//these used when a player presses ctrl-k
$DeathMessageSuicideCount = 5;
$DeathMessageSuicide[0] = '\c0%1 blows %3 own head off!';
$DeathMessageSuicide[1] = '\c0%1 ends it all. Cue violin music.';
$DeathMessageSuicide[2] = '\c0%1 kills %2self.';
$DeathMessageSuicide[3] = '\c0%1 goes for the quick and dirty respawn.';
$DeathMessageSuicide[4] = '\c0%1 self-destructs in a fit of ennui.';
$DeathMessageVehPadCount = 1;
$DeathMessageVehPad[0] = '\c0%1 got caught in a vehicle\'s spawn field.';
$DeathMessageFFPowerupCount = 1;
$DeathMessageFFPowerup[0] = '\c0%1 got caught up in a forcefield during power up.';
$DeathMessageRogueMineCount = 1;
$DeathMessageRogueMine[$DamageType::Mine, 0] = '\c0%1 is all mine.';
//these used when a player kills himself (other than by using ctrl - k)
$DeathMessageSelfKillCount = 5;
$DeathMessageSelfKill[$DamageType::Blaster, 0] = '\c0%1 kills %2self with a blaster.';
$DeathMessageSelfKill[$DamageType::Blaster, 1] = '\c0%1 makes a note to watch out for blaster ricochets.';
$DeathMessageSelfKill[$DamageType::Blaster, 2] = '\c0%1\'s blaster kills its hapless owner.';
$DeathMessageSelfKill[$DamageType::Blaster, 3] = '\c0%1 deftly guns %2self down with %3 own blaster.';
$DeathMessageSelfKill[$DamageType::Blaster, 4] = '\c0%1 has a fatal encounter with %3 own blaster.';
$DeathMessageSelfKill[$DamageType::Plasma, 0] = '\c0%1 kills %2self with plasma.';
$DeathMessageSelfKill[$DamageType::Plasma, 1] = '\c0%1 turns %2self into plasma-charred briquettes.';
$DeathMessageSelfKill[$DamageType::Plasma, 2] = '\c0%1 swallows a white-hot mouthful of %3 own plasma.';
$DeathMessageSelfKill[$DamageType::Plasma, 3] = '\c0%1 immolates %2self.';
$DeathMessageSelfKill[$DamageType::Plasma, 4] = '\c0%1 experiences the joy of cooking %2self.';
$DeathMessageSelfKill[$DamageType::Disc, 0] = '\c0%1 kills %2self with a disc.';
$DeathMessageSelfKill[$DamageType::Disc, 1] = '\c0%1 catches %3 own spinfusor disc.';
$DeathMessageSelfKill[$DamageType::Disc, 2] = '\c0%1 heroically falls on %3 own disc.';
$DeathMessageSelfKill[$DamageType::Disc, 3] = '\c0%1 helpfully jumps into %3 own disc\'s explosion.';
$DeathMessageSelfKill[$DamageType::Disc, 4] = '\c0%1 plays Russian roulette with %3 spinfusor.';
$DeathMessageSelfKill[$DamageType::Grenade, 0] = '\c0%1 destroys %2self with a grenade!'; //applies to hand grenades *and* grenade launcher grenades
$DeathMessageSelfKill[$DamageType::Grenade, 1] = '\c0%1 took a bad bounce from %3 own grenade!';
$DeathMessageSelfKill[$DamageType::Grenade, 2] = '\c0%1 pulled the pin a shade early.';
$DeathMessageSelfKill[$DamageType::Grenade, 3] = '\c0%1\'s own grenade turns on %2.';
$DeathMessageSelfKill[$DamageType::Grenade, 4] = '\c0%1 blows %2self up real good.';
$DeathMessageSelfKill[$DamageType::Mortar, 0] = '\c0%1 kills %2self with a mortar!';
$DeathMessageSelfKill[$DamageType::Mortar, 1] = '\c0%1 hugs %3 own big green boomie.';
$DeathMessageSelfKill[$DamageType::Mortar, 2] = '\c0%1 mortars %2self all over the map.';
$DeathMessageSelfKill[$DamageType::Mortar, 3] = '\c0%1 experiences %3 mortar\'s payload up close.';
$DeathMessageSelfKill[$DamageType::Mortar, 4] = '\c0%1 suffered the wrath of %3 own mortar.';
$DeathMessageSelfKill[$DamageType::Missile, 0] = '\c0%1 kills %2self with a missile!';
$DeathMessageSelfKill[$DamageType::Missile, 1] = '\c0%1 runs a missile up %3 own tailpipe.';
$DeathMessageSelfKill[$DamageType::Missile, 2] = '\c0%1 tests the missile\'s shaped charge on %2self.';
$DeathMessageSelfKill[$DamageType::Missile, 3] = '\c0%1 achieved missile lock on %2self.';
$DeathMessageSelfKill[$DamageType::Missile, 4] = '\c0%1 gracefully smoked %2self with a missile!';
$DeathMessageSelfKill[$DamageType::Mine, 0] = '\c0%1 kills %2self with a mine!';
$DeathMessageSelfKill[$DamageType::Mine, 1] = '\c0%1\'s mine violently reminds %2 of its existence.';
$DeathMessageSelfKill[$DamageType::Mine, 2] = '\c0%1 plants a decisive foot on %3 own mine!';
$DeathMessageSelfKill[$DamageType::Mine, 3] = '\c0%1 fatally trips on %3 own mine!';
$DeathMessageSelfKill[$DamageType::Mine, 4] = '\c0%1 makes a note not to run over %3 own mines.';
$DeathMessageSelfKill[$DamageType::SatchelCharge, 0] = '\c0%1 goes out with a bang!'; //applies to most explosion types
$DeathMessageSelfKill[$DamageType::SatchelCharge, 1] = '\c0%1 fall down...go boom.';
$DeathMessageSelfKill[$DamageType::SatchelCharge, 2] = '\c0%1 explodes in that fatal kind of way.';
$DeathMessageSelfKill[$DamageType::SatchelCharge, 3] = '\c0%1 experiences explosive decompression!';
$DeathMessageSelfKill[$DamageType::SatchelCharge, 4] = '\c0%1 splashes all over the map.';
$DeathMessageSelfKill[$DamageType::Ground, 0] = '\c0%1 lands too hard.';
$DeathMessageSelfKill[$DamageType::Ground, 1] = '\c0%1 finds gravity unforgiving.';
$DeathMessageSelfKill[$DamageType::Ground, 2] = '\c0%1 craters on impact.';
$DeathMessageSelfKill[$DamageType::Ground, 3] = '\c0%1 pancakes upon landing.';
$DeathMessageSelfKill[$DamageType::Ground, 4] = '\c0%1 loses a game of chicken with the ground.';
$DeathMessageSelfKill[$DamageType::Flame, 0] = '\c0%1 needed a mint - %10 killed %2self.';
$DeathMessageSelfKill[$DamageType::Flame, 1] = '\c0%1 burned.';
$DeathMessageSelfKill[$DamageType::Flame, 2] = '\c0%1 over-cooked %2self.';
$DeathMessageSelfKill[$DamageType::Flame, 3] = '\c0%1 thought %10 was flame retardent.';
$DeathMessageSelfKill[$DamageType::Flame, 4] = '\c0%1 was dumb enough to test %3 ability to resist fire.';
//used when a player is killed by a teammate
$DeathMessageTeamKillCount = 1;
$DeathMessageTeamKill[$DamageType::Blaster, 0] = '\c0%4 TEAMKILLED %1 with a blaster!';
$DeathMessageTeamKill[$DamageType::Plasma, 0] = '\c0%4 TEAMKILLED %1 with a plasma rifle!';
$DeathMessageTeamKill[$DamageType::Bullet, 0] = '\c0%4 TEAMKILLED %1 with a chaingun!';
$DeathMessageTeamKill[$DamageType::Disc, 0] = '\c0%4 TEAMKILLED %1 with a spinfusor!';
$DeathMessageTeamKill[$DamageType::Grenade, 0] = '\c0%4 TEAMKILLED %1 with a grenade!';
$DeathMessageTeamKill[$DamageType::Laser, 0] = '\c0%4 TEAMKILLED %1 with a laser rifle!';
$DeathMessageTeamKill[$DamageType::Elf, 0] = '\c0%4 TEAMKILLED %1 with an ELF projector!';
$DeathMessageTeamKill[$DamageType::Mortar, 0] = '\c0%4 TEAMKILLED %1 with a mortar!';
$DeathMessageTeamKill[$DamageType::Missile, 0] = '\c0%4 TEAMKILLED %1 with a missile!';
$DeathMessageTeamKill[$DamageType::Shocklance, 0] = '\c0%4 TEAMKILLED %1 with a shocklance!';
$DeathMessageTeamKill[$DamageType::Mine, 0] = '\c0%4 TEAMKILLED %1 with a mine!';
$DeathMessageTeamKill[$DamageType::SatchelCharge, 0] = '\c0%4 blew up TEAMMATE %1!';
$DeathMessageTeamKill[$DamageType::Impact, 0] = '\c0%4 runs down TEAMMATE %1!';
$DeathMessageTeamKill[$DamageType::Flame, 0] = '\c0%4 roasts TEAMMATE %1!';
//these used when a player is killed by an enemy
$DeathMessageCount = 5;
$DeathMessage[$DamageType::Blaster, 0] = '\c0%4 kills %1 with a blaster.';
$DeathMessage[$DamageType::Blaster, 1] = '\c0%4 pings %1 to death.';
$DeathMessage[$DamageType::Blaster, 2] = '\c0%1 gets a pointer in blaster use from %4.';
$DeathMessage[$DamageType::Blaster, 3] = '\c0%4 fatally embarrasses %1 with %6 pea shooter.';
$DeathMessage[$DamageType::Blaster, 4] = '\c0%4 unleashes a terminal blaster barrage into %1.';
$DeathMessage[$DamageType::Plasma, 0] = '\c0%4 roasts %1 with the plasma rifle.';
$DeathMessage[$DamageType::Plasma, 1] = '\c0%4 gooses %1 with an extra-friendly burst of plasma.';
$DeathMessage[$DamageType::Plasma, 2] = '\c0%4 entices %1 to try a faceful of plasma.';
$DeathMessage[$DamageType::Plasma, 3] = '\c0%4 introduces %1 to the plasma immolation dance.';
$DeathMessage[$DamageType::Plasma, 4] = '\c0%4 slaps The Hot Kiss of Death on %1.';
$DeathMessage[$DamageType::Bullet, 0] = '\c0%4 rips %1 up with the chaingun.';
$DeathMessage[$DamageType::Bullet, 1] = '\c0%4 happily chews %1 into pieces with %6 chaingun.';
$DeathMessage[$DamageType::Bullet, 2] = '\c0%4 administers a dose of Vitamin Lead to %1.';
$DeathMessage[$DamageType::Bullet, 3] = '\c0%1 suffers a serious hosing from %4\'s chaingun.';
$DeathMessage[$DamageType::Bullet, 4] = '\c0%4 bestows the blessings of %6 chaingun on %1.';
$DeathMessage[$DamageType::Disc, 0] = '\c0%4 demolishes %1 with the spinfusor.';
$DeathMessage[$DamageType::Disc, 1] = '\c0%4 serves %1 a blue plate special.';
$DeathMessage[$DamageType::Disc, 2] = '\c0%4 shares a little blue friend with %1.';
$DeathMessage[$DamageType::Disc, 3] = '\c0%4 puts a little spin into %1.';
$DeathMessage[$DamageType::Disc, 4] = '\c0%1 becomes one of %4\'s greatest hits.';
$DeathMessage[$DamageType::Grenade, 0] = '\c0%4 eliminates %1 with a grenade.'; //applies to hand grenades *and* grenade launcher grenades
$DeathMessage[$DamageType::Grenade, 1] = '\c0%4 blows up %1 real good!';
$DeathMessage[$DamageType::Grenade, 2] = '\c0%1 gets annihilated by %4\'s grenade.';
$DeathMessage[$DamageType::Grenade, 3] = '\c0%1 receives a kaboom lesson from %4.';
$DeathMessage[$DamageType::Grenade, 4] = '\c0%4 turns %1 into grenade salad.';
$DeathMessage[$DamageType::Laser, 0] = '\c0%1 becomes %4\'s latest pincushion.';
$DeathMessage[$DamageType::Laser, 1] = '\c0%4 picks off %1 with %6 laser rifle.';
$DeathMessage[$DamageType::Laser, 2] = '\c0%4 uses %1 as the targeting dummy in a sniping demonstration.';
$DeathMessage[$DamageType::Laser, 3] = '\c0%4 pokes a shiny new hole in %1 with %6 laser rifle.';
$DeathMessage[$DamageType::Laser, 4] = '\c0%4 caresses %1 with a couple hundred megajoules of laser.';
$DeathMessage[$DamageType::Elf, 0] = '\c0%4 fries %1 with the ELF projector.';
$DeathMessage[$DamageType::Elf, 1] = '\c0%4 bug zaps %1 with %6 ELF.';
$DeathMessage[$DamageType::Elf, 2] = '\c0%1 learns the shocking truth about %4\'s ELF skills.';
$DeathMessage[$DamageType::Elf, 3] = '\c0%4 electrocutes %1 without a sponge.';
$DeathMessage[$DamageType::Elf, 4] = '\c0%4\'s ELF projector leaves %1 a crispy critter.';
$DeathMessage[$DamageType::Mortar, 0] = '\c0%4 obliterates %1 with the mortar.';
$DeathMessage[$DamageType::Mortar, 1] = '\c0%4 drops a mortar round right in %1\'s lap.';
$DeathMessage[$DamageType::Mortar, 2] = '\c0%4 delivers a mortar payload straight to %1.';
$DeathMessage[$DamageType::Mortar, 3] = '\c0%4 offers a little "heavy love" to %1.';
$DeathMessage[$DamageType::Mortar, 4] = '\c0%1 stumbles into %4\'s mortar reticle.';
$DeathMessage[$DamageType::Missile, 0] = '\c0%4 intercepts %1 with a missile.';
$DeathMessage[$DamageType::Missile, 1] = '\c0%4 watches %6 missile touch %1 and go boom.';
$DeathMessage[$DamageType::Missile, 2] = '\c0%4 got sweet tone on %1.';
$DeathMessage[$DamageType::Missile, 3] = '\c0By now, %1 has realized %4\'s missile killed %2.';
$DeathMessage[$DamageType::Missile, 4] = '\c0%4\'s missile rains little pieces of %1 all over the ground.';
$DeathMessage[$DamageType::Shocklance, 0] = '\c0%4 reaps a harvest of %1 with the shocklance.';
$DeathMessage[$DamageType::Shocklance, 1] = '\c0%4 feeds %1 the business end of %6 shocklance.';
$DeathMessage[$DamageType::Shocklance, 2] = '\c0%4 stops %1 dead with the shocklance.';
$DeathMessage[$DamageType::Shocklance, 3] = '\c0%4 eliminates %1 in close combat.';
$DeathMessage[$DamageType::Shocklance, 4] = '\c0%4 ruins %1\'s day with one zap of a shocklance.';
$DeathMessage[$DamageType::Mine, 0] = '\c0%4 kills %1 with a mine.';
$DeathMessage[$DamageType::Mine, 1] = '\c0%1 doesn\'t see %4\'s mine in time.';
$DeathMessage[$DamageType::Mine, 2] = '\c0%4 gets a sapper kill on %1.';
$DeathMessage[$DamageType::Mine, 3] = '\c0%1 puts his foot on %4\'s mine.';
$DeathMessage[$DamageType::Mine, 4] = '\c0One small step for %1, one giant mine kill for %4.';
$DeathMessage[$DamageType::Flame, 0] = '\c0%4 cooked %1 extra crispy.';
$DeathMessage[$DamageType::Flame, 1] = '\c0%4 roasts %1.';
$DeathMessage[$DamageType::Flame, 2] = '\c0%4 ignited %1.';
$DeathMessage[$DamageType::Flame, 3] = '\c0%4 lit up %1 - literally.';
$DeathMessage[$DamageType::Flame, 4] = '\c0%4 magically turned %1 to ash.';
$DeathMessage[$DamageType::SatchelCharge, 0] = '\c0%4 buys %1 a ticket to the moon.'; //satchel charge only
$DeathMessage[$DamageType::SatchelCharge, 1] = '\c0%4 blows %1 into low orbit.';
$DeathMessage[$DamageType::SatchelCharge, 2] = '\c0%4 makes %1 a hugely explosive offer.';
$DeathMessage[$DamageType::SatchelCharge, 3] = '\c0%4 turns %1 into a cloud of satchel-vaporized armor.';
$DeathMessage[$DamageType::SatchelCharge, 4] = '\c0%4\'s satchel charge leaves %1 nothin\' but smokin\' boots.';
$DeathMessageHeadshotCount = 3;
$DeathMessageHeadshot[$DamageType::Laser, 0] = '\c0%4 drills right through %1\'s braincase with %6 laser.';
$DeathMessageHeadshot[$DamageType::Laser, 1] = '\c0%4 pops %1\'s head like a cheap balloon.';
$DeathMessageHeadshot[$DamageType::Laser, 2] = '\c0%1 loses %3 head over %4\'s laser skill.';
// z0dd - ZOD, 8/25/02. Added Lance rear shot messages
$DeathMessageRearshotCount = 3;
$DeathMessageRearshot[$DamageType::ShockLance, 0] = '\c0%4 delivers a backdoor Lance to %1.';
$DeathMessageRearshot[$DamageType::ShockLance, 1] = '\c0%4 sends high voltage up %1\'s bum.';
$DeathMessageRearshot[$DamageType::ShockLance, 2] = '\c0%1 receives %4\'s rear-entry Lance attack.';
//These used when a player is run over by a vehicle
$DeathMessageVehicleCount = 5;
$DeathMessageVehicle[0] = '\c0%4 runs down %1.';
$DeathMessageVehicle[1] = '\c0%1 acquires that run-down feeling from %4.';
$DeathMessageVehicle[2] = '\c0%4 transforms %1 into tribal roadkill.';
$DeathMessageVehicle[3] = '\c0%1 makes a painfully close examination of %4\'s front bumper.';
$DeathMessageVehicle[4] = '\c0%1\'s messy death leaves a mark on %4\'s vehicle finish.';
$DeathMessageVehicleCrashCount = 5;
$DeathMessageVehicleCrash[ $DamageType::Crash, 0 ] = '\c0%1 fails to eject in time.';
$DeathMessageVehicleCrash[ $DamageType::Crash, 1 ] = '\c0%1 becomes one with his vehicle dashboard.';
$DeathMessageVehicleCrash[ $DamageType::Crash, 2 ] = '\c0%1 drives under the influence of death.';
$DeathMessageVehicleCrash[ $DamageType::Crash, 3 ] = '\c0%1 makes a perfect three hundred point landing.';
$DeathMessageVehicleCrash[ $DamageType::Crash, 4 ] = '\c0%1 heroically pilots his vehicle into something really, really hard.';
$DeathMessageVehicleFriendlyCount = 3;
$DeathMessageVehicleFriendly[0] = '\c0%1 gets in the way of a friendly vehicle.';
$DeathMessageVehicleFriendly[1] = '\c0Sadly, a friendly vehicle turns %1 into roadkill.';
$DeathMessageVehicleFriendly[2] = '\c0%1 becomes an unsightly ornament on a team vehicle\'s hood.';
$DeathMessageVehicleUnmannedCount = 3;
$DeathMessageVehicleUnmanned[0] = '\c0%1 gets in the way of a runaway vehicle.';
$DeathMessageVehicleUnmanned[1] = '\c0An unmanned vehicle kills the pathetic %1.';
$DeathMessageVehicleUnmanned[2] = '\c0%1 is struck down by an empty vehicle.';
//These used when a player is killed by a nearby equipment explosion
$DeathMessageExplosionCount = 3;
$DeathMessageExplosion[0] = '\c0%1 was killed by exploding equipment!';
$DeathMessageExplosion[1] = '\c0%1 stood a little too close to the action!';
$DeathMessageExplosion[2] = '\c0%1 learns how to be collateral damage.';
//These used when an automated turret kills an enemy player
$DeathMessageTurretKillCount = 3;
$DeathMessageTurretKill[$DamageType::PlasmaTurret, 0] = '\c0%1 is killed by a plasma turret.';
$DeathMessageTurretKill[$DamageType::PlasmaTurret, 1] = '\c0%1\'s body now marks the location of a plasma turret.';
$DeathMessageTurretKill[$DamageType::PlasmaTurret, 2] = '\c0%1 is fried by a plasma turret.';
$DeathMessageTurretKill[$DamageType::AATurret, 0] = '\c0%1 is killed by an AA turret.';
$DeathMessageTurretKill[$DamageType::AATurret, 1] = '\c0%1 is shot down by an AA turret.';
$DeathMessageTurretKill[$DamageType::AATurret, 2] = '\c0%1 takes fatal flak from an AA turret.';
$DeathMessageTurretKill[$DamageType::ElfTurret, 0] = '\c0%1 is killed by an ELF turret.';
$DeathMessageTurretKill[$DamageType::ElfTurret, 1] = '\c0%1 is zapped by an ELF turret.';
$DeathMessageTurretKill[$DamageType::ElfTurret, 2] = '\c0%1 is short-circuited by an ELF turret.';
$DeathMessageTurretKill[$DamageType::MortarTurret, 0] = '\c0%1 is killed by a mortar turret.';
$DeathMessageTurretKill[$DamageType::MortarTurret, 1] = '\c0%1 enjoys a mortar turret\'s attention.';
$DeathMessageTurretKill[$DamageType::MortarTurret, 2] = '\c0%1 is blown to kibble by a mortar turret.';
$DeathMessageTurretKill[$DamageType::MissileTurret, 0] = '\c0%1 is killed by a missile turret.';
$DeathMessageTurretKill[$DamageType::MissileTurret, 1] = '\c0%1 is shot down by a missile turret.';
$DeathMessageTurretKill[$DamageType::MissileTurret, 2] = '\c0%1 is blown away by a missile turret.';
$DeathMessageTurretKill[$DamageType::IndoorDepTurret, 0] = '\c0%1 is killed by a clamp turret.';
$DeathMessageTurretKill[$DamageType::IndoorDepTurret, 1] = '\c0%1 gets burned by a clamp turret.';
$DeathMessageTurretKill[$DamageType::IndoorDepTurret, 2] = '\c0A clamp turret eliminates %1.';
$DeathMessageTurretKill[$DamageType::OutdoorDepTurret, 0] = '\c0A spike turret neatly drills %1.';
$DeathMessageTurretKill[$DamageType::OutdoorDepTurret, 1] = '\c0%1 gets taken out by a spike turret.';
$DeathMessageTurretKill[$DamageType::OutdoorDepTurret, 2] = '\c0%1 dies under a spike turret\'s love.';
$DeathMessageTurretKill[$DamageType::SentryTurret, 0] = '\c0%1 didn\'t see that Sentry turret, but it saw %2...';
$DeathMessageTurretKill[$DamageType::SentryTurret, 1] = '\c0%1 needs to watch for Sentry turrets.';
$DeathMessageTurretKill[$DamageType::SentryTurret, 2] = '\c0%1 now understands how Sentry turrets work.';
//used when a player is killed by a teammate controlling a turret
$DeathMessageCTurretTeamKillCount = 1;
$DeathMessageCTurretTeamKill[$DamageType::PlasmaTurret, 0] = '\c0%4 TEAMKILLED %1 with a plasma turret!';
$DeathMessageCTurretTeamKill[$DamageType::AATurret, 0] = '\c0%4 TEAMKILLED %1 with an AA turret!';
$DeathMessageCTurretTeamKill[$DamageType::ELFTurret, 0] = '\c0%4 TEAMKILLED %1 with an ELF turret!';
$DeathMessageCTurretTeamKill[$DamageType::MortarTurret, 0] = '\c0%4 TEAMKILLED %1 with a mortar turret!';
$DeathMessageCTurretTeamKill[$DamageType::MissileTurret, 0] = '\c0%4 TEAMKILLED %1 with a missile turret!';
$DeathMessageCTurretTeamKill[$DamageType::IndoorDepTurret, 0] = '\c0%4 TEAMKILLED %1 with a clamp turret!';
$DeathMessageCTurretTeamKill[$DamageType::OutdoorDepTurret, 0] = '\c0%4 TEAMKILLED %1 with a spike turret!';
$DeathMessageCTurretTeamKill[$DamageType::SentryTurret, 0] = '\c0%4 TEAMKILLED %1 with a sentry turret!';
$DeathMessageCTurretTeamKill[$DamageType::BomberBombs, 0] = '\c0%4 TEAMKILLED %1 in a bombastic explosion of raining death.';
$DeathMessageCTurretTeamKill[$DamageType::BellyTurret, 0] = '\c0%4 TEAMKILLED %1 by annihilating him from a belly turret.';
$DeathMessageCTurretTeamKill[$DamageType::TankChainGun, 0] = '\c0%4 TEAMKILLED %1 with his tank\'s chaingun.';
$DeathMessageCTurretTeamKill[$DamageType::TankMortar, 0] = '\c0%4 TEAMKILLED %1 by lobbing the BIG green death from a tank.';
$DeathMessageCTurretTeamKill[$DamageType::ShrikeBlaster, 0] = '\c0%4 TEAMKILLED %1 by strafing from a Shrike.';
$DeathMessageCTurretTeamKill[$DamageType::MPBMissile, 0] = '\c0%4 TEAMKILLED %1 when the MPB locked onto him.';
//used when a player is killed by an uncontrolled, friendly turret
$DeathMessageCTurretAccdtlKillCount = 1;
$DeathMessageCTurretAccdtlKill[$DamageType::PlasmaTurret, 0] = '\c0%1 got in the way of a plasma turret!';
$DeathMessageCTurretAccdtlKill[$DamageType::AATurret, 0] = '\c0%1 got in the way of an AA turret!';
$DeathMessageCTurretAccdtlKill[$DamageType::ELFTurret, 0] = '\c0%1 got in the way of an ELF turret!';
$DeathMessageCTurretAccdtlKill[$DamageType::MortarTurret, 0] = '\c0%1 got in the way of a mortar turret!';
$DeathMessageCTurretAccdtlKill[$DamageType::MissileTurret, 0] = '\c0%1 got in the way of a missile turret!';
$DeathMessageCTurretAccdtlKill[$DamageType::IndoorDepTurret, 0] = '\c0%1 got in the way of a clamp turret!';
$DeathMessageCTurretAccdtlKill[$DamageType::OutdoorDepTurret, 0] = '\c0%1 got in the way of a spike turret!';
$DeathMessageCTurretAccdtlKill[$DamageType::SentryTurret, 0] = '\c0%1 got in the way of a Sentry turret!';
//these messages for owned or controlled turrets
$DeathMessageCTurretKillCount = 3;
$DeathMessageCTurretKill[$DamageType::PlasmaTurret, 0] = '\c0%4 torches %1 with a plasma turret!';
$DeathMessageCTurretKill[$DamageType::PlasmaTurret, 1] = '\c0%4 fries %1 with a plasma turret!';
$DeathMessageCTurretKill[$DamageType::PlasmaTurret, 2] = '\c0%4 lights up %1 with a plasma turret!';
$DeathMessageCTurretKill[$DamageType::AATurret, 0] = '\c0%4 shoots down %1 with an AA turret.';
$DeathMessageCTurretKill[$DamageType::AATurret, 1] = '\c0%1 gets shot down by %1\'s AA turret.';
$DeathMessageCTurretKill[$DamageType::AATurret, 2] = '\c0%4 takes out %1 with an AA turret.';
$DeathMessageCTurretKill[$DamageType::ElfTurret, 0] = '\c0%1 gets zapped by ELF gunner %4.';
$DeathMessageCTurretKill[$DamageType::ElfTurret, 1] = '\c0%1 gets barbecued by ELF gunner %4.';
$DeathMessageCTurretKill[$DamageType::ElfTurret, 2] = '\c0%1 gets shocked by ELF gunner %4.';
$DeathMessageCTurretKill[$DamageType::MortarTurret, 0] = '\c0%1 is annihilated by %4\'s mortar turret.';
$DeathMessageCTurretKill[$DamageType::MortarTurret, 1] = '\c0%1 is blown away by %4\'s mortar turret.';
$DeathMessageCTurretKill[$DamageType::MortarTurret, 2] = '\c0%1 is pureed by %4\'s mortar turret.';
$DeathMessageCTurretKill[$DamageType::MissileTurret, 0] = '\c0%4 shows %1 a new world of pain with a missile turret.';
$DeathMessageCTurretKill[$DamageType::MissileTurret, 1] = '\c0%4 pops %1 with a missile turret.';
$DeathMessageCTurretKill[$DamageType::MissileTurret, 2] = '\c0%4\'s missile turret lights up %1\'s, uh, ex-life.';
$DeathMessageCTurretKill[$DamageType::IndoorDepTurret, 0] = '\c0%1 is chewed up and spat out by %4\'s clamp turret.';
$DeathMessageCTurretKill[$DamageType::IndoorDepTurret, 1] = '\c0%1 is knocked out by %4\'s clamp turret.';
$DeathMessageCTurretKill[$DamageType::IndoorDepTurret, 2] = '\c0%4\'s clamp turret drills %1 nicely.';
$DeathMessageCTurretKill[$DamageType::OutdoorDepTurret, 0] = '\c0%1 is chewed up by %4\'s spike turret.';
$DeathMessageCTurretKill[$DamageType::OutdoorDepTurret, 1] = '\c0%1 feels the burn from %4\'s spike turret.';
$DeathMessageCTurretKill[$DamageType::OutdoorDepTurret, 2] = '\c0%1 is nailed by %4\'s spike turret.';
$DeathMessageCTurretKill[$DamageType::SentryTurret, 0] = '\c0%4 caught %1 by surprise with a turret.';
$DeathMessageCTurretKill[$DamageType::SentryTurret, 1] = '\c0%4\'s turret took out %1.';
$DeathMessageCTurretKill[$DamageType::SentryTurret, 2] = '\c0%4 blasted %1 with a turret.';
$DeathMessageCTurretKill[$DamageType::BomberBombs, 0] = '\c0%1 catches %4\'s bomb in both teeth.';
$DeathMessageCTurretKill[$DamageType::BomberBombs, 1] = '\c0%4 leaves %1 a smoking bomb crater.';
$DeathMessageCTurretKill[$DamageType::BomberBombs, 2] = '\c0%4 bombs %1 back to the 20th century.';
$DeathMessageCTurretKill[$DamageType::BellyTurret, 0] = '\c0%1 eats a big helping of %4\'s belly turret bolt.';
$DeathMessageCTurretKill[$DamageType::BellyTurret, 1] = '\c0%4 plants a belly turret bolt in %1\'s belly.';
$DeathMessageCTurretKill[$DamageType::BellyTurret, 2] = '\c0%1 fails to evade %4\'s deft bomber strafing.';
$DeathMessageCTurretKill[$DamageType::TankChainGun, 0] = '\c0%1 enjoys the rich, metallic taste of %4\'s tank slug.';
$DeathMessageCTurretKill[$DamageType::TankChainGun, 1] = '\c0%4\'s tank chaingun plays sweet music all over %1.';
$DeathMessageCTurretKill[$DamageType::TankChainGun, 2] = '\c0%1 receives a stellar exit wound from %4\'s tank slug.';
$DeathMessageCTurretKill[$DamageType::TankMortar, 0] = '\c0Whoops! %1 + %4\'s tank mortar = Dead %1.';
$DeathMessageCTurretKill[$DamageType::TankMortar, 1] = '\c0%1 learns the happy explosion dance from %4\'s tank mortar.';
$DeathMessageCTurretKill[$DamageType::TankMortar, 2] = '\c0%4\'s tank mortar has a blast with %1.';
$DeathMessageCTurretKill[$DamageType::ShrikeBlaster, 0] = '\c0%1 dines on a Shrike blaster sandwich, courtesy of %4.';
$DeathMessageCTurretKill[$DamageType::ShrikeBlaster, 1] = '\c0The blaster of %4\'s Shrike turns %1 into finely shredded meat.';
$DeathMessageCTurretKill[$DamageType::ShrikeBlaster, 2] = '\c0%1 gets drilled big-time by the blaster of %4\'s Shrike.';
$DeathMessageCTurretKill[$DamageType::MPBMissile, 0] = '\c0%1 intersects nicely with %4\'s MPB Missile.';
$DeathMessageCTurretKill[$DamageType::MPBMissile, 1] = '\c0%4\'s MPB Missile makes armored chowder out of %1.';
$DeathMessageCTurretKill[$DamageType::MPBMissile, 2] = '\c0%1 has a brief, explosive fling with %4\'s MPB Missile.';
$DeathMessageTurretSelfKillCount = 3;
$DeathMessageTurretSelfKill[0] = '\c0%1 somehow kills %2self with a turret.';
$DeathMessageTurretSelfKill[1] = '\c0%1 apparently didn\'t know the turret was loaded.';
$DeathMessageTurretSelfKill[2] = '\c0%1 helps his team by killing himself with a turret.';
/////////////////////////////////////////////////////////////////////////////////////////////////
// %1 = Victim's name //
// %2 = Victim's gender (value will be either "him" or "her") //
// %3 = Victim's possessive gender (value will be either "his" or "her") //
// %4 = Killer's name //
// %5 = Killer's gender (value will be either "him" or "her") //
// %6 = Killer's possessive gender (value will be either "his" or "her") //
// %7 = implement that killed the victim (value is the object number of the bullet, disc, etc) //
// %10 = Victim gender (value will be either "he" or "she") //
// %11 = Killer gender (value will be either "he" or "she") //
/////////////////////////////////////////////////////////////////////////////////////////////////
$DeathMessageCampingCount = 1;
$DeathMessageCamping[0] = '\c0%1 was killed for camping near the Nexus.';
//Out of Bounds deaths
$DeathMessageOOBCount = 2;
$DeathMessageOOB[0] = '\c0%1 was killed for loitering outside the mission area.';
$DeathMessageOOB[1] = '\c0%1 was eaten by a Grue.';
$DeathMessageLavaCount = 4;
$DeathMessageLava[0] = '\c0%1\'s last thought before falling into the lava : \'Oops\'.';
$DeathMessageLava[1] = '\c0%1 makes the supreme sacrifice to the lava gods.';
$DeathMessageLava[2] = '\c0%1 looks surprised by the lava - but only briefly.';
$DeathMessageLava[3] = '\c0%1 wimps out by jumping into the lava and trying to make it look like an accident.';
$DeathMessageLightningCount = 3;
$DeathMessageLightning[0] = '\c0%1 was killed by lightning!';
$DeathMessageLightning[1] = '\c0%1 caught a lightning bolt!';
$DeathMessageLightning[2] = '\c0%1 stuck %3 finger in Mother Nature\'s light socket.';
//these used when a player presses ctrl-k
$DeathMessageSuicideCount = 5;
$DeathMessageSuicide[0] = '\c0%1 blows %3 own head off!';
$DeathMessageSuicide[1] = '\c0%1 ends it all. Cue violin music.';
$DeathMessageSuicide[2] = '\c0%1 kills %2self.';
$DeathMessageSuicide[3] = '\c0%1 goes for the quick and dirty respawn.';
$DeathMessageSuicide[4] = '\c0%1 self-destructs in a fit of ennui.';
$DeathMessageVehPadCount = 1;
$DeathMessageVehPad[0] = '\c0%1 got caught in a vehicle\'s spawn field.';
$DeathMessageFFPowerupCount = 1;
$DeathMessageFFPowerup[0] = '\c0%1 got caught up in a forcefield during power up.';
$DeathMessageRogueMineCount = 1;
$DeathMessageRogueMine[$DamageType::Mine, 0] = '\c0%1 is all mine.';
//these used when a player kills himself (other than by using ctrl - k)
$DeathMessageSelfKillCount = 5;
$DeathMessageSelfKill[$DamageType::Blaster, 0] = '\c0%1 kills %2self with a blaster.';
$DeathMessageSelfKill[$DamageType::Blaster, 1] = '\c0%1 makes a note to watch out for blaster ricochets.';
$DeathMessageSelfKill[$DamageType::Blaster, 2] = '\c0%1\'s blaster kills its hapless owner.';
$DeathMessageSelfKill[$DamageType::Blaster, 3] = '\c0%1 deftly guns %2self down with %3 own blaster.';
$DeathMessageSelfKill[$DamageType::Blaster, 4] = '\c0%1 has a fatal encounter with %3 own blaster.';
$DeathMessageSelfKill[$DamageType::Plasma, 0] = '\c0%1 kills %2self with plasma.';
$DeathMessageSelfKill[$DamageType::Plasma, 1] = '\c0%1 turns %2self into plasma-charred briquettes.';
$DeathMessageSelfKill[$DamageType::Plasma, 2] = '\c0%1 swallows a white-hot mouthful of %3 own plasma.';
$DeathMessageSelfKill[$DamageType::Plasma, 3] = '\c0%1 immolates %2self.';
$DeathMessageSelfKill[$DamageType::Plasma, 4] = '\c0%1 experiences the joy of cooking %2self.';
$DeathMessageSelfKill[$DamageType::Disc, 0] = '\c0%1 kills %2self with a disc.';
$DeathMessageSelfKill[$DamageType::Disc, 1] = '\c0%1 catches %3 own spinfusor disc.';
$DeathMessageSelfKill[$DamageType::Disc, 2] = '\c0%1 heroically falls on %3 own disc.';
$DeathMessageSelfKill[$DamageType::Disc, 3] = '\c0%1 helpfully jumps into %3 own disc\'s explosion.';
$DeathMessageSelfKill[$DamageType::Disc, 4] = '\c0%1 plays Russian roulette with %3 spinfusor.';
$DeathMessageSelfKill[$DamageType::Grenade, 0] = '\c0%1 destroys %2self with a grenade!'; //applies to hand grenades *and* grenade launcher grenades
$DeathMessageSelfKill[$DamageType::Grenade, 1] = '\c0%1 took a bad bounce from %3 own grenade!';
$DeathMessageSelfKill[$DamageType::Grenade, 2] = '\c0%1 pulled the pin a shade early.';
$DeathMessageSelfKill[$DamageType::Grenade, 3] = '\c0%1\'s own grenade turns on %2.';
$DeathMessageSelfKill[$DamageType::Grenade, 4] = '\c0%1 blows %2self up real good.';
$DeathMessageSelfKill[$DamageType::Mortar, 0] = '\c0%1 kills %2self with a mortar!';
$DeathMessageSelfKill[$DamageType::Mortar, 1] = '\c0%1 hugs %3 own big green boomie.';
$DeathMessageSelfKill[$DamageType::Mortar, 2] = '\c0%1 mortars %2self all over the map.';
$DeathMessageSelfKill[$DamageType::Mortar, 3] = '\c0%1 experiences %3 mortar\'s payload up close.';
$DeathMessageSelfKill[$DamageType::Mortar, 4] = '\c0%1 suffered the wrath of %3 own mortar.';
$DeathMessageSelfKill[$DamageType::Missile, 0] = '\c0%1 kills %2self with a missile!';
$DeathMessageSelfKill[$DamageType::Missile, 1] = '\c0%1 runs a missile up %3 own tailpipe.';
$DeathMessageSelfKill[$DamageType::Missile, 2] = '\c0%1 tests the missile\'s shaped charge on %2self.';
$DeathMessageSelfKill[$DamageType::Missile, 3] = '\c0%1 achieved missile lock on %2self.';
$DeathMessageSelfKill[$DamageType::Missile, 4] = '\c0%1 gracefully smoked %2self with a missile!';
$DeathMessageSelfKill[$DamageType::Mine, 0] = '\c0%1 kills %2self with a mine!';
$DeathMessageSelfKill[$DamageType::Mine, 1] = '\c0%1\'s mine violently reminds %2 of its existence.';
$DeathMessageSelfKill[$DamageType::Mine, 2] = '\c0%1 plants a decisive foot on %3 own mine!';
$DeathMessageSelfKill[$DamageType::Mine, 3] = '\c0%1 fatally trips on %3 own mine!';
$DeathMessageSelfKill[$DamageType::Mine, 4] = '\c0%1 makes a note not to run over %3 own mines.';
$DeathMessageSelfKill[$DamageType::SatchelCharge, 0] = '\c0%1 goes out with a bang!'; //applies to most explosion types
$DeathMessageSelfKill[$DamageType::SatchelCharge, 1] = '\c0%1 fall down...go boom.';
$DeathMessageSelfKill[$DamageType::SatchelCharge, 2] = '\c0%1 explodes in that fatal kind of way.';
$DeathMessageSelfKill[$DamageType::SatchelCharge, 3] = '\c0%1 experiences explosive decompression!';
$DeathMessageSelfKill[$DamageType::SatchelCharge, 4] = '\c0%1 splashes all over the map.';
$DeathMessageSelfKill[$DamageType::Ground, 0] = '\c0%1 lands too hard.';
$DeathMessageSelfKill[$DamageType::Ground, 1] = '\c0%1 finds gravity unforgiving.';
$DeathMessageSelfKill[$DamageType::Ground, 2] = '\c0%1 craters on impact.';
$DeathMessageSelfKill[$DamageType::Ground, 3] = '\c0%1 pancakes upon landing.';
$DeathMessageSelfKill[$DamageType::Ground, 4] = '\c0%1 loses a game of chicken with the ground.';
$DeathMessageSelfKill[$DamageType::Flame, 0] = '\c0%1 needed a mint - %10 killed %2self.';
$DeathMessageSelfKill[$DamageType::Flame, 1] = '\c0%1 burned.';
$DeathMessageSelfKill[$DamageType::Flame, 2] = '\c0%1 over-cooked %2self.';
$DeathMessageSelfKill[$DamageType::Flame, 3] = '\c0%1 thought %10 was flame retardent.';
$DeathMessageSelfKill[$DamageType::Flame, 4] = '\c0%1 was dumb enough to test %3 ability to resist fire.';
//used when a player is killed by a teammate
$DeathMessageTeamKillCount = 1;
$DeathMessageTeamKill[$DamageType::Blaster, 0] = '\c0%4 TEAMKILLED %1 with a blaster!';
$DeathMessageTeamKill[$DamageType::Plasma, 0] = '\c0%4 TEAMKILLED %1 with a plasma rifle!';
$DeathMessageTeamKill[$DamageType::Bullet, 0] = '\c0%4 TEAMKILLED %1 with a chaingun!';
$DeathMessageTeamKill[$DamageType::Disc, 0] = '\c0%4 TEAMKILLED %1 with a spinfusor!';
$DeathMessageTeamKill[$DamageType::Grenade, 0] = '\c0%4 TEAMKILLED %1 with a grenade!';
$DeathMessageTeamKill[$DamageType::Laser, 0] = '\c0%4 TEAMKILLED %1 with a laser rifle!';
$DeathMessageTeamKill[$DamageType::Elf, 0] = '\c0%4 TEAMKILLED %1 with an ELF projector!';
$DeathMessageTeamKill[$DamageType::Mortar, 0] = '\c0%4 TEAMKILLED %1 with a mortar!';
$DeathMessageTeamKill[$DamageType::Missile, 0] = '\c0%4 TEAMKILLED %1 with a missile!';
$DeathMessageTeamKill[$DamageType::Shocklance, 0] = '\c0%4 TEAMKILLED %1 with a shocklance!';
$DeathMessageTeamKill[$DamageType::Mine, 0] = '\c0%4 TEAMKILLED %1 with a mine!';
$DeathMessageTeamKill[$DamageType::SatchelCharge, 0] = '\c0%4 blew up TEAMMATE %1!';
$DeathMessageTeamKill[$DamageType::Impact, 0] = '\c0%4 runs down TEAMMATE %1!';
$DeathMessageTeamKill[$DamageType::Flame, 0] = '\c0%4 roasts TEAMMATE %1!';
//these used when a player is killed by an enemy
$DeathMessageCount = 5;
$DeathMessage[$DamageType::Blaster, 0] = '\c0%4 kills %1 with a blaster.';
$DeathMessage[$DamageType::Blaster, 1] = '\c0%4 pings %1 to death.';
$DeathMessage[$DamageType::Blaster, 2] = '\c0%1 gets a pointer in blaster use from %4.';
$DeathMessage[$DamageType::Blaster, 3] = '\c0%4 fatally embarrasses %1 with %6 pea shooter.';
$DeathMessage[$DamageType::Blaster, 4] = '\c0%4 unleashes a terminal blaster barrage into %1.';
$DeathMessage[$DamageType::Plasma, 0] = '\c0%4 roasts %1 with the plasma rifle.';
$DeathMessage[$DamageType::Plasma, 1] = '\c0%4 gooses %1 with an extra-friendly burst of plasma.';
$DeathMessage[$DamageType::Plasma, 2] = '\c0%4 entices %1 to try a faceful of plasma.';
$DeathMessage[$DamageType::Plasma, 3] = '\c0%4 introduces %1 to the plasma immolation dance.';
$DeathMessage[$DamageType::Plasma, 4] = '\c0%4 slaps The Hot Kiss of Death on %1.';
$DeathMessage[$DamageType::Bullet, 0] = '\c0%4 rips %1 up with the chaingun.';
$DeathMessage[$DamageType::Bullet, 1] = '\c0%4 happily chews %1 into pieces with %6 chaingun.';
$DeathMessage[$DamageType::Bullet, 2] = '\c0%4 administers a dose of Vitamin Lead to %1.';
$DeathMessage[$DamageType::Bullet, 3] = '\c0%1 suffers a serious hosing from %4\'s chaingun.';
$DeathMessage[$DamageType::Bullet, 4] = '\c0%4 bestows the blessings of %6 chaingun on %1.';
$DeathMessage[$DamageType::Disc, 0] = '\c0%4 demolishes %1 with the spinfusor.';
$DeathMessage[$DamageType::Disc, 1] = '\c0%4 serves %1 a blue plate special.';
$DeathMessage[$DamageType::Disc, 2] = '\c0%4 shares a little blue friend with %1.';
$DeathMessage[$DamageType::Disc, 3] = '\c0%4 puts a little spin into %1.';
$DeathMessage[$DamageType::Disc, 4] = '\c0%1 becomes one of %4\'s greatest hits.';
$DeathMessage[$DamageType::Grenade, 0] = '\c0%4 eliminates %1 with a grenade.'; //applies to hand grenades *and* grenade launcher grenades
$DeathMessage[$DamageType::Grenade, 1] = '\c0%4 blows up %1 real good!';
$DeathMessage[$DamageType::Grenade, 2] = '\c0%1 gets annihilated by %4\'s grenade.';
$DeathMessage[$DamageType::Grenade, 3] = '\c0%1 receives a kaboom lesson from %4.';
$DeathMessage[$DamageType::Grenade, 4] = '\c0%4 turns %1 into grenade salad.';
$DeathMessage[$DamageType::Laser, 0] = '\c0%1 becomes %4\'s latest pincushion.';
$DeathMessage[$DamageType::Laser, 1] = '\c0%4 picks off %1 with %6 laser rifle.';
$DeathMessage[$DamageType::Laser, 2] = '\c0%4 uses %1 as the targeting dummy in a sniping demonstration.';
$DeathMessage[$DamageType::Laser, 3] = '\c0%4 pokes a shiny new hole in %1 with %6 laser rifle.';
$DeathMessage[$DamageType::Laser, 4] = '\c0%4 caresses %1 with a couple hundred megajoules of laser.';
$DeathMessage[$DamageType::Elf, 0] = '\c0%4 fries %1 with the ELF projector.';
$DeathMessage[$DamageType::Elf, 1] = '\c0%4 bug zaps %1 with %6 ELF.';
$DeathMessage[$DamageType::Elf, 2] = '\c0%1 learns the shocking truth about %4\'s ELF skills.';
$DeathMessage[$DamageType::Elf, 3] = '\c0%4 electrocutes %1 without a sponge.';
$DeathMessage[$DamageType::Elf, 4] = '\c0%4\'s ELF projector leaves %1 a crispy critter.';
$DeathMessage[$DamageType::Mortar, 0] = '\c0%4 obliterates %1 with the mortar.';
$DeathMessage[$DamageType::Mortar, 1] = '\c0%4 drops a mortar round right in %1\'s lap.';
$DeathMessage[$DamageType::Mortar, 2] = '\c0%4 delivers a mortar payload straight to %1.';
$DeathMessage[$DamageType::Mortar, 3] = '\c0%4 offers a little "heavy love" to %1.';
$DeathMessage[$DamageType::Mortar, 4] = '\c0%1 stumbles into %4\'s mortar reticle.';
$DeathMessage[$DamageType::Missile, 0] = '\c0%4 intercepts %1 with a missile.';
$DeathMessage[$DamageType::Missile, 1] = '\c0%4 watches %6 missile touch %1 and go boom.';
$DeathMessage[$DamageType::Missile, 2] = '\c0%4 got sweet tone on %1.';
$DeathMessage[$DamageType::Missile, 3] = '\c0By now, %1 has realized %4\'s missile killed %2.';
$DeathMessage[$DamageType::Missile, 4] = '\c0%4\'s missile rains little pieces of %1 all over the ground.';
$DeathMessage[$DamageType::Shocklance, 0] = '\c0%4 reaps a harvest of %1 with the shocklance.';
$DeathMessage[$DamageType::Shocklance, 1] = '\c0%4 feeds %1 the business end of %6 shocklance.';
$DeathMessage[$DamageType::Shocklance, 2] = '\c0%4 stops %1 dead with the shocklance.';
$DeathMessage[$DamageType::Shocklance, 3] = '\c0%4 eliminates %1 in close combat.';
$DeathMessage[$DamageType::Shocklance, 4] = '\c0%4 ruins %1\'s day with one zap of a shocklance.';
$DeathMessage[$DamageType::Mine, 0] = '\c0%4 kills %1 with a mine.';
$DeathMessage[$DamageType::Mine, 1] = '\c0%1 doesn\'t see %4\'s mine in time.';
$DeathMessage[$DamageType::Mine, 2] = '\c0%4 gets a sapper kill on %1.';
$DeathMessage[$DamageType::Mine, 3] = '\c0%1 puts his foot on %4\'s mine.';
$DeathMessage[$DamageType::Mine, 4] = '\c0One small step for %1, one giant mine kill for %4.';
$DeathMessage[$DamageType::Flame, 0] = '\c0%4 cooked %1 extra crispy.';
$DeathMessage[$DamageType::Flame, 1] = '\c0%4 roasts %1.';
$DeathMessage[$DamageType::Flame, 2] = '\c0%4 ignited %1.';
$DeathMessage[$DamageType::Flame, 3] = '\c0%4 lit up %1 - literally.';
$DeathMessage[$DamageType::Flame, 4] = '\c0%4 magically turned %1 to ash.';
$DeathMessage[$DamageType::SatchelCharge, 0] = '\c0%4 buys %1 a ticket to the moon.'; //satchel charge only
$DeathMessage[$DamageType::SatchelCharge, 1] = '\c0%4 blows %1 into low orbit.';
$DeathMessage[$DamageType::SatchelCharge, 2] = '\c0%4 makes %1 a hugely explosive offer.';
$DeathMessage[$DamageType::SatchelCharge, 3] = '\c0%4 turns %1 into a cloud of satchel-vaporized armor.';
$DeathMessage[$DamageType::SatchelCharge, 4] = '\c0%4\'s satchel charge leaves %1 nothin\' but smokin\' boots.';
$DeathMessageHeadshotCount = 3;
$DeathMessageHeadshot[$DamageType::Laser, 0] = '\c0%4 drills right through %1\'s braincase with %6 laser.';
$DeathMessageHeadshot[$DamageType::Laser, 1] = '\c0%4 pops %1\'s head like a cheap balloon.';
$DeathMessageHeadshot[$DamageType::Laser, 2] = '\c0%1 loses %3 head over %4\'s laser skill.';
// z0dd - ZOD, 8/25/02. Added Lance rear shot messages
$DeathMessageRearshotCount = 3;
$DeathMessageRearshot[$DamageType::ShockLance, 0] = '\c0%4 delivers a backdoor Lance to %1.';
$DeathMessageRearshot[$DamageType::ShockLance, 1] = '\c0%4 sends high voltage up %1\'s bum.';
$DeathMessageRearshot[$DamageType::ShockLance, 2] = '\c0%1 receives %4\'s rear-entry Lance attack.';
//These used when a player is run over by a vehicle
$DeathMessageVehicleCount = 5;
$DeathMessageVehicle[0] = '\c0%4 runs down %1.';
$DeathMessageVehicle[1] = '\c0%1 acquires that run-down feeling from %4.';
$DeathMessageVehicle[2] = '\c0%4 transforms %1 into tribal roadkill.';
$DeathMessageVehicle[3] = '\c0%1 makes a painfully close examination of %4\'s front bumper.';
$DeathMessageVehicle[4] = '\c0%1\'s messy death leaves a mark on %4\'s vehicle finish.';
$DeathMessageVehicleCrashCount = 5;
$DeathMessageVehicleCrash[ $DamageType::Crash, 0 ] = '\c0%1 fails to eject in time.';
$DeathMessageVehicleCrash[ $DamageType::Crash, 1 ] = '\c0%1 becomes one with his vehicle dashboard.';
$DeathMessageVehicleCrash[ $DamageType::Crash, 2 ] = '\c0%1 drives under the influence of death.';
$DeathMessageVehicleCrash[ $DamageType::Crash, 3 ] = '\c0%1 makes a perfect three hundred point landing.';
$DeathMessageVehicleCrash[ $DamageType::Crash, 4 ] = '\c0%1 heroically pilots his vehicle into something really, really hard.';
$DeathMessageVehicleFriendlyCount = 3;
$DeathMessageVehicleFriendly[0] = '\c0%1 gets in the way of a friendly vehicle.';
$DeathMessageVehicleFriendly[1] = '\c0Sadly, a friendly vehicle turns %1 into roadkill.';
$DeathMessageVehicleFriendly[2] = '\c0%1 becomes an unsightly ornament on a team vehicle\'s hood.';
$DeathMessageVehicleUnmannedCount = 3;
$DeathMessageVehicleUnmanned[0] = '\c0%1 gets in the way of a runaway vehicle.';
$DeathMessageVehicleUnmanned[1] = '\c0An unmanned vehicle kills the pathetic %1.';
$DeathMessageVehicleUnmanned[2] = '\c0%1 is struck down by an empty vehicle.';
//These used when a player is killed by a nearby equipment explosion
$DeathMessageExplosionCount = 3;
$DeathMessageExplosion[0] = '\c0%1 was killed by exploding equipment!';
$DeathMessageExplosion[1] = '\c0%1 stood a little too close to the action!';
$DeathMessageExplosion[2] = '\c0%1 learns how to be collateral damage.';
//These used when an automated turret kills an enemy player
$DeathMessageTurretKillCount = 3;
$DeathMessageTurretKill[$DamageType::PlasmaTurret, 0] = '\c0%1 is killed by a plasma turret.';
$DeathMessageTurretKill[$DamageType::PlasmaTurret, 1] = '\c0%1\'s body now marks the location of a plasma turret.';
$DeathMessageTurretKill[$DamageType::PlasmaTurret, 2] = '\c0%1 is fried by a plasma turret.';
$DeathMessageTurretKill[$DamageType::AATurret, 0] = '\c0%1 is killed by an AA turret.';
$DeathMessageTurretKill[$DamageType::AATurret, 1] = '\c0%1 is shot down by an AA turret.';
$DeathMessageTurretKill[$DamageType::AATurret, 2] = '\c0%1 takes fatal flak from an AA turret.';
$DeathMessageTurretKill[$DamageType::ElfTurret, 0] = '\c0%1 is killed by an ELF turret.';
$DeathMessageTurretKill[$DamageType::ElfTurret, 1] = '\c0%1 is zapped by an ELF turret.';
$DeathMessageTurretKill[$DamageType::ElfTurret, 2] = '\c0%1 is short-circuited by an ELF turret.';
$DeathMessageTurretKill[$DamageType::MortarTurret, 0] = '\c0%1 is killed by a mortar turret.';
$DeathMessageTurretKill[$DamageType::MortarTurret, 1] = '\c0%1 enjoys a mortar turret\'s attention.';
$DeathMessageTurretKill[$DamageType::MortarTurret, 2] = '\c0%1 is blown to kibble by a mortar turret.';
$DeathMessageTurretKill[$DamageType::MissileTurret, 0] = '\c0%1 is killed by a missile turret.';
$DeathMessageTurretKill[$DamageType::MissileTurret, 1] = '\c0%1 is shot down by a missile turret.';
$DeathMessageTurretKill[$DamageType::MissileTurret, 2] = '\c0%1 is blown away by a missile turret.';
$DeathMessageTurretKill[$DamageType::IndoorDepTurret, 0] = '\c0%1 is killed by a clamp turret.';
$DeathMessageTurretKill[$DamageType::IndoorDepTurret, 1] = '\c0%1 gets burned by a clamp turret.';
$DeathMessageTurretKill[$DamageType::IndoorDepTurret, 2] = '\c0A clamp turret eliminates %1.';
$DeathMessageTurretKill[$DamageType::OutdoorDepTurret, 0] = '\c0A spike turret neatly drills %1.';
$DeathMessageTurretKill[$DamageType::OutdoorDepTurret, 1] = '\c0%1 gets taken out by a spike turret.';
$DeathMessageTurretKill[$DamageType::OutdoorDepTurret, 2] = '\c0%1 dies under a spike turret\'s love.';
$DeathMessageTurretKill[$DamageType::SentryTurret, 0] = '\c0%1 didn\'t see that Sentry turret, but it saw %2...';
$DeathMessageTurretKill[$DamageType::SentryTurret, 1] = '\c0%1 needs to watch for Sentry turrets.';
$DeathMessageTurretKill[$DamageType::SentryTurret, 2] = '\c0%1 now understands how Sentry turrets work.';
//used when a player is killed by a teammate controlling a turret
$DeathMessageCTurretTeamKillCount = 1;
$DeathMessageCTurretTeamKill[$DamageType::PlasmaTurret, 0] = '\c0%4 TEAMKILLED %1 with a plasma turret!';
$DeathMessageCTurretTeamKill[$DamageType::AATurret, 0] = '\c0%4 TEAMKILLED %1 with an AA turret!';
$DeathMessageCTurretTeamKill[$DamageType::ELFTurret, 0] = '\c0%4 TEAMKILLED %1 with an ELF turret!';
$DeathMessageCTurretTeamKill[$DamageType::MortarTurret, 0] = '\c0%4 TEAMKILLED %1 with a mortar turret!';
$DeathMessageCTurretTeamKill[$DamageType::MissileTurret, 0] = '\c0%4 TEAMKILLED %1 with a missile turret!';
$DeathMessageCTurretTeamKill[$DamageType::IndoorDepTurret, 0] = '\c0%4 TEAMKILLED %1 with a clamp turret!';
$DeathMessageCTurretTeamKill[$DamageType::OutdoorDepTurret, 0] = '\c0%4 TEAMKILLED %1 with a spike turret!';
$DeathMessageCTurretTeamKill[$DamageType::SentryTurret, 0] = '\c0%4 TEAMKILLED %1 with a sentry turret!';
$DeathMessageCTurretTeamKill[$DamageType::BomberBombs, 0] = '\c0%4 TEAMKILLED %1 in a bombastic explosion of raining death.';
$DeathMessageCTurretTeamKill[$DamageType::BellyTurret, 0] = '\c0%4 TEAMKILLED %1 by annihilating him from a belly turret.';
$DeathMessageCTurretTeamKill[$DamageType::TankChainGun, 0] = '\c0%4 TEAMKILLED %1 with his tank\'s chaingun.';
$DeathMessageCTurretTeamKill[$DamageType::TankMortar, 0] = '\c0%4 TEAMKILLED %1 by lobbing the BIG green death from a tank.';
$DeathMessageCTurretTeamKill[$DamageType::ShrikeBlaster, 0] = '\c0%4 TEAMKILLED %1 by strafing from a Shrike.';
$DeathMessageCTurretTeamKill[$DamageType::MPBMissile, 0] = '\c0%4 TEAMKILLED %1 when the MPB locked onto him.';
//used when a player is killed by an uncontrolled, friendly turret
$DeathMessageCTurretAccdtlKillCount = 1;
$DeathMessageCTurretAccdtlKill[$DamageType::PlasmaTurret, 0] = '\c0%1 got in the way of a plasma turret!';
$DeathMessageCTurretAccdtlKill[$DamageType::AATurret, 0] = '\c0%1 got in the way of an AA turret!';
$DeathMessageCTurretAccdtlKill[$DamageType::ELFTurret, 0] = '\c0%1 got in the way of an ELF turret!';
$DeathMessageCTurretAccdtlKill[$DamageType::MortarTurret, 0] = '\c0%1 got in the way of a mortar turret!';
$DeathMessageCTurretAccdtlKill[$DamageType::MissileTurret, 0] = '\c0%1 got in the way of a missile turret!';
$DeathMessageCTurretAccdtlKill[$DamageType::IndoorDepTurret, 0] = '\c0%1 got in the way of a clamp turret!';
$DeathMessageCTurretAccdtlKill[$DamageType::OutdoorDepTurret, 0] = '\c0%1 got in the way of a spike turret!';
$DeathMessageCTurretAccdtlKill[$DamageType::SentryTurret, 0] = '\c0%1 got in the way of a Sentry turret!';
//these messages for owned or controlled turrets
$DeathMessageCTurretKillCount = 3;
$DeathMessageCTurretKill[$DamageType::PlasmaTurret, 0] = '\c0%4 torches %1 with a plasma turret!';
$DeathMessageCTurretKill[$DamageType::PlasmaTurret, 1] = '\c0%4 fries %1 with a plasma turret!';
$DeathMessageCTurretKill[$DamageType::PlasmaTurret, 2] = '\c0%4 lights up %1 with a plasma turret!';
$DeathMessageCTurretKill[$DamageType::AATurret, 0] = '\c0%4 shoots down %1 with an AA turret.';
$DeathMessageCTurretKill[$DamageType::AATurret, 1] = '\c0%1 gets shot down by %1\'s AA turret.';
$DeathMessageCTurretKill[$DamageType::AATurret, 2] = '\c0%4 takes out %1 with an AA turret.';
$DeathMessageCTurretKill[$DamageType::ElfTurret, 0] = '\c0%1 gets zapped by ELF gunner %4.';
$DeathMessageCTurretKill[$DamageType::ElfTurret, 1] = '\c0%1 gets barbecued by ELF gunner %4.';
$DeathMessageCTurretKill[$DamageType::ElfTurret, 2] = '\c0%1 gets shocked by ELF gunner %4.';
$DeathMessageCTurretKill[$DamageType::MortarTurret, 0] = '\c0%1 is annihilated by %4\'s mortar turret.';
$DeathMessageCTurretKill[$DamageType::MortarTurret, 1] = '\c0%1 is blown away by %4\'s mortar turret.';
$DeathMessageCTurretKill[$DamageType::MortarTurret, 2] = '\c0%1 is pureed by %4\'s mortar turret.';
$DeathMessageCTurretKill[$DamageType::MissileTurret, 0] = '\c0%4 shows %1 a new world of pain with a missile turret.';
$DeathMessageCTurretKill[$DamageType::MissileTurret, 1] = '\c0%4 pops %1 with a missile turret.';
$DeathMessageCTurretKill[$DamageType::MissileTurret, 2] = '\c0%4\'s missile turret lights up %1\'s, uh, ex-life.';
$DeathMessageCTurretKill[$DamageType::IndoorDepTurret, 0] = '\c0%1 is chewed up and spat out by %4\'s clamp turret.';
$DeathMessageCTurretKill[$DamageType::IndoorDepTurret, 1] = '\c0%1 is knocked out by %4\'s clamp turret.';
$DeathMessageCTurretKill[$DamageType::IndoorDepTurret, 2] = '\c0%4\'s clamp turret drills %1 nicely.';
$DeathMessageCTurretKill[$DamageType::OutdoorDepTurret, 0] = '\c0%1 is chewed up by %4\'s spike turret.';
$DeathMessageCTurretKill[$DamageType::OutdoorDepTurret, 1] = '\c0%1 feels the burn from %4\'s spike turret.';
$DeathMessageCTurretKill[$DamageType::OutdoorDepTurret, 2] = '\c0%1 is nailed by %4\'s spike turret.';
$DeathMessageCTurretKill[$DamageType::SentryTurret, 0] = '\c0%4 caught %1 by surprise with a turret.';
$DeathMessageCTurretKill[$DamageType::SentryTurret, 1] = '\c0%4\'s turret took out %1.';
$DeathMessageCTurretKill[$DamageType::SentryTurret, 2] = '\c0%4 blasted %1 with a turret.';
$DeathMessageCTurretKill[$DamageType::BomberBombs, 0] = '\c0%1 catches %4\'s bomb in both teeth.';
$DeathMessageCTurretKill[$DamageType::BomberBombs, 1] = '\c0%4 leaves %1 a smoking bomb crater.';
$DeathMessageCTurretKill[$DamageType::BomberBombs, 2] = '\c0%4 bombs %1 back to the 20th century.';
$DeathMessageCTurretKill[$DamageType::BellyTurret, 0] = '\c0%1 eats a big helping of %4\'s belly turret bolt.';
$DeathMessageCTurretKill[$DamageType::BellyTurret, 1] = '\c0%4 plants a belly turret bolt in %1\'s belly.';
$DeathMessageCTurretKill[$DamageType::BellyTurret, 2] = '\c0%1 fails to evade %4\'s deft bomber strafing.';
$DeathMessageCTurretKill[$DamageType::TankChainGun, 0] = '\c0%1 enjoys the rich, metallic taste of %4\'s tank slug.';
$DeathMessageCTurretKill[$DamageType::TankChainGun, 1] = '\c0%4\'s tank chaingun plays sweet music all over %1.';
$DeathMessageCTurretKill[$DamageType::TankChainGun, 2] = '\c0%1 receives a stellar exit wound from %4\'s tank slug.';
$DeathMessageCTurretKill[$DamageType::TankMortar, 0] = '\c0Whoops! %1 + %4\'s tank mortar = Dead %1.';
$DeathMessageCTurretKill[$DamageType::TankMortar, 1] = '\c0%1 learns the happy explosion dance from %4\'s tank mortar.';
$DeathMessageCTurretKill[$DamageType::TankMortar, 2] = '\c0%4\'s tank mortar has a blast with %1.';
$DeathMessageCTurretKill[$DamageType::ShrikeBlaster, 0] = '\c0%1 dines on a Shrike blaster sandwich, courtesy of %4.';
$DeathMessageCTurretKill[$DamageType::ShrikeBlaster, 1] = '\c0The blaster of %4\'s Shrike turns %1 into finely shredded meat.';
$DeathMessageCTurretKill[$DamageType::ShrikeBlaster, 2] = '\c0%1 gets drilled big-time by the blaster of %4\'s Shrike.';
$DeathMessageCTurretKill[$DamageType::MPBMissile, 0] = '\c0%1 intersects nicely with %4\'s MPB Missile.';
$DeathMessageCTurretKill[$DamageType::MPBMissile, 1] = '\c0%4\'s MPB Missile makes armored chowder out of %1.';
$DeathMessageCTurretKill[$DamageType::MPBMissile, 2] = '\c0%1 has a brief, explosive fling with %4\'s MPB Missile.';
$DeathMessageTurretSelfKillCount = 3;
$DeathMessageTurretSelfKill[0] = '\c0%1 somehow kills %2self with a turret.';
$DeathMessageTurretSelfKill[1] = '\c0%1 apparently didn\'t know the turret was loaded.';
$DeathMessageTurretSelfKill[2] = '\c0%1 helps his team by killing himself with a turret.';

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,447 +1,447 @@
//------------------------------------------------------------------------------
//
// LoadingGui.cs
//
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
function LoadingGui::onAdd(%this)
{
%this.qLineCount = 0;
}
//------------------------------------------------------------------------------
function LoadingGui::onWake(%this)
{
if ( $HudHandle[shellScreen] !$= "" )
{
alxStop($HudHandle[shellScreen]);
$HudHandle[shellScreen] = "";
}
$HudHandle[loadingScreen] = alxPlay(LoadingScreenSound, 0, 0, 0);
CloseMessagePopup();
}
//------------------------------------------------------------------------------
function LoadingGui::onSleep(%this)
{
// Clear the load info:
if ( %this.qLineCount !$= "" )
{
for ( %line = 0; %line < %this.qLineCount; %line++ )
%this.qLine[%line] = "";
}
%this.qLineCount = 0;
LOAD_MapPic.setBitmap( "gui/Loading" );
LOAD_MapName.setText( "" );
LOAD_MapText.setText( "" );
LOAD_MissionType.setText( "" );
LOAD_GameText.setText( "" );
LoadingProgress.setValue( 0 );
alxStop($HudHandle[loadingScreen]);
}
//------------------------------------------------------------------------------
function clearLoadInfo()
{
for ( %line = 0; %line < $LoadQuoteLineCount; %line++ )
$LoadQuoteLine[%line] = "";
$LoadQuoteLineCount = 0;
for ( %line = 0; %line < $LoadObjLineCount; %line++ )
$LoadObjLine[%line] = "";
$LoadObjLineCount = 0;
for ( %line = 0; %line < $LoadRuleLineCount; %line++ )
$LoadRuleLine[%line] = "";
$LoadRuleLineCount = 0;
}
//------------------------------------------------------------------------------
function buildLoadInfo( %mission, %missionType )
{
clearLoadInfo();
$CurrentMission = %mission;
$MissionDisplayName = %mission;
$MissionTypeDisplayName = %missionType;
// Extract the map quote and objectives from the .mis file:
%mapFile = "missions/" @ %mission @ ".mis";
%file = new FileObject();
if ( %file.openForRead( %mapFile ) )
{
%state = "none";
while ( !%file.isEOF() )
{
%line = %file.readLine();
if ( %state $= "none" )
{
if ( getSubStr( %line, 0, 17 ) $= "// DisplayName = " )
$MissionDisplayName = getSubStr( %line, 17, 1000 );
else if ( %line $= "//--- MISSION QUOTE BEGIN ---" )
%state = "quote";
else if ( %line $= "//--- MISSION STRING BEGIN ---" )
%state = "objectives";
else if ( %missionType $= "SinglePlayer" )
{
if ( getSubStr( %line, 0, 16 ) $= "// PlanetName = " )
$MissionTypeDisplayName = getSubStr( %line, 16, 1000 );
else if ( %line $= "//--- MISSION BLURB BEGIN ---" )
%state = "blurb";
}
}
else if ( %state $= "quote" )
{
if ( %line $= "//--- MISSION QUOTE END ---" )
%state = "none";
else
{
$LoadQuoteLine[$LoadQuoteLineCount] = getSubStr( %line, 2, 1000 );
$LoadQuoteLineCount++;
}
}
else if ( %state $= "objectives" )
{
if ( %line $= "//--- MISSION STRING END ---" )
{
if ( %missionType $= "SinglePlayer" )
%state = "none";
else
{
// Once we've got the end of the mission string, we are through.
%state = "done";
break;
}
}
else
{
%pos = strstr( %line, "]" );
if ( %pos == -1 )
{
$LoadObjLine[$LoadObjLineCount] = getSubStr( %line, 2, 1000 );
$LoadObjLineCount++;
}
else if ( %pos > 3 )
{
// Filter objective lines by mission type:
%typeList = getSubStr( %line, 3, %pos - 3 );
// ------------------------------------------------------------------------
// z0dd - ZOD, 5/15/02. Add practice gametype so we get objectives printed.
if(%typeList $= "CTF")
%typeList = rtrim(%typeList) @ " PracticeCTF";
// ------------------------------------------------------------------------
if ( strstr( %typeList, %missionType ) != -1 )
{
$LoadObjLine[$LoadObjLineCount] = getSubStr( %line, %pos + 1, 1000 );
$LoadObjLineCount++;
}
}
else
error( "Invalid mission objective line - \"" @ %line @ "\"" );
}
}
else if ( %state $= "blurb" )
{
if ( %line $= "//--- MISSION BLURB END ---" )
{
%state = "done";
break;
}
else
{
$LoadRuleLine[$LoadRuleLineCount] = getSubStr( %line, 2, 1000 );
$LoadRuleLineCount++;
}
}
}
%file.close();
}
// Extract the rules of engagement from the <mission type>Game.cs file:
if ( %missionType !$= "SinglePlayer" )
{
%gameFile = "scripts/" @ %missionType @ "Game.cs";
if ( %file.openForRead( %gameFile ) )
{
%state = "none";
while ( !%file.isEOF() )
{
%line = %file.readLine();
if ( %state $= "none" )
{
if ( getSubStr( %line, 0, 17 ) $= "// DisplayName = " )
$MissionTypeDisplayName = getSubStr( %line, 17, 1000 );
if ( %line $= "//--- GAME RULES BEGIN ---" )
%state = "rules";
}
else if ( %state $= "rules" )
{
if ( %line $= "//--- GAME RULES END ---" )
{
%state = "done";
break;
}
else
{
$LoadRuleLine[$LoadRuleLineCount] = getSubStr( %line, 2, 1000 );
$LoadRuleLineCount++;
}
}
}
%file.close();
}
}
%file.delete();
}
//------------------------------------------------------------------------------
function dumpLoadInfo()
{
echo( "Mission = \"" @ $MissionDisplayName @ "\", Mission Type = \"" @ $MissionTypeDisplayName @ "\"" );
echo( "MISSION QUOTE: ( " @ $LoadQuoteLineCount @ " lines )" );
for ( %line = 0; %line < $LoadQuoteLineCount; %line++ )
echo( $LoadQuoteLine[%line] );
echo( " " );
echo( "MISSION STRING: ( " @ $LoadObjLineCount @ " lines )" );
for ( %line = 0; %line < $LoadObjLineCount; %line++ )
echo( $LoadObjLine[%line] );
echo( " " );
echo( "GAME RULES: ( " @ $LoadRuleLineCount @ " lines )" );
for ( %line = 0; %line < $LoadRuleLineCount; %line++ )
echo( $LoadRuleLine[%line] );
}
//------------------------------------------------------------------------------
// z0dd - ZOD, 5/12/02. Added another varible so we can send this twice
function sendLoadInfoToClient( %client, %second )
{
//error( "** SENDING LOAD INFO TO CLIENT " @ %client @ "! **" );
%singlePlayer = $CurrentMissionType $= "SinglePlayer";
messageClient( %client, 'MsgLoadInfo', "", $CurrentMission, $MissionDisplayName, $MissionTypeDisplayName );
// Send map quote:
for ( %line = 0; %line < $LoadQuoteLineCount; %line++ )
{
if ( $LoadQuoteLine[%line] !$= "" )
messageClient( %client, 'MsgLoadQuoteLine', "", $LoadQuoteLine[%line] );
}
// Send map objectives:
if ( %singlePlayer )
{
switch ( $pref::TrainingDifficulty )
{
case 2: %diff = "Medium";
case 3: %diff = "Hard";
default: %diff = "Easy";
}
messageClient( %client, 'MsgLoadObjectiveLine', "", "<spush><font:" @ $ShellLabelFont @ ":" @ $ShellMediumFontSize @ ">DIFFICULTY: <spop>" @ %diff );
}
for ( %line = 0; %line < $LoadObjLineCount; %line++ )
{
if ( $LoadObjLine[%line] !$= "" )
messageClient( %client, 'MsgLoadObjectiveLine', "", $LoadObjLine[%line], !%singlePlayer );
}
// Send rules of engagement:
if ( !%singlePlayer )
messageClient( %client, 'MsgLoadRulesLine', "", "<spush><font:Univers Condensed:18>RULES OF ENGAGEMENT:<spop>", false );
for ( %line = 0; %line < $LoadRuleLineCount; %line++ )
{
if ( $LoadRuleLine[%line] !$= "" )
messageClient( %client, 'MsgLoadRulesLine', "", $LoadRuleLine[%line], !%singlePlayer );
}
messageClient( %client, 'MsgLoadInfoDone' );
// ----------------------------------------------------------------------------------------------
// z0dd - ZOD, 5/12/02. Send the mod info screen if this isn't the second showing of mission info
if(!%second)
schedule(6000, 0, "sendModInfoToClient", %client);
// ----------------------------------------------------------------------------------------------
}
function sendModInfoToClient(%client) //Kinda Jacked Classic's loadScreen here.. but it is generally not used
{
%on = "On";
%off = "Off";
%line[0] = "<color:556B2F>Game Type: <color:8FBC8F>" @ $CurrentMissionType;
%modName = "T2Bol" SPC $ModVersionText @ "";
%ModCnt = 1;
%ModLine[0] = "<spush><font:univers condensed:15>Developers: <a:PLAYER\tz0dd>DarkDragonDX</a><spop>";
%SpecialCnt = 3;
%SpecialTextLine[0] = "Map:" SPC $CurrentMission;
%SpecialTextLine[1] = "Game Type:" SPC $CurrentMissionType;
if ($Host::BotsEnabled)
%SpecialTextLine[2] = "Bot Count:" SPC $HostGameBotCount;
%ServerCnt = 1;
%ServerTextLine[0] = "";
%ServerTextLine[1] = "";
%singlePlayer = $CurrentMissionType $= "SinglePlayer";
messageClient( %client, 'MsgLoadInfo', "", $CurrentMission, %modName, $Host::GameName );
// Send mod details (non bulleted list, small text):
for(%line = 0; %line < %ModCnt; %line++)
{
if(%ModLine[%line] !$= "")
messageClient(%client, 'MsgLoadQuoteLine', "", %ModLine[%line]);
}
// Send mod special settings (bulleted list, large text):
for (%line = 0; %line < %SpecialCnt; %line++)
{
if(%SpecialTextLine[%line] !$= "")
messageClient( %client, 'MsgLoadObjectiveLine', "", %SpecialTextLine[%line], !%singlePlayer);
}
// Send server info:
if ( !%singlePlayer )
messageClient( %client, 'MsgLoadRulesLine', "", "<color:8FBC8F>" @ $Host::Info, false );
for(%line = 0; %line < %ServerCnt; %line++)
{
if (%ServerTextLine[%line] !$= "")
messageClient(%client, 'MsgLoadRulesLine', "", %ServerTextLine[%line], !%singlePlayer);
}
messageClient(%client, 'MsgLoadInfoDone');
// z0dd - ZOD, 5/12/02. Send mission info again so as not to conflict with cs scripts.
schedule(7000, 0, "sendLoadInfoToClient", %client, true);
}
//------------------------------------------------------------------------------
addMessageCallback( 'MsgLoadInfo', handleLoadInfoMessage );
addMessageCallback( 'MsgLoadQuoteLine', handleLoadQuoteLineMessage );
addMessageCallback( 'MsgLoadObjectiveLine', handleLoadObjectiveLineMessage );
addMessageCallback( 'MsgLoadRulesLine', handleLoadRulesLineMessage );
addMessageCallback( 'MsgLoadInfoDone', handleLoadInfoDoneMessage );
//------------------------------------------------------------------------------
function handleLoadInfoMessage( %msgType, %msgString, %bitmapName, %mapName, %missionType )
{
// Clear all of the loading info lines:
for ( %line = 0; %line < LoadingGui.qLineCount; %line++ )
LoadingGui.qLine[%line] = "";
LoadingGui.qLineCount = 0;
for ( %line = 0; %line < LobbyGui.objLineCount; %line++ )
LobbyGui.objLine[%line] = "";
LobbyGui.objLineCount = 0;
// ---------------------------------------------------
// z0dd - ZOD, 9/29/02. Removed T2 demo code from here
%loadBmp = "gui/load_" @ %bitmapName @ ".png";
// ---------------------------------------------------
if ( !isFile( "textures/" @ %loadBmp ) )
%loadBmp = "gui/loading";
LOAD_MapPic.setBitmap( %loadBmp );
LOAD_MapName.setText( %mapName );
LOAD_MissionType.setText( %missionType );
LOAD_MapText.setText( "" );
LOAD_GameText.setText( "" );
}
//------------------------------------------------------------------------------
function handleLoadQuoteLineMessage( %msgType, %msgString, %line )
{
LoadingGui.qLine[LoadingGui.qLineCount] = %line;
LoadingGui.qLineCount++;
%text = "<spush><color:dcdcdc><spush><font:Univers italic:16>";
for ( %line = 0; %line < LoadingGui.qLineCount - 1; %line++ )
%text = %text @ LoadingGui.qLine[%line] @ "\n";
%text = %text @ "<spop><spush><font:" @ $ShellLabelFont @ ":" @ $ShellFontSize @ ">";
%text = %text @ LoadingGui.qLine[%line] @ "<spop><spop>\n"; // tag line
LOAD_MapText.setText( %text );
}
//------------------------------------------------------------------------------
function handleLoadObjectiveLineMessage( %msgType, %msgString, %line, %bulletStyle )
{
LobbyGui.objLine[LobbyGui.objLineCount] = %line;
LobbyGui.objLineCount++;
if ( %bulletStyle )
%line = "<bitmap:bullet_2><lmargin:24>" @ %line @ "<lmargin:0>";
%newText = LOAD_MapText.getText();
if ( %newText $= "" ) // In case there's no quote
%newText = %line;
else
%newText = %newText NL %line;
LOAD_MapText.setText( %newText );
}
//------------------------------------------------------------------------------
function handleLoadRulesLineMessage( %msgType, %msgString, %line, %bulletStyle )
{
if ( %bulletStyle )
%line = "<bitmap:bullet_2><lmargin:24>" @ %line @ "<lmargin:0>";
%newText = LOAD_GameText.getText();
if ( %newText $= "" )
%newText = %line;
else
%newText = %newText NL %line;
LOAD_GameText.setText( %newText );
}
//------------------------------------------------------------------------------
function handleLoadInfoDoneMessage( %msgType, %msgString )
{
LoadingGui.gotLoadInfo = true;
}
package debriefload
{
function debriefLoad(%client)
{
if (isObject(Game))
%game = Game.getId();
else
return;
if ($HostGameType $= "SinglePlayer")
return;
//Clear the debrief first
messageClient( %client, 'MsgClearDebrief', "");
messageClient( %client, 'MsgDebriefResult', "", "<Just:Center><font:Broadway Bt:21><Color:FFFFFF>"@$Host::GameName@"\n<font:Broadway Bt:14>Tribes 2: Birth Of Legend");
messageClient( %client, 'MsgDebriefAddLine', "", "<Just:Center><Color:FFFFFF><font:Broadway Bt:15>A mod by: <Color:888888><a:PLAYER\tDarkDragonDX>Dark Dragon DX (Vector)</a>" );
messageClient( %client, 'MsgDebriefAddLine', "", "<Just:Center>Hello "@%client.race@" "@%client.namebase@".");
messageClient( %client, 'MsgDebriefAddLine', "", "");
messageClient( %client, 'MsgDebriefAddLine', "", "<Just:Center>You are in a Tribes 2: Birth of Legend server!");
messageClient( %client, 'MsgDebriefAddLine', "", "");
messageClient( %client, 'MsgDebriefAddLine', "", "<Just:Center>Server Information:");
messageClient( %client, 'MsgDebriefAddLine', "", "<Just:Center>Player Count: "@$HostGamePlayerCount@"");
messageClient( %client, 'MsgDebriefAddLine', "", "<Just:Center>Game Mode: "@$CurrentMissionType@"");
if ($CurrentMissionType $= "RPG" && !$Data::IsRPGReady[%client.GUID]) //Make sure the client knows.
messageClient( %client, 'MsgDebriefAddLine', "", "<Just:Center>The race/gender settings you have joined with have been saved.");
messageClient( %client, 'MsgDebriefAddLine', "", "" );
//Go to the debrief gui.
messageClient( %client, 'MsgGameOver', "" );
}
};
activatepackage(Debriefload);
//------------------------------------------------------------------------------
//
// LoadingGui.cs
//
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
function LoadingGui::onAdd(%this)
{
%this.qLineCount = 0;
}
//------------------------------------------------------------------------------
function LoadingGui::onWake(%this)
{
if ( $HudHandle[shellScreen] !$= "" )
{
alxStop($HudHandle[shellScreen]);
$HudHandle[shellScreen] = "";
}
$HudHandle[loadingScreen] = alxPlay(LoadingScreenSound, 0, 0, 0);
CloseMessagePopup();
}
//------------------------------------------------------------------------------
function LoadingGui::onSleep(%this)
{
// Clear the load info:
if ( %this.qLineCount !$= "" )
{
for ( %line = 0; %line < %this.qLineCount; %line++ )
%this.qLine[%line] = "";
}
%this.qLineCount = 0;
LOAD_MapPic.setBitmap( "gui/Loading" );
LOAD_MapName.setText( "" );
LOAD_MapText.setText( "" );
LOAD_MissionType.setText( "" );
LOAD_GameText.setText( "" );
LoadingProgress.setValue( 0 );
alxStop($HudHandle[loadingScreen]);
}
//------------------------------------------------------------------------------
function clearLoadInfo()
{
for ( %line = 0; %line < $LoadQuoteLineCount; %line++ )
$LoadQuoteLine[%line] = "";
$LoadQuoteLineCount = 0;
for ( %line = 0; %line < $LoadObjLineCount; %line++ )
$LoadObjLine[%line] = "";
$LoadObjLineCount = 0;
for ( %line = 0; %line < $LoadRuleLineCount; %line++ )
$LoadRuleLine[%line] = "";
$LoadRuleLineCount = 0;
}
//------------------------------------------------------------------------------
function buildLoadInfo( %mission, %missionType )
{
clearLoadInfo();
$CurrentMission = %mission;
$MissionDisplayName = %mission;
$MissionTypeDisplayName = %missionType;
// Extract the map quote and objectives from the .mis file:
%mapFile = "missions/" @ %mission @ ".mis";
%file = new FileObject();
if ( %file.openForRead( %mapFile ) )
{
%state = "none";
while ( !%file.isEOF() )
{
%line = %file.readLine();
if ( %state $= "none" )
{
if ( getSubStr( %line, 0, 17 ) $= "// DisplayName = " )
$MissionDisplayName = getSubStr( %line, 17, 1000 );
else if ( %line $= "//--- MISSION QUOTE BEGIN ---" )
%state = "quote";
else if ( %line $= "//--- MISSION STRING BEGIN ---" )
%state = "objectives";
else if ( %missionType $= "SinglePlayer" )
{
if ( getSubStr( %line, 0, 16 ) $= "// PlanetName = " )
$MissionTypeDisplayName = getSubStr( %line, 16, 1000 );
else if ( %line $= "//--- MISSION BLURB BEGIN ---" )
%state = "blurb";
}
}
else if ( %state $= "quote" )
{
if ( %line $= "//--- MISSION QUOTE END ---" )
%state = "none";
else
{
$LoadQuoteLine[$LoadQuoteLineCount] = getSubStr( %line, 2, 1000 );
$LoadQuoteLineCount++;
}
}
else if ( %state $= "objectives" )
{
if ( %line $= "//--- MISSION STRING END ---" )
{
if ( %missionType $= "SinglePlayer" )
%state = "none";
else
{
// Once we've got the end of the mission string, we are through.
%state = "done";
break;
}
}
else
{
%pos = strstr( %line, "]" );
if ( %pos == -1 )
{
$LoadObjLine[$LoadObjLineCount] = getSubStr( %line, 2, 1000 );
$LoadObjLineCount++;
}
else if ( %pos > 3 )
{
// Filter objective lines by mission type:
%typeList = getSubStr( %line, 3, %pos - 3 );
// ------------------------------------------------------------------------
// z0dd - ZOD, 5/15/02. Add practice gametype so we get objectives printed.
if(%typeList $= "CTF")
%typeList = rtrim(%typeList) @ " PracticeCTF";
// ------------------------------------------------------------------------
if ( strstr( %typeList, %missionType ) != -1 )
{
$LoadObjLine[$LoadObjLineCount] = getSubStr( %line, %pos + 1, 1000 );
$LoadObjLineCount++;
}
}
else
error( "Invalid mission objective line - \"" @ %line @ "\"" );
}
}
else if ( %state $= "blurb" )
{
if ( %line $= "//--- MISSION BLURB END ---" )
{
%state = "done";
break;
}
else
{
$LoadRuleLine[$LoadRuleLineCount] = getSubStr( %line, 2, 1000 );
$LoadRuleLineCount++;
}
}
}
%file.close();
}
// Extract the rules of engagement from the <mission type>Game.cs file:
if ( %missionType !$= "SinglePlayer" )
{
%gameFile = "scripts/" @ %missionType @ "Game.cs";
if ( %file.openForRead( %gameFile ) )
{
%state = "none";
while ( !%file.isEOF() )
{
%line = %file.readLine();
if ( %state $= "none" )
{
if ( getSubStr( %line, 0, 17 ) $= "// DisplayName = " )
$MissionTypeDisplayName = getSubStr( %line, 17, 1000 );
if ( %line $= "//--- GAME RULES BEGIN ---" )
%state = "rules";
}
else if ( %state $= "rules" )
{
if ( %line $= "//--- GAME RULES END ---" )
{
%state = "done";
break;
}
else
{
$LoadRuleLine[$LoadRuleLineCount] = getSubStr( %line, 2, 1000 );
$LoadRuleLineCount++;
}
}
}
%file.close();
}
}
%file.delete();
}
//------------------------------------------------------------------------------
function dumpLoadInfo()
{
echo( "Mission = \"" @ $MissionDisplayName @ "\", Mission Type = \"" @ $MissionTypeDisplayName @ "\"" );
echo( "MISSION QUOTE: ( " @ $LoadQuoteLineCount @ " lines )" );
for ( %line = 0; %line < $LoadQuoteLineCount; %line++ )
echo( $LoadQuoteLine[%line] );
echo( " " );
echo( "MISSION STRING: ( " @ $LoadObjLineCount @ " lines )" );
for ( %line = 0; %line < $LoadObjLineCount; %line++ )
echo( $LoadObjLine[%line] );
echo( " " );
echo( "GAME RULES: ( " @ $LoadRuleLineCount @ " lines )" );
for ( %line = 0; %line < $LoadRuleLineCount; %line++ )
echo( $LoadRuleLine[%line] );
}
//------------------------------------------------------------------------------
// z0dd - ZOD, 5/12/02. Added another varible so we can send this twice
function sendLoadInfoToClient( %client, %second )
{
//error( "** SENDING LOAD INFO TO CLIENT " @ %client @ "! **" );
%singlePlayer = $CurrentMissionType $= "SinglePlayer";
messageClient( %client, 'MsgLoadInfo', "", $CurrentMission, $MissionDisplayName, $MissionTypeDisplayName );
// Send map quote:
for ( %line = 0; %line < $LoadQuoteLineCount; %line++ )
{
if ( $LoadQuoteLine[%line] !$= "" )
messageClient( %client, 'MsgLoadQuoteLine', "", $LoadQuoteLine[%line] );
}
// Send map objectives:
if ( %singlePlayer )
{
switch ( $pref::TrainingDifficulty )
{
case 2: %diff = "Medium";
case 3: %diff = "Hard";
default: %diff = "Easy";
}
messageClient( %client, 'MsgLoadObjectiveLine', "", "<spush><font:" @ $ShellLabelFont @ ":" @ $ShellMediumFontSize @ ">DIFFICULTY: <spop>" @ %diff );
}
for ( %line = 0; %line < $LoadObjLineCount; %line++ )
{
if ( $LoadObjLine[%line] !$= "" )
messageClient( %client, 'MsgLoadObjectiveLine', "", $LoadObjLine[%line], !%singlePlayer );
}
// Send rules of engagement:
if ( !%singlePlayer )
messageClient( %client, 'MsgLoadRulesLine', "", "<spush><font:Univers Condensed:18>RULES OF ENGAGEMENT:<spop>", false );
for ( %line = 0; %line < $LoadRuleLineCount; %line++ )
{
if ( $LoadRuleLine[%line] !$= "" )
messageClient( %client, 'MsgLoadRulesLine', "", $LoadRuleLine[%line], !%singlePlayer );
}
messageClient( %client, 'MsgLoadInfoDone' );
// ----------------------------------------------------------------------------------------------
// z0dd - ZOD, 5/12/02. Send the mod info screen if this isn't the second showing of mission info
if(!%second)
schedule(6000, 0, "sendModInfoToClient", %client);
// ----------------------------------------------------------------------------------------------
}
function sendModInfoToClient(%client) //Kinda Jacked Classic's loadScreen here.. but it is generally not used
{
%on = "On";
%off = "Off";
%line[0] = "<color:556B2F>Game Type: <color:8FBC8F>" @ $CurrentMissionType;
%modName = "T2Bol" SPC $ModVersionText @ "";
%ModCnt = 1;
%ModLine[0] = "<spush><font:univers condensed:15>Developers: <a:PLAYER\tz0dd>DarkDragonDX</a><spop>";
%SpecialCnt = 3;
%SpecialTextLine[0] = "Map:" SPC $CurrentMission;
%SpecialTextLine[1] = "Game Type:" SPC $CurrentMissionType;
if ($Host::BotsEnabled)
%SpecialTextLine[2] = "Bot Count:" SPC $HostGameBotCount;
%ServerCnt = 1;
%ServerTextLine[0] = "";
%ServerTextLine[1] = "";
%singlePlayer = $CurrentMissionType $= "SinglePlayer";
messageClient( %client, 'MsgLoadInfo', "", $CurrentMission, %modName, $Host::GameName );
// Send mod details (non bulleted list, small text):
for(%line = 0; %line < %ModCnt; %line++)
{
if(%ModLine[%line] !$= "")
messageClient(%client, 'MsgLoadQuoteLine', "", %ModLine[%line]);
}
// Send mod special settings (bulleted list, large text):
for (%line = 0; %line < %SpecialCnt; %line++)
{
if(%SpecialTextLine[%line] !$= "")
messageClient( %client, 'MsgLoadObjectiveLine', "", %SpecialTextLine[%line], !%singlePlayer);
}
// Send server info:
if ( !%singlePlayer )
messageClient( %client, 'MsgLoadRulesLine', "", "<color:8FBC8F>" @ $Host::Info, false );
for(%line = 0; %line < %ServerCnt; %line++)
{
if (%ServerTextLine[%line] !$= "")
messageClient(%client, 'MsgLoadRulesLine', "", %ServerTextLine[%line], !%singlePlayer);
}
messageClient(%client, 'MsgLoadInfoDone');
// z0dd - ZOD, 5/12/02. Send mission info again so as not to conflict with cs scripts.
schedule(7000, 0, "sendLoadInfoToClient", %client, true);
}
//------------------------------------------------------------------------------
addMessageCallback( 'MsgLoadInfo', handleLoadInfoMessage );
addMessageCallback( 'MsgLoadQuoteLine', handleLoadQuoteLineMessage );
addMessageCallback( 'MsgLoadObjectiveLine', handleLoadObjectiveLineMessage );
addMessageCallback( 'MsgLoadRulesLine', handleLoadRulesLineMessage );
addMessageCallback( 'MsgLoadInfoDone', handleLoadInfoDoneMessage );
//------------------------------------------------------------------------------
function handleLoadInfoMessage( %msgType, %msgString, %bitmapName, %mapName, %missionType )
{
// Clear all of the loading info lines:
for ( %line = 0; %line < LoadingGui.qLineCount; %line++ )
LoadingGui.qLine[%line] = "";
LoadingGui.qLineCount = 0;
for ( %line = 0; %line < LobbyGui.objLineCount; %line++ )
LobbyGui.objLine[%line] = "";
LobbyGui.objLineCount = 0;
// ---------------------------------------------------
// z0dd - ZOD, 9/29/02. Removed T2 demo code from here
%loadBmp = "gui/load_" @ %bitmapName @ ".png";
// ---------------------------------------------------
if ( !isFile( "textures/" @ %loadBmp ) )
%loadBmp = "gui/loading";
LOAD_MapPic.setBitmap( %loadBmp );
LOAD_MapName.setText( %mapName );
LOAD_MissionType.setText( %missionType );
LOAD_MapText.setText( "" );
LOAD_GameText.setText( "" );
}
//------------------------------------------------------------------------------
function handleLoadQuoteLineMessage( %msgType, %msgString, %line )
{
LoadingGui.qLine[LoadingGui.qLineCount] = %line;
LoadingGui.qLineCount++;
%text = "<spush><color:dcdcdc><spush><font:Univers italic:16>";
for ( %line = 0; %line < LoadingGui.qLineCount - 1; %line++ )
%text = %text @ LoadingGui.qLine[%line] @ "\n";
%text = %text @ "<spop><spush><font:" @ $ShellLabelFont @ ":" @ $ShellFontSize @ ">";
%text = %text @ LoadingGui.qLine[%line] @ "<spop><spop>\n"; // tag line
LOAD_MapText.setText( %text );
}
//------------------------------------------------------------------------------
function handleLoadObjectiveLineMessage( %msgType, %msgString, %line, %bulletStyle )
{
LobbyGui.objLine[LobbyGui.objLineCount] = %line;
LobbyGui.objLineCount++;
if ( %bulletStyle )
%line = "<bitmap:bullet_2><lmargin:24>" @ %line @ "<lmargin:0>";
%newText = LOAD_MapText.getText();
if ( %newText $= "" ) // In case there's no quote
%newText = %line;
else
%newText = %newText NL %line;
LOAD_MapText.setText( %newText );
}
//------------------------------------------------------------------------------
function handleLoadRulesLineMessage( %msgType, %msgString, %line, %bulletStyle )
{
if ( %bulletStyle )
%line = "<bitmap:bullet_2><lmargin:24>" @ %line @ "<lmargin:0>";
%newText = LOAD_GameText.getText();
if ( %newText $= "" )
%newText = %line;
else
%newText = %newText NL %line;
LOAD_GameText.setText( %newText );
}
//------------------------------------------------------------------------------
function handleLoadInfoDoneMessage( %msgType, %msgString )
{
LoadingGui.gotLoadInfo = true;
}
package debriefload
{
function debriefLoad(%client)
{
if (isObject(Game))
%game = Game.getId();
else
return;
if ($HostGameType $= "SinglePlayer")
return;
//Clear the debrief first
messageClient( %client, 'MsgClearDebrief', "");
messageClient( %client, 'MsgDebriefResult', "", "<Just:Center><font:Broadway Bt:21><Color:FFFFFF>"@$Host::GameName@"\n<font:Broadway Bt:14>Tribes 2: Birth Of Legend");
messageClient( %client, 'MsgDebriefAddLine', "", "<Just:Center><Color:FFFFFF><font:Broadway Bt:15>A mod by: <Color:888888><a:PLAYER\tDarkDragonDX>Dark Dragon DX (Vector)</a>" );
messageClient( %client, 'MsgDebriefAddLine', "", "<Just:Center>Hello "@%client.race@" "@%client.namebase@".");
messageClient( %client, 'MsgDebriefAddLine', "", "");
messageClient( %client, 'MsgDebriefAddLine', "", "<Just:Center>You are in a Tribes 2: Birth of Legend server!");
messageClient( %client, 'MsgDebriefAddLine', "", "");
messageClient( %client, 'MsgDebriefAddLine', "", "<Just:Center>Server Information:");
messageClient( %client, 'MsgDebriefAddLine', "", "<Just:Center>Player Count: "@$HostGamePlayerCount@"");
messageClient( %client, 'MsgDebriefAddLine', "", "<Just:Center>Game Mode: "@$CurrentMissionType@"");
if ($CurrentMissionType $= "RPG" && !$Data::IsRPGReady[%client.GUID]) //Make sure the client knows.
messageClient( %client, 'MsgDebriefAddLine', "", "<Just:Center>The race/gender settings you have joined with have been saved.");
messageClient( %client, 'MsgDebriefAddLine', "", "" );
//Go to the debrief gui.
messageClient( %client, 'MsgGameOver', "" );
}
};
activatepackage(Debriefload);

View file

@ -1,490 +1,463 @@
$MaxMessageWavLength = 5200;
function addMessageCallback(%msgType, %func)
{
for(%i = 0; (%afunc = $MSGCB[%msgType, %i]) !$= ""; %i++)
{
// only add each callback once
if(%afunc $= %func)
return;
}
$MSGCB[%msgType, %i] = %func;
}
function messagePump(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7 ,%a8, %a9, %a10)
{
clientCmdServerMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
}
function clientCmdServerMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
{
%tag = getWord(%msgType, 0);
for(%i = 0; (%func = $MSGCB["", %i]) !$= ""; %i++)
call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
if(%tag !$= "")
for(%i = 0; (%func = $MSGCB[%tag, %i]) !$= ""; %i++)
call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
}
function defaultMessageCallback(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
{
if ( %msgString $= "" )
return;
%message = detag( %msgString );
// search for wav tag marker
%wavStart = strstr( %message, "~w" );
if ( %wavStart != -1 )
{
%wav = getSubStr( %message, %wavStart + 2, 1000 );
%wavLengthMS = alxGetWaveLen( %wav );
if ( %wavLengthMS <= $MaxMessageWavLength )
{
%handle = alxCreateSource( AudioChat, %wav );
alxPlay( %handle );
}
else
error( "WAV file \"" @ %wav @ "\" is too long! **" );
%message = getSubStr( %message, 0, %wavStart );
if ( %message !$= "" )
addMessageHudLine( %message );
}
else
addMessageHudLine( %message );
}
//--------------------------------------------------------------------------
function handleClientJoin(%msgType, %msgString, %clientName, %clientId, %targetId, %isAI, %isAdmin, %isSuperAdmin, %isSmurf, %guid)
{
logEcho("got client join: " @ detag(%clientName) @ " : " @ %clientId);
//create the player list group, and add it to the ClientConnectionGroup...
if(!isObject("PlayerListGroup"))
{
%newGroup = new SimGroup("PlayerListGroup");
ClientConnectionGroup.add(%newGroup);
}
%player = new ScriptObject()
{
className = "PlayerRep";
name = detag(%clientName);
guid = %guid;
clientId = %clientId;
targetId = %targetId;
teamId = 0; // start unassigned
score = 0;
ping = 0;
packetLoss = 0;
chatMuted = false;
canListen = false;
voiceEnabled = false;
isListening = false;
isBot = %isAI;
isAdmin = %isAdmin;
isSuperAdmin = %isSuperAdmin;
isSmurf = %isSmurf;
};
PlayerListGroup.add(%player);
$PlayerList[%clientId] = %player;
if ( !%isAI )
getPlayerPrefs(%player);
lobbyUpdatePlayer( %clientId );
}
function handleClientDrop( %msgType, %msgString, %clientName, %clientId )
{
logEcho("got client drop: " @ detag(%clientName) @ " : " @ %clientId);
%player = $PlayerList[%clientId];
if( %player )
{
%player.delete();
$PlayerList[%clientId] = "";
lobbyRemovePlayer( %clientId );
}
}
function handleClientJoinTeam( %msgType, %msgString, %clientName, %teamName, %clientId, %teamId )
{
%player = $PlayerList[%clientId];
if( %player )
{
%player.teamId = %teamId;
lobbyUpdatePlayer( %clientId );
}
}
function handleClientNameChanged( %msgType, %msgString, %oldName, %newName, %clientId )
{
%player = $PlayerList[%clientId];
if( %player )
{
%player.name = detag( %newName );
lobbyUpdatePlayer( %clientId );
}
}
addMessageCallback("", defaultMessageCallback);
addMessageCallback('MsgClientJoin', handleClientJoin);
addMessageCallback('MsgClientDrop', handleClientDrop);
addMessageCallback('MsgClientJoinTeam', handleClientJoinTeam);
addMessageCallback('MsgClientNameChanged', handleClientNameChanged);
//---------------------------------------------------------------------------
// Client chat'n
//---------------------------------------------------------------------------
function isClientChatMuted(%client)
{
%player = $PlayerList[%client];
if(%player)
return(%player.chatMuted ? true : false);
return(true);
}
//---------------------------------------------------------------------------
function clientCmdChatMessage(%sender, %voice, %pitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
{
%message = detag( %msgString );
%voice = detag( %voice );
if ( ( %message $= "" ) || isClientChatMuted( %sender ) )
return;
// search for wav tag marker
%wavStart = strstr( %message, "~w" );
if ( %wavStart == -1 )
addMessageHudLine( %message );
else
{
%wav = getSubStr(%message, %wavStart + 2, 1000);
if (%voice !$= "")
%wavFile = "voice/" @ %voice @ "/" @ %wav @ ".wav";
else
%wavFile = %wav;
//only play voice files that are < 5000ms in length
if (%pitch < 0.5 || %pitch > 2.0)
%pitch = 1.0;
%wavLengthMS = alxGetWaveLen(%wavFile) * %pitch;
if (%wavLengthMS < $MaxMessageWavLength )
{
if ( $ClientChatHandle[%sender] != 0 )
alxStop( $ClientChatHandle[%sender] );
$ClientChatHandle[%sender] = alxCreateSource( AudioChat, %wavFile );
//pitch the handle
if (%pitch != 1.0)
alxSourcef($ClientChatHandle[%sender], "AL_PITCH", %pitch);
alxPlay( $ClientChatHandle[%sender] );
}
else
error( "** WAV file \"" @ %wavFile @ "\" is too long! **" );
%message = getSubStr(%message, 0, %wavStart);
addMessageHudLine(%message);
}
}
//---------------------------------------------------------------------------
function clientCmdCannedChatMessage( %sender, %msgString, %name, %string, %keys, %voiceTag, %pitch )
{
%message = detag( %msgString );
%voice = detag( %voiceTag );
if ( $defaultVoiceBinds )
clientCmdChatMessage( %sender, %voice, %pitch, "[" @ %keys @ "]" SPC %message );
else
clientCmdChatMessage( %sender, %voice, %pitch, %message );
}
//---------------------------------------------------------------------------
// silly spam protection...
$SPAM_PROTECTION_PERIOD = 10000;
$SPAM_MESSAGE_THRESHOLD = 4;
$SPAM_PENALTY_PERIOD = 10000;
$SPAM_MESSAGE = '\c3FLOOD PROTECTION:\cr You must wait another %1 seconds.';
function GameConnection::spamMessageTimeout(%this)
{
if(%this.spamMessageCount > 0)
%this.spamMessageCount--;
}
function GameConnection::spamReset(%this)
{
%this.isSpamming = false;
}
function spamAlert(%client)
{
if($Host::FloodProtectionEnabled != true)
return(false);
if(!%client.isSpamming && (%client.spamMessageCount >= $SPAM_MESSAGE_THRESHOLD))
{
%client.spamProtectStart = getSimTime();
%client.isSpamming = true;
%client.schedule($SPAM_PENALTY_PERIOD, spamReset);
}
if(%client.isSpamming)
{
%wait = mFloor(($SPAM_PENALTY_PERIOD - (getSimTime() - %client.spamProtectStart)) / 1000);
messageClient(%client, "", $SPAM_MESSAGE, %wait);
return(true);
}
%client.spamMessageCount++;
%client.schedule($SPAM_PROTECTION_PERIOD, spamMessageTimeout);
return(false);
}
function chatMessageClient( %client, %sender, %voiceTag, %voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 )
{
//see if the client has muted the sender
if ( !%client.muted[%sender] )
commandToClient( %client, 'ChatMessage', %sender, %voiceTag, %voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
}
function cannedChatMessageClient( %client, %sender, %msgString, %name, %string, %keys )
{
if ( !%client.muted[%sender] )
commandToClient( %client, 'CannedChatMessage', %sender, %msgString, %name, %string, %keys, %sender.voiceTag, %sender.voicePitch );
}
function chatMessageTeam( %sender, %team, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 )
{
if ( ( %msgString $= "" ) || spamAlert( %sender ) )
return;
if ($CurrentMissionType $= "RPG")
{
if (!%sender.hasRadio)
{
messageClient(%sender,'msgNoRadio',"\c3You must have a radio.");
return;
}
%count = ClientGroup.getCount();
for ( %i = 0; %i < %count; %i++ )
{
%obj = ClientGroup.getObject( %i );
if ( %obj.team == %sender.team )
messageClient(%obj,'msgClient',"\c3"@%sender.namebase@" (1): "@%a2@" ~wfx/misc/static.wav");
//chatMessageClient( %obj, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
}
}
else
{
%count = ClientGroup.getCount();
for ( %i = 0; %i < %count; %i++ )
{
%obj = ClientGroup.getObject( %i );
if ( %obj.team == %sender.team )
chatMessageClient( %obj, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
}
}
}
function cannedChatMessageTeam( %sender, %team, %msgString, %name, %string, %keys )
{
if ( ( %msgString $= "" ) || spamAlert( %sender ) )
return;
%count = ClientGroup.getCount();
for ( %i = 0; %i < %count; %i++ )
{
%obj = ClientGroup.getObject( %i );
if ( %obj.team == %sender.team )
cannedChatMessageClient( %obj, %sender, %msgString, %name, %string, %keys );
}
}
function chatMessageAll( %sender, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 )
{
if ( ( %msgString $= "" ) || spamAlert( %sender ) )
{
return;
}
if ($CurrentMissionType $= "RPG" && !$Host::GlobalChat)
{
%count = MissionCleanup.getCount();
for (%i = 0; %i < %count; %i++)
{
%obj = MissionCleanup.getObject(%i);
if (%obj.getClassName() $= "Player")
{
%dist = vectorDist(%sender.player.getPosition(),%obj.getPosition());
if (%dist < 200)
chatMessageClient( %obj.client, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, addTaggedString("(Radius - 200)" SPC getTaggedString(%a1)), %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
}
}
}
else
{
%count = ClientGroup.getCount();
for ( %i = 0; %i < %count; %i++ )
{
%obj = ClientGroup.getObject( %i );
//----------------------------------------------------------------------------------------------------------------------------------------------------
// z0dd - ZOD, 6/03/02. Allow observer global chat to be seen by all, not just admins and other observers
chatMessageClient( %obj, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
//if(%sender.team != 0)
//{
// chatMessageClient( %obj, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
//}
//else
//{
// message sender is an observer -- only send message to other observers
//if(%obj.team == %sender.team || %obj.isAdmin || %obj.isSuperAdmin)
//{
// chatMessageClient( %obj, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
//}
//}
//----------------------------------------------------------------------------------------------------------------------------------------------------
}
}
// z0dd - ZOD 5/13/02. Echo chat to console for remote telnet apps.
if($Host::ClassicEchoChat)
{
echo( stripTaggedVar(%sender.name), ": ", %a2 );
}
//echo( "SAY: " @ stripchars(detag(gettaggedstring(%sender.name)),"\cp\co\c6\c7\c8\c9") @ " \"" @ %a2 @ "\"");
}
function cannedChatMessageAll( %sender, %msgString, %name, %string, %keys )
{
if ( ( %msgString $= "" ) || spamAlert( %sender ) )
return;
if ($CurrentMissionType $= "RPG" && !$Host::GlobalChat)
{
%count = MissionCleanup.getCount();
for (%i = 0; %i < %count; %i++)
{
%obj = MissionCleanup.getObject(%i);
if (%obj.getClassName() $= "Player")
{
%dist = vectorDist(%sender.player.getPosition(),%obj.getPosition());
if (%dist < 200)
cannedChatMessageClient( %obj.client, %sender, addTaggedString("\c4(Radius - "@%dist@")" SPC getTaggedString(%msgString)), %name, %string, %keys );
}
}
}
else
{
%count = ClientGroup.getCount();
for ( %i = 0; %i < %count; %i++ )
cannedChatMessageClient( ClientGroup.getObject(%i), %sender, %msgString, %name, %string, %keys );
}
// z0dd - ZOD 5/13/02. Echo chat to console for remote telnet apps.
if($Host::ClassicEchoChat)
{
echo( stripTaggedVar(%sender.name), ": ", getSubStr(%string, 0, strstr(%string, "~w")) );
}
//echo("SAY: " @ stripchars(detag(gettaggedstring(%sender.name)),"\cp\co\c6\c7\c8\c9") @ " \"" @ %string @ "\"");
}
//---------------------------------------------------------------------------
function messageClient(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
{
commandToClient(%client, 'ServerMessage', %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
}
function messageTeam(%team, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
{
%count = ClientGroup.getCount();
for(%cl= 0; %cl < %count; %cl++)
{
%recipient = ClientGroup.getObject(%cl);
if(%recipient.team == %team)
messageClient(%recipient, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
}
}
function messageTeamExcept(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
{
%team = %client.team;
%count = ClientGroup.getCount();
for(%cl= 0; %cl < %count; %cl++)
{
%recipient = ClientGroup.getObject(%cl);
if((%recipient.team == %team) && (%recipient != %client))
messageClient(%recipient, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
}
}
function messageAll(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
{
%count = ClientGroup.getCount();
for(%cl = 0; %cl < %count; %cl++)
{
%client = ClientGroup.getObject(%cl);
messageClient(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
}
}
function messageAllExcept(%client, %team, %msgtype, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
{
//can exclude a client, a team or both. A -1 value in either field will ignore that exclusion, so
//messageAllExcept(-1, -1, $Mesblah, 'Blah!'); will message everyone (since there shouldn't be a client -1 or client on team -1).
%count = ClientGroup.getCount();
for(%cl= 0; %cl < %count; %cl++)
{
%recipient = ClientGroup.getObject(%cl);
if((%recipient != %client) && (%recipient.team != %team))
messageClient(%recipient, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
}
}
//---------------------------------------------------------------------------
// functions to support repair messaging
//---------------------------------------------------------------------------
function clientCmdTeamRepairMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6)
{
if($pref::ignoreTeamRepairMessages)
%msgString = ""; // z0dd - ZOD, 8/23/02. Yogi. The message gets to the client but is "muted" from the HUD
clientCmdServerMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6);
}
function teamRepairMessage(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6)
{
%team = %client.team;
%count = ClientGroup.getCount();
for(%i = 0; %i < %count; %i++)
{
%recipient = ClientGroup.getObject(%i); // z0dd - ZOD, 8/20/02. param to getObject was $cl, which is an error
if((%recipient.team == %team) && (%recipient != %client))
{
commandToClient(%recipient, 'TeamRepairMessage', %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6); // z0dd - ZOD, 6/18/02. Was sending to the wrong variable. 1st param was %client
}
}
}
// -----------------------------------------------------------------------------------------------------------
// z0dd - ZOD, 8/20/02. Added this team destroy message function
function teamDestroyMessage(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6)
{
%team = %client.team;
%count = ClientGroup.getCount();
for(%i = 0; %i < %count; %i++)
{
%recipient = ClientGroup.getObject(%i);
if((%recipient.team == %team) && (%recipient != %client))
{
commandToClient(%recipient, 'TeamDestroyMessage', %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6);
}
}
}
// -----------------------------------------------------------------------------------------------------------
$MaxMessageWavLength = 5200;
function addMessageCallback(%msgType, %func)
{
for(%i = 0; (%afunc = $MSGCB[%msgType, %i]) !$= ""; %i++)
{
// only add each callback once
if(%afunc $= %func)
return;
}
$MSGCB[%msgType, %i] = %func;
}
function messagePump(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7 ,%a8, %a9, %a10)
{
clientCmdServerMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
}
function clientCmdServerMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
{
%tag = getWord(%msgType, 0);
for(%i = 0; (%func = $MSGCB["", %i]) !$= ""; %i++)
call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
if(%tag !$= "")
for(%i = 0; (%func = $MSGCB[%tag, %i]) !$= ""; %i++)
call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
}
function defaultMessageCallback(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
{
if ( %msgString $= "" )
return;
%message = detag( %msgString );
// search for wav tag marker
%wavStart = strstr( %message, "~w" );
if ( %wavStart != -1 )
{
%wav = getSubStr( %message, %wavStart + 2, 1000 );
%wavLengthMS = alxGetWaveLen( %wav );
if ( %wavLengthMS <= $MaxMessageWavLength )
{
%handle = alxCreateSource( AudioChat, %wav );
alxPlay( %handle );
}
else
error( "WAV file \"" @ %wav @ "\" is too long! **" );
%message = getSubStr( %message, 0, %wavStart );
if ( %message !$= "" )
addMessageHudLine( %message );
}
else
addMessageHudLine( %message );
}
//--------------------------------------------------------------------------
function handleClientJoin(%msgType, %msgString, %clientName, %clientId, %targetId, %isAI, %isAdmin, %isSuperAdmin, %isSmurf, %guid)
{
logEcho("got client join: " @ detag(%clientName) @ " : " @ %clientId);
//create the player list group, and add it to the ClientConnectionGroup...
if(!isObject("PlayerListGroup"))
{
%newGroup = new SimGroup("PlayerListGroup");
ClientConnectionGroup.add(%newGroup);
}
%player = new ScriptObject()
{
className = "PlayerRep";
name = detag(%clientName);
guid = %guid;
clientId = %clientId;
targetId = %targetId;
teamId = 0; // start unassigned
score = 0;
ping = 0;
packetLoss = 0;
chatMuted = false;
canListen = false;
voiceEnabled = false;
isListening = false;
isBot = %isAI;
isAdmin = %isAdmin;
isSuperAdmin = %isSuperAdmin;
isSmurf = %isSmurf;
};
PlayerListGroup.add(%player);
$PlayerList[%clientId] = %player;
if ( !%isAI )
getPlayerPrefs(%player);
lobbyUpdatePlayer( %clientId );
}
function handleClientDrop( %msgType, %msgString, %clientName, %clientId )
{
logEcho("got client drop: " @ detag(%clientName) @ " : " @ %clientId);
%player = $PlayerList[%clientId];
if( %player )
{
%player.delete();
$PlayerList[%clientId] = "";
lobbyRemovePlayer( %clientId );
}
}
function handleClientJoinTeam( %msgType, %msgString, %clientName, %teamName, %clientId, %teamId )
{
%player = $PlayerList[%clientId];
if( %player )
{
%player.teamId = %teamId;
lobbyUpdatePlayer( %clientId );
}
}
function handleClientNameChanged( %msgType, %msgString, %oldName, %newName, %clientId )
{
%player = $PlayerList[%clientId];
if( %player )
{
%player.name = detag( %newName );
lobbyUpdatePlayer( %clientId );
}
}
addMessageCallback("", defaultMessageCallback);
addMessageCallback('MsgClientJoin', handleClientJoin);
addMessageCallback('MsgClientDrop', handleClientDrop);
addMessageCallback('MsgClientJoinTeam', handleClientJoinTeam);
addMessageCallback('MsgClientNameChanged', handleClientNameChanged);
//---------------------------------------------------------------------------
// Client chat'n
//---------------------------------------------------------------------------
function isClientChatMuted(%client)
{
%player = $PlayerList[%client];
if(%player)
return(%player.chatMuted ? true : false);
return(true);
}
//---------------------------------------------------------------------------
function clientCmdChatMessage(%sender, %voice, %pitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
{
%message = detag( %msgString );
%voice = detag( %voice );
if ( ( %message $= "" ) || isClientChatMuted( %sender ) )
return;
// search for wav tag marker
%wavStart = strstr( %message, "~w" );
if ( %wavStart == -1 )
addMessageHudLine( %message );
else
{
%wav = getSubStr(%message, %wavStart + 2, 1000);
if (%voice !$= "")
%wavFile = "voice/" @ %voice @ "/" @ %wav @ ".wav";
else
%wavFile = %wav;
//only play voice files that are < 5000ms in length
if (%pitch < 0.5 || %pitch > 2.0)
%pitch = 1.0;
%wavLengthMS = alxGetWaveLen(%wavFile) * %pitch;
if (%wavLengthMS < $MaxMessageWavLength )
{
if ( $ClientChatHandle[%sender] != 0 )
alxStop( $ClientChatHandle[%sender] );
$ClientChatHandle[%sender] = alxCreateSource( AudioChat, %wavFile );
//pitch the handle
if (%pitch != 1.0)
alxSourcef($ClientChatHandle[%sender], "AL_PITCH", %pitch);
alxPlay( $ClientChatHandle[%sender] );
}
else
error( "** WAV file \"" @ %wavFile @ "\" is too long! **" );
%message = getSubStr(%message, 0, %wavStart);
addMessageHudLine(%message);
}
}
//---------------------------------------------------------------------------
function clientCmdCannedChatMessage( %sender, %msgString, %name, %string, %keys, %voiceTag, %pitch )
{
%message = detag( %msgString );
%voice = detag( %voiceTag );
if ( $defaultVoiceBinds )
clientCmdChatMessage( %sender, %voice, %pitch, "[" @ %keys @ "]" SPC %message );
else
clientCmdChatMessage( %sender, %voice, %pitch, %message );
}
//---------------------------------------------------------------------------
// silly spam protection...
$SPAM_PROTECTION_PERIOD = 10000;
$SPAM_MESSAGE_THRESHOLD = 4;
$SPAM_PENALTY_PERIOD = 10000;
$SPAM_MESSAGE = '\c3FLOOD PROTECTION:\cr You must wait another %1 seconds.';
function GameConnection::spamMessageTimeout(%this)
{
if(%this.spamMessageCount > 0)
%this.spamMessageCount--;
}
function GameConnection::spamReset(%this)
{
%this.isSpamming = false;
}
function spamAlert(%client)
{
if($Host::FloodProtectionEnabled != true)
return(false);
if(!%client.isSpamming && (%client.spamMessageCount >= $SPAM_MESSAGE_THRESHOLD))
{
%client.spamProtectStart = getSimTime();
%client.isSpamming = true;
%client.schedule($SPAM_PENALTY_PERIOD, spamReset);
}
if(%client.isSpamming)
{
%wait = mFloor(($SPAM_PENALTY_PERIOD - (getSimTime() - %client.spamProtectStart)) / 1000);
messageClient(%client, "", $SPAM_MESSAGE, %wait);
return(true);
}
%client.spamMessageCount++;
%client.schedule($SPAM_PROTECTION_PERIOD, spamMessageTimeout);
return(false);
}
function chatMessageClient( %client, %sender, %voiceTag, %voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 )
{
//see if the client has muted the sender
if ( !%client.muted[%sender] )
commandToClient( %client, 'ChatMessage', %sender, %voiceTag, %voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
}
function cannedChatMessageClient( %client, %sender, %msgString, %name, %string, %keys )
{
if ( !%client.muted[%sender] )
commandToClient( %client, 'CannedChatMessage', %sender, %msgString, %name, %string, %keys, %sender.voiceTag, %sender.voicePitch );
}
function chatMessageTeam( %sender, %team, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 )
{
if ( ( %msgString $= "" ) || spamAlert( %sender ) )
return;
if ($CurrentMissionType $= "RPG")
radioChatMessageTeam(%sender, %team, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
else
{
%count = ClientGroup.getCount();
for ( %i = 0; %i < %count; %i++ )
{
%obj = ClientGroup.getObject( %i );
if ( %obj.team == %sender.team )
chatMessageClient( %obj, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
}
}
}
function cannedChatMessageTeam( %sender, %team, %msgString, %name, %string, %keys )
{
if ( ( %msgString $= "" ) || spamAlert( %sender ) )
return;
%count = ClientGroup.getCount();
for ( %i = 0; %i < %count; %i++ )
{
%obj = ClientGroup.getObject( %i );
if ( %obj.team == %sender.team )
cannedChatMessageClient( %obj, %sender, %msgString, %name, %string, %keys );
}
}
function chatMessageAll( %sender, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 )
{
if ( ( %msgString $= "" ) || spamAlert( %sender ) )
{
return;
}
if ($CurrentMissionType $= "RPG" && !$Host::GlobalChat)
rangedChatMessageAll(%sender, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %c8, %a9, %a10);
else
{
%count = ClientGroup.getCount();
for ( %i = 0; %i < %count; %i++ )
{
%obj = ClientGroup.getObject( %i );
//----------------------------------------------------------------------------------------------------------------------------------------------------
// z0dd - ZOD, 6/03/02. Allow observer global chat to be seen by all, not just admins and other observers
chatMessageClient( %obj, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
//if(%sender.team != 0)
//{
// chatMessageClient( %obj, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
//}
//else
//{
// message sender is an observer -- only send message to other observers
//if(%obj.team == %sender.team || %obj.isAdmin || %obj.isSuperAdmin)
//{
// chatMessageClient( %obj, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
//}
//}
//----------------------------------------------------------------------------------------------------------------------------------------------------
}
}
// z0dd - ZOD 5/13/02. Echo chat to console for remote telnet apps.
if($Host::ClassicEchoChat)
{
echo( stripTaggedVar(%sender.name), ": ", %a2 );
}
//echo( "SAY: " @ stripchars(detag(gettaggedstring(%sender.name)),"\cp\co\c6\c7\c8\c9") @ " \"" @ %a2 @ "\"");
}
function cannedChatMessageAll( %sender, %msgString, %name, %string, %keys )
{
if ( ( %msgString $= "" ) || spamAlert( %sender ) )
return;
if ($CurrentMissionType $= "RPG" && !$Host::GlobalChat)
{
%count = MissionCleanup.getCount();
for (%i = 0; %i < %count; %i++)
{
%obj = MissionCleanup.getObject(%i);
if (%obj.getClassName() $= "Player")
{
%dist = vectorDist(%sender.player.getPosition(),%obj.getPosition());
if (%dist < 200)
cannedChatMessageClient( %obj.client, %sender, addTaggedString("\c4(Radius - "@%dist@")" SPC getTaggedString(%msgString)), %name, %string, %keys );
}
}
}
else
{
%count = ClientGroup.getCount();
for ( %i = 0; %i < %count; %i++ )
cannedChatMessageClient( ClientGroup.getObject(%i), %sender, %msgString, %name, %string, %keys );
}
// z0dd - ZOD 5/13/02. Echo chat to console for remote telnet apps.
if($Host::ClassicEchoChat)
{
echo( stripTaggedVar(%sender.name), ": ", getSubStr(%string, 0, strstr(%string, "~w")) );
}
//echo("SAY: " @ stripchars(detag(gettaggedstring(%sender.name)),"\cp\co\c6\c7\c8\c9") @ " \"" @ %string @ "\"");
}
//---------------------------------------------------------------------------
function messageClient(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
{
commandToClient(%client, 'ServerMessage', %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
}
function messageTeam(%team, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
{
%count = ClientGroup.getCount();
for(%cl= 0; %cl < %count; %cl++)
{
%recipient = ClientGroup.getObject(%cl);
if(%recipient.team == %team)
messageClient(%recipient, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
}
}
function messageTeamExcept(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
{
%team = %client.team;
%count = ClientGroup.getCount();
for(%cl= 0; %cl < %count; %cl++)
{
%recipient = ClientGroup.getObject(%cl);
if((%recipient.team == %team) && (%recipient != %client))
messageClient(%recipient, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
}
}
function messageAll(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
{
%count = ClientGroup.getCount();
for(%cl = 0; %cl < %count; %cl++)
{
%client = ClientGroup.getObject(%cl);
messageClient(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
}
}
function messageAllExcept(%client, %team, %msgtype, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
{
//can exclude a client, a team or both. A -1 value in either field will ignore that exclusion, so
//messageAllExcept(-1, -1, $Mesblah, 'Blah!'); will message everyone (since there shouldn't be a client -1 or client on team -1).
%count = ClientGroup.getCount();
for(%cl= 0; %cl < %count; %cl++)
{
%recipient = ClientGroup.getObject(%cl);
if((%recipient != %client) && (%recipient.team != %team))
messageClient(%recipient, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
}
}
//---------------------------------------------------------------------------
// functions to support repair messaging
//---------------------------------------------------------------------------
function clientCmdTeamRepairMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6)
{
if($pref::ignoreTeamRepairMessages)
%msgString = ""; // z0dd - ZOD, 8/23/02. Yogi. The message gets to the client but is "muted" from the HUD
clientCmdServerMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6);
}
function teamRepairMessage(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6)
{
%team = %client.team;
%count = ClientGroup.getCount();
for(%i = 0; %i < %count; %i++)
{
%recipient = ClientGroup.getObject(%i); // z0dd - ZOD, 8/20/02. param to getObject was $cl, which is an error
if((%recipient.team == %team) && (%recipient != %client))
{
commandToClient(%recipient, 'TeamRepairMessage', %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6); // z0dd - ZOD, 6/18/02. Was sending to the wrong variable. 1st param was %client
}
}
}
// -----------------------------------------------------------------------------------------------------------
// z0dd - ZOD, 8/20/02. Added this team destroy message function
function teamDestroyMessage(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6)
{
%team = %client.team;
%count = ClientGroup.getCount();
for(%i = 0; %i < %count; %i++)
{
%recipient = ClientGroup.getObject(%i);
if((%recipient.team == %team) && (%recipient != %client))
{
commandToClient(%recipient, 'TeamDestroyMessage', %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6);
}
}
}
// -----------------------------------------------------------------------------------------------------------

View file

@ -1,2 +0,0 @@
These scripts are the internal functioning of the T2BoL mod. It is recommended you don't touch these and just use the BASIC API
to make your changes to the game.

View file

@ -1,81 +0,0 @@
//------------------------------------------------------------------------------
// Application SDK for the PDA. (to make my life easier)
// Trigger code for RPG Gamemode
// Copyright (c) 2012 The DarkDragonDX
//==============================================================================
function RPGGame::onEnterTrigger(%game, %name, %data, %obj, %colObj)
{
switch$(%obj.type)
{
case "Transport": if (%obj.targetTransform $= "") return;
%Colobj.setTransform(%obj.targetTransform);
if (%Colobj.Usewhiteout)
%Obj.setWhiteout(0.8);
break;
case "Territory":
if (%obj.race $= "")
return;
%obj.client.isOnTerritory[%Colobj.race] = true;
setClientTeam(%Colobj.client,getRaceTeam(%Obj.race));
if (%obj.location $= "")
{
messageClient(%Colobj.client,'MsgSPCurrentObjective1',"",'Location: %1.', %obj.race SPC "Territory");
messageClient(%colObj.client,'msgEnteredRaceTerritory','\c3You have entered %1 territory.',%obj.race);
}
else
{
messageClient(%colObj.client,'msgEnteredRaceTerritory','\c3You have entered %1.',%obj.location);
messageClient(%Colobj.client,'MsgSPCurrentObjective1',"",'Location: %1.', %obj.location);
}
break;
case "Damage": //Will add lots o' vars onto it..
%obj.damage[%colobj] = true;
%colObj.isinLava = true;
break;
}
if (%Colobj.message $= "" && %Colobj.type !$= "Territory")
messageClient(%Colobj.client,'MsgTrigger',%obj.message);
return true;
}
function RPGGame::onLeaveTrigger(%game, %name, %data, %obj, %colObj)
{
switch$(%obj.type)
{
case "Territory":
if (%obj.race $= "")
return;
if (%obj.location $= "")
messageClient(%Colobj.client,'MsgExitedRaceTerritory',"\c3You have exited "@%obj.race@" territory. Your sensor data is now undetectable.");
else
messageClient(%Colobj.client,'MsgExitedRaceTerritory',"\c3You have exited "@%obj.location@".");
%Colobj.client.isOnTerritory[%obj.race] = false;
messageClient(%colObj.client,'MsgSPCurrentObjective1',"",'Location: Unknown.');
setClientTeam(%Colobj.client,0); //Not on the sensor, I think
break;
case "Damage":
%obj.damage[%obj] = false;
%colObj.isInLava = true;
break;
}
return true;
}
function RPGGame::onTickTrigger(%game, %name, %data, %obj)
{
switch(%obj.type)
{
case "Damage":
for (%i = 0; %i < MissionCleanup.getCount(); %i++)
{
%objT = MissionCleanup.getObject(%i);
if (%objt.getClassName() $= "Player" && %objt.getState() $= "move")
if (%obj.damage[%objT] && %objT.isInLava)
%objT.damage(0, %objT.getPosition(), %obj.damage, %obj,damageType);
break;
}
}
return true;
}

View file

@ -1,15 +0,0 @@
//------------------------------------------------------------------------------
// Server Scripts Init
//==============================================================================
exec("scripts/modScripts/server/propData.cs");
exec("scripts/modScripts/server/mining.cs");
exec("scripts/modScripts/server/propertyOwning.cs");
exec("scripts/modScripts/server/looting.cs");
exec("scripts/modScripts/server/serverFunctions.cs");
exec("scripts/modScripts/server/bloodHuman.cs");
exec("scripts/modScripts/server/bloodBioderm.cs");
exec("scripts/modScripts/server/dataImport.cs");
exec("scripts/modScripts/server/serverNetworking.cs");
exec("scripts/modScripts/server/HTTPServer.cs");
exec("scripts/modScripts/server/TorqueExServer.cs");

View file

@ -1,11 +0,0 @@
//------------------------------------------------------------------------------
// initialise.cs
// Shared Functions for T2Bol
// Copyright (c) 2012 The DarkDragonDX
//==============================================================================
exec("scripts/modScripts/shared/Array.cs");
exec("scripts/modScripts/shared/stringProcessing.cs");
exec("scripts/modScripts/shared/fileProcessing.cs");
exec("scripts/modScripts/shared/basicDataStorage.cs");

View file

@ -0,0 +1 @@
//------------------------------------------------------------------------------ // ActivePlayers.cs // .cs code listing currently active players // Copyright (c) 2012 Robert MacGregor //------------------------------------------------------------------------------ // Function that returns raw HTML formatting for the web browser on the client end to read function ActivePlayers::contents(%this) { %data = "<head><title>T2BoL Webserver Testing | Active Players</title></head><body>" @ "<center>" @ "<font size=\x225\x22>Currently Active Players</font>" @ "<hr></br></br>" @ "<table border=\x225\x22 width=\x22500\x22>"; %data = %data @ "<tr><td><center>Name</center></td>"; %data = %data @ "<td><center>Species</center></td>"; %data = %data @ "<td><center>Gender</center></td></tr>"; for (%i = 0; %i < ClientGroup.getCount(); %i++) { %client = ClientGroup.getObject(%i); %data = %data @ "<tr><td><center>" @ %client.namebase @ "</center></td>"; %data = %data @ "<td><center>" @ %client.race @ "</center></td>"; %data = %data @ "<td><center>" @ %client.sex @ "</center></td></tr>"; } //"<tr>" @ //"<td><center><a href=\x22ActivePlayers.cs\x22>Active Players</a></center></td>" @ //"</tr>" @ %data = %data @ "</table>" @ "</body>"; return %data; }

View file

@ -0,0 +1,21 @@
//------------------------------------------------------------------------------
// Index.cs
// Home page for the BoL inbuilt web server
// Copyright (c) 2012 Robert MacGregor
//------------------------------------------------------------------------------
// Function that returns raw HTML formatting for the web browser on the client end to read
function Index::contents(%this)
{
%data = "<head><title>T2BoL Webserver Testing</title></head><body>" @
"<center>" @
"<font size=\x225\x22>Welcome! This is the testing index page!</font>" @
"<hr></br></br>" @
"<table border=\x225\x22 width=\x22200\x22>" @
"<tr>" @
"<td><center><a href=\x22ActivePlayers.cs\x22>Active Players</a></center></td>" @
"</tr>" @
"</table>" @
"</body>";
return %data;
}

View file

@ -1,349 +1,336 @@
//------------------------------------------------------------------------------
// HTTPServer.cs
// An experimental HTTP Server written in Torque!
// Copyright (c) 2012 The DarkDragonDX
//------------------------------------------------------------------------------
// --
// BoL Specific Code -- automatically load the server if enabled
if (!IsObject(HTTPServerPrefs))
new ScriptObject(HTTPServerPrefs) { class = "BasicDataParser"; };
HTTPServerPrefs.empty();
HTTPServerPrefs.load("prefs/WebServer.conf");
%generic = HTTPServerPrefs.get("Generic",0);
if(%generic.element("Enabled") $= "true")
{
new ScriptObject(WebServer) { class = "HTTPServer"; };
WebServer.listen(%generic.element("Host"),%generic.element("Port"),%generic.element("StartWorkers"));
}
// --
// Replicate Code for Servers
$HTTPServer::ServerReplicate = "function *UNIQUESOCKET*::onConnectRequest(%this, %address, %socket)\n" @
"{\n" @
"%this.Parent.connectionCreated(%address, %socket);\n" @
"return true;\n" @
"}\n";
// Replicate Code for Clients
$HTTPServer::ClientReplicate = "function *UNIQUESOCKET*::onLine(%this, %line)\n" @
"{\n" @
"%this.Parent.onLine(%this, %line);\n" @
"return true;\n" @
"}\n" @
"function *UNIQUESOCKET*::onDisconnect(%this) { %this.Parent.connectionDropped(%this); return true; }\n" @
"function *UNIQUESOCKET*::sendPacket(%this,%packet)\n" @
"{\n" @
"%this.send(%packet.statusCode);\n" @
"for (%i = 0; %i < %packet.headerCount; %i++)\n" @
"{\n" @
"echo(%packet.headers[%packet.headerName[%i]]);\n" @
"%this.send(%packet.headers[%packet.headerName[%i]]);\n" @
"}\n" @
"%this.send(\"\\n\");\n" @
"%this.send(%packet.payLoad);\n" @
"%this.disconnect();\n" @
"}\n";
function HTTPServer::listen(%this, %address, %port, %maxClients)
{
%uniqueNameLength = 6; // Adjust this if need be, but there should never be a reason to
%this.allowMultiConnect = false; // If false, when a client connects twice, its old connection is killed and replaced with a new one.
if (%this.isListening)
return false;
if (%maxClients < 1 || %maxClients == 0)
%maxClients = 8;
%oldAddr = $Host::BindAddress;
%address = strlwr(%address);
if (%address $= "local" || %address $="localhost" ) %address = "127.0.0.1";
else if (%address $= "any") %address = "0.0.0.0";
%charList = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// Generate A name for a TCPObject (and make sure it's unique)
%uniqueStringLen = 6; // Adjust this if needed, but there shouldn't be a reason to
%uniqueString = "";
while (true)
{
%uniqueString = generateString(%uniqueNameLength, %charList);
if (!isObject(%uniqueString)) break;
else %uniqueString = "";
}
%evalCode = $HTTPServer::ServerReplicate;
%evalCode = strReplace(%evalCode, "*UNIQUESOCKET*", %uniqueString);
eval(%evalCode);
// Generate a list of unique names that this TCPServer will use (to keep down function def count)
for (%i = 0; %i < %maxClients; %i++)
while (true)
{
%uniqueName = generateString(%uniqueNameLength, %charList);
if (!isObject(%uniqueName))
{
%eval = strReplace($HTTPServer::ClientReplicate, "*UNIQUESOCKET*", %uniqueName);
eval(%eval);
%this.uniqueName[%i] = %uniqueName;
%this.uniqueNameInUse[%uniqueName] = false;
break;
}
}
// Create the Socket and we'll rock n' roll
$Host::BindAddress = %address;
%this.Server = new TCPObject(%uniqueString);
%this.Server.listen(%port);
%this.Server.Parent = %this;
%this.connectionCount = 0;
%this.maximumClients = %maxClients;
$Host::BindAddress = %oldAddr;
%this.isListening = true;
%statusCodes = HTTPServerPrefs.get("StatusCodes",0);
%this.Page[404] = %statusCodes.element("404");
%this.Page[403] = %statusCodes.element("403");
%generic = HTTPServerPrefs.get("Generic",0);
%this.Root = %generic.element("Root");
%this.Variables = Array.create();
%this.MimeTypes = HTTPServerPrefs.get("MIME");
logEcho("Server " @ %uniqueString SPC "is ready on " @ %address @ ":" @ %port);
return true;
}
function HTTPServer::disconnect(%this)
{
}
function HTTPServer::connectionDropped(%this, %socket)
{
if (!IsObject(%socket))
return false;
%socket.disconnect();
if (!%this.allowMultiConnect)
%this.connections[%socket.Address] = "";
else
%this.connections[%socket.Address, %socket.Port] = "";
%this.uniqueNameInUse[%socket.getName()] = false;
%this.connectionCount--;
%this.onClientDisconnect(%socket);
}
function HTTPServer::connectionCreated(%this, %address, %socket)
{
%isReplicate = false;
// Get the Port No. and Address respectively
%address = strReplace(%address, "IP:","");
%portPos = strStr(%address, ":");
%port = getSubStr(%address, %portPos+1, strLen(%address));
%address = getSubStr(%address, 0, %portPos);
// Pick a unique name
%uniqueName = "";
for (%i = 0; %i < %this.maximumClients; %i++)
{
%name = %this.uniqueName[%i];
if (!%this.uniqueNameInUse[%name])
{
%uniqueName = %name;
%this.uniqueNameInUse[%name] = true;
break;
}
}
// If we were unable to find a good unique name
%charList = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
%uniqueStringLen = 6; // Adjust this if needed, but there shouldn't be a reason to
if (%uniqueName $= "")
{
while (true)
{
%uniqueName = generateString(%uniqueStringLen, %charList);
if (!isObject(%uniqueName)) break;
else %uniqueName = "";
}
%eval = strReplace($HTTPServer::ClientReplicate, "*UNIQUESOCKET*", %uniqueName);
eval(%eval);
%this.uniqueName[%this.maximumClients] = %uniqueName;
%this.uniqueNameInUse[%uniqueName] = true;
%this.maximumClients++;
}
// Create The Client Socket
%connection = new TCPObject(%uniqueName,%socket) { class = ConnectionTCP; parent = %this; Address = %address; Port = %port; };
if (!%this.allowMultiConnect)
%this.connections[%address] = %connection;
else
%this.connections[%address, %port] = %connection;
%this.connectionCount++;
%this.onClientConnect(%address, %connection);
logEcho("Received client connection from " @ %address);
%this.schedule(10000,"connectionDropped",%connection);
return true;
}
// Callbacks -- make these do whatever you please!
function HTTPServer::onClientConnect(%this, %address, %socket)
{
echo("Received connection from " @ %address @ ". ID:" @ %socket);
//%socket.disconnect();
return true;
}
function HTTPServer::onClientRejected(%this, %socket, %reason) // %reason is always zero as of now.
{
return true;
}
function HTTPServer::onClientDisconnect(%this, %socket)
{
logEcho("Received Disconnect (" @ %socket @ ")");
%socket.delete();
return true;
}
function HTTPServer::onLine(%this, %socket, %line)
{
logEcho(%socket SPC "says: " @ %line);
%reqType = getWord(%line, 0);
if (%reqType $= "GET")
{
%req = getWord(%line, 1);
%reqLen = strLen(%req);
%socket.request = getSubStr(%req, 1, %reqLen);
%socket.request = strReplace(%socket.request, "%20", " ");
%socket.request = %this.Root @ %socket.request;
%socket.requestType = "GET";
}
%data = "<HTML><header><title>404 - Not Found</title></header><body>Oops!<br>File not found.</body></HTML>";
%forbiddenData = "<HTML><header><title>403- Forbidden</title></header><body>Oops!<br>You're not allowed to see this.</body></HTML>";
%packet = new ScriptObject(){ class = "HTTPResponsePacket"; };
//return;
// We received the end-of-packet from a socket
if (%line $= "")
{
//Shitty
if (strStr(%socket.request,".") != -1)
{
if (!isFile(%socket.request))
%packet.setStatusCode(404);
else if (%socket.request $= "prefs/ClientPrefs.cs")
{
%packet.setStatusCode(403);
%data = %forbiddenData;
}
else
{
%packet.setStatusCode(200);
%file = new FileObject();
%file.openForRead(%socket.request);
%data = "";
while (!%file.isEOF())
{
%line = %file.readLine();
echo(%line);
if (strStr(%socket.request,".html") == -1)
{
%line = strReplace(%line,">","&#62;");
%line = strReplace(%line,"<","&#60;");
%line = strReplace(%line," ","&nbsp;");
%line = strReplace(%line,"\t","&nbsp;&nbsp;&nbsp;&nbsp;");
%data = %data @ %line @ "<br>\n";
}
else
%data = %data @ %line @ "\n";
}
%file.close();
%file.delete();
}
// Check the file type
%extension = getFileExtensionFromString(%socket.request);
if (%extension $= "html" || %extension $= "htm")
{
%script = strReplace(%socket.request,".html",".cs");
if (isFile(%script))
{
exec(%script);
%Object = new ScriptObject(){ class = "ServerApp"; };
%data = %Object.execute(%data);
%Object.delete();
}
}
}
else
{
%packet.setStatusCode(200);
%data = "<HTML>\n<header>\n<title>\nDirectory\n</title>\n</header>\n<body><h1>Directory of " @ %socket.request @ "</h1>\n";
for( %file = findFirstFile( %socket.request @ "*.*" ); %file !$= ""; %file = findNextFile( %socket.request @ "*.*" ) )
{
%file = strReplace(%file, %socket.request, "");
if (strStr(%file, "/") != -1)
{
%dir = getSubStr(%file, 0, strStr(%file, "/")) @ "/";
if (!%dirAdded[%dir])
{
%data = %data @ "<a href=\"" @ strReplace(%dir, " ","%20") @ "\">" @ %dir @ "</a><br>\n";
%dirAdded[%dir] = true;
}
}
else
%data = %data @ "<a href=\"" @ strReplace(%file, " ", "%20") @ "\">" @ %file @ "</a><br>\n";
}
%data = %data @ "</body>\n</HTML>\n";
}
%packet.setHeader("Date",formatTimeString("DD, dd MM yy hh:nn:ss ") @ "Eastern");
%packet.setHeader("Server","Tribes 2");
%packet.setHeader("Content-Type","text/html");
%packet.setPayload(%data);
%socket.sendPacket(%packet);
%packet.delete();
%this.connectionDropped(%socket);
}
if (isObject(%packet))
%packet.delete();
return true;
}
// Packet Functions (used for packet generation/reading)
function HTTPResponsePacket::setHeader(%this, %name, %value)
{
if (%this.headerCount == "")
%this.headerCount = 0;
if (%this.headers[%name] $= "")
{
%this.headerName[%this.headerCount] = %name;
%this.headerCount++;
}
%this.headers[%name] = %name @ ": " @ %value @ "\n";
return true;
}
function HTTPResponsePacket::setStatusCode(%this, %code)
{
%this.statusCode = "HTTP/1.1 " @ %code SPC "OK\n";
return true;
}
function HTTPResponsePacket::setPayload(%this, %data)
{
%this.payLoad = %data;
%this.payloadSize = strLen(%data);
%this.setHeader("Content-Length", %this.payloadSize);
return true;
}
// Lib Functions
function generateString(%length, %alpha)
{
%len = strLen(%alpha);
%result = "";
for (%i = 0; %i < %length; %i++)
%result = %result @ getSubStr(%alpha, getRandom(0, %len), 1);
return %result;
}
//------------------------------------------------------------------------------
// HTTPServer.cs
// An experimental HTTP Server written in Torque!
// Copyright (c) 2012 Robert MacGregor
//------------------------------------------------------------------------------
// Replicate Code for Servers
$HTTPServer::ServerReplicate = "function *UNIQUESOCKET*::onConnectRequest(%this, %address, %socket)\n" @
"{\n" @
"%this.Parent.connectionCreated(%address, %socket);\n" @
"return true;\n" @
"}\n";
// Replicate Code for Clients
$HTTPServer::ClientReplicate = "function *UNIQUESOCKET*::onLine(%this, %line)\n" @
"{\n" @
"%this.Parent.onLine(%this, %line);\n" @
"return true;\n" @
"}\n" @
"function *UNIQUESOCKET*::onDisconnect(%this) { %this.Parent.connectionDropped(%this); return true; }\n" @
"function *UNIQUESOCKET*::sendPacket(%this,%packet)\n" @
"{\n" @
"%this.send(%packet.statusCode);\n" @
"for (%i = 0; %i < %packet.headerCount; %i++)\n" @
"{\n" @
"%this.send(%packet.headers[%packet.headerName[%i]]);\n" @
"}\n" @
"%this.send(\"\\n\");\n" @
"%this.send(%packet.payLoad);\n" @
"%this.disconnect();\n" @
"}\n";
function HTTPServer::listen(%this, %address, %port, %maxClients)
{
%uniqueNameLength = 6; // Adjust this if need be, but there should never be a reason to
%this.allowMultiConnect = false; // If false, when a client connects twice, its old connection is killed and replaced with a new one.
if (%this.isListening)
return false;
if (%maxClients < 1 || %maxClients == 0)
%maxClients = 8;
%oldAddr = $Host::BindAddress;
%address = strlwr(%address);
if (%address $= "local" || %address $="localhost" ) %address = "127.0.0.1";
else if (%address $= "any") %address = "0.0.0.0";
%charList = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// Generate A name for a TCPObject (and make sure it's unique)
%uniqueStringLen = 6; // Adjust this if needed, but there shouldn't be a reason to
%uniqueString = "";
while (true)
{
%uniqueString = generateString(%uniqueNameLength, %charList);
if (!isObject(%uniqueString)) break;
else %uniqueString = "";
}
%evalCode = $HTTPServer::ServerReplicate;
%evalCode = strReplace(%evalCode, "*UNIQUESOCKET*", %uniqueString);
eval(%evalCode);
// Generate a list of unique names that this TCPServer will use (to keep down function def count)
for (%i = 0; %i < %maxClients; %i++)
while (true)
{
%uniqueName = generateString(%uniqueNameLength, %charList);
if (!isObject(%uniqueName))
{
%eval = strReplace($HTTPServer::ClientReplicate, "*UNIQUESOCKET*", %uniqueName);
eval(%eval);
%this.uniqueName[%i] = %uniqueName;
%this.uniqueNameInUse[%uniqueName] = false;
break;
}
}
// Create the Socket and we'll rock n' roll
$Host::BindAddress = %address;
%this.Server = new TCPObject(%uniqueString);
%this.Server.listen(%port);
%this.Server.Parent = %this;
%this.connectionCount = 0;
%this.maximumClients = %maxClients;
$Host::BindAddress = %oldAddr;
%this.isListening = true;
%statusCodes = HTTPServerPrefs.get("StatusCodes",0);
%this.Page[404] = %statusCodes.element("404");
%this.Page[403] = %statusCodes.element("403");
%generic = HTTPServerPrefs.get("Generic",0);
%this.Root = %generic.element("Root");
%this.Variables = Array.create();
%this.MimeTypes = HTTPServerPrefs.get("MIME");
logEcho("Server " @ %uniqueString SPC "is ready on " @ %address @ ":" @ %port);
return true;
}
function HTTPServer::disconnect(%this)
{
}
function HTTPServer::connectionDropped(%this, %socket)
{
if (!IsObject(%socket))
return false;
%socket.disconnect();
if (!%this.allowMultiConnect)
%this.connections[%socket.Address] = "";
else
%this.connections[%socket.Address, %socket.Port] = "";
%this.uniqueNameInUse[%socket.getName()] = false;
%this.connectionCount--;
%this.onClientDisconnect(%socket);
}
function HTTPServer::connectionCreated(%this, %address, %socket)
{
%isReplicate = false;
// Get the Port No. and Address respectively
%address = strReplace(%address, "IP:","");
%portPos = strStr(%address, ":");
%port = getSubStr(%address, %portPos+1, strLen(%address));
%address = getSubStr(%address, 0, %portPos);
// Pick a unique name
%uniqueName = "";
for (%i = 0; %i < %this.maximumClients; %i++)
{
%name = %this.uniqueName[%i];
if (!%this.uniqueNameInUse[%name])
{
%uniqueName = %name;
%this.uniqueNameInUse[%name] = true;
break;
}
}
// If we were unable to find a good unique name
%charList = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
%uniqueStringLen = 6; // Adjust this if needed, but there shouldn't be a reason to
if (%uniqueName $= "")
{
while (true)
{
%uniqueName = generateString(%uniqueStringLen, %charList);
if (!isObject(%uniqueName)) break;
else %uniqueName = "";
}
%eval = strReplace($HTTPServer::ClientReplicate, "*UNIQUESOCKET*", %uniqueName);
eval(%eval);
%this.uniqueName[%this.maximumClients] = %uniqueName;
%this.uniqueNameInUse[%uniqueName] = true;
%this.maximumClients++;
}
// Create The Client Socket
%connection = new TCPObject(%uniqueName,%socket) { class = ConnectionTCP; parent = %this; Address = %address; Port = %port; };
if (!%this.allowMultiConnect)
%this.connections[%address] = %connection;
else
%this.connections[%address, %port] = %connection;
%this.connectionCount++;
%this.onClientConnect(%address, %connection);
logEcho("Received client connection from " @ %address);
%this.schedule(10000,"connectionDropped",%connection);
return true;
}
// Callbacks -- make these do whatever you please!
function HTTPServer::onClientConnect(%this, %address, %socket)
{
echo("Received connection from " @ %address @ ". ID:" @ %socket);
return true;
}
function HTTPServer::onClientRejected(%this, %socket, %reason) // %reason is always zero as of now.
{
return true;
}
function HTTPServer::onClientDisconnect(%this, %socket)
{
logEcho("Received Disconnect (" @ %socket @ ")");
%socket.delete();
return true;
}
function HTTPServer::onLine(%this, %socket, %line)
{
%reqType = getWord(%line, 0);
if (%reqType $= "GET")
{
%req = getWord(%line, 1);
%reqLen = strLen(%req);
%socket.request = getSubStr(%req, 1, %reqLen);
%socket.request = strReplace(%socket.request, "%20", " ");
%socket.request = %this.Root @ %socket.request;
%socket.requestType = "GET";
}
%data = "<HTML><header><title>404 - Not Found</title></header><body>Oops!<br>File not found.</body></HTML>";
%forbiddenData = "<HTML><header><title>403- Forbidden</title></header><body>Oops!<br>You're not allowed to see this.</body></HTML>";
%packet = new ScriptObject(){ class = "HTTPResponsePacket"; };
//return;
// We received the end-of-packet from a socket
if (%line $= "")
{
//Shitty
if (strStr(%socket.request,".") != -1)
{
if (!isFile(%socket.request))
%packet.setStatusCode(404);
else if (%socket.request $= "prefs/ClientPrefs.cs")
{
%packet.setStatusCode(403);
%data = %forbiddenData;
}
else if (getFileExtensionFromString(%socket.request) $= "cs")
{
%packet.setStatusCode(200);
// FIXME: INSECURE and gay
exec(%socket.request);
%class = strReplace(getFileNameFromString(%socket.request), ".cs", ""); // FIXME: Crappy
%instance = new ScriptObject() { class = %class; };
%data = %instance.contents();
%instance.delete();
}
else
{
%packet.setStatusCode(403);
%data = %forbiddenData;
}
// Check the file type
%extension = getFileExtensionFromString(%socket.request);
if (%extension $= "html" || %extension $= "htm")
{
%script = strReplace(%socket.request,".html",".cs");
if (isFile(%script))
{
exec(%script);
%Object = new ScriptObject(){ class = "ServerApp"; };
%data = %Object.execute(%data);
%Object.delete();
}
}
}
else
{
%packet.setStatusCode(200);
%data = "<HTML>\n<header>\n<title>\nDirectory\n</title>\n</header>\n<body><h1>Directory of " @ %socket.request @ "</h1>\n";
for( %file = findFirstFile( %socket.request @ "*.*" ); %file !$= ""; %file = findNextFile( %socket.request @ "*.*" ) )
{
%file = strReplace(%file, %socket.request, "");
if (strStr(%file, "/") != -1)
{
%dir = getSubStr(%file, 0, strStr(%file, "/")) @ "/";
if (!%dirAdded[%dir])
{
%data = %data @ "<a href=\"" @ strReplace(%dir, " ","%20") @ "\">" @ %dir @ "</a><br>\n";
%dirAdded[%dir] = true;
}
}
else
%data = %data @ "<a href=\"" @ strReplace(%file, " ", "%20") @ "\">" @ %file @ "</a><br>\n";
}
%data = %data @ "</body>\n</HTML>\n";
}
%packet.setHeader("Date",formatTimeString("DD, dd MM yy hh:nn:ss ") @ "Eastern");
%packet.setHeader("Server","Tribes 2");
%packet.setHeader("Content-Type","text/html");
%packet.setPayload(%data);
%socket.sendPacket(%packet);
%packet.delete();
%this.connectionDropped(%socket);
}
if (isObject(%packet))
%packet.delete();
return true;
}
// Packet Functions (used for packet generation/reading)
function HTTPResponsePacket::setHeader(%this, %name, %value)
{
if (%this.headerCount == "")
%this.headerCount = 0;
if (%this.headers[%name] $= "")
{
%this.headerName[%this.headerCount] = %name;
%this.headerCount++;
}
%this.headers[%name] = %name @ ": " @ %value @ "\n";
return true;
}
function HTTPResponsePacket::setStatusCode(%this, %code)
{
%this.statusCode = "HTTP/1.1 " @ %code SPC "OK\n";
return true;
}
function HTTPResponsePacket::setPayload(%this, %data)
{
%this.payLoad = %data;
%this.payloadSize = strLen(%data);
%this.setHeader("Content-Length", %this.payloadSize);
return true;
}
// Lib Functions
function generateString(%length, %alpha)
{
%len = strLen(%alpha);
%result = "";
for (%i = 0; %i < %length; %i++)
%result = %result @ getSubStr(%alpha, getRandom(0, %len), 1);
return %result;
}
// --
// BoL Specific Code -- automatically load the server if enabled
if (!IsObject(HTTPServerPrefs))
new ScriptObject(HTTPServerPrefs) { class = "BasicDataParser"; };
HTTPServerPrefs.empty();
HTTPServerPrefs.load("prefs/WebServer.conf");
%generic = HTTPServerPrefs.get("Generic",0);
if(%generic.element("Enabled") $= "true")
{
new ScriptObject(WebServer) { class = "HTTPServer"; };
WebServer.listen(%generic.element("Host"),%generic.element("Port"),%generic.element("StartWorkers"));
}
// --

View file

@ -0,0 +1,49 @@
//------------------------------------------------------------------------------
// BoLFunctions.cs
// T2BoL Specific Functions
// Copyright (c) 2012 Robert MacGregor
//------------------------------------------------------------------------------
function GameConnection::saveState(%this)
{
if ($CurrentMissionType !$= "RPG")
{
error("Not running the BoL gamemode.");
return false;
}
return true;
}
function GameConnection::loadState(%this, %file)
{
if ($CurrentMissionType !$= "RPG")
{
error("Not running the BoL gamemode.");
return false;
}
return true;
}
function AIConnection::saveState(%this)
{
if ($CurrentMissionType !$= "RPG")
{
error("Not running the BoL gamemode.");
return false;
}
return true;
}
function AIConnection::loadState(%this, %file)
{
if ($CurrentMissionType !$= "RPG")
{
error("Not running the BoL gamemode.");
return false;
}
return true;
}

View file

@ -0,0 +1,31 @@
//------------------------------------------------------------------------------
// GameTriggers.cs
// Trigger code for RPG Gamemode
// Copyright (c) 2012 Robert MacGregor
//==============================================================================
$BOL::Triggers::Territory = 0;
$BOL::Triggers::Damage = 1;
$BOL::Triggers::TeleportStart = 2;
$PDA::Triggers::TeleportEnd = 3;
function RPGGame::onEnterTrigger(%game, %name, %data, %obj, %colObj)
{
switch (%obj.Type)
{
case $BOL::Triggers::Territory:
echo("LOL");
return;
}
}
function RPGGame::onLeaveTrigger(%game, %name, %data, %obj, %colObj)
{
return true;
}
function RPGGame::onTickTrigger(%game, %name, %data, %obj)
{
return true;
}

View file

@ -0,0 +1,63 @@
//--$BOL::PDA::Page::Interact----------------------------------------------------------------------------
// Interact.cs
// Functions for object interaction in T2BoL
// Copyright (c) 2012 Robert MacGregor
//------------------------------------------------------------------------------
$BOL::Interact::Type::General = 0; // Generic; jus makes conversation
$BOL::Interact::Range = 50; // In Meters
function serverCmdInteractWithObject(%client)
{
if (!IsObject(%client.player) || %client.player.getState() !$= "Move")
{
messageClient(%client, 'MsgClient', "\c3Sorry, you appear to be dead.");
return false;
}
%player = %client.player;
%pos = getWords(%player.getEyeTransform(), 0, 2);
%vec = %player.getMuzzleVector($WeaponSlot);
%targetpos=vectoradd(%pos,vectorscale(%vec,5000));
%object = getWord(containerRayCast(%pos,%targetpos,$TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType,%player),0);
echo(%object);
if (!isObject(%object) || !%object.isInteractive)
return false;
%client.pdaPage = $BOL::PDA::Page::Interacted;
serverCmdShowHud(%client, 'scoreScreen');
return true;
}
function Player::interactListUpdate(%this)
{
if (!isObject(%this.interactList))
%this.interactList = Array.create();
// We don't want to run multiple threads ...
cancel(%this.interactListUpdateThread);
// We also don't need dead people or bots to be doing this either
if ((%this.getState() !$= "Move" && %this.getState() !$= "Mounted") || %this.client.isAIControlled())
return;
%found = Array.create(); // This takes up one objID per call, but objID's go up to 2^32, so this shouldn't matter as it helps make cleaner code here
%found_anything = false;
InitContainerRadiusSearch(%this.getWorldBoxCenter(), $BOL::Interact::Range, $TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType);
while ((%target = containerSearchNext()) != 0)
{
//if (!calcExplosionCoverage(%this.getWorldBoxCenter(), %target,$TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType))
// continue;
%found.setElement(%found.count(), %target);
if(isObject(%target) && %target !$= %this && !%this.interactList.hasElementValue(%target))
%this.interactList.setElement(%this.interactList.count(), %target);
}
// Remove any non-found elements from the interact list
for (%i = %this.interactList.count(); %i > -1; %i--)
if (!%found.hasElementValue(%this.interactList.element(%i)))
%this.interactList.removeElement(%i);
%found.delete();
%this.interactListUpdateThread = %this.schedule(100, "interactListUpdate");
}

View file

@ -0,0 +1,268 @@
//------------------------------------------------------------------------------
// PDA.cs
// PDA code for T2BoL
// Copyright (c) 2012 Robert MacGregor
//==============================================================================
// 0-100
$BOL::PDA::Page::Main = 0;
$BOL::PDA::Page::Applications = 1;
$BOL::PDA::Page::Close = 2; // Not even necessarily a page but it's used to signal the client wants to close
$BOL::PDA::Page::Stats = 3;
$BOL::PDA::Page::Save = 4;
$BOL::PDA::Page::FactionManagement = 5;
$BOL::PDA::Page::Radio = 6;
$BOL::PDA::Page::Voice = 7;
$BOL::PDA::Function::Increment = 1;
$BOL::PDA::Function::Decrement = 2;
$BOL::PDA::Page::EMail = 8;
$BOL::PDA::Page::Inbox = 9;
$BOL::PDA::Page::Outbox = 10;
$BOL::PDA::Page::Compose = 11;
$BOL::PDA::Page::Wiki = 12;
// 101-201
$BOL::PDA::Page::Interact = 101;
$BOL::PDA::Page::Interacted = 102;
$BOL::PDA::Page::Hack = 103;
$BOL::PDA::Page::Information = 104;
function RPGGame::updateScoreHud(%game, %client, %tag)
{
if (%client.PDAPage == $BOL::PDA::Page::Main || %client.PDAPage == $BOL::PDA::Page::Interact)
Game.processGameLink(%client, %client.PDAPage);
}
function RPGGame::processGameLink(%game, %client, %arg1, %arg2, %arg3, %arg4, %arg5)
{
%index = 0;
if (%arg1 != $BOL::PDA::Page::Close)
%client.PDAPage = %arg1;
messageClient( %client, 'ClearHud', "", 'scoreScreen', 0 );
switch(%arg1)
{
//------------------------------------------------------------------------------
// PDA Applications
//------------------------------------------------------------------------------
case $BOL::PDA::Page::Applications:
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>Applications | Main');
messageClient( %client, 'SetScoreHudHeader', "", "<just:center>| <a:gamelink\t" @ $BOL::PDA::Page::Wiki @ "\t1>Wiki</a> | <color:FF0000>Applications<color:66EEEE> | <a:gamelink\t" @ $BOL::PDA::Page::EMail @ "\t0>E-Mail</a> | <just:right><a:gamelink\t" @ $BOL::PDA::Page::Close @ "\t1>Close</a>");
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Command List:");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Stats @ "\t1>- Self Diagnosis</a>");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Interact @ "\t0>- Interact with Object</a>");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Radio @ "\t0>- Radio</a>");
%index++;
if (!$Host::GlobalChat)
{
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Voice @ "\t0>- Voice Settings</a>");
%index++;
}
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::FactionManagement @ "\t1>- Faction Management</a>");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Save @ "\t1>- Save State</a>");
return;
case $BOL::PDA::Page::Stats:
messageClient( %client, 'SetScoreHudHeader', "", "<just:center>Automated Self Diagnosis Systems v1.2<just:right><a:gamelink\t" @ $BOL::PDA::Page::Close @ "\t1>Close</a>");
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>Copyright (c) 3030 S.G.S. Corporation');
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Subject Name: " @ %client.namebase);
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Subject Species: " @ %client.race);
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Subject Condition: " @ 100 - mfloor(100*%client.player.getDamageLevel()) @ "%");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, " ");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Stats @ "\t1>REFRESH</a>");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Applications@ "\t1>RETURN TO MAIN</a>");
return;
case $BOL::PDA::Page::Radio:
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>Applications | Radio');
if (!%client.hasRadio)
{
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>-- You do not have a radio to manage --");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, " ");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Applications@ "\t1>RETURN TO MAIN</a>");
return;
}
switch (%arg2)
{
case $BOL::PDA::Function::Increment:
ServerCmdIncreaseRadioFrequency(%client, true);
case $BOL::PDA::Function::Decrement:
ServerCmdDecreaseRadioFrequency(%client, true);
}
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Radio Status: Normal");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Current Frequency: " @ %client.radioFrequency @ "MHz");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Radio @ "\t" @ $BOL::PDA::Function::Increment @ ">[Increment Frequency</a> - <a:gamelink\t" @ $BOL::PDA::Page::Radio @ "\t" @ $BOL::PDA::Function::Decrement @ ">Decrement Frequency]</a>");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, " ");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Applications@ "\t1>RETURN TO MAIN</a>");
return;
case $BOL::PDA::Page::Voice:
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>Applications | Voice Settings');
switch (%arg2)
{
case $BOL::PDA::Function::Increment:
serverCmdIncreaseVoiceRange(%client, true);
case $BOL::PDA::Function::Decrement:
serverCmdDecreaseVoiceRange(%client, true);
}
%voice = %client.voiceMode;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Voice Status: Normal");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Current Voice: \x22" @ $BOL::Voice::Display[%voice] @ "\x22 (" @ $BOL::Voice::Range[%voice] @ " meters)");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Voice @ "\t" @ $BOL::PDA::Function::Increment @ ">[Increment Range</a> - <a:gamelink\t" @ $BOL::PDA::Page::Voice @ "\t" @ $BOL::PDA::Function::Decrement @ ">Decrement Range]</a>");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, " ");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Applications@ "\t1>RETURN TO MAIN</a>");
return;
case $BOL::PDA::Page::Interact:
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>Applications | Interact with Object');
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>-- Objects within Range --");
%index++;
%client_team = getTargetSensorGroup(%client.target);
%object_count = %client.player.interactList.count();
if (%object_count > 0)
for (%i = 0; %i < %object_count; %i++)
{
%object = %client.player.interactList.element(%i);
if (isObject(%object))
{
%object_target = %object.target;
if (%object_target != -1)
{
%object_team = getTargetSensorGroup(%object_target);
%object_friendly = %client_team == %object_team;
%object_friend_text = %object_friendly ? "Friendly" : "Enemy";
%display = %object_friend_text SPC %object.getClassName() SPC "\x22" @ getTaggedString(getTargetName(%object_target)) @ "\x22";
}
else
%display = "Unknown" SPC %object.getClassName() SPC "(" @ %object @ ")";
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>" @ %display);
%index++;
}
}
else
{
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>There are no objects in range.");
%index++;
}
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, " ");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Applications@ "\t1>RETURN TO MAIN</a>");
return;
case $BOL::PDA::Page::FactionManagement:
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>Applications | Faction Management');
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Applications@ "\t1>RETURN TO MAIN</a>");
return;
case $BOL::PDA::Page::Save:
messageClient( %client, 'SetScoreHudHeader', "", '<just:center>Save State<just:right><a:gamelink\tCLOSE\t1>Close</a>');
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Save function is not supported as of now!");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Applications @ "\t1>RETURN TO MAIN</a>");
return;
//------------------------------------------------------------------------------
// PDA E-Mail System
//------------------------------------------------------------------------------
case $BOL::PDA::Page::Inbox:
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>E-Mail | Your Inbox');
return;
case $BOL::PDA::Page::Outbox:
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>E-Mail | Your Outbox');
return;
case $BOL::PDA::Page::Compose:
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>E-Mail | Compose a New Mail');
return;
//------------------------------------------------------------------------------
// Interaction Commands
//------------------------------------------------------------------------------
case $BOL::PDA::Page::Interact:
return;
//------------------------------------------------------------------------------
// Handle for Normal PDA functions
//------------------------------------------------------------------------------
case $BOL::PDA::Page::Main:
messageClient( %client, 'SetScoreHudHeader', "", "<just:center>| <a:gamelink\t" @ $BOL::PDA::Page::Wiki @ "\t1>Wiki</a> | <a:gamelink\t" @ $BOL::PDA::Page::Applications @ "\t1>Applications</a> | <a:gamelink\t" @ $BOL::PDA::Page::EMail @ "\t1>E-Mail</a> | <just:right><a:gamelink\t" @ $BOL::PDA::Page::Close @ "\t1>Close</a>");
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>Welcome to the PDA');
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Welcome to the PDA, this is where you will accomplish some daily tasks.");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Click any of the text in the subheader to begin exploring your PDA.");
return;
case $BOL::PDA::Page::EMail:
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>E-Mail | Main');
messageClient( %client, 'SetScoreHudHeader', "", "<just:center>| <a:gamelink\t" @ $BOL::PDA::Page::Wiki @ "\t1>Wiki</a> | <a:gamelink\t" @ $BOL::PDA::Page::Applications @ "\t1>Applications</a> | <color:FF0000>E-Mail<color:66EEEE> | <just:right><a:gamelink\t" @ $BOL::PDA::Page::Close @ "\t1>Close</a>");
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>E-Mail Functions:");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center> - <a:gamelink\t" @ $BOL::PDA::Page::Inbox @ "\t1>Your Inbox (?)</a>");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center> - <a:gamelink\t" @ $BOL::PDA::Page::Outbox @ "\t1>Your Outbox (?)</a>");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center> - <a:gamelink\t" @ $BOL::PDA::Page::Compose @ "\t1>Compose a New Mail</a>");
return;
case $BOL::PDA::Page::Close:
serverCmdHideHud(%client, 'scoreScreen');
commandToClient(%client, 'DisplayHuds');
return;
case $BOL::PDA::Page::Wiki:
messageClient( %client, 'SetScoreHudHeader', "", "<just:center>| <color:FF0000>Wiki<color:66EEEE> | <a:gamelink\t" @ $BOL::PDA::Page::Applications @ "\t1>Applications</a> | <a:gamelink\t" @ $BOL::PDA::Page::EMail @ "\t1>E-Mail</a> | <just:right><a:gamelink\t" @ $BOL::PDA::Page::Close @ "\t1>Close</a>");
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>Wiki | Main');
return;
default: // In case something stupid happens
messageClient( %client, 'SetScoreHudHeader', "", "<just:center>| Information | <a:gamelink\t" @ $BOL::PDA::Page::Applications @ "\t1>Applications</a> | <a:gamelink\t" @ $BOL::PDA::Page::EMail @ "\t1>E-Mail</a> | <a:gamelink\t" @ $BOL::PDA::Page::Wiki @ "\t1>Wiki</a> | <just:right><a:gamelink\t" @ $BOL::PDA::Page::Close @ "\t1>Close</a>");
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>Error | Main');
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>-- An ERROR has occurred in the PDA Subsystem code --");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>-- Please report this error to DarkDragonDX --");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Unknown PDA page: " @ %arg1);
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, " ");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Main @ "\t1>-- RETURN TO MAIN --</a>");
return;
}
}

View file

@ -1,32 +1,32 @@
//------------------------------------------------------------------------------
// PDAApplication.cs
// Application SDK for the PDA. (to make my life easier)
// Copyright (c) 2012 The DarkDragonDX
//==============================================================================
function PDAApplication::main(%this, %client)
{
}
function PDAApplication::action(%this, %client, %page)
{
}
function PDAApplication::exit(%this, %client, %page)
{
}
// API Functions
function PDAApplication::setTitle(%this, %title)
{
// Won't do anything for now because the title is a clientside thing, actually.
}
function PDAApplication::cls(%this)
{
}
// The script parses <URL=
function PDAApplication::setLine(%this, %lineNo, %columnStart, %data)
{
//------------------------------------------------------------------------------
// PDAApplication.cs
// Application SDK for the PDA. (to make my life easier)
// Copyright (c) 2012 Robert MacGregor
//==============================================================================
function PDAApplication::main(%this, %client)
{
}
function PDAApplication::action(%this, %client, %page)
{
}
function PDAApplication::exit(%this, %client, %page)
{
}
// API Functions
function PDAApplication::setTitle(%this, %title)
{
// Won't do anything for now because the title is a clientside thing, actually.
}
function PDAApplication::cls(%this)
{
}
// The script parses <URL=
function PDAApplication::setLine(%this, %lineNo, %columnStart, %data)
{
}

View file

@ -0,0 +1 @@
//------------------------------------------------------------------------------ // radioChat.cs // Functions for radio voice in T2BoL // Copyright (c) 2012 Robert MacGregor //------------------------------------------------------------------------------ $BOL::Radio::Max = 10; $BOL::Radio::Min = 1; $BOL::Radio::Units = "MHz"; function ServerCmdIncreaseRadioFrequency(%client, %noDisplay) { if (!%client.hasRadio) { messageClient(%client, 'msgClient', "\c3You have no radio to tune."); return; } else if ($CurrentMissionType !$= "RPG") { messageClient(%client, 'msgClient', "\c3Server is not running the RPG gamemode currently."); return; } if (%client.radioFrequency == 0) %client.radioFrequency = 1; if (%client.radioFrequency >= $BOL::Radio::Max) %client.radioFrequency = $BOL::Radio::Min; else %client.radioFrequency++; if (!%noDisplay) messageClient(%client, 'msgClient',"\c3You tune your radio to " @ %client.radioFrequency @ $BOL::Radio::Units @ "."); } function ServerCmdDecreaseRadioFrequency(%client, %noDisplay) { if (!%client.hasRadio) { messageClient(%client, 'msgClient', "\c3You have no radio to tune."); return; } if (%client.radioFrequency == 0) %client.radioFrequency = 1; if (%client.radioFrequency <= $BOL::Radio::Min) %client.radioFrequency = $BOL::Radio::Max; else %client.radioFrequency--; if (!%noDisplay) messageClient(%client, 'msgClient',"\c3You tune your radio to " @ %client.radioFrequency @ $BOL::Radio::Units @ "."); } function radioBroadcast( %text, %frequency ) { %units = $BOL::Radio::Units; %count = ClientGroup.getCount(); for ( %i = 0; %i < %count; %i++ ) { %client = ClientGroup.getObject( %i ); if ( %client.hasRadio && %client.radioFrequency == %frequency ) messageClient(%client,'msgClient',"\c3(" @ %frequency @ %units @ "): " @ %text @ "~wfx/misc/static.wav"); } } function radioChatMessageTeam( %sender, %team, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 ) { if (!%sender.hasRadio) { messageClient(%sender,'msgNoRadio',"\c3You must have a radio."); return; } %frequency = %sender.radioFrequency; if (%frequency < $BOL::Radio::Min || %frequency > $BOL::Radio::Max) { %sender.radioFrequency = $BOL::Radio::Min; messageClient(%sender,'msgClient',"\c3Your radio appears to be in dire need of retuning."); return; } %units = $BOL::Radio::Units; %count = ClientGroup.getCount(); for ( %i = 0; %i < %count; %i++ ) { %client = ClientGroup.getObject(%i); if ( %client.hasRadio && %client.radioFrequency == %sender.radioFrequency ) messageClient(%client,'msgClient',"\c3"@ %sender.namebase@ " (" @ %frequency @ %units @ "): "@%a2@" ~wfx/misc/static.wav"); } }

View file

@ -0,0 +1,98 @@
//------------------------------------------------------------------------------
// rangedVoice.cs
// Functions for ranged voice in T2BoL
// Copyright (c) 2012 Robert MacGregor
//------------------------------------------------------------------------------
$BOL::Voice::Whisper = 0;
$BOL::Voice::Range[0] = 15;
$BOL::Voice::Display[0] = "Whispering";
$BOL::Voice::Speak = 1;
$BOL::voice::Range[1] = 25;
$BOL::Voice::Display[1] = "Speaking";
$BOL::Voice::Yell = 2;
$BOL::Voice::Range[2] = 50;
$BOL::Voice::Display[2] = "Yelling";
$BOL::Voice::Scream = 3;
$BOL::Voice::Range[3] = 100;
$BOL::Voice::Display[3] = "Screaming";
$BOL::Voice::Total = 4;
function serverCmdIncreaseVoiceRange(%client, %noDisplay)
{
if ($CurrentMissionType $= "RPG" && $Host::GlobalChat)
{
messageClient(%client, 'msgClient', "\c3Server has global chat enabled.");
return;
}
else if ($CurrentMissionType !$= "RPG")
{
messageClient(%client, 'msgClient', "\c3Server is not running the RPG gamemode currently.");
return;
}
if (%client.voiceMode >= $BOL::Voice::Total-1)
%client.voiceMode = 0;
else
%client.voiceMode++;
%display = $BOL::Voice::Display[%client.voiceMode];
%range = $BOL::Voice::Range[%client.voiceMode];
if (!%noDisplay)
messageClient(%client, 'msgClient',"\c3Voice mode set to \"" @ %display @ "\" (" @ %range @ "m)");
}
function serverCmdDecreaseVoiceRange(%client, %noDisplay)
{
if ($CurrentMissionType $= "RPG" && $Host::GlobalChat)
{
messageClient(%client, 'msgClient', "\c3Server has global chat enabled.");
return;
}
else if ($CurrentMissionType !$= "RPG")
{
messageClient(%client, 'msgClient', "\c3Server is not running the RPG gamemode currently.");
return;
}
if (%client.voiceMode <= 0)
%client.voiceMode = $BOL::Voice::Total-1;
else
%client.voiceMode--;
%display = $BOL::Voice::Display[%client.voiceMode];
%range = $BOL::Voice::Range[%client.voiceMode];
if (!%noDisplay)
messageClient(%client, 'msgClient',"\c3Voice mode set to \"" @ %display @ "\" (" @ %range @ "m)");
}
function rangedchatMessageAll(%sender, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
{
%mode = %sender.voiceMode;
if (%mode < 0 || %mode >= $BOL::Voice::Total)
{
%sender.voiceMode = 0;
%mode = 0;
messageClient(%sender,'msgClient',"\c3Your throat feels agitated.");
}
%voicedist = $BOL::Voice::Range[%sender.voiceMode];
%display = $BOL::Voice::Display[%sender.voiceMode];
%count = MissionCleanup.getCount();
for (%i = 0; %i < %count; %i++)
{
%obj = MissionCleanup.getObject(%i);
if (%obj.getClassName() $= "Player")
{
%dist = vectorDist(%sender.player.getPosition(),%obj.getPosition());
if (%dist <= %voicedist)
{
%string = addTaggedString("(" @ %display @ " - " @ %voicedist @ "m) " @ getTaggedString(%a1));
chatMessageClient( %obj.client, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %string, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
}
}
}
}

View file

@ -0,0 +1,302 @@
//------------------------------------------------------------------------------
// scripts/modScripts/server/dataImport.cs
// Copyright (c) 2012 Robert MacGregor
//------------------------------------------------------------------------------
function gameConnection::writeSaveFile(%this)
{
//Compile Main Variable List
%mission = $CurrentMission;
%player = %this.player;
%transform = %player.getTransform();
%velocity = %player.getVelocity();
%damage = %player.getDamageLevel();
%race = %this.race;
%armor = %this.armor;
%energy = %player.getEnergyLevel();
%whiteout = %player.getWhiteout();
%damageFlash = %player.getDamageFlash();
%cash = %this.cash;
%hasRadio = %this.hasRadio;
%underStandsHuman = %this.underStandsHuman;
%underStandsBioderm = %this.underStandsBioderm;
%underStandsDraakan = %this.underStandsDraakan;
%underStandsCriollos = %this.underStandsCriollos;
%time = formatTimeString("hh:nn A");
%date = formatTimeString("mm/dd/yy");
%file = "data/game/saves/" @ %mission @ "/" @ %this.guid @ ".txt";
%fileObj = new fileObject();
%fileObj.openForWrite(%file);
%fileObj.writeLine(";Saved by" SPC %this.nameBase SPC "on" SPC %date SPC "at" SPC %time);
%fileObj.writeLine("");
//Todo: Make this writing method more efficient ...
%fileObj.writeLine("[Character]");
%fileObj.writeLine("transform = \x22" @ %transform @ "\x22;");
%fileObj.writeLine("velocity = \x22" @ %velocity @ "\x22;");
%fileObj.writeLine("damage = \x22" @ %damage @ "\x22;");
%fileObj.writeLine("race = \x22" @ %race @ "\x22;");
%fileObj.writeLine("armor = \x22" @ %armor @ "\x22;");
%fileObj.writeLine("energy = \x22" @ %energy @ "\x22;");
%fileObj.writeLine("whiteOut = \x22" @ %whiteout @ "\x22;");
%fileObj.writeLine("damageFlash = \x22" @ %damageFlash @ "\x22;");
%fileObj.writeLine("cash = \x22" @ %cash @ "\x22;");
%fileObj.writeLine("hasRadio = \x22" @ %hasRadio @ "\x22;");
%fileObj.writeLine("underStandsHuman = \x22" @ %underStandsHuman @ "\x22;");
%fileObj.writeLine("underStandsBioderm = \x22" @ %underStandsBioderm @ "\x22;");
%fileObj.writeLine("underStandsDraakan = \x22" @ %underStandsDraakan @ "\x22;");
%fileObj.writeLine("underStandsCriollos = \x22" @ %underStandsCriollos @ "\x22;");
%fileObj.writeLine("");
//Compile Inventory List
%slotCount = %player.weaponSlotCount;
%healthKits = %player.invRepairKit;
%fileObj.writeLine("[Inventory]");
%fileObj.writeLine("slotCount = \x22" @ %slotCount @ "\x22;");
for (%i = 0; %i < %slotCount; %i++)
{
%weaponName = %player.weaponSlot[%i];
%weaponAmmo = eval("%weaponAmmo = %player.inv" @ %weaponName @ "Ammo" @ ";");
%fileObj.writeLine("slot" @ %i SPC "= \x22" @ %weaponName @ "\x22;");
%fileObj.writeLine("slot" @ %i @ "Ammo" SPC "= \x22" @ %weaponAmmo @ "\x22;");
}
%fileObj.writeLine("healthKits = \x22" @ %healthKits @ "\x22;");
%fileObj.detach();
logEcho(" -- Save File Written for Player:" SPC %this.namebase SPC "--");
return true;
}
function gameConnection::applySaveFile(%this)
{
//Compile Main Variable List
%mission = $CurrentMission;
%file = "data/game/saves/" @ %mission @ "/" @ %this.guid @ ".txt";
if (!isFile(%file))
return false;
%transform = getBlockData(%file,"Character",1,"transform");
%velocity = getBlockData(%file,"Character",1,"velocity");
%damage = getBlockData(%file,"Character",1,"damage");
%race = getBlockData(%file,"Character",1,"race");
%armor = getBlockData(%file,"Character",1,"armor");
%energy = getBlockData(%file,"Character",1,"energyLevel");
%whiteout = getBlockData(%file,"Character",1,"whiteOut");
%damageFlash = getBlockData(%file,"Character",1,"damageFlash");
%cash = getBlockData(%file,"Character",1,"cash");
%hasRadio = getBlockData(%file,"Character",1,"hasRadio");
%underStandsHuman = getBlockData(%file,"Character",1,"underStandsHuman");
%underStandsBioderm = getBlockData(%file,"Character",1,"underStandsBioderm");
%underStandsDraakan = getBlockData(%file,"Character",1,"underStandsDraakan");
%underStandsCriollos = getBlockData(%file,"Character",1,"underStandsCriollos");
%player = %this.player;
%player.setTransform(%transform);
%player.setVelocity(%velocity);
%player.applyDamage(%damage);
%player.setArmor(%armor);
%player.setEnergyLevel(%energy);
%player.setWhiteout(%whiteOut);
%player.setDamageFlash(%damageFlash);
%this.cash = %cash;
%this.underStandsHuman = %underStandsHuman;
%this.underStandsBioderm = %underStandsBioderm;
%this.underStandsDraakan = %underStandsDraakan;
%this.underStandsCriollos = %underStandsCriollos;
return true;
for (%i = 0; %i < %slotCount; %i++)
{
%weaponName = %player.weaponSlot[%i];
%weaponAmmo = eval("%weaponAmmo = %player.inv" @ %weaponName @ "Ammo" @ ";");
%fileObj.writeLine("slot" @ %i SPC "= \x22" @ %weaponName @ "\x22;");
%fileObj.writeLine("slot" @ %i @ "Ammo" SPC "= \x22" @ %weaponAmmo @ "\x22;");
}
%fileObj.writeLine("healthKits = \x22" @ %healthKits @ "\x22;");
return;
}
// Generic Import Functions
function importGameData()
{
importGems();
importOres();
importCharacters();
return true;
}
// Gem Import Functions
function importGems()
{
if (!IsObject(GemData))
{
new ScriptObject(GemData);
if (!IsObject(GameData))
new simGroup(GameData);
GameData.add(GemData);
}
else
return true;
%file = "data/game/gems.txt";
%count = getBlockCount(%file,"Gem") + 1;
for (%i = 1; %i < %count; %i++)
{
%name = getBlockData(%file,"Gem",%i,"Name");
%price = getBlockData(%file,"Gem",%i,"Price");
%sellPrice = getBlockData(%file,"Gem",%i,"SellPrice");
GemData.gem[%i] = %name;
GemData.price[%name] = %price;
GemData.sellPrice[%name] = %sellPrice;
warn("Imported gem:" SPC %name);
GemData.gemCount = %count--;
}
// Ore Import Functions
function importOres()
{
if (!IsObject(OreData))
{
new ScriptObject(OreData);
if (!IsObject(GameData))
new simGroup(GameData);
GameData.add(OreData);
}
else
return true;
%file = "data/game/ores.txt";
%count = getBlockCount(%file,"Ore") + 1;
for (%i = 1; %i < %count; %i++)
{
%name = getBlockData(%file,"Ore",%i,"Name");
%price = getBlockData(%file,"Ore",%i,"Price");
%sellPrice = getBlockData(%file,"Ore",%i,"SellPrice");
OreData.ore[%i] = %name;
OreData.price[%name] = %price;
OreData.sellPrice[%name] = %sellPrice;
warn("Imported ore:" SPC %name);
}
OreData.oreCount = %count--;
}
// Character Import Functions
function spawnCharacter(%name,%trans,%aimPos,%team)
{
%object = "Character" @ %name;
if (!IsObject(%object))
return false;
%Bname = %object.name;
%race = %object.race;
%skin = %object.skin;
%voice = %object.voice;
%voicePitch = %object.voicePitch;
%sex = %object.sex;
%bot = aiConnectByName(%Bname,%team);
%bot.race = %race;
%bot.skin = addTaggedString(%skin);
%bot.voice = %voice;
%bot.voiceTag = addTaggedString(%voice);
%bot.voicePitch = %voicePitch;
%bot.sex = %sex;
setVoice(%bot,%voice, %voicePitch);
setSkin(%bot,%skin);
setSkin(%bot,%skin);
setTeam(%bot, %team);
%bot.player.setArmor("light");
%bot.player.setTransform(%trans);
%bot.aimAt(%aimPos);
warn("Spawned Character:" SPC %name);
}
function importCharacters()
{
%path = "data/game/characters/*.txt";
for( %file = findFirstFile( %path ); %file !$= ""; %file = findNextFile( %path ) )
{
%name = getFileNameFromString(%file);
%pos = strStr(%name,".");
%character = getSubStr(%name,0,%pos);
importCharacter(%character);
}
}
function importCharacter(%character)
{
%prefix = "data/game/characters/";
%file = %prefix @ %character @ ".txt";
%charName = %character;
%character = strReplace("Character" @ %character," ","_");
if (!IsFile(%file))
return false;
if (!IsObject(%character))
{
new scriptObject(%character);
if (!IsObject(GameData))
new simGroup(GameData);
GameData.add(%character);
}
else
return true;
//Get our variable values ...
%name = getBlockData(%file,"Character",1,"Name");
%race = getBlockData(%file,"Character",1,"Race");
%sex = getBlockData(%file,"Character",1,"Sex");
%skin = getBlockData(%file,"Character",1,"Skin");
%voice = getBlockData(%file,"Character",1,"Voice");
%voicePitch = getBlockData(%file,"Character",1,"VoicePitch");
//Import Message Arrays ... and assign them
%arrayName[0] = "Death";
%arrayName[1] = "Kill";
%arrayName[2] = "Healed";
%arrayCount = 3;
for (%i = 0; %i < %arrayCount; %i++)
{
%arrayVariableName[%i] = %arrayName[%i] @ "MessageArray";
for (%j = 0; %j < 100; %j++)
{
%arrayTest = getArrayData(%file,%arrayName[%i],%j);
if (%arrayTest !$= "}")
{
if (%j == 0)
%arrayData[%i] = %arrayData[%i] @ %arrayTest;
else
%arrayData[%i] = %arrayData[%i] @ "\t" @ %arrayTest;
}
else
break;
}
eval(%character @ "." @ %arrayVariableName[%i] SPC "= \x22" @ %arrayData[%i] @ "\x22;");
}
//Assign the variables now ...
%character.name = %name;
%character.race = %race;
%character.sex = %sex;
%character.skin = %skin;
%character.voice = %voice;
%character.voicePitch = %voicePitch;
warn("Imported Character:" SPC %charname);
}

View file

@ -0,0 +1 @@
//------------------------------------------------------------------------------ // initialise.cs // Code executed by scripts/RPGGame.cs to load up any BoL specific components. // Copyright (c) 2012 Robert MacGregor //============================================================================== exec("scripts/ModScripts/Server/RPG/ClientFunctions.cs"); exec("scripts/ModScripts/Server/RPG/GameTriggers.cs"); exec("scripts/ModScripts/Server/RPG/PDA.cs"); exec("scripts/ModScripts/Server/RPG/RangedVoice.cs"); exec("scripts/ModScripts/Server/RPG/RadioChat.cs"); exec("scripts/ModScripts/Server/RPG/Interact.cs");

View file

@ -1,106 +1,106 @@
//Component: Lootage
//Description: You can loot corpses. (w00t)
//----------------------------------------------------------------------------
// DATABLOCKS
//----------------------------------------------------------------------------
datablock ItemData(Lootbag)
{
className = Weapon;
catagory = "Misc";
shapeFile = "moneybag.dts";
mass = 1;
elasticity = 0.2;
friction = 50;
pickupRadius = 2;
pickUpPrefix = "a bag of items";
alwaysAmbient = true;
description = "lootbag_model";
computeCRC = false;
emap = true;
};
//----------------------------------------------------------------------------
// BOUND FUNCTIONS
//----------------------------------------------------------------------------
//Realized this isn't required..
//function LootBag::onAdd(%this,%obj) //Force a loot check on creation.
//{
//LootBagCheckForPickUp(%obj);
//parent::onAdd(%this,%obj);
//}
//----------------------------------------------------------------------------
// FUNCTIONS
//----------------------------------------------------------------------------
function LootBagCheckForPickUp(%this) //Not sure why, loot bags won't do a T2 system pickup..
{
cancel(%this.loop);
if (!IsObject(%this))
return;
%count = MissionCleanUp.getCount();
for(%i = 0; %i < %count; %i++)
{
%test = MissionCleanUp.getObject(%i);
if (%test.getClassName() $= "Player" && %test.getState() !$= "dead" && !%test.client.isAIControlled())
{
%dist = vectorDist(%this.getPosition(),%test.getPosition());
if (%dist < %this.getDatablock().pickUpRadius)
{
LootBagPickedUp(%this,%test.client);
return;
}
%this.loop = schedule(100,0,"LootBagCheckForPickup",%this);
}
}
}
function LootBagPickedUp(%this,%client)
{
%db = %client.player.getDatablock(); //The player's datablock
%money = %this.money; //Monies?
%numItems = %this.numItems; //Giving out items.
%numAmmo = %this.numAmmo; //..Ammo too!
//Does the bag have money?
if (%money $= "")
%hasMoney = false;
else
%hasMoney = true;
if (%money !$= "")
%client.money = %client.money + %money; //Give some monies.
for (%i = 0; %i < %numItems; %i++)
{
if (%db.max[%this.item[%i]] != 0) //Don't want people in light armor running around with mortars, do we?
{
%client.player.setInventory(%this.item[%i],1);
%client.player.setInventory(%this.ammo[%i],%this.ammoNum[%i]);
}
}
%this.delete(); //Delete the bag.
//Let the player know.
switch (%hasMoney)
{
case 0:
if (%numItems > 1)
messageClient(%client,'MsgClient','You picked up a bag of items that contained %1 items.',%numitems);
else
messageClient(%client,'MsgClient','You picked up a bag of items that contained 1 item.');
case 1:
if (%numItems > 1)
messageClient(%client,'MsgClient','You picked up a bag of items that contained $%1 and %2 items.',%money,%numitems);
else
messageClient(%client,'MsgClient','You picked up a bag of items that contained $%1 and 1 item.',%money);
}
}
//Component: Lootage
//Description: You can loot corpses. (w00t)
//----------------------------------------------------------------------------
// DATABLOCKS
//----------------------------------------------------------------------------
datablock ItemData(Lootbag)
{
className = Weapon;
catagory = "Misc";
shapeFile = "moneybag.dts";
mass = 1;
elasticity = 0.2;
friction = 50;
pickupRadius = 2;
pickUpPrefix = "a bag of items";
alwaysAmbient = true;
description = "lootbag_model";
computeCRC = false;
emap = true;
};
//----------------------------------------------------------------------------
// BOUND FUNCTIONS
//----------------------------------------------------------------------------
//Realized this isn't required..
//function LootBag::onAdd(%this,%obj) //Force a loot check on creation.
//{
//LootBagCheckForPickUp(%obj);
//parent::onAdd(%this,%obj);
//}
//----------------------------------------------------------------------------
// FUNCTIONS
//----------------------------------------------------------------------------
function LootBagCheckForPickUp(%this) //Not sure why, loot bags won't do a T2 system pickup..
{
cancel(%this.loop);
if (!IsObject(%this))
return;
%count = MissionCleanUp.getCount();
for(%i = 0; %i < %count; %i++)
{
%test = MissionCleanUp.getObject(%i);
if (%test.getClassName() $= "Player" && %test.getState() !$= "dead" && !%test.client.isAIControlled())
{
%dist = vectorDist(%this.getPosition(),%test.getPosition());
if (%dist < %this.getDatablock().pickUpRadius)
{
LootBagPickedUp(%this,%test.client);
return;
}
%this.loop = schedule(100,0,"LootBagCheckForPickup",%this);
}
}
}
function LootBagPickedUp(%this,%client)
{
%db = %client.player.getDatablock(); //The player's datablock
%money = %this.money; //Monies?
%numItems = %this.numItems; //Giving out items.
%numAmmo = %this.numAmmo; //..Ammo too!
//Does the bag have money?
if (%money $= "")
%hasMoney = false;
else
%hasMoney = true;
if (%money !$= "")
%client.money = %client.money + %money; //Give some monies.
for (%i = 0; %i < %numItems; %i++)
{
if (%db.max[%this.item[%i]] != 0) //Don't want people in light armor running around with mortars, do we?
{
%client.player.setInventory(%this.item[%i],1);
%client.player.setInventory(%this.ammo[%i],%this.ammoNum[%i]);
}
}
%this.delete(); //Delete the bag.
//Let the player know.
switch (%hasMoney)
{
case 0:
if (%numItems > 1)
messageClient(%client,'MsgClient','You picked up a bag of items that contained %1 items.',%numitems);
else
messageClient(%client,'MsgClient','You picked up a bag of items that contained 1 item.');
case 1:
if (%numItems > 1)
messageClient(%client,'MsgClient','You picked up a bag of items that contained $%1 and %2 items.',%money,%numitems);
else
messageClient(%client,'MsgClient','You picked up a bag of items that contained $%1 and 1 item.',%money);
}
}

View file

@ -1,38 +1,39 @@
// -----------------------------------------------------
// Datablocks
// Note: You can't actually target interiors with beams,
// so make an interior and put this box around it.
// -----------------------------------------------------
datablock StaticShapeData(MiningBox) : StaticShapeDamageProfile {
className = "MineBox";
shapeFile = "Pmiscf.dts";
maxDamage = 5000;
destroyedLevel = 0;
disabledLevel = 0;
isShielded = false;
energyPerDamagePoint = 240;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Mining Detection Box';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
needsPower = false;
};
// -----------------------------------------------------
// Code
// Note: Weapon code is in weapons/miningTool.cs
// -----------------------------------------------------
function MiningBox::onAdd(%this, %obj)
{
%obj.startFade(1,0,1);
%obj.applyDamage(%obj.getDataBlock().maxDamage); //Start the rock off
}
// -----------------------------------------------------
// Datablocks
// Note: You can't actually target interiors with beams,
// so make an interior and put this box around it.
// Copyright (c) 2012 Robert MacGregor
// -----------------------------------------------------
datablock StaticShapeData(MiningBox) : StaticShapeDamageProfile {
className = "MineBox";
shapeFile = "Pmiscf.dts";
maxDamage = 5000;
destroyedLevel = 0;
disabledLevel = 0;
isShielded = false;
energyPerDamagePoint = 240;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Mining Detection Box';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
needsPower = false;
};
// -----------------------------------------------------
// Code
// Note: Weapon code is in weapons/miningTool.cs
// -----------------------------------------------------
function MiningBox::onAdd(%this, %obj)
{
%obj.startFade(1,0,1);
%obj.applyDamage(%obj.getDataBlock().maxDamage); //Start the rock off
}

View file

@ -1,49 +1,50 @@
//------------------------------------------------------------------------------
// scripts/modScripts/server/serverNetworking.cs
//------------------------------------------------------------------------------
if (!IsObject(ServerNetwork))
new TCPObject(ServerNetwork);
function ServerNetwork::onConnect(%this)
{
}
function ServerNetwork::onConnectFailed(%this)
{
if (%this.testingServer)
{
error("Error: Unable to verify connection to server "@%this.testIP@" at port "@%this.testPort@"!");
%this.testIP = "";
%this.testPort = "";
%this.testingServer = false;
}
}
function ServerNetwork::onDisconnect(%this)
{
}
function ServerNetwork::onDisconnectFailed(%this)
{
}
function ServerNetwork::listen(%this)
{
}
function ServerNetwork::send(%this)
{
}
function ServerNetwork::onLine(%this, %line)
{
}
function ServerNetwork::testServerIP(%this, %IP, %port)
{
%this.testingServer = true;
%this.testIP = %ip;
%this.testPort = %port;
%this.connect(%ip @ ":" @ %port);
}
//------------------------------------------------------------------------------
// scripts/modScripts/server/serverNetworking.cs
// Copyright (c) 2012 Robert MacGregor
//------------------------------------------------------------------------------
if (!IsObject(ServerNetwork))
new TCPObject(ServerNetwork);
function ServerNetwork::onConnect(%this)
{
}
function ServerNetwork::onConnectFailed(%this)
{
if (%this.testingServer)
{
error("Error: Unable to verify connection to server "@%this.testIP@" at port "@%this.testPort@"!");
%this.testIP = "";
%this.testPort = "";
%this.testingServer = false;
}
}
function ServerNetwork::onDisconnect(%this)
{
}
function ServerNetwork::onDisconnectFailed(%this)
{
}
function ServerNetwork::listen(%this)
{
}
function ServerNetwork::send(%this)
{
}
function ServerNetwork::onLine(%this, %line)
{
}
function ServerNetwork::testServerIP(%this, %IP, %port)
{
%this.testingServer = true;
%this.testIP = %ip;
%this.testPort = %port;
%this.connect(%ip @ ":" @ %port);
}

View file

@ -1,175 +1,182 @@
//------------------------------------------------------------------------------
// TCPServer.cs
// Needed this type of thing for communication between servers in the game,
// so after some googling -- this is what I put out.
// forum.blockland.us/index.php?topic=105360
// Copyright (c) 2012 The DarkDragonDX
//------------------------------------------------------------------------------
// Replicate Code for Servers
$TCPServer::ServerReplicate = "function *UNIQUESOCKET*::onConnectRequest(%this, %address, %socket)" @
"{" @
"%this.Parent.connectionCreated(%address, %socket); " @
"return true;" @
"}";
// Replicate Code for Clients
$TCPServer::ClientReplicate = "function *UNIQUESOCKET*::onLine(%this, %line)" @
"{" @
"%this.Parent.onLine(%this, %line);" @
"return true;" @
"}" @
"function *UNIQUESOCKET*::onDisconnect(%this) { %this.Parent.connectionDropped(%this); return true; }";
function TCPServer::listen(%this, %address, %port, %maxClients)
{
%uniqueNameLength = 6; // Adjust this if need be, but there should never be a reason to
%this.allowMultiConnect = false; // If false, when a client connects twice, its old connection is killed and replaced with a new one.
if (%this.isListening)
return false;
if (%maxClients < 1 || %maxClients == 0)
%maxClients = 8;
%oldAddr = $Host::BindAddress;
%address = strlwr(%address);
if (%address $= "local" || %address $="localhost" ) %address = "127.0.0.1";
else if (%address $= "any") %address = "0.0.0.0";
%charList = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// Generate A name for a TCPObject (and make sure it's unique)
%uniqueStringLen = 6; // Adjust this if needed, but there shouldn't be a reason to
%uniqueString = "";
while (true)
{
%uniqueString = generateString(%uniqueNameLength, %charList);
if (!isObject(%uniqueString)) break;
else %uniqueString = "";
}
%evalCode = $TCPServer::ServerReplicate;
%evalCode = strReplace(%evalCode, "*UNIQUESOCKET*", %uniqueString);
eval(%evalCode);
// Generate a list of unique names that this TCPServer will use (to keep down function def count)
for (%i = 0; %i < %maxClients; %i++)
while (true)
{
%uniqueName = generateString(%uniqueNameLength, %charList);
if (!isObject(%uniqueName))
{
%eval = strReplace($TCPServer::ClientReplicate, "*UNIQUESOCKET*", %uniqueName);
eval(%eval);
%this.uniqueName[%i] = %uniqueName;
%this.uniqueNameInUse[%uniqueName] = false;
break;
}
}
// Create the Socket and we'll rock n' roll
$Host::BindAddress = %address;
%this.Server = new TCPObject(%uniqueString);
%this.Server.listen(%port);
%this.Server.Parent = %this;
%this.connectionCount = 0;
%this.maximumClients = %maxClients;
$Host::BindAddress = %oldAddr;
%this.isListening = true;
logEcho("Server " @ %uniqueString SPC "is ready on " @ %address @ ":" @ %port);
return true;
}
function TCPServer::disconnect(%this)
{
}
function TCPServer::connectionDropped(%this, %socket)
{
if (!%this.allowMultiConnect)
%this.connections[%socket.Address] = "";
else
%this.connections[%socket.Address, %socket.Port] = "";
%this.connectionCount--;
%this.onClientDisconnect(%socket);
}
function TCPServer::connectionCreated(%this, %address, %socket)
{
%isReplicate = false;
// Get the Port No. and Address respectively
%address = strReplace(%address, "IP:","");
%portPos = strStr(%address, ":");
%port = getSubStr(%address, %portPos+1, strLen(%address));
%address = getSubStr(%address, 0, %portPos);
if (!%this.allowMultiConnect && %this.connections[%address] != 0)
{
%this.connections[%address].disconnect();
%this.connections[%address].delete();
%isReplicate = true;
}
if (%this.connectionCount >= %this.maximumClients)
{
// Create the connection so we can disconnect it *lol*
%connection = new TCPObject(%uniqueName,%socket) { class = ConnectionTCP; parent = %this; Address = %address; Port = %port; };
%this.onClientRejected(%connection, 0);
logEcho("Unable to accept connection from " @ %address SPC " -- already at maximum client count! (" @ %this.maximumClients @ ")");
%connection.disconnect();
%connection.delete();
return false;
}
// Pick a unique name
%uniqueName = "";
for (%i = 0; %i < %this.maximumClients; %i++)
{
%name = %this.uniqueName[%i];
if (!%this.uniqueNameInUse[%name])
{
%uniqueName = %name;
%this.uniqueNameInUse[%name] = true;
break;
}
}
// Create The Client Socket
%connection = new TCPObject(%uniqueName,%socket) { class = ConnectionTCP; parent = %this; Address = %address; Port = %port; };
if (!%this.allowMultiConnect)
%this.connections[%address] = %connection;
else
%this.connections[%address, %port] = %connection;
%this.connectionCount++;
%this.onClientConnect(%address, %connection);
logEcho("Received client connection from " @ %address);
return true;
}
// Callbacks -- make these do whatever you please!
function TCPServer::onClientConnect(%this, %address, %socket)
{
echo("Received connection from " @ %address @ ". ID:" @ %socket);
return true;
}
function TCPServer::onClientRejected(%this, %socket, %reason) // %reason is always zero as of now.
{
return true;
}
function TCPServer::onClientDisconnect(%this, %socket)
{
error("Received Disconnect (" @ %socket @ ")");
return true;
}
function TCPServer::onLine(%this, %socket, %line)
{
echo(%socket SPC "says: " @ %line);
return true;
}
// Lib Functions
function generateString(%length, %alpha)
{
%len = strLen(%alpha);
%result = "";
for (%i = 0; %i < %length; %i++)
%result = %result @ getSubStr(%alpha, getRandom(0, %len), 1);
return %result;
//------------------------------------------------------------------------------
// TCPServer.cs
// Needed this type of thing for communication between servers in the game,
// so after some googling -- this is what I put out.
// forum.blockland.us/index.php?topic=105360
// Copyright (c) 2012 Robert MacGregor
//------------------------------------------------------------------------------
// Replicate Code for Servers
$TCPServer::ServerReplicate = "function *UNIQUESOCKET*::onConnectRequest(%this, %address, %socket)" @
"{" @
"%this.Parent.connectionCreated(%address, %socket); " @
"return true;" @
"}";
// Replicate Code for Clients
$TCPServer::ClientReplicate = "function *UNIQUESOCKET*::onLine(%this, %line)" @
"{" @
"%this.Parent.onLine(%this, %line);" @
"return true;" @
"}" @
"function *UNIQUESOCKET*::onDisconnect(%this) { %this.Parent.connectionDropped(%this); return true; }";
function TCPServer::listen(%this, %address, %port, %maxClients)
{
%uniqueNameLength = 6; // Adjust this if need be, but there should never be a reason to
%this.allowMultiConnect = false; // If false, when a client connects twice, its old connection is killed and replaced with a new one.
if (%this.isListening)
return false;
if (%maxClients < 1 || %maxClients == 0)
%maxClients = 8;
%oldAddr = $Host::BindAddress;
%address = strlwr(%address);
if (%address $= "local" || %address $="localhost" ) %address = "127.0.0.1";
else if (%address $= "any") %address = "0.0.0.0";
%charList = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// Generate A name for a TCPObject (and make sure it's unique)
%uniqueStringLen = 6; // Adjust this if needed, but there shouldn't be a reason to
%uniqueString = "";
while (true)
{
%uniqueString = generateString(%uniqueNameLength, %charList);
if (!isObject(%uniqueString)) break;
else %uniqueString = "";
}
%evalCode = $TCPServer::ServerReplicate;
%evalCode = strReplace(%evalCode, "*UNIQUESOCKET*", %uniqueString);
eval(%evalCode);
// Generate a list of unique names that this TCPServer will use (to keep down function def count)
for (%i = 0; %i < %maxClients; %i++)
while (true)
{
%uniqueName = generateString(%uniqueNameLength, %charList);
if (!isObject(%uniqueName))
{
%eval = strReplace($TCPServer::ClientReplicate, "*UNIQUESOCKET*", %uniqueName);
eval(%eval);
%this.uniqueName[%i] = %uniqueName;
%this.uniqueNameInUse[%uniqueName] = false;
break;
}
}
// Create the Socket and we'll rock n' roll
$Host::BindAddress = %address;
%this.Server = new TCPObject(%uniqueString);
%this.Server.listen(%port);
%this.Server.Parent = %this;
%this.connectionCount = 0;
%this.maximumClients = %maxClients;
$Host::BindAddress = %oldAddr;
%this.isListening = true;
logEcho("Server " @ %uniqueString SPC "is ready on " @ %address @ ":" @ %port);
return true;
}
function TCPServer::disconnect(%this)
{
}
function TCPServer::connectionDropped(%this, %socket)
{
if (!%this.allowMultiConnect)
%this.connections[%socket.Address] = "";
else
%this.connections[%socket.Address, %socket.Port] = "";
%this.connectionCount--;
%this.onClientDisconnect(%socket);
}
function TCPServer::connectionCreated(%this, %address, %socket)
{
%isReplicate = false;
// Get the Port No. and Address respectively
%address = strReplace(%address, "IP:","");
%portPos = strStr(%address, ":");
%port = getSubStr(%address, %portPos+1, strLen(%address));
%address = getSubStr(%address, 0, %portPos);
if (!%this.allowMultiConnect && %this.connections[%address] != 0)
{
%this.connections[%address].disconnect();
%this.connections[%address].delete();
%isReplicate = true;
}
if (%this.connectionCount >= %this.maximumClients)
{
// Create the connection so we can disconnect it *lol*
%connection = new TCPObject(%uniqueName,%socket) { class = ConnectionTCP; parent = %this; Address = %address; Port = %port; };
%this.onClientRejected(%connection, 0);
logEcho("Unable to accept connection from " @ %address SPC " -- already at maximum client count! (" @ %this.maximumClients @ ")");
%connection.disconnect();
%connection.delete();
return false;
}
// Pick a unique name
%uniqueName = "";
for (%i = 0; %i < %this.maximumClients; %i++)
{
%name = %this.uniqueName[%i];
if (!%this.uniqueNameInUse[%name])
{
%uniqueName = %name;
%this.uniqueNameInUse[%name] = true;
break;
}
}
// Create The Client Socket
%connection = new TCPObject(%uniqueName,%socket) { class = ConnectionTCP; parent = %this; Address = %address; Port = %port; };
if (!%this.allowMultiConnect)
%this.connections[%address] = %connection;
else
%this.connections[%address, %port] = %connection;
%this.connectionCount++;
%this.onClientConnect(%address, %connection);
logEcho("Received client connection from " @ %address);
return true;
}
// Callbacks -- make these do whatever you please!
function TCPServer::onClientConnect(%this, %address, %socket)
{
%this.client = %socket;
echo("Received connection from " @ %address @ ". ID:" @ %socket);
return true;
}
function TCPServer::onClientRejected(%this, %socket, %reason) // %reason is always zero as of now.
{
return true;
}
function TCPServer::onClientDisconnect(%this, %socket)
{
error("Received Disconnect (" @ %socket @ ")");
return true;
}
function TCPServer::onLine(%this, %socket, %line)
{
messageAll('msgClient',"Telnet: " @ %line);
echo(%socket SPC "says: " @ %line);
return true;
}
function TCPServer::message(%this, %message)
{
%this.client.send(%message @ "\n");
}
// Lib Functions
function generateString(%length, %alpha)
{
%len = strLen(%alpha);
%result = "";
for (%i = 0; %i < %length; %i++)
%result = %result @ getSubStr(%alpha, getRandom(0, %len), 1);
return %result;
}

View file

@ -1,405 +1,405 @@
//------------------------------------------------------------------------------
// Bioderm Death Effects v3.0
// Effects by: LuCiD
//==============================================================================
// see player.cs for functions.
//------------------------------------------------------------------------------
// Splash Mist
//==============================================================================
datablock ParticleData(BiodermPlayerSplashMist)
{
dragCoefficient = 2.0;
gravityCoefficient = -0.05;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 600;
lifetimeVarianceMS = 100;
useInvAlpha = false;
spinRandomMin = -90.0;
spinRandomMax = 500.0;
textureName = "particleTest";
colors[0] = "0.1 0.9 0.1 0.5";
colors[1] = "0.2 0.09 0.05 0.5";
colors[2] = "0.0 0.4 0.0 0.0";
sizes[0] = 0.5;
sizes[1] = 0.5;
sizes[2] = 0.8;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(BiodermPlayerSplashMistEmitter)
{
ejectionPeriodMS = 6;
periodVarianceMS = 0;
ejectionVelocity = 3.0;
velocityVariance = 2.0;
ejectionOffset = 0.0;
thetaMin = 85;
thetaMax = 85;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
lifetimeMS = 450;
particles = "BiodermPlayerSplashMist";
};
//------------------------------------------------------------------------------
// Bioderm Green Pool
//==============================================================================
datablock ShockwaveData(GreenBloodHit)
{
width = 3.0;
numSegments = 164;
numVertSegments = 35;
velocity = -1.5;
acceleration = 2.0;
lifetimeMS = 800;
height = 0.1;
verticalCurve = 0.5;
mapToTerrain = false;
renderBottom = true;
orientToNormal = true;
texture[0] = "special/shockwave4";
texture[1] = "special/droplet";//"special/gradient";
texWrap = 8.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
colors[0] = "0.1 0.9 0.1 0.5";
colors[1] = "0.5 0.06 0.05 0.5";
colors[2] = "0.0 0.4 0.0 0.0";
};
//------------------------------------------------------------------------------
// Bioderm Blood
//==============================================================================
datablock ParticleData(BiodermBloodParticle)
{
dragCoeffiecient = 0.0;
gravityCoefficient = 120.0; // drops quickly
inheritedVelFactor = 0;
lifetimeMS = 1600; // lasts 2 second
lifetimeVarianceMS = 000; // ...more or less
textureName = "snowflake8x8";//"particletest";
useInvAlpha = true;
spinRandomMin = -30.0;
spinRandomMax = 30.0;
colors[0] = "0.1 0.9 0.1 0.5";
colors[1] = "0.2 0.06 0.05 0.5";
colors[2] = "0.0 0.4 0.0 0.0";
sizes[0] = 0.2;
sizes[1] = 0.05;
sizes[2] = 0.06;
times[0] = 0.0;
times[1] = 0.2;
times[2] = 1.0;
};
datablock ParticleEmitterData(BiodermBloodEmitter)
{
ejectionPeriodMS = 15;
periodVarianceMS = 5;
ejectionVelocity = 1.25;
velocityVariance = 0.50;
thetaMin = 0.0;
thetaMax = 90.0;
particles = "BiodermBloodParticle";
};
//------------------------------------------------------------------------------
// Bioderm Droplets Particle
//==============================================================================
datablock ParticleData( BiodermDropletsParticle )
{
dragCoefficient = 1;
gravityCoefficient = 0.5;
inheritedVelFactor = 0.5;
constantAcceleration = 0.1;
lifetimeMS = 300;
lifetimeVarianceMS = 100;
textureName = "special/droplet";
colors[0] = "0.1 0.9 0.1 1.0";
colors[1] = "0.2 0.06 0.05 1.0";
colors[2] = "0.0 0.4 0.0 0.0";
sizes[0] = 0.8;
sizes[1] = 0.3;
sizes[2] = 0.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData( BiodermDropletsEmitter )
{
ejectionPeriodMS = 7;
periodVarianceMS = 0;
ejectionVelocity = 2;
velocityVariance = 1.0;
ejectionOffset = 0.0;
thetaMin = 60;
thetaMax = 80;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
orientParticles = true;
particles = "BiodermDropletsParticle";
};
//------------------------------------------------------------------------------
// Bioderm Explosion
//==============================================================================
datablock ExplosionData(BiodermExplosion)
{
soundProfile = BloodSplashSound;
particleEmitter = BiodermBloodEmitter;
particleDensity = 250;
particleRadius = 1.25;
faceViewer = true;
emitter[0] = BiodermPlayerSplashMistEmitter;
emitter[1] = BiodermDropletsEmitter;
shockwave = GreenBloodHit;
};
datablock GrenadeProjectileData(BiodermBlood)
{
projectileShapeName = "turret_muzzlepoint.dts"; //Really small and hard to see
emitterDelay = -1;
directDamage = 0.15;
hasDamageRadius = false;
indirectDamage = 0.0;
damageRadius = 0.15;
radiusDamageType = $DamageType::ArmorDeath;
kickBackStrength = 0;
bubbleEmitTime = 1.0;
//sound = BloodSplashSound;
explosion = BiodermExplosion;
//explodeOnMaxBounce = true;
velInheritFactor = 0.5;
baseEmitter[0] = BiodermBloodEmitter;
grenadeElasticity = 0.4;
grenadeFriction = 0.2;
armingDelayMS = 100; // was 400
muzzleVelocity = 0;
drag = 0.1;
};
//------------------------------------------------------------------------------
// Purple Bioderm blood
//==============================================================================
//------------------------------------------------------------------------------
// Purple Splash Mist
//==============================================================================
datablock ParticleData(PurpleBiodermPlayerSplashMist)
{
dragCoefficient = 2.0;
gravityCoefficient = -0.05;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 600;
lifetimeVarianceMS = 100;
useInvAlpha = false;
spinRandomMin = -90.0;
spinRandomMax = 500.0;
textureName = "particleTest";
colors[0] = "0.25 0.12 0.40 0.5";
colors[1] = "0.25 0.12 0.40 0.5";
colors[2] = "0.4 0.0 0.5 0.0";
sizes[0] = 0.5;
sizes[1] = 0.5;
sizes[2] = 0.8;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(PurpleBiodermPlayerSplashMistEmitter)
{
ejectionPeriodMS = 6;
periodVarianceMS = 0;
ejectionVelocity = 3.0;
velocityVariance = 2.0;
ejectionOffset = 0.0;
thetaMin = 85;
thetaMax = 85;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
lifetimeMS = 450;
particles = "PurpleBiodermPlayerSplashMist";
};
//------------------------------------------------------------------------------
// Bioderm Purple Pool
//==============================================================================
datablock ShockwaveData(PurpleBloodHit)
{
width = 3.0;
numSegments = 164;
numVertSegments = 35;
velocity = -1.5;
acceleration = 2.0;
lifetimeMS = 800;
height = 0.1;
verticalCurve = 0.5;
mapToTerrain = false;
renderBottom = true;
orientToNormal = true;
texture[0] = "special/shockwave4";
texture[1] = "special/droplet";//"special/gradient";
texWrap = 8.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
colors[0] = "0.25 0.12 0.40 0.5";
colors[1] = "0.25 0.12 0.40 0.5";
colors[2] = "0.4 0.0 0.5 0.0";
};
//------------------------------------------------------------------------------
// Purple Bioderm Blood
//==============================================================================
datablock ParticleData(PurpleBiodermBloodParticle)
{
dragCoeffiecient = 0.0;
gravityCoefficient = 120.0; // drops quickly
inheritedVelFactor = 0;
lifetimeMS = 1550; // lasts 2 second
lifetimeVarianceMS = 300; // ...more or less
textureName = "snowflake8x8";//"particletest";
useInvAlpha = true;
spinRandomMin = -30.0;
spinRandomMax = 30.0;
colors[0] = "0.25 0.12 0.40 0.5";
colors[1] = "0.25 0.12 0.40 0.5";
colors[2] = "0.4 0.0 0.5 0.0";
sizes[0] = 0.2;
sizes[1] = 0.05;
sizes[2] = 0.05;
times[0] = 0.0;
times[1] = 0.2;
times[2] = 1.0;
};
datablock ParticleEmitterData(PurpleBiodermBloodEmitter)
{
ejectionPeriodMS = 15;
periodVarianceMS = 5;
ejectionVelocity = 1.25;
velocityVariance = 0.50;
thetaMin = 0.0;
thetaMax = 90.0;
particles = "PurpleBiodermBloodParticle";
};
//------------------------------------------------------------------------------
// purple Bioderm Droplets Particle
//==============================================================================
datablock ParticleData( PurpleBiodermDropletsParticle )
{
dragCoefficient = 1;
gravityCoefficient = 0.5;
inheritedVelFactor = 0.5;
constantAcceleration = -0.0;
lifetimeMS = 300;
lifetimeVarianceMS = 100;
textureName = "special/droplet";
colors[0] = "0.25 0.12 0.40 0.5";
colors[1] = "0.25 0.12 0.40 0.5";
colors[2] = "0.4 0.0 0.5 0.0";
sizes[0] = 0.8;
sizes[1] = 0.3;
sizes[2] = 0.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData( PurpleBiodermDropletsEmitter )
{
ejectionPeriodMS = 7;
periodVarianceMS = 0;
ejectionVelocity = 2;
velocityVariance = 1.0;
ejectionOffset = 0.0;
thetaMin = 60;
thetaMax = 80;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
orientParticles = true;
particles = "PurpleBiodermDropletsParticle";
};
//------------------------------------------------------------------------------
// Purple Bioderm Explosion
//==============================================================================
datablock ExplosionData(PurpleBiodermExplosion)
{
soundProfile = BloodSplashSound;
particleEmitter = PurpleBiodermBloodEmitter;
particleDensity = 250;
particleRadius = 1.25;
faceViewer = true;
emitter[0] = PurpleBiodermPlayerSplashMistEmitter;
emitter[1] = PurpleBiodermDropletsEmitter;
shockwave = PurpleBloodHit;
};
datablock GrenadeProjectileData(PurpleBiodermBlood)
{
projectileShapeName = "turret_muzzlepoint.dts"; //Really small and hard to see
emitterDelay = -1;
directDamage = 0.0;
hasDamageRadius = false;
indirectDamage = 0.0;
damageRadius = 0.0;
radiusDamageType = $DamageType::Default;
kickBackStrength = 0;
bubbleEmitTime = 1.0;
//sound = BloodSplashSound;
explosion = PurpleBiodermExplosion;
//explodeOnMaxBounce = true;
velInheritFactor = 0.5;
baseEmitter[0] = PurpleBiodermBloodEmitter;
grenadeElasticity = 0.4;
grenadeFriction = 0.2;
armingDelayMS = 100; // was 400
muzzleVelocity = 0;
drag = 0.1;
};
//------------------------------------------------------------------------------
// Bioderm Death Effects v3.0
// Effects by: LuCiD
//==============================================================================
// see player.cs for functions.
//------------------------------------------------------------------------------
// Splash Mist
//==============================================================================
datablock ParticleData(BiodermPlayerSplashMist)
{
dragCoefficient = 2.0;
gravityCoefficient = -0.05;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 600;
lifetimeVarianceMS = 100;
useInvAlpha = false;
spinRandomMin = -90.0;
spinRandomMax = 500.0;
textureName = "particleTest";
colors[0] = "0.1 0.9 0.1 0.5";
colors[1] = "0.2 0.09 0.05 0.5";
colors[2] = "0.0 0.4 0.0 0.0";
sizes[0] = 0.5;
sizes[1] = 0.5;
sizes[2] = 0.8;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(BiodermPlayerSplashMistEmitter)
{
ejectionPeriodMS = 6;
periodVarianceMS = 0;
ejectionVelocity = 3.0;
velocityVariance = 2.0;
ejectionOffset = 0.0;
thetaMin = 85;
thetaMax = 85;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
lifetimeMS = 450;
particles = "BiodermPlayerSplashMist";
};
//------------------------------------------------------------------------------
// Bioderm Green Pool
//==============================================================================
datablock ShockwaveData(GreenBloodHit)
{
width = 3.0;
numSegments = 164;
numVertSegments = 35;
velocity = -1.5;
acceleration = 2.0;
lifetimeMS = 800;
height = 0.1;
verticalCurve = 0.5;
mapToTerrain = false;
renderBottom = true;
orientToNormal = true;
texture[0] = "special/shockwave4";
texture[1] = "special/droplet";//"special/gradient";
texWrap = 8.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
colors[0] = "0.1 0.9 0.1 0.5";
colors[1] = "0.5 0.06 0.05 0.5";
colors[2] = "0.0 0.4 0.0 0.0";
};
//------------------------------------------------------------------------------
// Bioderm Blood
//==============================================================================
datablock ParticleData(BiodermBloodParticle)
{
dragCoeffiecient = 0.0;
gravityCoefficient = 120.0; // drops quickly
inheritedVelFactor = 0;
lifetimeMS = 1600; // lasts 2 second
lifetimeVarianceMS = 000; // ...more or less
textureName = "snowflake8x8";//"particletest";
useInvAlpha = true;
spinRandomMin = -30.0;
spinRandomMax = 30.0;
colors[0] = "0.1 0.9 0.1 0.5";
colors[1] = "0.2 0.06 0.05 0.5";
colors[2] = "0.0 0.4 0.0 0.0";
sizes[0] = 0.2;
sizes[1] = 0.05;
sizes[2] = 0.06;
times[0] = 0.0;
times[1] = 0.2;
times[2] = 1.0;
};
datablock ParticleEmitterData(BiodermBloodEmitter)
{
ejectionPeriodMS = 15;
periodVarianceMS = 5;
ejectionVelocity = 1.25;
velocityVariance = 0.50;
thetaMin = 0.0;
thetaMax = 90.0;
particles = "BiodermBloodParticle";
};
//------------------------------------------------------------------------------
// Bioderm Droplets Particle
//==============================================================================
datablock ParticleData( BiodermDropletsParticle )
{
dragCoefficient = 1;
gravityCoefficient = 0.5;
inheritedVelFactor = 0.5;
constantAcceleration = 0.1;
lifetimeMS = 300;
lifetimeVarianceMS = 100;
textureName = "special/droplet";
colors[0] = "0.1 0.9 0.1 1.0";
colors[1] = "0.2 0.06 0.05 1.0";
colors[2] = "0.0 0.4 0.0 0.0";
sizes[0] = 0.8;
sizes[1] = 0.3;
sizes[2] = 0.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData( BiodermDropletsEmitter )
{
ejectionPeriodMS = 7;
periodVarianceMS = 0;
ejectionVelocity = 2;
velocityVariance = 1.0;
ejectionOffset = 0.0;
thetaMin = 60;
thetaMax = 80;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
orientParticles = true;
particles = "BiodermDropletsParticle";
};
//------------------------------------------------------------------------------
// Bioderm Explosion
//==============================================================================
datablock ExplosionData(BiodermExplosion)
{
soundProfile = BloodSplashSound;
particleEmitter = BiodermBloodEmitter;
particleDensity = 250;
particleRadius = 1.25;
faceViewer = true;
emitter[0] = BiodermPlayerSplashMistEmitter;
emitter[1] = BiodermDropletsEmitter;
shockwave = GreenBloodHit;
};
datablock GrenadeProjectileData(BiodermBlood)
{
projectileShapeName = "turret_muzzlepoint.dts"; //Really small and hard to see
emitterDelay = -1;
directDamage = 0.15;
hasDamageRadius = false;
indirectDamage = 0.0;
damageRadius = 0.15;
radiusDamageType = $DamageType::ArmorDeath;
kickBackStrength = 0;
bubbleEmitTime = 1.0;
//sound = BloodSplashSound;
explosion = BiodermExplosion;
//explodeOnMaxBounce = true;
velInheritFactor = 0.5;
baseEmitter[0] = BiodermBloodEmitter;
grenadeElasticity = 0.4;
grenadeFriction = 0.2;
armingDelayMS = 100; // was 400
muzzleVelocity = 0;
drag = 0.1;
};
//------------------------------------------------------------------------------
// Purple Bioderm blood
//==============================================================================
//------------------------------------------------------------------------------
// Purple Splash Mist
//==============================================================================
datablock ParticleData(PurpleBiodermPlayerSplashMist)
{
dragCoefficient = 2.0;
gravityCoefficient = -0.05;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 600;
lifetimeVarianceMS = 100;
useInvAlpha = false;
spinRandomMin = -90.0;
spinRandomMax = 500.0;
textureName = "particleTest";
colors[0] = "0.25 0.12 0.40 0.5";
colors[1] = "0.25 0.12 0.40 0.5";
colors[2] = "0.4 0.0 0.5 0.0";
sizes[0] = 0.5;
sizes[1] = 0.5;
sizes[2] = 0.8;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(PurpleBiodermPlayerSplashMistEmitter)
{
ejectionPeriodMS = 6;
periodVarianceMS = 0;
ejectionVelocity = 3.0;
velocityVariance = 2.0;
ejectionOffset = 0.0;
thetaMin = 85;
thetaMax = 85;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
lifetimeMS = 450;
particles = "PurpleBiodermPlayerSplashMist";
};
//------------------------------------------------------------------------------
// Bioderm Purple Pool
//==============================================================================
datablock ShockwaveData(PurpleBloodHit)
{
width = 3.0;
numSegments = 164;
numVertSegments = 35;
velocity = -1.5;
acceleration = 2.0;
lifetimeMS = 800;
height = 0.1;
verticalCurve = 0.5;
mapToTerrain = false;
renderBottom = true;
orientToNormal = true;
texture[0] = "special/shockwave4";
texture[1] = "special/droplet";//"special/gradient";
texWrap = 8.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
colors[0] = "0.25 0.12 0.40 0.5";
colors[1] = "0.25 0.12 0.40 0.5";
colors[2] = "0.4 0.0 0.5 0.0";
};
//------------------------------------------------------------------------------
// Purple Bioderm Blood
//==============================================================================
datablock ParticleData(PurpleBiodermBloodParticle)
{
dragCoeffiecient = 0.0;
gravityCoefficient = 120.0; // drops quickly
inheritedVelFactor = 0;
lifetimeMS = 1550; // lasts 2 second
lifetimeVarianceMS = 300; // ...more or less
textureName = "snowflake8x8";//"particletest";
useInvAlpha = true;
spinRandomMin = -30.0;
spinRandomMax = 30.0;
colors[0] = "0.25 0.12 0.40 0.5";
colors[1] = "0.25 0.12 0.40 0.5";
colors[2] = "0.4 0.0 0.5 0.0";
sizes[0] = 0.2;
sizes[1] = 0.05;
sizes[2] = 0.05;
times[0] = 0.0;
times[1] = 0.2;
times[2] = 1.0;
};
datablock ParticleEmitterData(PurpleBiodermBloodEmitter)
{
ejectionPeriodMS = 15;
periodVarianceMS = 5;
ejectionVelocity = 1.25;
velocityVariance = 0.50;
thetaMin = 0.0;
thetaMax = 90.0;
particles = "PurpleBiodermBloodParticle";
};
//------------------------------------------------------------------------------
// purple Bioderm Droplets Particle
//==============================================================================
datablock ParticleData( PurpleBiodermDropletsParticle )
{
dragCoefficient = 1;
gravityCoefficient = 0.5;
inheritedVelFactor = 0.5;
constantAcceleration = -0.0;
lifetimeMS = 300;
lifetimeVarianceMS = 100;
textureName = "special/droplet";
colors[0] = "0.25 0.12 0.40 0.5";
colors[1] = "0.25 0.12 0.40 0.5";
colors[2] = "0.4 0.0 0.5 0.0";
sizes[0] = 0.8;
sizes[1] = 0.3;
sizes[2] = 0.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData( PurpleBiodermDropletsEmitter )
{
ejectionPeriodMS = 7;
periodVarianceMS = 0;
ejectionVelocity = 2;
velocityVariance = 1.0;
ejectionOffset = 0.0;
thetaMin = 60;
thetaMax = 80;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
orientParticles = true;
particles = "PurpleBiodermDropletsParticle";
};
//------------------------------------------------------------------------------
// Purple Bioderm Explosion
//==============================================================================
datablock ExplosionData(PurpleBiodermExplosion)
{
soundProfile = BloodSplashSound;
particleEmitter = PurpleBiodermBloodEmitter;
particleDensity = 250;
particleRadius = 1.25;
faceViewer = true;
emitter[0] = PurpleBiodermPlayerSplashMistEmitter;
emitter[1] = PurpleBiodermDropletsEmitter;
shockwave = PurpleBloodHit;
};
datablock GrenadeProjectileData(PurpleBiodermBlood)
{
projectileShapeName = "turret_muzzlepoint.dts"; //Really small and hard to see
emitterDelay = -1;
directDamage = 0.0;
hasDamageRadius = false;
indirectDamage = 0.0;
damageRadius = 0.0;
radiusDamageType = $DamageType::Default;
kickBackStrength = 0;
bubbleEmitTime = 1.0;
//sound = BloodSplashSound;
explosion = PurpleBiodermExplosion;
//explodeOnMaxBounce = true;
velInheritFactor = 0.5;
baseEmitter[0] = PurpleBiodermBloodEmitter;
grenadeElasticity = 0.4;
grenadeFriction = 0.2;
armingDelayMS = 100; // was 400
muzzleVelocity = 0;
drag = 0.1;
};

View file

@ -1,213 +1,213 @@
//------------------------------------------------------------------------------
// Human Death Effects v3.0
// Effects By: LuCiD
//==============================================================================
// see player.cs for functions.
datablock AudioProfile(BloodSplashSound)
{
filename = "fx/armor/light_LF_water.wav";
description = AudioClosest3d;
preload = true;
};
//------------------------------------------------------------------------------
// Splash Mist
//==============================================================================
datablock ParticleData(HumanRedPlayerSplashMist)
{
dragCoefficient = 2.0;
gravityCoefficient = -0.05;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 600;
lifetimeVarianceMS = 100;
useInvAlpha = false;
spinRandomMin = -90.0;
spinRandomMax = 500.0;
textureName = "particleTest";
colors[0] = "0.9 0.1 0.1 0.5";
colors[1] = "0.6 0.05 0.05 0.5";
colors[2] = "0.4 0.0 0.0 0.0";
sizes[0] = 0.5;
sizes[1] = 0.5;
sizes[2] = 0.8;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(HumanRedPlayerSplashMistEmitter)
{
ejectionPeriodMS = 6;
periodVarianceMS = 1;
ejectionVelocity = 4.0;
velocityVariance = 2.0;
ejectionOffset = 0.0;
thetaMin = 85;
thetaMax = 85;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
lifetimeMS = 450;
particles = "HumanRedPlayerSplashMist";
};
//------------------------------------------------------------------------------
// Human Red Pool
//==============================================================================
datablock ShockwaveData(RedBloodHit)
{
width = 3.0;
numSegments = 164;
numVertSegments = 35;
velocity = -1.5;
acceleration = 2.0;
lifetimeMS = 800;
height = 0.1;
verticalCurve = 0.5;
mapToTerrain = false;
renderBottom = true;
orientToNormal = true;
texture[0] = "special/shockwave4";
texture[1] = "special/droplet";//"special/gradient";
texWrap = 8.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
colors[0] = "0.9 0.1 0.1 0.5";
colors[1] = "0.6 0.05 0.05 0.5";
colors[2] = "0.4 0.0 0.0 0.0";
};
//------------------------------------------------------------------------------
// Human Red Blood
//==============================================================================
datablock ParticleData(HumanRedBloodParticle)
{
dragCoeffiecient = 0.0;
gravityCoefficient = 120.0;
inheritedVelFactor = 0.0;
lifetimeMS = 1600;
lifetimeVarianceMS = 000;
textureName = "snowflake8x8";//"particletest";
useInvAlpha = true;
spinRandomMin = -30.0;
spinRandomMax = 30.0;
colors[0] = "0.9 0.1 0.1 0.5";
colors[1] = "0.6 0.05 0.05 0.5";
colors[2] = "0.4 0.0 0.0 0.0";
sizes[0] = 0.2;
sizes[1] = 0.05;
sizes[2] = 0.06;
times[0] = 0.0;
times[1] = 0.2;
times[2] = 1.0;
};
datablock ParticleEmitterData(HumanRedBloodEmitter)
{
ejectionPeriodMS = 15;
periodVarianceMS = 5;
ejectionVelocity = 1.25;
velocityVariance = 0.50;
thetaMin = 0.0;
thetaMax = 90.0;
particles = "HumanRedBloodParticle";
};
//------------------------------------------------------------------------------
// Human Red Droplets Particle
//==============================================================================
datablock ParticleData( HumanRedDropletsParticle )
{
dragCoefficient = 1;
gravityCoefficient = 0.5;
inheritedVelFactor = 0.5;
constantAcceleration = 0.1;
lifetimeMS = 300;
lifetimeVarianceMS = 100;
textureName = "special/droplet";
colors[0] = "0.9 0.1 0.1 1.0";
colors[1] = "0.6 0.05 0.05 1.0";
colors[2] = "0.4 0.0 0.0 0.0";
sizes[0] = 0.8;
sizes[1] = 0.3;
sizes[2] = 0.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData( HumanRedDropletsEmitter )
{
ejectionPeriodMS = 7;
periodVarianceMS = 0;
ejectionVelocity = 2;
velocityVariance = 1.0;
ejectionOffset = 0.0;
thetaMin = 60;
thetaMax = 80;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
orientParticles = true;
particles = "HumanRedDropletsParticle";
};
//------------------------------------------------------------------------------
// Human Red Explosion
//==============================================================================
datablock ExplosionData(HumanRedExplosion)
{
soundProfile = BloodSplashSound;
particleEmitter = HumanRedBloodEmitter;
particleDensity = 250;
particleRadius = 1.25;
faceViewer = true;
emitter[0] = HumanRedPlayerSplashMistEmitter;
emitter[1] = HumanRedDropletsEmitter;
shockwave = RedBloodHit;
};
datablock GrenadeProjectileData(HumanBlood)
{
projectileShapeName = "turret_muzzlepoint.dts"; //Really small and hard to see
emitterDelay = -1;
directDamage = 0.0;
hasDamageRadius = false;
indirectDamage = 0.0;
damageRadius = 0.0;
radiusDamageType = $DamageType::Default;
kickBackStrength = 0;
bubbleEmitTime = 1.0;
//sound = BloodSplashSound;
explosion = HumanRedExplosion;
//explodeOnMaxBounce = true;
velInheritFactor = 0.5;
baseEmitter[0] = HumanRedBloodEmitter;
grenadeElasticity = 0.4;
grenadeFriction = 0.2;
armingDelayMS = 100; // was 400
muzzleVelocity = 0;
drag = 0.1;
};
//------------------------------------------------------------------------------
// Human Death Effects v3.0
// Effects By: LuCiD
//==============================================================================
// see player.cs for functions.
datablock AudioProfile(BloodSplashSound)
{
filename = "fx/armor/light_LF_water.wav";
description = AudioClosest3d;
preload = true;
};
//------------------------------------------------------------------------------
// Splash Mist
//==============================================================================
datablock ParticleData(HumanRedPlayerSplashMist)
{
dragCoefficient = 2.0;
gravityCoefficient = -0.05;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 600;
lifetimeVarianceMS = 100;
useInvAlpha = false;
spinRandomMin = -90.0;
spinRandomMax = 500.0;
textureName = "particleTest";
colors[0] = "0.9 0.1 0.1 0.5";
colors[1] = "0.6 0.05 0.05 0.5";
colors[2] = "0.4 0.0 0.0 0.0";
sizes[0] = 0.5;
sizes[1] = 0.5;
sizes[2] = 0.8;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(HumanRedPlayerSplashMistEmitter)
{
ejectionPeriodMS = 6;
periodVarianceMS = 1;
ejectionVelocity = 4.0;
velocityVariance = 2.0;
ejectionOffset = 0.0;
thetaMin = 85;
thetaMax = 85;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
lifetimeMS = 450;
particles = "HumanRedPlayerSplashMist";
};
//------------------------------------------------------------------------------
// Human Red Pool
//==============================================================================
datablock ShockwaveData(RedBloodHit)
{
width = 3.0;
numSegments = 164;
numVertSegments = 35;
velocity = -1.5;
acceleration = 2.0;
lifetimeMS = 800;
height = 0.1;
verticalCurve = 0.5;
mapToTerrain = false;
renderBottom = true;
orientToNormal = true;
texture[0] = "special/shockwave4";
texture[1] = "special/droplet";//"special/gradient";
texWrap = 8.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
colors[0] = "0.9 0.1 0.1 0.5";
colors[1] = "0.6 0.05 0.05 0.5";
colors[2] = "0.4 0.0 0.0 0.0";
};
//------------------------------------------------------------------------------
// Human Red Blood
//==============================================================================
datablock ParticleData(HumanRedBloodParticle)
{
dragCoeffiecient = 0.0;
gravityCoefficient = 120.0;
inheritedVelFactor = 0.0;
lifetimeMS = 1600;
lifetimeVarianceMS = 000;
textureName = "snowflake8x8";//"particletest";
useInvAlpha = true;
spinRandomMin = -30.0;
spinRandomMax = 30.0;
colors[0] = "0.9 0.1 0.1 0.5";
colors[1] = "0.6 0.05 0.05 0.5";
colors[2] = "0.4 0.0 0.0 0.0";
sizes[0] = 0.2;
sizes[1] = 0.05;
sizes[2] = 0.06;
times[0] = 0.0;
times[1] = 0.2;
times[2] = 1.0;
};
datablock ParticleEmitterData(HumanRedBloodEmitter)
{
ejectionPeriodMS = 15;
periodVarianceMS = 5;
ejectionVelocity = 1.25;
velocityVariance = 0.50;
thetaMin = 0.0;
thetaMax = 90.0;
particles = "HumanRedBloodParticle";
};
//------------------------------------------------------------------------------
// Human Red Droplets Particle
//==============================================================================
datablock ParticleData( HumanRedDropletsParticle )
{
dragCoefficient = 1;
gravityCoefficient = 0.5;
inheritedVelFactor = 0.5;
constantAcceleration = 0.1;
lifetimeMS = 300;
lifetimeVarianceMS = 100;
textureName = "special/droplet";
colors[0] = "0.9 0.1 0.1 1.0";
colors[1] = "0.6 0.05 0.05 1.0";
colors[2] = "0.4 0.0 0.0 0.0";
sizes[0] = 0.8;
sizes[1] = 0.3;
sizes[2] = 0.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData( HumanRedDropletsEmitter )
{
ejectionPeriodMS = 7;
periodVarianceMS = 0;
ejectionVelocity = 2;
velocityVariance = 1.0;
ejectionOffset = 0.0;
thetaMin = 60;
thetaMax = 80;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
orientParticles = true;
particles = "HumanRedDropletsParticle";
};
//------------------------------------------------------------------------------
// Human Red Explosion
//==============================================================================
datablock ExplosionData(HumanRedExplosion)
{
soundProfile = BloodSplashSound;
particleEmitter = HumanRedBloodEmitter;
particleDensity = 250;
particleRadius = 1.25;
faceViewer = true;
emitter[0] = HumanRedPlayerSplashMistEmitter;
emitter[1] = HumanRedDropletsEmitter;
shockwave = RedBloodHit;
};
datablock GrenadeProjectileData(HumanBlood)
{
projectileShapeName = "turret_muzzlepoint.dts"; //Really small and hard to see
emitterDelay = -1;
directDamage = 0.0;
hasDamageRadius = false;
indirectDamage = 0.0;
damageRadius = 0.0;
radiusDamageType = $DamageType::Default;
kickBackStrength = 0;
bubbleEmitTime = 1.0;
//sound = BloodSplashSound;
explosion = HumanRedExplosion;
//explodeOnMaxBounce = true;
velInheritFactor = 0.5;
baseEmitter[0] = HumanRedBloodEmitter;
grenadeElasticity = 0.4;
grenadeFriction = 0.2;
armingDelayMS = 100; // was 400
muzzleVelocity = 0;
drag = 0.1;
};

View file

@ -1,76 +1,44 @@
//Component: Destructable Props
//Description: Not much to describe.. stuff that blows up or can be broken.
//----------------------------------------------------------------------------
// DATABLOCKS
//----------------------------------------------------------------------------
//datablock StaticShapeData(DetructableSecurityCamera) : StaticShapeDamageProfile
//{
// className = "SecurityCamera";
// shapeFile = "SecurityCamera.dts";
// maxDamage = 2.0;
// destroyedLevel = 2.0;
// disabledLevel = 2.0;
// mass = 1.2;
// elasticity = 0.1;
// friction = 0.9;
// collideable = 1;
// pickupRadius = 1;
// sticky = false;
// explosion = CameraGrenadeExplosion;
// expDmgRadius = 1.0;
// expDamage = 0.1;
// expImpulse = 200.0;
// dynamicType = $TypeMasks::StaticShapeObjectType;
// deployedObject = true;
// cmdCategory = "Misc";
// cmdIcon = CMDSensorIcon;
// targetNameTag = 'Security';
// targetTypeTag = 'Camera';
// deployAmbientThread = true;
// debrisShapeName = "debris_generic_small.dts";
// debris = SmallShapeDebris;
// heatSignature = 0;
// needsPower = true;
//};
datablock StaticShapeData(DeployedSpine) : StaticShapeDamageProfile {
className = "spine";
shapeFile = "Pmiscf.dts";
maxDamage = 0.5;
destroyedLevel = 0.5;
disabledLevel = 0.3;
isShielded = true;
energyPerDamagePoint = 240;
maxEnergy = 50;
rechargeRate = 0.25;
explosion = HandGrenadeExplosion;
expDmgRadius = 3.0;
expDamage = 0.1;
expImpulse = 200.0;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Light Support Beam';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
needsPower = true;
};
//----------------------------------------------------------------------------
// FUNCTIONS
//----------------------------------------------------------------------------
function DetructableSecurityCamera::onDestroyed(%this, %obj)
{
schedule(1000,0,"delete",%obj);
}
//Component: Destructable Props
//Description: Not much to describe.. stuff that blows up or can be broken.
//----------------------------------------------------------------------------
// DATABLOCKS
//----------------------------------------------------------------------------
datablock StaticShapeData(DeployedSpine) : StaticShapeDamageProfile {
className = "spine";
shapeFile = "Pmiscf.dts";
maxDamage = 0.5;
destroyedLevel = 0.5;
disabledLevel = 0.3;
isShielded = true;
energyPerDamagePoint = 240;
maxEnergy = 50;
rechargeRate = 0.25;
explosion = HandGrenadeExplosion;
expDmgRadius = 3.0;
expDamage = 0.1;
expImpulse = 200.0;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Light Support Beam';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
needsPower = true;
};
//----------------------------------------------------------------------------
// FUNCTIONS
//----------------------------------------------------------------------------
function DetructableSecurityCamera::onDestroyed(%this, %obj)
{
schedule(1000,0,"delete",%obj);
}

View file

@ -1,222 +1,294 @@
//------------------------------------------------------------------------------
// torqueExServer.cs
// Torque Extensions for Servers
// Copyright (c) 2012 The DarkDragonDX
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Name: setVoice
// Argument %client: The client object to change the voice of.
// Argument %voice: The name of the voice to change to
// Argument %voicepitch: The voicepitch to use
// Description: Changes the voice of the targeted client object.
//==============================================================================
function setVoice(%client, %voice, %voicepitch)
{
freeClientTarget(%client);
%client.voice = %voice;
%client.voicetag = addtaggedstring(%voice);
%client.target = allocClientTarget(%client, %client.name, %client.skin, %client.voiceTag, '_ClientConnection', 0, 0, %client.voicePitch);
if (IsObject(%client.player))
%client.player.setTarget(%client.target);
return true;
}
//------------------------------------------------------------------------------
// Name: setSkin
// Argument %client: The client object to change the voice of.
// Argument %skin: The skin to change to.
// Description: Changes the skin of the targeted client object.
//==============================================================================
function setSkin(%client, %skin)
{
freeClientTarget(%client);
%client.skin = addtaggedstring(%skin);
%client.target = allocClientTarget(%client, %client.name, %client.skin, %client.voiceTag, '_ClientConnection', 0, 0, %client.voicePitch);
// If the client has a player object
if (IsObject(%client.player))
%client.player.setTarget(%client.target);
return true;
}
//------------------------------------------------------------------------------
// Name: setName
// Argument %client: The client object to change the skin of.
// Argument %name: The name to change to.
// Description: Changes the name of the targeted client object.
//==============================================================================
function setName(%client, %name)
{
freeClientTarget(%client);
%client.namebase = %name;
%client.name = addtaggedstring(%name);
%client.target = allocClientTarget(%client, %client.name, %client.skin, %client.voiceTag, '_ClientConnection', 0, 0, %client.voicePitch);
if (IsObject(%client.player))
%client.player.setTarget(%client.target);
//Update the client in the lobby.
HideClient(%client);
ShowClient(%client);
return true;
}
//------------------------------------------------------------------------------
// Name: setTeam
// Argument %client: The client object to change the team of.
// Argument %name: The team to change to.
// Description: Changes the team of the targeted client object.
//==============================================================================
function setTeam(%client,%team)
{
%client.team = %team;
%client.setSensorGroup(%team);
setTargetSensorGroup(%client.target,%team);
return true;
}
//------------------------------------------------------------------------------
// Name: hideClientInLobby
// Argument %client: The client to hide.
// Description: Hides this client object from the lobby only.
// (Doesn't have anything to do with the server list)
//==============================================================================
function hideClientInLobby(%client)
{
messageAllExcept( %client, -1, 'MsgClientDrop', "", Game.kickClientName, %client );
return true;
}
//------------------------------------------------------------------------------
// Name: showClientInLobby
// Argument %client: The client to show.
// Description: Shows this client object in the lobby only.
// (Doesn't have anything to do with the server list)
//==============================================================================
function showClientInLobby(%client)
{
messageAllExcept(%client, -1, 'MsgClientJoin', "", %client.name, %client, %client.target, %client.isAIControlled(), %client.isAdmin, %client.isSuperAdmin, %client.isSmurf, %client.Guid);
return true;
}
//------------------------------------------------------------------------------
// Name: hideClientInList
// Argument %client: The client to hide.
// Description: Hides the client in the server list only.
// WARNING!!! Running this on actual GameConnections is destructive. The game
// will refuse to update the client anymore until they are reshown. This is
// only known to work on AI's without a problem.
//==============================================================================
function hideClientInList(%client)
{
if (!IsObject(HiddenClientGroup))
{
new SimGroup(HiddenClientGroup);
ServerGroup.add(HiddenClientGroup);
}
HiddenClientGroup.add(%client);
return true;
}
//------------------------------------------------------------------------------
// Name: showClientInList
// Argument %client: The client to show.
// Description: Shows the client in the server list only.
//==============================================================================
function showClientInList(%client)
{
ClientGroup.add(%client);
return true;
}
function ServerCMDCheckHTilt(%client){ return %client; } // CCM-based clients spam fix, for some reason they spam this to the server whenever they strafe.
// TypeMasks
$TypeMasks::AllObjectType = -1; //Same thing as everything, thanks to Krash123 for telling me this. :)
$TypeMasks::InteractiveObjectType = $TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType | $TypeMasks::WaterObjectType | $TypeMasks::ProjectileObjectType | $TypeMasks::ItemObjectType | $TypeMasks::CorpseObjectType;
$TypeMasks::UnInteractiveObjectType = $TypeMasks::StaticObjectType | $TypeMasks::TerrainObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::StaticTSObjectType | $TypeMasks::StaticRenderedObjectType;
$TypeMasks::BaseAssetObjectType = $TypeMasks::ForceFieldObjectType | $TypeMasks::TurretObjectType | $TypeMasks::SensorObjectType | $TypeMasks::StationObjectType | $TypeMasks::GeneratorObjectType;
$TypeMasks::GameSupportObjectType = $TypeMasks::TriggerObjectType | $TypeMasks::MarkerObjectType | $TypeMasks::CameraObjectType | $TypeMasks::VehicleBlockerObjectType | $TypeMasks::PhysicalZoneObjectType;
$TypeMasks::GameContentObjectType = $TypeMasks::ExplosionObjectType | $TypeMasks::CorpseObjectType | $TypeMasks::DebrisObjectType;
$TypeMasks::DefaultLOSObjectType = $TypeMasks::TerrainObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::StaticObjectType;
// --- Binding Functions
function GameConnection::setVoice(%this, %voice, %voicepitch) { return setVoice(%this, %voice, %voicepitch); }
function GameConnection::setSkin(%this, %skin) { return setSkin(%this, %skin); }
function GameConnection::setName(%this, %name){ return setName(%this, %name); }
function GameConnection::setTeam(%this, %team){ return setTeam(%this, %team); }
function GameConnection::hideInLobby(%this){ return hideClientInLobby(%this); }
function GameConnection::showInLobby(%this){ return showClientInLobby(%this); }
// function GameConnection::hideClientInList(%this){ return hideClientInList(%this); }
// function GameConnection::showClientInList(%this){ return showClientInList(%this); }
function AIConnection::setVoice(%this, %voice, %voicepitch) { return setVoice(%this, %voice, %voicepitch); }
function AIConnection::setSkin(%this, %skin) { return setSkin(%this, %skin); }
function AIConnection::setName(%this, %name){ return setName(%this, %name); }
function AIConnection::setTeam(%this, %team){ return setTeam(%this, %team); }
function AIConnection::hide(%this){ return hideClientInLobby(%this); }
function AIConnection::show(%this){ return showClientInLobby(%this); }
function AIConnection::hideClientInList(%this){ return hideClientInList(%this); }
function AIConnection::showClientInList(%this){ return showClientInList(%this); }
function AIConnection::disengageTasks(%this)
{
// Don't quite remember exactly what the minimal
// requirements here to get the same effect is,
// but this works fine as it is it seems.
AIUnassignClient(%this); // Have no idea what this does!
%this.stop();
%this.clearTasks(); // Clear the Behavior Tree
%this.clearStep();
%this.lastDamageClient = -1;
%this.lastDamageTurret = -1;
%this.shouldEngage = -1;
%this.setEngageTarget(-1);
%this.setTargetObject(-1);
%this.pilotVehicle = false;
%this.defaultTasksAdded = false;
return true;
}
function Player::setVoice(%this, %voice, %voicepitch)
{
if (!isObject(%this.Client))
{
%this.Client = new ScriptObject(); // Glue!
%this.Client.Player = %this;
}
return setVoice(%this.Client, %voice, %voicepitch);
}
function Player::setSkin(%this, %skin)
{
if (!isObject(%this.Client))
{
%this.Client = new ScriptObject();
%this.Client.Player = %this;
}
return setSkin(%this, %skin);
}
function Player::setName(%this, %name)
{
if (!isObject(%this.Client))
{
%this.Client = new ScriptObject();
%this.Client.Player = %this;
}
return setName(%this, %name);
}
function Player::setTeam(%this, %team)
{
if (!isObject(%this.Client))
{
%this.Client = new ScriptObject();
%this.Client.Player = %this;
}
return setTeam(%this, %team);
//------------------------------------------------------------------------------
// torqueExServer.cs
// Torque Extensions for Servers
// Copyright (c) 2012 Robert MacGregor
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Name: setVoice
// Argument %client: The client object to change the voice of.
// Argument %voice: The name of the voice to change to
// Argument %voicepitch: The voicepitch to use
// Description: Changes the voice of the targeted client object.
//==============================================================================
function setVoice(%client, %voice, %voicepitch)
{
freeClientTarget(%client);
%client.voice = %voice;
%client.voicePitch = %voicePitch;
%client.voicetag = addtaggedstring(%voice);
%client.target = allocClientTarget(%client, %client.name, %client.skin, %client.voiceTag, '_ClientConnection', 0, 0, %client.voicePitch);
if (IsObject(%client.player))
%client.player.setTarget(%client.target);
return true;
}
//------------------------------------------------------------------------------
// Name: setSkin
// Argument %client: The client object to change the voice of.
// Argument %skin: The skin to change to.
// Description: Changes the skin of the targeted client object.
//==============================================================================
function setSkin(%client, %skin)
{
freeClientTarget(%client);
%client.skin = addtaggedstring(%skin);
%client.target = allocClientTarget(%client, %client.name, %client.skin, %client.voiceTag, '_ClientConnection', 0, 0, %client.voicePitch);
// If the client has a player object
if (IsObject(%client.player))
%client.player.setTarget(%client.target);
return true;
}
//------------------------------------------------------------------------------
// Name: setName
// Argument %client: The client object to change the skin of.
// Argument %name: The name to change to.
// Description: Changes the name of the targeted client object.
//==============================================================================
function setName(%client, %name, %lobbyUpdate)
{
freeClientTarget(%client);
%client.namebase = %name;
%client.name = addtaggedstring(%name);
%client.target = allocClientTarget(%client, %client.name, %client.skin, %client.voiceTag, '_ClientConnection', 0, 0, %client.voicePitch);
if (IsObject(%client.player))
%client.player.setTarget(%client.target);
// Update the client in the lobby if we wanted to
if (%lobbyUpdate)
{
hideClientInLobby(%client);
ShowClientInLobby(%client);
}
return true;
}
//------------------------------------------------------------------------------
// Name: setTeam
// Argument %client: The client object to change the team of.
// Argument %name: The team to change to.
// Description: Changes the team of the targeted client object.
//==============================================================================
function setTeam(%client,%team)
{
%client.team = %team;
%client.setSensorGroup(%team);
setTargetSensorGroup(%client.target,%team);
return true;
}
//------------------------------------------------------------------------------
// Name: hideClientInLobby
// Argument %client: The client to hide.
// Description: Hides this client object from the lobby only.
// (Doesn't have anything to do with the server list)
//==============================================================================
function hideClientInLobby(%client)
{
messageAllExcept( %client, -1, 'MsgClientDrop', "", Game.kickClientName, %client );
return true;
}
//------------------------------------------------------------------------------
// Name: showClientInLobby
// Argument %client: The client to show.
// Description: Shows this client object in the lobby only.
// (Doesn't have anything to do with the server list)
//==============================================================================
function showClientInLobby(%client)
{
messageAllExcept(%client, -1, 'MsgClientJoin', "", %client.name, %client, %client.target, %client.isAIControlled(), %client.isAdmin, %client.isSuperAdmin, %client.isSmurf, %client.Guid);
return true;
}
//------------------------------------------------------------------------------
// Name: hideClientInList
// Argument %client: The client to hide.
// Description: Hides the client in the server list only.
// WARNING!!! Running this on actual GameConnections is destructive. The game
// will refuse to update the client anymore until they are reshown. This is
// only known to work on AI's without a problem.
//==============================================================================
function hideClientInList(%client)
{
if (!IsObject(HiddenClientGroup))
{
new SimGroup(HiddenClientGroup);
ServerGroup.add(HiddenClientGroup);
}
if (HiddenClientGroup.isMember(%client))
return false;
$HostGamePlayerCount--;
if (%client.isAIControlled())
$HostGameBotCount--;
HiddenClientGroup.add(%client);
return true;
}
function listHiddenPlayers()
{
for (%i = 0; %i < HiddenClientGroup.getCount(); %i++)
{
%cl = HiddenClientGroup.getObject(%i);
%status = %cl.isAIControlled() ? "Bot" : "Player";
echo("client: " @ %cl @ " player: " @ %cl.player @ " name: " @ %cl.namebase @ " team: " @ %cl.team @ " status: " @ %status);
}
return true;
}
//------------------------------------------------------------------------------
// Name: showClientInList
// Argument %client: The client to show.
// Description: Shows the client in the server list only.
//==============================================================================
function showClientInList(%client)
{
if (ClientGroup.isMember(%client))
return false;
$HostGamePlayerCount++;
if (%client.isAIControlled())
$HostGameBotCount++;
ClientGroup.add(%client);
return true;
}
//------------------------------------------------------------------------------
// Name: plnametocid
// Argument %name: The name of a client.
// Description: Returns the client ID of a player whose name closest matches
// %name. (Does not take the hidden group into consideration)
// Note: This code was pulled from construction, the author is unknown to me.
//==============================================================================
function plnametocid(%name)
{
%count = ClientGroup.getCount(); //counts total clients
for(%i = 0; %i < %count; %i++) //loops till all clients are accounted for
{
%obj = ClientGroup.getObject(%i); //gets the clientid based on the ordering hes in on the list
%nametest=%obj.namebase; //pointless step but i didnt feel like removing it....
%nametest=strlwr(%nametest); //make name lowercase
%name=strlwr(%name); //same as above, for the other name
if(strstr(%nametest,%name) != -1) //is all of name test used in name
return %obj; //if so return the clientid and stop the function
}
return 0; //if none fits return 0 and end function
}
function forceSpawn(%client)
{
Game.spawnPlayer( %client, false );
CloseScoreScreen(%client);
return true;
}
function ServerCMDCheckHTilt(%client){ } // CCM-based clients spam fix, for some reason they spam this to the server whenever they strafe.
// TypeMasks
$TypeMasks::AllObjectType = -1; //Same thing as everything, thanks to Krash123 for telling me this. :)
$TypeMasks::InteractiveObjectType = $TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType | $TypeMasks::WaterObjectType | $TypeMasks::ProjectileObjectType | $TypeMasks::ItemObjectType | $TypeMasks::CorpseObjectType;
$TypeMasks::UnInteractiveObjectType = $TypeMasks::StaticObjectType | $TypeMasks::TerrainObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::StaticTSObjectType | $TypeMasks::StaticRenderedObjectType;
$TypeMasks::BaseAssetObjectType = $TypeMasks::ForceFieldObjectType | $TypeMasks::TurretObjectType | $TypeMasks::SensorObjectType | $TypeMasks::StationObjectType | $TypeMasks::GeneratorObjectType;
$TypeMasks::GameSupportObjectType = $TypeMasks::TriggerObjectType | $TypeMasks::MarkerObjectType | $TypeMasks::CameraObjectType | $TypeMasks::VehicleBlockerObjectType | $TypeMasks::PhysicalZoneObjectType;
$TypeMasks::GameContentObjectType = $TypeMasks::ExplosionObjectType | $TypeMasks::CorpseObjectType | $TypeMasks::DebrisObjectType;
$TypeMasks::DefaultLOSObjectType = $TypeMasks::TerrainObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::StaticObjectType;
// --- Binding Functions
function GameConnection::setVoice(%this, %voice, %voicepitch) { return setVoice(%this, %voice, %voicepitch); }
function GameConnection::setSkin(%this, %skin) { return setSkin(%this, %skin); }
function GameConnection::setName(%this, %name){ return setName(%this, %name); }
function GameConnection::setTeam(%this, %team){ return setTeam(%this, %team); }
function GameConnection::hideInLobby(%this){ return hideClientInLobby(%this); }
function GameConnection::showInLobby(%this){ return showClientInLobby(%this); }
function Gameconnection::spawn(%this){ return forceSpawn(%this); }
// function GameConnection::hideClientInList(%this){ return hideClientInList(%this); }
// function GameConnection::showClientInList(%this){ return showClientInList(%this); }
function AIConnection::setVoice(%this, %voice, %voicepitch) { return setVoice(%this, %voice, %voicepitch); }
function AIConnection::setSkin(%this, %skin) { return setSkin(%this, %skin); }
function AIConnection::setName(%this, %name){ return setName(%this, %name); }
function AIConnection::setTeam(%this, %team){ return setTeam(%this, %team); }
function AIConnection::hide(%this){ return hideClientInLobby(%this); }
function AIConnection::show(%this){ return showClientInLobby(%this); }
function AIConnection::hideClientInList(%this){ return hideClientInList(%this); }
function AIConnection::showClientInList(%this){ return showClientInList(%this); }
function AIConnection::disengageTasks(%this)
{
// Don't quite remember exactly what the minimal
// requirements here to get the same effect is,
// but this works fine as it is it seems.
AIUnassignClient(%this); // Have no idea what this does!
%this.stop();
%this.clearTasks(); // Clear the Behavior Tree
%this.clearStep();
%this.lastDamageClient = -1;
%this.lastDamageTurret = -1;
%this.shouldEngage = -1;
%this.setEngageTarget(-1);
%this.setTargetObject(-1);
%this.pilotVehicle = false;
%this.defaultTasksAdded = false;
return true;
}
function Player::setVoice(%this, %voice, %voicepitch)
{
if (!isObject(%this.Client))
{
%this.Client = new ScriptObject(); // Glue!
%this.Client.Player = %this;
}
return setVoice(%this.Client, %voice, %voicepitch);
}
function Player::setSkin(%this, %skin)
{
if (!isObject(%this.Client))
{
%this.Client = new ScriptObject();
%this.Client.Player = %this;
}
return setSkin(%this, %skin);
}
function Player::setName(%this, %name, %lobbyUpdate)
{
if (!isObject(%this.Client))
{
%this.Client = new ScriptObject();
%this.Client.Player = %this;
}
return setName(%this, %name, %lobbyUpdate);
}
function Player::setTeam(%this, %team)
{
if (!isObject(%this.Client))
{
%this.Client = new ScriptObject();
%this.Client.Player = %this;
}
return setTeam(%this, %team);
}
// This package is used to hook several functions that will induce bugs due to usage of this code
package ExOverrides
{
function fixMe(){}
};
if (!isActivePackage(ExOverrides))
activatePackage(ExOverrides);
else
{
deactivatePackage(ExOverrides);
activatePackage(ExOverrides);
}

View file

@ -1,75 +1,83 @@
//------------------------------------------------------------------------------
// Array.cs
// Array object you can pass around.
// Copyright (c) 2012 The DarkDragonDX
//==============================================================================
function ArrayFactory::create(%this, %name)
{
if (isObject(%name))
%name = "";
%object = new ScriptObject(%name) { class = "ArrayObject"; };
%object.elementCount = 0;
return %object;
}
function ArrayObject::setElement(%this, %index, %object)
{
%replaced = false;
if (%this.Element[%index] != "")
%replaced = true;
else
{
%this.elementIndex[%index] = %this.elementCount;
%this.elementIndices[%this.elementCount] = %index;
%this.elementCount++;
}
%this.Element[%index] = %object;
return %replaced;
}
function ArrayObject::list(%this)
{
%list = Array.create();
for (%i = 0; %i < %this.elementCount; %i++)
%list.setElement(%i, %this.Element[%this.elementIndices[%i]]);
return %list;
}
function ArrayObject::removeElement(%this, %index)
{
if (%this.Element[%index] != "")
{
%this.Element[%index] = "";
for (%i = %this.elementIndex[%index]; %i < %this.elementCount; %i++)
%this.elementIndices[%i] = %this.elementIndices[%i+1];
%this.elementCount--;
return true;
}
else
return false;
return false;
}
function ArrayObject::isElement(%this, %index)
{
if (%this.Element[%index] == "")
return false;
else
return true;
return false;
}
function ArrayObject::element(%this, %index)
{
return %this.Element[%index];
}
function ArrayObject::count(%this)
{
return %this.elementCount;
}
if (!IsObject(Array))
//------------------------------------------------------------------------------
// Array.cs
// Array object you can pass around.
// Copyright (c) 2012 Robert MacGregor
//==============================================================================
function ArrayFactory::create(%this, %name)
{
if (isObject(%name))
%name = "";
%object = new ScriptObject(%name) { class = "ArrayObject"; };
%object.elementCount = 0;
return %object;
}
function ArrayObject::setElement(%this, %index, %object)
{
%replaced = false;
if (%this.Element[%index] != "")
%replaced = true;
else
{
%this.elementIndex[%index] = %this.elementCount;
%this.elementIndices[%this.elementCount] = %index;
%this.elementCount++;
}
%this.Element[%index] = %object;
return %replaced;
}
function ArrayObject::list(%this)
{
%list = Array.create();
for (%i = 0; %i < %this.elementCount; %i++)
%list.setElement(%i, %this.Element[%this.elementIndices[%i]]);
return %list;
}
function ArrayObject::removeElement(%this, %index)
{
if (%this.Element[%index] != "")
{
%this.Element[%index] = "";
for (%i = %this.elementIndex[%index]; %i < %this.elementCount; %i++)
%this.elementIndices[%i] = %this.elementIndices[%i+1];
%this.elementCount--;
return true;
}
else
return false;
return false;
}
function ArrayObject::hasElementValue(%this, %value)
{
for (%i = 0; %i < %this.elementCount; %i++)
if (%this.Element[%i] == %value)
return true;
return false;
}
function ArrayObject::isElement(%this, %index)
{
if (%this.Element[%index] == "")
return false;
else
return true;
return false;
}
function ArrayObject::element(%this, %index)
{
return %this.Element[%index];
}
function ArrayObject::count(%this)
{
return %this.elementCount;
}
if (!IsObject(Array))
new ScriptObject(Array) { class = "ArrayFactory"; };

View file

@ -0,0 +1,276 @@
//------------------------------------------------------------------------------
// basicDataStorage.cs
// Originally written for T2BoL mod back in the day, now is being rewritten
// for the original implementation was pretty crappy.
// Requires: Array.cs
// Copyright (c) 2012 Robert MacGregor
//==============================================================================
//------------------------------------------------------------------------------
// Name: BasicDataParser.load
// Argument %file: The file to parse and load into memory.
// Description: This function is the main function of everything; it loads
// %file into memory.
// Return: True if the function succeeded, false if otherwise failed.
//==============================================================================
function BasicDataParser::load(%this, %file)
{
// Make sure we have our values initialised (math doesn't work right on nonexistent variables!)
if (%this.filesLoaded == "")
%this.filesLoaded = 0;
if (%this.blockEntryCount == "")
%this.blockEntryCount = 0;
if (%this.blockInstances == "")
%this.blockInstances = 0;
%currentSeconds = formatTimeString("ss");
// Check to see if the data is valid (returns false if we tried to load a nonexistent file)
if (!isFile(%file))
{
error("basicDataStorage.cs: Attempted to load non-existent file " @ %file @ "!");
return false;
}
// Check to see if this file is already loaded
if (%this.isLoaded(%file))
{
error("basicDataStorage.cs: Attempted to reload data file " @ %file SPC "while it's already in memory! (try unloading or emptying)");
return false;
}
// Add the file entry to memory (for the file check above)
%this.files[%this.filesLoaded] = %file;
%this.fileIndex[%file] = %this.filesLoaded;
%this.filesLoaded++;
// Load the file into memory (function is from fileProcessing.cs)
%fileData = strReplace(stripChars(getFileBuffer(%file),"\t"),"\n","\t");
%lineCount = getFieldCount(%fileData);
%isProcessingBlock = false; // Used to set processing mode
%currentBlock = 0;
%hadError = false;
// Iterate through all lines
for (%i = 0; %i < %lineCount; %i++)
{
%currentLine = getField(%fileData,%i);
// Check to see if this line contains a block definition or not
%openingBlock = strStr(%currentLine, "[");
%closingBlock = strStr(%currentLine, "]");
// If we have a block definition, it should be against left margin
if (%openingBlock == 0 && %closingBlock > 0 && !%isProcessingBlock)
{
%isProcessingBlock = true;
%blockName = getSubStr(%currentLine,%openingBlock+1,%closingBlock-1);
if (%this.blockInstances[%blockName] == "")
{
%this.blockInstances[%blockName] = 0;
%this.blockEntry[%this.blockEntryCount] = %blockName;
%this.blockEntryCount++;
}
// Create the array to store our block data
%currentBlock = Array.create();
%currentBlock.Name = %blockName;
%currentBlock.File = %file;
%this.blocks[%blockName,%this.blockInstances] = %currentBlock;
%this.blockInstances[%blockName]++;
%this.blockInstances++;
continue;
}
// Results in an error
else if (%openingBlock == 0 && %closingBlock > 0 && %isProcessingBlock)
{
error("basicDataStorage.cs: Error loading file "@ %file @ ", block spacing error.");
return false;
}
// If we're processing the actual block
if (%isProcessingBlock)
{
if (%currentLine $="" || %i == %lineCount)
{
%isProcessingBlock = false;
continue;
}
else
{
%eqPos = strStr(%currentLine,"="); // This is safe since the equals sign should be first.
if (%eqPos == -1)
{
error("basicDataStorage.cs: Unable to read entry for block" SPC %currentBlock.Name @ " in file" SPC %file @ "!");
%isProcessingBlock = false;
%hadError = true;
continue;
}
// Note: I got lazy here, just don't have semicolons in your data entries..
%semiPos = strStr(%currentLine,";");
if (%semiPos == -1 || getSubStrOccurance(%currentLine,";") > 1)
{
error("basicDataStorage.cs: Unable to read entry for block" SPC %currentBlock.Name @ " in file" SPC %file @ "!");
%isProcessingBlock = false;
%hadError = true;
continue;
}
%entryName = trim(getSubStr(%currentLine,0,%eqPos-1));
%entryValue = trim(getSubStr(%currentLine,%eqPos+1, mAbs(%eqPos-%semiPos)-1 ));
%currentBlock.setElement(%entryName,%entryValue);
}
}
}
if (!%hadError)
warn("basicDataStorage.cs: Successfully loaded file" SPC %file SPC "in " @ formatTimeString("ss") - %currentSeconds SPC "seconds.");
return !%hadError;
}
//------------------------------------------------------------------------------
// Name: BasicDataParser.unload
// Argument %file: The file of who's entries should be unloaded.
// Description: This function is used to unload data by filename -- useful for
// reloading data from specific files.
// Return: True if the function was successful, false if otherwise failed.
//==============================================================================
function BasicDataParser::unload(%this, %file)
{
if (!%this.isLoaded(%file))
{
error("basicDataStorage.cs: Attempted to unload non-loaded data file " @ %file @ "!");
return false;
}
// Unload any data associated with this file now
%removed = "";
for (%i = 0; %i < %this.blockEntryCount; %i++)
{
%name = %this.blockEntry[%i];
for (%h = 0; %h < %this.blockInstances[%name]; %h++)
if (%this.blocks[%name, %h].File $= %file)
{
%this.blocks[%name, %h].delete();
%this.blocks[%name, %h] = "";
%this.blockEntry[%i] = "";
%removed = trim(%removed SPC %i);
if (%this.blockInstances[%name] == 1)
%this.blockInstances[%name] = "";
else
%this.blockInstances[%name]--;
}
}
// Iterate through our block entries and correct the imbalance
for (%i = 0; %i < getWordCount(%removed); %i++)
{
for (%h = i; %h < %this.blockEntryCount; %h++)
%this.blockEntry[%h-%i] = %this.blockEntry[%h+1];
%this.blockEntryCount--;
}
// Now remove the file entry
for (%i = %this.fileIndex[%file]; %i < %this.filesLoaded; %i++)
if (%i != %this.filesLoaded-1)
{
%this.files[%i] = %this.files[%i+1];
%this.fileIndex[%this.files[%i+1]] = %i;
}
else
{
%this.fileIndex[%file] = "";
%this.files[%i] = "";
}
// Decrement the files loaded count and return true
%this.filesLoaded--;
return true;
}
//------------------------------------------------------------------------------
// Name: BasicDataParser.count
// Argument %block: The bloick entry to count the occurances of
// Return: The occurances of %block in this parser object. If there is no
// such entry of %block anywhere, false (0) is returned.
//==============================================================================
function BasicDataParser::count(%this, %block)
{
// Return zero if the block has no entries even registered
if (%this.blockInstances[%block] == "")
return false;
else
// Return the block Instances otherwise
return %this.blockInstances[%block];
return false; // Shouldn't happen
}
//------------------------------------------------------------------------------
// Name: BasicDataParser.empty
// Description: Empties the entire object of any information it may have
// loaded anytime.
// Return: True is always returned from this function.
//==============================================================================
function BasicDataParser::empty(%this)
{
// Iterate through our block entries and destroy them
for (%i = 0; %i < %this.blockEntryCount; %i++)
{
%name = %this.blockEntry[%i];
for (%h = 0; %h < %this.blockInstances[%name]; %h++)
{
%this.blocks[%name, %h].delete();
%this.blocks[%name, %h] = "";
}
%this.blockInstances[%name] = "";
%this.blockEntry[%i] = "";
}
// Remove the files loaded entries now
for (%i = 0; %i < %this.filesLoaded; %i++)
{
%this.fileIndex[%this.files[%i]] = "";
%this.files[%i] = "";
}
// Reset some variables to 0 and return true
%this.filesLoaded = 0;
%this.blockInstances = 0;
%this.blockEntryCount = 0;
return true;
}
//------------------------------------------------------------------------------
// Name: BasicDataParser.isLoaded
// Argument %file: The file to check the loaded status of.
// Description: Returns if %file is loaded into memory of this object or not.
// Return: A boolean representing the loaded status.
//==============================================================================
function BasicDataParser::isLoaded(%this, %file)
{
// Check to see if this file is already loaded
for (%i = 0; %i < %this.filesLoaded; %i++)
if (%this.files[%i] $= %file)
return true;
return false;
}
//------------------------------------------------------------------------------
// Name: BasicDataParser.get
// Argument %block: The name of the block to return.
// Argument %occurance: The block index we need to return -- if there's
// multiple entries of %block.
// Description: This function is used to retrieve block entries loaded from
// within any of the files this object has parsed.
// Return: An Array (array.cs) containing relevent information to the requested
// block. If there is no such entry of %block, false is returned.
//==============================================================================
function BasicDataParser::get(%this, %block, %occurance)
{
// Check ti see uf thus block has only once entry -- in which case %occurance is ignored
if (%this.count(%block) == 1) return %this.blocks[%block, 0];
// Otherwise we use %occurance to return the specific index
else if (%occurance >= 0 && %occurance <= %this.count(%block)) return %this.blocks[%block, %occurance];
return false;
}

View file

@ -0,0 +1,80 @@
// -----------------------------------------------------
// FileFunctions.cs
// Basic file functions
// Copyright (c) 2012 Robert MacGregor
// -----------------------------------------------------
function getFileBuffer(%file)
{
if (!IsFile(%file))
return -1;
new FileObject(FileBuffer);
FileBuffer.openForRead(%file);
while (!FileBuffer.isEOF())
%buffer = %buffer @ FileBuffer.readLine() @ "\n";
FileBuffer.detach();
return %buffer; //Long string. >.>
}
function getLine(%file, %line)
{
if (!IsFile(%file))
return -1;
new FileObject(FileLine);
FileLine.openForRead(%file);
for (%i = 0; %i < %line; %i++)
%line = FileLine.readLine();
FileLine.detach();
return %line;
}
function getLine(%file, %line)
{
if (!IsFile(%file))
return -1;
new FileObject(FileLine);
FileLine.openForRead(%file);
for (%i = 0; %i < %line; %i++)
%line = FileLine.readLine();
FileLine.detach();
return %line;
}
// Returns an unsorted list of the contents of %dir (including folders)
function getDirectory(%dir)
{
%array = Array.create();
%fileCount = 0;
for( %file = findFirstFile( %dir @ "*.*" ); %file !$= ""; %file = findNextFile( %dir @ "*.*" ) )
{
%file = strReplace(%file, %socket.request, "");
if (strStr(%file, "/") != -1)
{
%dir = getSubStr(%file, 0, strStr(%file, "/")) @ "/";
if (!%dirAdded[%dir])
{
%data = %data @ "<a href=\"" @ strReplace(%dir, " ","%20") @ "\">" @ %dir @ "</a><br>\n";
%dirAdded[%dir] = true;
}
}
else
%data = %data @ "<a href=\"" @ strReplace(%file, " ", "%20") @ "\">" @ %file @ "</a><br>\n";
}
return %array;
}
// -----------------------------------------------------
// Bound Functions
// -----------------------------------------------------
function fileObject::Detach(%this) //Detaches fileObject from file & deletes
{
%this.close();
%this.delete();
return %this;
}

Some files were not shown because too many files have changed in this diff Show more