T2RPG: Initial commit of ironsphererpg directory

Taking everything obtained from http://ironsphererpg2.webs.com/ and dumping it in a git repo
This commit is contained in:
Jusctsch5 2015-01-18 21:06:06 -06:00
parent fe9e2d05d1
commit a5143b67f7
1730 changed files with 186051 additions and 0 deletions

899
scripts/BountyGame.cs Normal file
View file

@ -0,0 +1,899 @@
//--- GAME RULES BEGIN ---
//Eliminate Targets in order assigned; eliminate Pursuer(s) without penalty
//Killing a Bystander who was a former Target returns him to your Target pool
//Killing 3 or more Targets in a row without dying earns a bonus
//Killing all Targets first earns a bonus
//Red = Target, Green = Bystander
//--- GAME RULES END ---
//Spec Note: Upon entry to game -
// All opponents have green triangles.
// Once you select your target, that player's triangle appears red (for you).
// If someone who has you as a target (a Pursuer) damages you, his triangle disappears altogether (for you).
// Once your target is eliminated, he respawns with a green triangle.
// If your Pursuer kills you, he has a green triangle again when you respawn (unless he becomes your target).
exec("scripts/aiBountyGame.cs");
$InvBanList[Bounty, "TurretOutdoorDeployable"] = 1;
$InvBanList[Bounty, "TurretIndoorDeployable"] = 1;
$InvBanList[Bounty, "ElfBarrelPack"] = 1;
$InvBanList[Bounty, "MortarBarrelPack"] = 1;
$InvBanList[Bounty, "PlasmaBarrelPack"] = 1;
$InvBanList[Bounty, "AABarrelPack"] = 1;
$InvBanList[Bounty, "MissileBarrelPack"] = 1;
$InvBanList[Bounty, "Mine"] = 1;
//-----------------Bounty Game score inits --------------
// .objectiveTargetKills .bystanderKills .predatorKills .suicides .deaths
function BountyGame::initGameVars(%game)
{
%game.SCORE_PER_TARGETKILL = 1;
%game.SCORE_PER_BYSTANDERKILL = -1;
%game.SCORE_PER_SUICIDE = -1;
%game.SCORE_PER_DEATH = 0;
%game.SCORE_PER_COMPLETION_BONUS = 5;
%game.SIZE_STREAK_TO_AWARD = 3; //award bonus for a winning streak this big or better
%game.WARN_AT_NUM_OBJREM = 2; //display warning when player has only this many or less objectives left
%game.MAX_CHEATDEATHS_ALLOWED = 1; //number of times a player can die by cntrl-k or die by leaving mission area before being labeled a cheater
%game.waypointFrequency = 24000;
%game.waypointDuration = 6000;
}
function BountyGame::startMatch(%game)
{
//call the default
DefaultGame::startMatch(%game);
//now give everyone who's already playing a target
%count = ClientGroup.getCount();
for (%i = 0; %i < %count; %i++)
{
%cl = ClientGroup.getObject(%i);
%game.nextObjective(%cl);
}
}
function BountyGame::allowsProtectedStatics(%game)
{
return true;
}
function BountyGame::setUpTeams(%game)
{
if ((%group = nameToID("MissionGroup/Teams")) == -1)
return;
%dropSet = new SimSet("TeamDrops0");
MissionCleanup.add(%dropSet);
%group.setTeam(0);
game.numTeams = 1;
setSensorGroupCount(32);
//now set up the sensor group colors - specific for bounty - everyone starts out green to everone else...
for(%i = 0; %i < 32; %i++)
setSensorGroupColor(%i, 0xfffffffe, "0 255 0 255");
}
function BountyGame::pickTeamSpawn(%game, %team)
{
DefaultGame::pickTeamSpawn(%game, 0);
}
function BountyGame::claimSpawn(%game, %obj, %newTeam, %oldTeam)
{
%newSpawnGroup = nameToId("MissionCleanup/TeamDrops0");
%newSpawnGroup.add(%obj);
}
function BountyGame::clientJoinTeam( %game, %client, %team, %respawn )
{
%game.assignClientTeam( %client );
// Spawn the player:
%game.spawnPlayer( %client, %respawn );
}
function BountyGame::assignClientTeam(%game, %client)
{
%client.team = 0;
//initialize the team array
for (%i = 1; %i < 32; %i++)
%game.teamArray[%i] = false;
%count = ClientGroup.getCount();
for (%i = 0; %i < %count; %i++)
{
%cl = ClientGroup.getObject(%i);
if (%cl.team != 0)
%game.teamArray[%cl.team] = true;
}
//now loop through the team array, looking for an empty team
for (%i = 1; %i < 32; %i++)
{
if (! %game.teamArray[%i])
{
%client.team = %i;
break;
}
}
// set player's skin pref here
setTargetSkin(%client.target, %client.skin);
%client.justEntered = true;
// Let everybody know you are no longer an observer:
messageAll( 'MsgClientJoinTeam', '\c1%1 has joined the fray.', %client.name, "", %client, 1 );
updateCanListenState( %client );
logEcho(%client.nameBase@" (cl "@%client@") entered game");
}
function BountyGame::playerSpawned(%game, %player, %armor)
{
DefaultGame::playerSpawned(%game, %player, %armor);
%client = %player.client;
if (%client.justEntered)
{
%client.justEntered = "";
%game.updateHitLists();
}
%client.isPlaying = true;
// if client spawned and has no target (e.g. when first enters game), give him one
// if client came from observer mode, should still have a target
if (!%client.objectiveTarget && $MatchStarted)
%game.nextObjective(%client);
//make sure the colors for this client are correct
%game.updateColorMask(%client);
//show the waypoint for this player...
%client.damagedTargetTime = 0;
cancel(%client.waypointSchedule);
%game.showTargetWaypoint(%client);
//also, anyone who has this client as an objective target, update their waypoint as well...
for (%i = 0; %i < ClientGroup.getCount(); %i++)
{
%cl = ClientGroup.getObject(%i);
if (%cl.objectiveTarget == %client)
{
%cl.damagedTargetTime = 0;
cancel(%cl.waypointSchedule);
%game.showTargetWaypoint(%cl);
}
}
}
function BountyGame::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(EnergyPack, 1);
%player.setInventory(RepairKit,1);
%player.setInventory(Grenade,6);
%player.setInventory(Blaster,1);
%player.setInventory(Disc,1);
%player.setInventory(Chaingun, 1);
%player.setInventory(ChaingunAmmo, 100);
%player.setInventory(DiscAmmo, 20);
%player.setInventory(Beacon, 3);
%player.setInventory(TargetingLaser, 1);
%player.weaponCount = 3;
%player.use("Blaster");
}
function BountyGame::updateColorMask(%game, %client)
{
//set yourself to red, so your objectives will be red
%redMask = 0;
%blueMask = 0;
%count = ClientGroup.getCount();
for (%i = 0; %i < %count; %i++)
{
%cl = ClientGroup.getObject(%i);
//first, see if the client is your target
if (%cl == %client.objectiveTarget)
%redMask |= (1 << %cl.team);
//else see if the have you as a target, and have damaged you...
else if (%cl.objectiveTarget == %client && %cl.damagedObjectiveTarget)
%blueMask |= (1 << %cl.team);
}
//first everyone to green
setSensorGroupColor(%client.team, 0xfffffffe, "0 255 0 255");
//now set the red mask (your target)
setSensorGroupColor(%client.team, %redMask, "255 0 0 255");
//finally, set the blue mask (by setting alpha to 0 the damage/triangle will not appear, though
// names still can).. if none were desired then making this group never visible would be
// the better solution
setSensorGroupColor(%client.team, %blueMask, "0 0 255 0");
}
function BountyGame::showTargetWaypoint(%game, %client)
{
//AI's simply detect their target
if (%client.isAIControlled())
{
if (AIClientIsAlive(%client.objectiveTarget))
%client.clientDetected(%client.objectiveTarget);
return;
}
//only show the target waypoint if the target hasn't been damaged within the frequency period
if (getSimTime() - %client.damagedTargetTime < %game.waypointFrequency)
{
%client.waypointSchedule = %game.schedule(%game.waypointFrequency, "showTargetWaypoint", %client);
return;
}
//flash a waypoint on the %client's current objective
%clTarget = %client.objectiveTarget;
if (!AIClientIsAlive(%clTarget) || !AIClientIsAlive(%client))
return;
//set the vis mask
%visMask = getSensorGroupAlwaysVisMask(%clTarget.getSensorGroup());
%visMask |= (1 << %client.getSensorGroup());
setSensorGroupAlwaysVisMask(%clTarget.getSensorGroup(), %visMask);
//scope the client, then set the always vis mask...
if (isObject(%clTarget.player))
{
//always keep the target in scope...
%clTarget.player.scopeToClient(%client);
//now issue a command to kill the target
%client.setTargetId(%clTarget.target);
commandToClient(%client, 'TaskInfo', %client, -1, false, "Attack Target");
%client.sendTargetTo(%client, true);
//send the "waypoint is here sound" - QIX, need a sound!
messageClient(%client, 'MsgBountyWaypoint', '~wfx/misc/target_waypoint.wav');
}
//schedule the time to hide the waypoint
%client.waypointSchedule = %game.schedule(%game.waypointDuration, "hideTargetWaypoint", %client);
}
function BountyGame::hideTargetWaypoint(%game, %client)
{
//AI's simply detect their target
if (%client.isAIControlled())
{
if (AIClientIsAlive(%client.objectiveTarget))
%client.clientDetected(%client.objectiveTarget);
return;
}
//flash a waypoint on the %client's current objective
%clTarget = %client.objectiveTarget;
if (!isObject(%clTarget))
return;
//clear scope the client, then unset the always vis mask...
%visMask = getSensorGroupAlwaysVisMask(%clTarget.getSensorGroup());
%visMask &= ~(1 << %client.getSensorGroup());
setSensorGroupAlwaysVisMask(%clTarget.getSensorGroup(), %visMask);
//kill the actually task...
removeClientTargetType(%client, "AssignedTask");
//schedule the next time the waypoint should flash
%client.waypointSchedule = %game.schedule(%game.waypointFrequency, "showTargetWaypoint", %client);
}
function BountyGame::nextObjective(%game, %client)
{
%numValidTargets = %game.buildListValidTargets(%client);
if (%numValidTargets > 0)
{
// if there are valid targets (other players that client hasn't killed)
%client.objectiveTarget = %game.selectNewTarget(%client, %numValidTargets);
%client.objectiveTargetName = detag((%client.objectiveTarget).name);
%client.damagedObjectiveTarget = false;
// this client has now been assigned a target
%client.hasHadTarget = true;
messageClient(%client, 'msgBountyTargetIs', '\c2Your target is %1.', %client.objectiveTarget.name);
//for the client, set his mask to see his target as red, anyone who as him as a target and has damaged him is blue
//and everyone else is green...
%game.updateColorMask(%client);
//set a temporary waypoint so you can find your new target
if (%client.isAIControlled())
%game.aiBountyAssignTarget(%client, %client.objectiveTarget);
//show the waypoint...
%client.damagedTargetTime = 0;
cancel(%client.waypointSchedule);
%game.showTargetWaypoint(%client);
logEcho(%client.nameBase@" (pl "@%client.player@"/cl "@%client@") assigned objective");
}
else
{
if (%client.hasHadTarget)
{
// if there aren't any more valid targets and you've been assigned one,
// that means you've killed everyone -- game over!
%game.awardScoreCompletionBonus(%client);
%game.gameOver();
cycleMissions();
}
else
{
cancel(%client.awaitingTargetThread);
%client.awaitingTargetThread = %game.schedule(500, "nextObjective", %client); //waiting for an opponent to join, keep checking 2x per second.
}
}
}
function BountyGame::buildListValidTargets(%game, %cl)
{
%availTargets = 0;
%numClients = ClientGroup.getCount();
for (%cIndex = 0; %cIndex < %numClients; %cIndex++)
{
%opponent = ClientGroup.getObject(%cIndex);
//make sure the target isn't yourself, or an observer
if (%opponent != %cl && %opponent.team > 0 && !%opponent.isNotInGame)
{
//make sure candidate for list has not already been killed by client
if (!%cl.eliminated[%opponent])
{
%cl.validList[%availTargets] = %opponent;
%availTargets++;
}
}
}
//returns length of list (number of players eligible as targets to this client)
%game.hudUpdateObjRem(%cl, %availTargets);
if ((%availTargets <= %game.WARN_AT_NUM_OBJREM) && (%cl.hasHadTarget))
%game.announceEminentWin(%cl, %availTargets);
return %availTargets;
}
function BountyGame::selectNewTarget(%game, %cl, %numValidTargets)
{
// pick a player at random from eligible target list
%targetIndex = mFloor(getRandom() * (%numValidTargets - 0.01));
//echo("picking index " @ %targetIndex @ " from ValidList");
return %cl.validList[%targetIndex];
}
function BountyGame::updateHitLists(%game)
{
%numClients = ClientGroup.getCount();
for (%cIndex = 0; %cIndex < %numClients; %cIndex++)
{
%cl = ClientGroup.getObject(%cIndex);
%game.buildListValidTargets(%cl);
}
}
function BountyGame::timeLimitReached(%game)
{
%game.gameOver();
cycleMissions();
}
function BountyGame::gameOver(%game)
{
//call the default
DefaultGame::gameOver(%game);
//send the message
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);
cancel(%client.waypointSchedule);
cancel(%client.forceRespawnThread);
}
}
function BountyGame::clientMissionDropReady(%game, %client)
{
%game.resetScore(%client);
messageClient(%client, 'MsgClientReady', "", %game.class);
messageClient(%client, 'MsgBountyTargetIs', "", "");
messageClient(%client, 'MsgYourScoreIs', "", 0);
//%objRem = %game.buildListValidTargets(%client);
//messageClient(%client, 'MsgBountyObjRem', "", %objRem);
//messageClient(%client, 'MsgYourRankIs', "", -1);
messageClient(%client, 'MsgMissionDropInfo', '\c0You are in mission %1 (%2).', $MissionDisplayName, $MissionTypeDisplayName, $ServerName );
DefaultGame::clientMissionDropReady(%game, %client);
}
function BountyGame::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 BountyGame::forceRespawn(%game, %client)
{
//make sure the player hasn't already respawned
if (isObject(%client.player))
return;
commandToClient(%client, 'setHudMode', 'Standard');
Game.spawnPlayer( %client, true );
%client.camera.setFlyMode();
%client.setControlObject(%client.player);
}
function BountyGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLoc)
{
DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLoc);
// you had your shot
%clVictim.isPlaying = false;
cancel(%clVictim.awaitingTargetThread);
// any time a person dies, the kill streak is reset
%clVictim.killStreak = 0;
//force the player to respawn
if (!%clVictim.isAIControlled())
%clVictim.forceRespawnThread = %game.schedule(5000, forceRespawn, %clVictim);
}
function BountyGame::onClientLeaveGame(%game, %clientId)
{
DefaultGame::onClientLeaveGame(%game, %clientId);
%clientId.isNotInGame = true;
%numClients = ClientGroup.getCount();
for (%index = 0; %index < %numClients; %index++)
{
%possPredator = ClientGroup.getObject(%index);
// make sure this guy gets erased from everyone's eliminated list
%possPredator.eliminated[%clientId] = "";
//no need for this - anyone who has him as a target will have their colors reset in game.nextObjective()
//reset everyones triangles to friendly and visible so the next guy that joins, doesn't get the old settings
//setTargetFriendlyMask(%possPredator.target, getTargetFriendlyMask(%possPredator.target) | (1<<getTargetSensorGroup(%clientID.target)));
//setTargetNeverVisMask(%possPredator.target, getTargetNeverVisMask(%possPredator.target) & ~(1<<getTargetSensorGroup(%clientID.target)));
// if anyone had this client as a target, get them a new target
if (%possPredator.objectiveTarget == %clientID)
{
messageClient(%possPredator, 'msgBountyTargetDropped', '\c2%1 has left the game and is no longer a target', %clientId.name);
%game.nextObjective(%possPredator);
}
}
}
function BountyGame::onClientEnterObserverMode(%game, %clientId)
{
//cancel the respawn schedule
cancel(%clientId.forceRespawnThread);
//notify everyone else, and choose a new objective if required...
%numClients = ClientGroup.getCount();
for (%index = 0; %index < %numClients; %index++)
{
// if anyone had this guy as a target, pick new target
%possPredator = ClientGroup.getObject(%index);
if (%possPredator.objectiveTarget == %clientId)
{
messageClient(%possPredator, 'msgBountyTargetEntObs', '\c2%1 has left the playfield and is no longer a target', %clientId.name);
%game.nextObjective(%possPredator);
}
}
}
function BountyGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %sourceObject)
{
DefaultGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %sourceObject);
//the updateColorMask function chooses red over blue, so no need to check if each is the other's target
if (%clAttacker.objectiveTarget == %clVictim && !%clAttacker.damagedObjectiveTarget)
{
%clAttacker.damagedObjectiveTarget = true;
%game.updateColorMask(%clVictim);
}
//update the time at which the attacker damaged his target
if (%clAttacker.objectiveTarget == %clVictim)
%clAttacker.damagedTargetTime = getSimTime();
}
function BountyGame::updateKillScores(%game, %clVictim, %clKiller, %damageType, %implement)
{
if (%game.testSuicide(%clVictim, %clKiller, %damageType))
%game.awardScoreSuicide(%clVictim, %damageType);
else if (%game.testTargetKill(%clVictim, %clKiller))
%game.awardScoreTargetKill(%clVictim, %clKiller);
else if (%game.testPredatorKill(%clVictim, %clKiller))
%game.awardScorePredatorKill(%clVictim, %clKiller);
else
%game.awardScoreBystanderKill(%clVictim, %clKiller);
if (%game.testCheating(%clVictim))
%game.announceCheater(%clVictim);
%game.recalcScore(%clKiller);
%game.recalcScore(%clVictim);
}
function BountyGame::testCheating(%game, %client)
{
return (%client.cheated > %game.MAX_CHEATDEATHS_ALLOWED);
}
function BountyGame::testSuicide(%game, %victimID, %killerID, %damageType)
{
return ((%victimID == %killerID) || (%damageType == $DamageType::Ground) || (%damageType == $DamageType::Suicide) || (%damageType == $DamageType::OutOfBounds));
}
function BountyGame::testTargetKill(%game, %clVictim, %clKiller)
{
// was the person you just killed your target?
return (%clKiller.objectiveTarget == %clVictim);
}
function BountyGame::testPredatorKill(%game, %clVictim, %clKiller)
{
// were you the target of the person you just killed?
return (%clVictim.objectiveTarget == %clKiller);
}
function BountyGame::awardScoreSuicide(%game, %clVictim, %damageType)
{
//now loop through the client, and award the kill to any attacker who damaged the client within 20 secs...
for (%i = 0; %i < ClientGroup.getCount(); %i++)
{
%cl = ClientGroup.getObject(%i);
if (%cl.objectiveTarget == %clVictim)
{
%game.awardScoreTargetKill(%clVictim, %cl, true);
messageClient(%clVictim, 'msgBountyTarKil', '\c2You eliminated yourself. %1 has been awarded the bounty!', %cl.name);
}
}
//update the "cheated" count
if (%damageType == $DamageType::Suicide)
{
%clVictim.cheated++;
DefaultGame::awardScoreSuicide(%game, %clVictim);
}
%game.recalcScore(%clVictim);
%clVictim.killStreak = 0;
}
function BountyGame::awardScoreTargetKill(%game,%clVictim, %clKiller, %victimSuicided)
{
// congratulations, you killed your target
%clKiller.objectiveTargetKills++;
%clKiller.kills = %clKiller.objectiveTargetKills;
%clKiller.eliminated[%clVictim] = true;
if (%victimSuicided)
{
if (%clVictim.gender $= "Female")
messageClient(%clKiller, 'msgBountyTarKil', '\c2Target %1 helped you out by eliminating herself!', %clVictim.name);
else
messageClient(%clKiller, 'msgBountyTarKil', '\c2Target %1 helped you out by eliminating himself!', %clVictim.name);
}
else
messageClient(%clKiller, 'msgBountyTarKil', '\c2You eliminated target %1!', %clVictim.name);
if (%game.SCORE_PER_TARGETKILL != 0)
%game.recalcScore(%clKiller);
%clKiller.killStreak++;
%clVictim.killStreak = 0;
if (%clKiller.killStreak >= %game.SIZE_STREAK_TO_AWARD) //award points for a kill streak
%game.awardScoreKillStreak(%clKiller);
//the victim is no longer the objective of the killer, reset his colors.
//The colors for the killer will be reset in game.nextObjective()
%clKiller.objectiveTarget = "";
%game.updateColorMask(%clVictim);
%game.nextObjective(%clKiller);
//since the killer scored, update everyone who's got him as a target...
for (%i = 0; %i < ClientGroup.getCount(); %i++)
{
%cl = ClientGroup.getObject(%i);
if (%cl.objectiveTarget == %clKiller)
{
%cl.damagedTargetTime = 0;
cancel(%cl.waypointSchedule);
%game.showTargetWaypoint(%cl);
}
}
}
function BountyGame::awardScoreBystanderKill(%game, %clVictim, %clKiller)
{
// uh oh, you killed someone other than your target or the person targeting you
%clKiller.bystanderKills++;
//%clVictim.killStreak = 0; //don't penalize the bystander right now, maybe change this later
// if you'd already killed him legally, he's back on your prospective target list
if (mAbs(%game.SCORE_PER_BYSTANDERKILL) > 1)
%plural = (%game.SCORE_PER_BYSTANDERKILL > 1 ? "s" : "");
if (%game.SCORE_PER_BYSTANDERKILL != 0)
{
messageClient(%clKiller, 'msgBountyBysKil', '\c0You have been penalized %1 point%2 for killing bystander %3.', mAbs(%game.SCORE_PER_BYSTANDERKILL), %plural, %clVictim.name);
messageClient(%clVictim, 'msgBountyBystander', '\c2You were the victim of %1\'s lousy aim! He was penalized.', %clKiller.name);
%game.recalcScore(%clKiller);
}
//add a target back to your list (any target)
%targetCount = 0;
for (%i = 0; %i < ClientGroup.getCount(); %i++)
{
%cl = ClientGroup.getObject(%i);
if (%clKiller.eliminated[%cl])
{
%addTargetsArray[%targetCount] = %cl;
%targetCount++;
}
}
//see if we found any targets we can add back on...
if (%targetCount > 0)
{
%clKiller.eliminated[%addTargetsArray[mFloor(getRandom() * (%targetCount - 0.01))]] = false;
messageClient(%clKiller, 'msgBountyBysRedo', '\c2One target has been added back onto your Bounty list.');
}
%clKiller.killStreak = 0;
}
function BountyGame::awardScorePredatorKill(%game, %clVictim, %clKiller)
{
%clVictim.killStreak = 0;
messageClient(%clKiller, 'msgBountyPredKill', '\c0You have temporarily fended off %1.', %clVictim.name);
//now, try to assign a new objective target for clVictim...
%game.nextObjective(%clVictim);
//also update the color mask for the killer...
%game.updateColorMask(%clKiller);
}
function BountyGame::awardScoreKillStreak(%game, %cl)
{
%bonus = (%cl.killStreak - %game.SIZE_STREAK_TO_AWARD) + 1;
%cl.streakPoints += %bonus;
messageClient(%cl,'msgBountyPlrStrkBonus', '\c0You received a %1 point bonus for a %2 kill streak!', %bonus, %cl.killStreak);
messageAll('msgBountyStreakBonus', '\c0%1 has eliminated %2 targets in a row!', %cl.name, %cl.killStreak, %bonus); //send bonus for sound parsing
//callback exists in client.cs for 'msgBountyStreakBonus', to play repeating bell sound length dependent on streak
}
function BountyGame::awardScoreCompletionBonus(%game, %cl)
{
// you killed everybody who was on your list
%cl.compBonus = 1;
if (%game.SCORE_PER_COMPLETION_BONUS != 0)
messageAll('msgBountyCompBonus', '\c2%1 receives a %2 point bonus for completing all objectives.', %cl.name, %game.SCORE_PER_COMPLETION_BONUS);
%game.recalcScore(%cl);
}
function BountyGame::announceEminentWin(%game, %cl, %objRem)
{
%wav = "~wfx/misc/bounty_objRem" @ %objRem @ ".wav";
%plural = (%objRem > 1 ? "s" : "");
if (%objRem > 0)
messageAll('msgBountyEminent', '\c2%1 has only %2 target%3 left!%4', %cl.name, %objRem, %plural, %wav);
else
messageAll('msgBountyOver', '\c2%1 has eliminated all targets!~wfx/misc/bounty_completed.wav', %cl.name);
}
function BountyGame::announceCheater(%game, %client)
{
if (%client.cheated > 1)
%plural = "s";
else
%plural = "";
messageAll('msgCheater', '%1 has suicided \c2%2 \c0time%3!', %client.name, %client.cheated, %plural);
}
function BountyGame::recalcScore(%game, %cl)
{
%cl.score = %cl.objectiveTargetKills * %game.SCORE_PER_TARGETKILL;
%cl.score += %cl.bystanderKills * %game.SCORE_PER_BYSTANDERKILL;
%cl.score += %cl.suicides * %game.SCORE_PER_SUICIDE;
%cl.score += %cl.compBonus * %game.SCORE_PER_COMPLETION_BONUS;
%cl.score += %cl.streakPoints; //this awarded in awardScoreKillStreak
messageClient(%cl, 'MsgYourScoreIs', "", %cl.score);
%game.recalcTeamRanks(%cl);
}
function BountyGame::resetScore(%game, %cl)
{
%cl.score = 0;
%cl.kills = 0;
%cl.objectiveTargetKills = 0;
%cl.bystanderKills = 0;
%cl.suicides = 0;
%cl.compBonus = 0;
%cl.streakPoints = 0;
cancel(%cl.awaitingTargetThread);
%cl.killstreak = "";
%cl.cheated = "";
%cl.hasHadTarget = false;
//reset %cl's hit list
//note that although this only clears clients (enemies) currently in the game,
//clients (enemies) who left early should have been cleared at that time.
%numClients = ClientGroup.getCount();
for (%count = 0; %count < %numClients; %count++)
{
%enemy = ClientGroup.getObject(%count);
%cl.eliminated[%enemy] = "";
}
}
function BountyGame::hudUpdateObjRem(%game, %client, %availTargets)
{
// how many people do you have left to kill?
messageClient(%client, 'msgBountyObjRem', "", %availTargets);
}
function BountyGame::enterMissionArea(%game, %playerData, %player)
{
%player.client.outOfBounds = false;
messageClient(%player.client, 'EnterMissionArea', '\c1You are back in the mission area.');
cancel(%player.alertThread);
logEcho(%player.client.nameBase@" (pl "@%player@"/cl "@%player.client@") entered mission area");
}
function BountyGame::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');
%player.alertThread = %game.schedule(1000, "AlertPlayer", 3, %player);
logEcho(%player.client.nameBase@" (pl "@%player@"/cl "@%player.client@") left mission area");
}
function BountyGame::AlertPlayer(%game, %count, %player)
{
if(%count > 1)
%player.alertThread = %game.schedule(1000, "AlertPlayer", %count - 1, %player);
else
%player.alertThread = %game.schedule(1000, "MissionAreaDamage", %player);
}
function BountyGame::MissionAreaDamage(%game, %player)
{
if(%player.getState() !$= "Dead") {
%player.setDamageFlash(0.1);
%prevHurt = %player.getDamageLevel();
%player.setDamageLevel(%prevHurt + 0.05);
// a little redundancy to see if the lastest damage killed the player
if(%player.getState() $= "Dead")
%game.onClientKilled(%player.client, 0, $DamageType::OutOfBounds);
else
%player.alertThread = %game.schedule(1000, "MissionAreaDamage", %player);
}
else
{
%game.onClientKilled(%player.client, 0, $DamageType::OutOfBounds);
}
}
function BountyGame::updateScoreHud(%game, %client, %tag)
{
// clear the header:
messageClient( %client, 'SetScoreHudHeader', "", "" );
// send the subheader:
messageClient( %client, 'SetScoreHudSubheader', "", '<tab:15,235,335>\tPLAYER\tSCORE\tTARGETS LEFT' );
for ( %index = 0; %index < $TeamRank[0, count]; %index++ )
{
//get the client info
%cl = $TeamRank[0, %index];
%clScore = %cl.score $= "" ? 0 : %cl.score;
//find out how many targets this client has left
%clTargets = 0;
for (%cIndex = 0; %cIndex < ClientGroup.getCount(); %cIndex++)
{
%opponent = ClientGroup.getObject(%cIndex);
if (!%opponent.isNotInGame && %opponent.team > 0 && %opponent != %cl && !%cl.eliminated[%opponent])
%clTargets++;
}
//find out if we've killed this target
%clKilled = "";
if ( %client.eliminated[%cl] )
%clKilled = "<font:univers condensed:18>ELIMINATED";
%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,430>\t<clip:200>%1</clip><rmargin:280><just:right>%2<rmargin:400><just:right>%3<rmargin:610><just:left>\t<color:FF0000>%4',
%cl.name, %clScore, %clTargets, %clKilled, %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,430>\t<clip:200><a:gamelink\t%6>%1</a></clip><rmargin:280><just:right>%2<rmargin:400><just:right>%3<rmargin:610><just:left>\t<color:FF0000>%4',
%cl.name, %clScore, %clTargets, %clKilled, %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 BountyGame::applyConcussion(%game, %player)
{
}

180
scripts/CenterPrint.cs Normal file
View file

@ -0,0 +1,180 @@
// CenterPrint Methods
//-------------------------------------------------------------------------------------------------------
$centerPrintActive = 0;
$bottomPrintActive = 0;
$CenterPrintSizes[1] = 20;
$CenterPrintSizes[2] = 36;
$CenterPrintSizes[3] = 56;
function centerPrintAll( %message, %time, %lines )
{
if( %lines $= "" || ((%lines > 3) || (%lines < 1)) )
%lines = 1;
%count = ClientGroup.getCount();
for (%i = 0; %i < %count; %i++)
{
%cl = ClientGroup.getObject(%i);
if( !%cl.isAIControlled() )
commandToClient( %cl, 'centerPrint', %message, %time, %lines );
}
}
function bottomPrintAll( %message, %time, %lines )
{
if( %lines $= "" || ((%lines > 3) || (%lines < 1)) )
%lines = 1;
%count = ClientGroup.getCount();
for (%i = 0; %i < %count; %i++)
{
%cl = ClientGroup.getObject(%i);
if( !%cl.isAIControlled() )
commandToClient( %cl, 'bottomPrint', %message, %time, %lines );
}
}
//-------------------------------------------------------------------------------------------------------
function centerPrint( %client, %message, %time, %lines )
{
if( %lines $= "" || ((%lines > 3) || (%lines < 1)) )
%lines = 1;
commandToClient( %client, 'CenterPrint', %message, %time, %lines );
}
function bottomPrint( %client, %message, %time, %lines )
{
if( %lines $= "" || ((%lines > 3) || (%lines < 1)) )
%lines = 1;
commandToClient( %client, 'BottomPrint', %message, %time, %lines );
}
//-------------------------------------------------------------------------------------------------------
function clearCenterPrint( %client )
{
commandToClient( %client, 'ClearCenterPrint');
}
function clearBottomPrint( %client )
{
commandToClient( %client, 'ClearBottomPrint');
}
//-------------------------------------------------------------------------------------------------------
function clearCenterPrintAll()
{
%count = ClientGroup.getCount();
for (%i = 0; %i < %count; %i++)
{
%cl = ClientGroup.getObject(%i);
if( !%cl.isAIControlled() )
commandToClient( %cl, 'ClearCenterPrint');
}
}
function clearBottomPrintAll()
{
%count = ClientGroup.getCount();
for (%i = 0; %i < %count; %i++)
{
%cl = ClientGroup.getObject(%i);
if( !%cl.isAIControlled() )
commandToClient( %cl, 'ClearBottomPrint');
}
}
//-------------------------------------------------------------------------------------------------------
function clientCmdCenterPrint( %message, %time, %lines ) // time is specified in seconds
{
// if centerprint already visible, reset text and time.
if($centerPrintActive)
{
CenterPrintText.setText( "<just:center>" @ %message );
if( centerPrintDlg.removePrint !$= "")
{
cancel(centerPrintDlg.removePrint);
}
if(%time > 0)
centerPrintDlg.removePrint = schedule( ( %time * 1000 ), 0, "clientCmdClearCenterPrint" );
// were done.
return;
}
CenterPrintDlg.visible = 1;
$centerPrintActive = 1;
CenterPrintText.setText( "<just:center>" @ %message );
CenterPrintDlg.extent = firstWord(CenterPrintDlg.extent) @ " " @ $CenterPrintSizes[%lines];
if(%time > 0)
centerPrintDlg.removePrint = schedule( ( %time * 1000 ), 0, "clientCmdClearCenterPrint" );
}
function clientCmdBottomPrint( %message, %time, %lines ) // time is specified in seconds
{
// if bottomprint already visible, reset text and time.
if($bottomPrintActive)
{
if( bottomPrintDlg.removePrint !$= "")
{
cancel(bottomPrintDlg.removePrint);
}
bottomPrintText.setText( "<just:center>" @ %message );
bottomPrintDlg.extent = firstWord(bottomPrintDlg.extent) @ " " @ $CenterPrintSizes[%lines];
if(%time > 0)
bottomPrintDlg.removePrint = schedule( ( %time * 1000 ), 0, "clientCmdClearbottomPrint" );
// were done.
return;
}
bottomPrintDlg.setVisible(true);
$bottomPrintActive = 1;
bottomPrintText.setText( "<just:center>" @ %message );
bottomPrintDlg.extent = firstWord(bottomPrintDlg.extent) @ " " @ $CenterPrintSizes[%lines];
if(%time > 0)
{
bottomPrintDlg.removePrint = schedule( ( %time * 1000 ), 0, "clientCmdClearbottomPrint" );
}
}
function BottomPrintText::onResize(%this, %width, %height)
{
%this.position = "0 0";
}
function CenterPrintText::onResize(%this, %width, %height)
{
%this.position = "0 0";
}
//-------------------------------------------------------------------------------------------------------
function clientCmdClearCenterPrint()
{
$centerPrintActive = 0;
CenterPrintDlg.visible = 0;
CenterPrintDlg.removePrint = "";
}
function clientCmdClearBottomPrint()
{
$bottomPrintActive = 0;
BottomPrintDlg.visible = 0;
BottomPrintDlg.removePrint = "";
}

3425
scripts/ChatGui.cs Normal file

File diff suppressed because it is too large Load diff

BIN
scripts/ChatGui.cs.dso Normal file

Binary file not shown.

433
scripts/ChooseFilterDlg.cs Normal file
View file

@ -0,0 +1,433 @@
//------------------------------------------------------------------------------
//
// ChooseFilterDlg.cs
//
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
function ChooseFilterDlg::onWake( %this )
{
CF_FilterList.clear();
CF_FilterList.addRow( 0, "All servers" );
CF_FilterList.addRow( 1, "Servers with buddies" );
CF_FilterList.addRow( 2, "Favorites only" );
for ( %i = 0; $pref::ServerBrowser::Filter[%i] !$= ""; %i++ )
CF_FilterList.addRow( %i + 3, $pref::ServerBrowser::Filter[%i] );
if ( $pref::ServerBrowser::activeFilter >= %i + 3 )
$pref::ServerBrowser::activeFilter = 0;
CF_FilterList.setSelectedById( $pref::ServerBrowser::activeFilter );
CF_GoBtn.makeFirstResponder( 1 );
}
//------------------------------------------------------------------------------
function ChooseFilterDlg::onSleep( %this )
{
// export out all the filters...
%count = CF_FilterList.rowCount();
for ( %row = 3; %row < %count; %row++ )
$pref::ServerBrowser::Filter[%row - 3] = CF_FilterList.getRowText( %row );
}
//------------------------------------------------------------------------------
function ChooseFilterDlg::newFilter( %this )
{
// get an updated list of game types:
queryMasterGameTypes();
%this.editFilterIndex = CF_FilterList.rowCount();
FilterEditName.setValue( "New Filter" );
FilterEditGameType.setText( "Any" );
FilterEditMissionType.setText( "Any" );
FilterEditMinPlayers.setValue( 0 );
FilterEditMaxPlayers.setValue( 255 );
FilterEditMaxBots.setValue( 16 );
FilterEditMinCPU.setValue( 0 );
FilterEditUsePingTgl.setValue( false );
FilterEditMaxPing.setValue( 50 );
FilterEditMaxPing.setVisible( false );
FilterEditTDOnTgl.setValue( false );
FilterEditTDOffTgl.setValue( false );
FilterEditWindowsTgl.setValue( false );
FilterEditLinuxTgl.setValue( false );
FilterEditDedicatedTgl.setValue( false );
FilterEditNoPwdTgl.setValue( false );
FilterEditCurVersionTgl.setValue( false );
for ( %i = 0; isObject( "FilterEditLocMask" @ %i ); %i++ )
( "FilterEditLocMask" @ %i ).setValue( true );
Canvas.pushDialog( FilterEditDlg );
}
//------------------------------------------------------------------------------
function ChooseFilterDlg::editFilter( %this )
{
%rowId = CF_FilterList.getSelectedId();
if ( %rowId < 3 ) // can't edit default filters
return;
// get an updated list of game types:
queryMasterGameTypes();
%rowText = CF_FilterList.getRowTextById( %rowId );
%filterName = getField( %rowText, 0 );
%gameType = getField( %rowText, 1 );
if ( %gameType $= "" )
%gameType = "Any";
%misType = getField( %rowText, 2 );
if ( %misType $= "" )
%misType = "Any";
%minPlayers = getField( %rowText, 3 );
if ( %minPlayers $= "" )
%minPlayers = 0;
%maxPlayers = getField( %rowText, 4 );
if ( %maxPlayers $= "" )
%maxPlayers = 255;
%regionCode = getField( %rowText, 5 );
if ( %regionCode $= "" )
%regionCode = 4294967295;
%maxPing = getField( %rowText, 6 );
%maxBots = getField( %rowText, 7 );
if ( %maxBots $= "" )
%maxBots = 16;
%minCPU = getField( %rowText, 8 );
if ( %minCPU $= "" )
%minCPU = 0;
%flags = getField( %rowText, 9 );
FilterEditName.setValue( %filterName );
FilterEditMinPlayers.setValue( %minPlayers );
FilterEditMaxPlayers.setValue( %maxPlayers );
FilterEditGameType.setText( %gameType );
FilterEditMissionType.setText( %misType );
%index = 0;
while ( isObject( "FilterEditLocMask" @ %index ) )
{
( "FilterEditLocMask" @ %index ).setValue( %regionCode & 1 );
%index++;
%regionCode >>= 1;
}
if ( %maxPing == 0 )
{
FilterEditUsePingTgl.setValue( false );
FilterEditMaxPing.setValue( 50 );
FilterEditMaxPing.setVisible( false );
}
else
{
FilterEditUsePingTgl.setValue( true );
FilterEditMaxPing.setValue( %maxPing );
FilterEditMaxPing.setVisible( true );
}
FilterEditMaxBots.setValue( %maxBots );
FilterEditMinCPU.setValue( %minCPU );
if ( %flags & 8 )
{
FilterEditWindowsTgl.setValue( true );
FilterEditLinuxTgl.setValue( false );
}
else
{
FilterEditWindowsTgl.setValue( false );
FilterEditLinuxTgl.setValue( %flags & 4 );
}
if ( %flags & 16 )
{
FilterEditTDOnTgl.setValue( true );
FilterEditTDOffTgl.setValue( false );
}
else
{
FilterEditTDOnTgl.setValue( false );
FilterEditTDOffTgl.setValue( %flags & 32 );
}
FilterEditDedicatedTgl.setValue( %flags & 1 );
FilterEditNoPwdTgl.setValue( %flags & 2 );
FilterEditCurVersionTgl.setValue( %flags & 128 );
%this.editFilterIndex = %rowId;
Canvas.pushDialog( FilterEditDlg );
}
//------------------------------------------------------------------------------
function ChooseFilterDlg::saveFilter( %this )
{
%filterName = FilterEditName.getValue();
%gameType = FilterEditGameType.getText();
%misType = FilterEditMissionType.getText();
%minPlayers = FilterEditMinPlayers.getValue();
%maxPlayers = FilterEditMaxPlayers.getValue();
%regionCode = 0;
for ( %i = 0; isObject( "FilterEditLocMask" @ %i ); %i++ )
{
if ( ( "FilterEditLocMask" @ %i ).getValue() )
%regionCode |= ( 1 << %i );
}
%maxPing = FilterEditUsePingTgl.getValue() ? FilterEditMaxPing.getValue() : 0;
%maxBots = FilterEditMaxBots.getValue();
%minCPU = FilterEditMinCPU.getValue();
%flags = FilterEditDedicatedTgl.getValue()
| ( FilterEditNoPwdTgl.getValue() << 1 )
| ( FilterEditLinuxTgl.getValue() << 2 )
| ( FilterEditWindowsTgl.getValue() << 3 )
| ( FilterEditTDOnTgl.getValue() << 4 )
| ( FilterEditTDOffTgl.getValue() << 5 )
| ( FilterEditCurVersionTgl.getValue() << 7 );
%row = %filterName TAB %gameType TAB %misType
TAB %minPlayers TAB %maxPlayers TAB %regionCode
TAB %maxPing TAB %maxBots TAB %minCPU TAB %flags;
CF_FilterList.setRowById( %this.editFilterIndex, %row );
CF_FilterList.setSelectedById( %this.editFilterIndex );
%this.editFilterIndex = "";
Canvas.popDialog( FilterEditDlg );
}
//------------------------------------------------------------------------------
function ChooseFilterDlg::deleteFilter( %this )
{
%rowId = CF_FilterList.getSelectedId();
if ( %rowId < 3 ) // can't delete default filters
return;
%row = CF_FilterList.getRowNumById( %rowId );
%lastFilter = CF_FilterList.rowCount() - 4;
while ( ( %nextRow = CF_FilterList.getRowTextById( %rowId + 1 ) ) !$= "" )
{
CF_FilterList.setRowById( %rowId, %nextRow );
%rowId++;
}
CF_FilterList.removeRowById( %rowId );
// Get rid of the last filter (now extra):
$pref::ServerBrowser::Filter[%lastFilter] = "";
// Select next (or failing that, previous) filter:
if ( CF_FilterList.getRowTextById( %row ) $= "" )
%selId = CF_FilterList.getRowId( %row - 1 );
else
%selId = CF_FilterList.getRowId( %row );
CF_FilterList.setSelectedById( %selId );
}
//------------------------------------------------------------------------------
function ChooseFilterDlg::go( %this )
{
Canvas.popDialog( ChooseFilterDlg );
GMJ_Browser.runQuery();
}
//------------------------------------------------------------------------------
function CF_FilterList::onSelect( %this, %id, %text )
{
// Let the user know they can't edit or delete the default filters:
if ( %id < 3 )
{
CF_EditFilterBtn.setActive( false );
CF_DeleteFilterBtn.setActive( false );
}
else
{
CF_EditFilterBtn.setActive( true );
CF_DeleteFilterBtn.setActive( true );
}
$pref::ServerBrowser::activeFilter = %id;
}
//------------------------------------------------------------------------------
function FilterEditDlg::setMinPlayers( %this )
{
%newMin = FilterEditMinPlayers.getValue();
if ( %newMin < 0 )
{
%newMin = 0;
FilterEditMinPlayers.setValue( %newMin );
}
else if ( %newMin > 254 )
{
%newMin = 254;
FilterEditMinPlayers.setValue( %newMin );
}
%newMax = FilterEditMaxPlayers.getValue();
if ( %newMax <= %newMin )
{
%newMax = %newMin + 1;
FilterEditMaxPlayers.setValue( %newMax );
}
}
//------------------------------------------------------------------------------
function FilterEditDlg::setMaxPlayers( %this )
{
%newMax = FilterEditMaxPlayers.getValue();
if ( %newMax < 1 )
{
%newMax = 1;
FilterEditMaxPlayers.setValue( %newMax );
}
else if ( %newMax > 255 )
{
%newMax = 255;
FilterEditMaxPlayers.setValue( %newMax );
}
%newMin = FilterEditMinPlayers.getValue();
if ( %newMin >= %newMax )
{
%newMin = %newMax - 1;
FilterEditMinPlayers.setValue( %newMin );
}
}
//------------------------------------------------------------------------------
function FilterEditDlg::setMaxBots( %this )
{
%newMax = FilterEditMaxBots.getValue();
if ( %newMax < 0 )
{
%newMax = 0;
FilterEditMaxBots.setValue( %newMax );
}
else if ( %newMax > 16 )
{
%newMax = 16;
FilterEditMaxBots.setValue( %newMax );
}
}
//------------------------------------------------------------------------------
function FilterEditUsePingTgl::onAction( %this )
{
FilterEditMaxPing.setVisible( %this.getValue() );
}
//------------------------------------------------------------------------------
function FilterEditDlg::setMaxPing( %this )
{
%newMax = FilterEditMaxPing.getValue();
if ( %newMax < 10 )
{
%newMax = 10;
FilterEditMaxPing.setValue( %newMax );
}
}
//------------------------------------------------------------------------------
function FilterEditDlg::setMinCPU( %this )
{
%newMin = FilterEditMinCPU.getValue();
if ( %newMin < 0 )
{
%newMin = 0;
FilterEditMinCPU.setValue( %newMin );
}
}
//------------------------------------------------------------------------------
function clearGameTypes()
{
%text = FilterEditGameType.getText();
FilterEditGameType.clear();
FilterEditGameType.add( "Any", 0 );
FilterEditGameType.add( "base", 1 );
FilterEditGameType.add( "variant", 2 );
FilterEditGameType.setText( %text );
}
//------------------------------------------------------------------------------
function addGameType( %type )
{
if ( FilterEditGameType.findText( %type ) == -1 )
{
%id = FilterEditGameType.size();
FilterEditGameType.add( %type, %id );
}
}
//------------------------------------------------------------------------------
function clearMissionTypes()
{
%text = FilterEditMissionType.getText();
FilterEditMissionType.clear();
FilterEditMissionType.add( "Any", 0 );
FilterEditMissionType.setText( %text );
// Add all the mission types found on this machine:
for ( %i = 0; %i < $HostTypeCount; %i++ )
FilterEditMissionType.add( $HostTypeDisplayName[%i], %i + 1 );
}
//------------------------------------------------------------------------------
function addMissionType(%type)
{
if ( %type !$= "" && FilterEditMissionType.findText( %type ) == -1 )
{
%id = FilterEditMissionType.size();
FilterEditMissionType.add( %type, %id );
}
}
//------------------------------------------------------------------------------
function sortGameAndMissionTypeLists()
{
FilterEditGameType.sort( true, 3 );
%idx = FilterEditGameType.findText( FilterEditGameType.getText() );
if ( %idx > -1 )
FilterEditGameType.setSelected( %idx );
FilterEditMissionType.sort( true, 1 );
%idx = FilterEditMissionType.findText( FilterEditMissionType.getText() );
if ( %idx > -1 )
FilterEditMissionType.setSelected( %idx );
}
//------------------------------------------------------------------------------
function FilterEditTDOnTgl::onAction( %this )
{
if ( %this.getValue() && FilterEditTDOffTgl.getValue() )
FilterEditTDOffTgl.setValue( false );
}
//------------------------------------------------------------------------------
function FilterEditTDOffTgl::onAction( %this )
{
if ( %this.getValue() && FilterEditTDOnTgl.getValue() )
FilterEditTDOnTgl.setValue( false );
}
//------------------------------------------------------------------------------
function FilterEditWindowsTgl::onAction( %this )
{
if ( %this.getValue() && FilterEditLinuxTgl.getValue() )
FilterEditLinuxTgl.setValue( false );
}
//------------------------------------------------------------------------------
function FilterEditLinuxTgl::onAction( %this )
{
if ( %this.getValue() && FilterEditWindowsTgl.getValue() )
FilterEditWindowsTgl.setValue( false );
}
//------------------------------------------------------------------------------
// Make sure we still have at least one region selected:
function FilterEditDlg::checkRegionMasks( %this, %lastIndex )
{
%index = 0;
while ( isObject( "FilterEditLocMask" @ %index ) )
{
if ( ( "FilterEditLocMask" @ %index ).getValue() )
return;
%index++;
}
// None are selected, so reselect the last control:
( "FilterEditLocMask" @ %lastIndex ).setValue( true );
}

Binary file not shown.

BIN
scripts/CreditsGui.cs.dso Normal file

Binary file not shown.

138
scripts/DebriefGui.cs Normal file
View file

@ -0,0 +1,138 @@
//------------------------------------------------------------------------------
//
// DebriefGui.cs
//
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
function DebriefGui::onWake( %this )
{
moveMap.pop();
if ( isObject( passengerKeys ) )
passengerKeys.pop();
if ( isObject( observerBlockMap ) )
observerBlockMap.pop();
if ( isObject( observerMap ) )
observerMap.pop();
//flyingCameraMove.pop();
if ( isObject( debriefMap ) )
{
debriefMap.pop();
debriefMap.delete();
}
new ActionMap( debriefMap );
%bind = moveMap.getBinding( toggleMessageHud );
debriefMap.bind( getField( %bind, 0 ), getField( %bind, 1 ), toggleDebriefChat );
debriefMap.copyBind( moveMap, activateChatMenuHud );
debriefMap.bindCmd( keyboard, escape, "", "debriefContinue();" );
debriefMap.push();
DB_ChatVector.attach( HudMessageVector );
DB_ChatScroll.scrollToBottom();
DB_LoadingProgress.setValue( 0 );
LoadingProgress.setValue( 0 );
DB_LoadingProgressTxt.setValue( "LOADING MISSION" );
LoadingProgressTxt.setValue( "LOADING MISSION" );
}
//------------------------------------------------------------------------------
function DebriefGui::onSleep( %this )
{
debriefMap.pop();
debriefMap.delete();
}
//------------------------------------------------------------------------------
function DebriefResultText::onResize( %this, %width, %height )
{
%fieldHeight = getWord( DB_ResultPane.getExtent(), 1 );
%x = getWord( DB_ResultScroll.getPosition(), 0 );
%w = getWord( DB_ResultScroll.getExtent(), 0 );
%h = %fieldHeight - %height - 4;
DB_ResultScroll.resize( %x, %height + 2, %w, %h );
}
//------------------------------------------------------------------------------
function toggleDebriefChat()
{
Canvas.pushDialog( DB_ChatDlg );
}
//------------------------------------------------------------------------------
function DB_ChatDlg::onWake( %this )
{
DB_ChatEntry.setValue( "" );
}
//------------------------------------------------------------------------------
function DB_ChatEntry::onEscape( %this )
{
Canvas.popDialog( DB_ChatDlg );
}
//------------------------------------------------------------------------------
function DB_ChatEntry::sendChat( %this )
{
%text = %this.getValue();
if ( %text !$= "" )
commandToServer( 'MessageSent', %text );
Canvas.popDialog( DB_ChatDlg );
}
//------------------------------------------------------------------------------
function debriefDisconnect()
{
MessageBoxYesNo( "DISCONNECT", "Are you sure you want to leave this game?", "Disconnect();" );
}
//------------------------------------------------------------------------------
function debriefContinue()
{
checkGotLoadInfo();
}
//------------------------------------------------------------------------------
addMessageCallback( 'MsgGameOver', handleGameOverMessage );
addMessageCallback( 'MsgClearDebrief', handleClearDebriefMessage );
addMessageCallback( 'MsgDebriefResult', handleDebriefResultMessage );
addMessageCallback( 'MsgDebriefAddLine', handleDebriefLineMessage );
//------------------------------------------------------------------------------
function handleGameOverMessage( %msgType, %msgString )
{
weaponsHud.clearAll();
inventoryHud.clearAll();
// Fill the Debriefer up with stuff...
Canvas.setContent( DebriefGui );
}
function handleClearDebriefMessage( %msgType, %msgString )
{
DebriefResultText.setText( "" );
DebriefText.setText( "" );
}
//------------------------------------------------------------------------------
function handleDebriefResultMessage( %msgType, %msgString, %string )
{
%text = DebriefResultText.getText();
if ( %text $= "" )
%newText = detag( %string );
else
%newText = %text NL detag( %string );
DebriefResultText.setText( %newText );
}
//------------------------------------------------------------------------------
function handleDebriefLineMessage( %msgType, %msgString, %string )
{
%text = DebriefText.getText();
if ( %text $= "" )
%newText = detag( %string );
else
%newText = %text NL detag( %string );
DebriefText.setText( %newText );
}

BIN
scripts/DebriefGui.cs.dso Normal file

Binary file not shown.

29
scripts/DemoEndGui.cs Normal file
View file

@ -0,0 +1,29 @@
$DemoCycleDelay = 6000;
function DemoEndGui::onWake(%this)
{
%this.index = 1;
new ActionMap( DemoEndMap );
DemoEndMap.bindCmd( mouse, button0, "DemoEndGui.forceBitmapCycle();", "" );
DemoEndMap.bindCmd( keyboard, space, "DemoEndGui.forceBitmapCycle();", "" );
DemoEndMap.push();
%this.cycleTimer = %this.schedule($DemoCycleDelay, cycleBitmaps);
}
function DemoEndGui::cycleBitmaps(%this)
{
if (%this.index == 3)
quit();
else
{
%this.index++;
%this.setBitmap("gui/bg_DemoEnd" @ %this.index);
%this.cycleTimer = %this.schedule( $DemoCycleDelay, cycleBitmaps );
}
}
function DemoEndGui::forceBitmapCycle( %this )
{
cancel( %this.cycleTimer );
%this.cycleBitmaps();
}

508
scripts/EditChatMenuGui.cs Normal file
View file

@ -0,0 +1,508 @@
//------------------------------------------------------------------------------
//
// EditChatMenuGui.cs
//
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
function EditChatMenuGui::onWake( %this )
{
fillChatMenuTree();
}
//------------------------------------------------------------------------------
function EditChatMenuGui::onSleep( %this )
{
chatMenuGuiTree.clear();
}
//------------------------------------------------------------------------------
function fillChatMenuTree()
{
%guiRoot = chatMenuGuiTree.getFirstRootItem();
%newGuiId = chatMenuGuiTree.insertItem( %guiRoot, "CHAT MENU ROOT", 0 );
traverseChatMenu( %newGuiId, $RootChatMenu );
chatMenuGuiTree.expandItem( %newGuiId );
chatMenuGuiTree.selectItem( %newGuiId );
chatMenuGuiTree.dirty = false;
}
//------------------------------------------------------------------------------
function traverseChatMenu( %guiID, %menu )
{
for ( %i = 0; %i < %menu.optionCount; %i++ )
{
%text = %menu.option[%i];
if ( %menu.isMenu[%i] )
{
//echo( "** add menu item \"" @ %menu.option[%i] @ "\" **" );
%newGuiID = chatMenuGuiTree.insertItem( %guiID, %text, 0 );
traverseChatMenu( %newGuiID, %menu.command[%i] );
}
else
{
//echo( "** add command item \"" @ %menu.option[%i] @ "\" (" @ %menu.command[%i] @ ") **" );
%temp = %menu.command[%i];
%cmdId = getSubStr( %temp, 1, strlen( temp ) - 1 );
%commandName = $ChatTable[%cmdId].name;
%text = %text @ " - ( " @ %commandName @ " )";
chatMenuGuiTree.insertItem( %guiID, %text, %cmdId );
}
}
}
//------------------------------------------------------------------------------
function newChatMenu()
{
chatMenuGuiTree.clear();
%guiRoot = chatMenuGuiTree.getFirstRootItem();
chatMenuGuiTree.insertItem( %guiRoot, "CHAT MENU ROOT", 0 );
chatMenuGuiTree.dirty = true;
}
//------------------------------------------------------------------------------
function saveChatMenu()
{
//getSaveFilename( "prefs/chatMenu/*.cs", doSaveChatMenu );
doSaveChatMenu( "customVoiceBinds.cs" );
}
//------------------------------------------------------------------------------
function resetChatMenu()
{
doLoadChatMenu( "scripts/voiceBinds.cs" );
}
//------------------------------------------------------------------------------
//function loadChatMenu()
//{
// getLoadFilename( "prefs/chatMenu/*.cs", doLoadChatMenu );
//}
//------------------------------------------------------------------------------
function doSaveChatMenu( %filename )
{
%filename = fileBase( %filename );
if ( %filename $= "" )
return;
new fileObject( "saveFile" );
saveFile.openForWrite( "prefs/" @ %filename @ ".cs" );
// Write a little header...
saveFile.writeLine( "//------------------------------------------------------------------------------" );
saveFile.writeLine( "//" );
saveFile.writeLine( "// Tribes 2 voice chat menu." );
saveFile.writeLine( "//" );
saveFile.writeLine( "//------------------------------------------------------------------------------" );
saveFile.writeLine( " " );
// Fire off the tree-traversing write function:
%rootItem = chatMenuGuiTree.getFirstRootItem();
writeTreeNode( saveFile, chatMenuGuiTree.getChild( %rootItem ) );
saveFile.close();
saveFile.delete();
chatMenuGuiTree.dirty = false;
MessageBoxOK( "SAVED", "Save successful." );
}
//------------------------------------------------------------------------------
function writeTreeNode( %file, %item )
{
%temp = chatMenuGuiTree.getItemText( %item );
%key = getSubStr( firstWord( %temp ), 0, 1 );
%text = restWords( %temp );
%command = chatMenuGuiTree.getItemValue( %item );
if ( strcmp( %command, "0" ) == 0 )
{
%file.writeLine( "startChatMenu( \"" @ %key @ " " @ %text @ "\" );" );
%child = chatMenuGuiTree.getChild( %item );
if ( %child )
writeTreeNode( %file, %child );
%file.writeLine( "endChatMenu(); // " @ %text );
}
else
{
// Clip the command text off of the string:
%cmdName = $ChatTable[%command].name;
%text = getSubStr( %text, 0, strlen( %text ) - strlen( %cmdName ) - 7 );
%file.writeLine( "addChat( \"" @ %key @ " " @ %text @ "\", '" @ %cmdName @ "' );" );
}
%sibling = chatMenuGuiTree.getNextSibling( %item );
if ( %sibling != 0 )
writeTreeNode( %file, %sibling );
}
//------------------------------------------------------------------------------
function doLoadChatMenu( %filename )
{
// Clear existing chat menu:
chatMenuGuiTree.clear();
// Load the file...
activateChatMenu( %filename );
fillChatMenuTree();
}
//------------------------------------------------------------------------------
function chatMenuGuiTree::onRightMouseDown( %this, %item, %pos )
{
// launch the action menu...
chatMenuGuiTree.selectItem( %item );
ChatMenuItemActionPopup.awaken( %item, %pos );
}
//------------------------------------------------------------------------------
function editSelectedChatMenuItem()
{
%item = chatMenuGuiTree.getSelectedItem();
if ( %item != chatMenuGuiTree.getFirstRootItem() )
{
%temp = chatMenuGuiTree.getItemText( %item );
if ( strlen( %temp ) > 0 )
{
%key = getSubStr( firstWord( %temp ), 0, 1 );
%text = restWords( %temp );
%command = chatMenuGuiTree.getItemValue( %item );
if ( %command $= "0" )
editChatMenu( %key, %text, "doEditChatMenu" );
else
{
%temp = strlen( $ChatTable[%command].name ) + 7;
%text = getSubStr( %text, 0, strlen( %text ) - %temp );
editChatCommand( %key, %text, %command, "doEditChatCommand" );
}
}
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
function ChatMenuItemActionPopup::awaken( %this, %item, %pos )
{
%this.position = %pos;
%this.clear();
%treeRoot = chatMenuGuiTree.getFirstRootItem();
%isMenu = ( strcmp( chatMenuGuiTree.getItemValue( %item ), "0" ) == 0 );
if ( %item != %treeRoot )
%this.addEntry( "Edit", 0 );
if ( %isMenu )
{
%this.addEntry( "Add menu", 1 );
%this.addEntry( "Add command", 2 );
}
if ( chatMenuGuiTree.getPrevSibling( %item ) )
%this.addEntry( "Move up", 3 );
if ( chatMenuGuiTree.getNextSibling( %item ) )
%this.addEntry( "Move down", 4 );
if ( %item != %treeRoot )
%this.addEntry( "Delete", 5 );
if ( %this.numEntries == 0 )
return;
Canvas.pushDialog( ChatMenuItemActionDlg );
%this.forceOnAction();
}
//------------------------------------------------------------------------------
function ChatMenuItemActionPopup::addEntry( %this, %text, %id )
{
%this.numEntries++;
%this.add( %text, %id );
}
//------------------------------------------------------------------------------
function ChatMenuItemActionPopup::reset( %this )
{
%this.numEntries = 0;
%this.forceClose();
Canvas.popDialog( ChatMenuItemActionDlg );
}
//------------------------------------------------------------------------------
function ChatMenuItemActionPopup::onSelect( %this, %id, %text )
{
%item = chatMenuGuiTree.getSelectedItem();
switch ( %id )
{
case 0: // Edit
%temp = chatMenuGuiTree.getItemText( %item );
%key = getSubStr( firstWord( %temp ), 0, 1 );
%text = restWords( %temp );
%command = chatMenuGuiTree.getItemValue( %item );
if ( strcmp( %command, "0" ) == 0 )
editChatMenu( %key, %text, "doEditChatMenu" );
else
{
// Strip the command name from the text:
%temp = strlen( $ChatTable[%command].name ) + 7;
%text = getSubStr( %text, 0, strlen( %text ) - %temp );
editChatCommand( %key, %text, %command, "doEditChatCommand" );
}
case 1: // Add menu
editChatMenu( "", "", "doNewChatMenu" );
case 2: // Add command
editChatCommand( "", "", "", "doNewChatCommand" );
case 3: // Move up
chatMenuGuiTree.moveItemUp( %item );
chatMenuGuiTree.dirty = true;
case 4: // Move down
%nextItem = chatMenuGuiTree.getNextSibling( %item );
chatMenuGuiTree.moveItemUp( %nextItem );
chatMenuGuiTree.dirty = true;
case 5: // Delete
chatMenuGuiTree.removeItem( %item );
chatMenuGuiTree.dirty = true;
}
%this.reset();
}
//------------------------------------------------------------------------------
function ChatMenuItemActionPopup::onCancel( %this )
{
%this.reset();
}
//------------------------------------------------------------------------------
function editChatMenu( %key, %text, %callback )
{
$ECI::key = %key;
$ECI::text = %text;
$ECI::OKCommand = %callback @ "($ECI::key, $ECI::text);";
Canvas.pushDialog( EditChatMenuDlg );
}
//------------------------------------------------------------------------------
function editChatCommand( %key, %text, %command, %callback )
{
$ECI::key = %key;
$ECI::text = %text;
$ECI::command = %command;
$ECI::OKCommand = %callback @ "($ECI::key, $ECI::text, $ECI::command);";
Canvas.pushDialog( EditChatCommandDlg );
}
//------------------------------------------------------------------------------
function doEditChatMenu( %key, %text )
{
if ( strlen( %key ) && strlen( %text ) )
{
Canvas.popDialog( EditChatMenuDlg );
%item = chatMenuGuiTree.getSelectedItem();
%newText = %key @ ": " @ %text;
chatMenuGuiTree.editItem( %item, %newText, "0" );
checkSiblings( %item );
chatMenuGuiTree.dirty = true;
}
//else
// WARN
}
//------------------------------------------------------------------------------
function doEditChatCommand( %key, %text, %command )
{
if ( strlen( %key ) && strlen( %text ) && isObject( $ChatTable[%command] ) )
{
Canvas.popDialog( EditChatCommandDlg );
%item = chatMenuGuiTree.getSelectedItem();
%newText = %key @ ": " @ %text @ " - ( " @ $ChatTable[%command].name @ " )";
chatMenuGuiTree.editItem( %item, %newText, %command );
checkSiblings( %item );
chatMenuGuiTree.dirty = true;
}
//else
// WARN
}
//------------------------------------------------------------------------------
function doNewChatMenu( %key, %text )
{
if ( strlen( %key ) && strlen( %text ) )
{
Canvas.popDialog( EditChatMenuDlg );
%item = chatMenuGuiTree.getSelectedItem();
%newText = %key @ ": " @ %text;
%newItem = chatMenuGuiTree.insertItem( %item, %newText, "0" );
chatMenuGuiTree.expandItem( %item );
chatMenuGuiTree.selectItem( %newItem );
checkSiblings( %newItem );
chatMenuGuiTree.dirty = true;
}
//else
// WARN
}
//------------------------------------------------------------------------------
function doNewChatCommand( %key, %text, %command )
{
if ( strlen( %key ) && strlen( %text ) && isObject( $ChatTable[%command] ) )
{
Canvas.popDialog( EditChatCommandDlg );
%item = chatMenuGuiTree.getSelectedItem();
%newText = %key @ ": " @ %text @ " - ( " @ $ChatTable[%command].name @ " )";
%newItem = chatMenuGuiTree.insertItem( %item, %newText, %command );
chatMenuGuiTree.expandItem( %item );
chatMenuGuiTree.selectItem( %newItem );
checkSiblings( %newItem );
chatMenuGuiTree.dirty = true;
}
//else
// WARN
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
function EditChatMenuDlg::onWake( %this )
{
}
//------------------------------------------------------------------------------
function EditChatCommandDlg::onWake( %this )
{
// Fill the command popup list:
EditChatCommandList.clear();
for ( %i = $MinChatItemId; %i <= $MaxChatItemId; %i++ )
{
if ( isObject( $ChatTable[%i] ) )
EditChatCommandList.add( $ChatTable[%i].name, %i );
}
EditChatCommandList.sort( true );
// Select the current command:
if ( isObject( $ChatTable[$ECI::command] ) )
{
EditChatCommandList.setSelected( $ECI::command );
EditChatCommandMessage.setText( $ChatTable[$ECI::command].text );
ChatCommandTestBtn.setVisible( true );
}
else
{
EditChatCommandList.setText( "Select command" );
EditChatCommandMessage.setText( " " );
ChatCommandTestBtn.setVisible( false );
}
}
//------------------------------------------------------------------------------
function EditChatCommandList::onSelect( %this, %index, %value )
{
$ECI::command = %index;
EditChatCommandMessage.setText( $ChatTable[%index].text );
ChatCommandTestBtn.setVisible( true );
}
//------------------------------------------------------------------------------
function checkSiblings( %item )
{
%allClear = true;
%sibling = chatMenuGuiTree.getPrevSibling( %item );
while ( %sibling != 0 )
{
%siblingKey = getSubStr( firstWord( chatMenuGuiTree.getItemText( %sibling ) ), 0, 1 );
if ( %siblingKey $= $ECI::key )
{
%allClear = false;
break;
}
%sibling = chatMenuGuiTree.getPrevSibling( %sibling );
}
if ( %allClear )
{
%sibling = chatMenuGuiTree.getNextSibling( %item );
while ( %sibling != 0 )
{
%siblingKey = getSubStr( firstWord( chatMenuGuiTree.getItemText( %sibling ) ), 0, 1 );
if ( %siblingKey $= $ECI::key )
{
%allClear = false;
break;
}
%sibling = chatMenuGuiTree.getNextSibling( %sibling );
}
}
if ( !%allClear )
{
if ( chatMenuGuiTree.getItemValue( %item ) $= "0" )
%text1 = restWords( chatMenuGuiTree.getItemText( %item ) );
else
{
%temp = chatMenuGuiTree.getItemText( %item );
%text1 = getWords( %temp, 1, getWordCount( %temp ) - 5 );
}
if ( chatMenuGuiTree.getItemValue( %sibling ) $= "0" )
%text2 = restWords( chatMenuGuiTree.getItemText( %sibling ) );
else
{
%temp = chatMenuGuiTree.getItemText( %sibling );
%text2 = getWords( %temp, 1, getWordCount( %temp ) - 5 );
}
MessageBoxOK( "WARNING", "Menu siblings \"" @ %text1 @ "\" and \"" @ %text2 @ "\" are both bound to the \'" @ %siblingKey @ "\' key!" );
}
return %allClear;
}
//------------------------------------------------------------------------------
function testChatCommand( %command )
{
// Play the sound:
if ( $pref::Player::Count > 0 )
%voiceSet = getField( $pref::Player[$pref::Player::Current], 3 );
else
%voiceSet = "Male1";
ChatCommandTestBtn.setActive( false );
%wav = "voice/" @ %voiceSet @ "/" @ $ChatTable[%command].audioFile @ ".wav";
%handle = alxCreateSource( AudioChat, %wav );
alxPlay( %handle );
%delay = alxGetWaveLen( %wav );
schedule( %delay, 0, "restoreCommandTestBtn" );
}
//------------------------------------------------------------------------------
function restoreCommandTestBtn()
{
ChatCommandTestBtn.setActive( true );
}
//------------------------------------------------------------------------------
function leaveChatMenuEditor()
{
if ( chatMenuGuiTree.dirty )
MessageBoxYesNo( "CHANGES", "Do you want to save your changes?",
"saveChatMenu(); reallyLeaveChatMenuEditor();",
"reallyLeaveChatMenuEditor();" );
else
reallyLeaveChatMenuEditor();
}
//------------------------------------------------------------------------------
function reallyLeaveChatMenuEditor()
{
activateChatMenu( "prefs/customVoiceBinds.cs" );
Canvas.popDialog( EditChatMenuGui );
Canvas.pushDialog( OptionsDlg );
}

Binary file not shown.

3164
scripts/EditorGui.cs Normal file

File diff suppressed because it is too large Load diff

460
scripts/EditorProfiles.cs Normal file
View file

@ -0,0 +1,460 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
// Portions Copyright (c) 2001 by Sierra Online, Inc.
//-----------------------------------------------------------------------------
//--------------------------------------------------------------------------
$Gui::fontCacheDirectory = expandFilename("./cache");
$Gui::clipboardFile = expandFilename("./cache/clipboard.gui");
// GuiDefaultProfile is a special case, all other profiles are initialized
// to the contents of this profile first then the profile specific
// overrides are assigned.
if(!isObject(GuiDefaultProfile)) new GuiControlProfile (GuiDefaultProfile)
{
tab = false;
canKeyFocus = false;
hasBitmapArray = false;
mouseOverSelected = false;
// fill color
opaque = false;
fillColor = ($platform $= "macos") ? "211 211 211" : "192 192 192";
fillColorHL = ($platform $= "macos") ? "244 244 244" : "220 220 220";
fillColorNA = ($platform $= "macos") ? "244 244 244" : "220 220 220";
// border color
border = false;
borderColor = "0 0 0";
borderColorHL = "128 128 128";
borderColorNA = "64 64 64";
// font
fontType = "Arial";
fontSize = 14;
fontColor = "0 0 0";
fontColorHL = "32 100 100";
fontColorNA = "0 0 0";
fontColorSEL= "200 200 200";
// bitmap information
bitmap = "gui/darkWindow";
bitmapBase = "";
textOffset = "0 0";
// used by guiTextControl
modal = true;
justify = "left";
autoSizeWidth = false;
autoSizeHeight = false;
returnTab = false;
numbersOnly = false;
cursorColor = "0 0 0 255";
// sounds
soundButtonDown = "";
soundButtonOver = "";
};
if(!isObject(GuiInputCtrlProfile)) new GuiControlProfile( GuiInputCtrlProfile )
{
tab = true;
canKeyFocus = true;
};
if(!isObject(GuiDialogProfile)) new GuiControlProfile(GuiDialogProfile);
if(!isObject(GuiSolidDefaultProfile)) new GuiControlProfile (GuiSolidDefaultProfile)
{
opaque = true;
border = true;
};
if(!isObject(GuiWindowProfile)) new GuiControlProfile (GuiWindowProfile)
{
opaque = true;
border = 2;
fillColor = ($platform $= "macos") ? "211 211 211" : "192 192 192";
fillColorHL = ($platform $= "macos") ? "190 255 255" : "64 150 150";
fillColorNA = ($platform $= "macos") ? "255 255 255" : "150 150 150";
fontColor = ($platform $= "macos") ? "0 0 0" : "255 255 255";
fontColorHL = ($platform $= "macos") ? "200 200 200" : "0 0 0";
text = "GuiWindowCtrl test";
bitmap = "gui/darkWindow";
textOffset = ($platform $= "macos") ? "5 5" : "6 6";
hasBitmapArray = true;
justify = ($platform $= "macos") ? "center" : "left";
};
if(!isObject(EditorToolButtonProfile)) new GuiControlProfile (EditorToolButtonProfile)
{
opaque = true;
border = 2;
};
if(!isObject(GuiContentProfile)) new GuiControlProfile (GuiContentProfile)
{
opaque = true;
fillColor = "255 255 255";
};
if(!isObject(GuiModelessDialogProfile)) new GuiControlProfile("GuiModelessDialogProfile")
{
modal = false;
};
if(!isObject(GuiButtonProfile)) new GuiControlProfile (GuiButtonProfile)
{
opaque = true;
border = true;
fontColor = "0 0 0";
fontColorHL = "32 100 100";
fixedExtent = true;
justify = "center";
canKeyFocus = false;
};
if(!isObject(GuiBorderButtonProfile)) new GuiControlProfile (GuiBorderButtonProfile)
{
fontColorHL = "0 0 0";
};
if(!isObject(GuiMenuBarProfile)) new GuiControlProfile (GuiMenuBarProfile)
{
fontType = "Arial";
fontSize = 14;
opaque = true;
fillColor = "192 192 192";
fillColorHL = "220 220 220";
fillColorNA = "220 220 220";
fillColorHL = "0 0 96";
border = 4;
fontColor = "0 0 0";
fontColorHL = "255 255 255";
fontColorNA = "128 128 128";
fixedExtent = true;
justify = "center";
canKeyFocus = false;
mouseOverSelected = true;
//bitmap = ($platform $= "macos") ? "./osxMenu" : "./torqueMenu";
//hasBitmapArray = true;
};
if(!isObject(GuiButtonSmProfile)) new GuiControlProfile (GuiButtonSmProfile)
{
fontSize = 14;
};
if(!isObject(GuiRadioProfile)) new GuiControlProfile (GuiRadioProfile)
{
fontSize = 14;
fillColor = "232 232 232";
fontColorHL = "32 100 100";
fixedExtent = true;
bitmap = "gui/darkWindow";
hasBitmapArray = true;
};
if(!isObject(GuiScrollProfile)) new GuiControlProfile (GuiScrollProfile)
{
opaque = true;
fillColor = "255 255 255";
border = 3;
borderThickness = 2;
borderColor = "0 0 0";
bitmap = "gui/darkScroll";
hasBitmapArray = true;
};
if(!isObject(GuiSliderProfile)) new GuiControlProfile (GuiSliderProfile);
if(!isObject(PainterTextProfile)) new GuiControlProfile (PainterTextProfile)
{
fontType = "Univers Condensed";
fontSize = 16;
fontColor = "0 0 0";
fontColorLink = "255 96 96";
fontColorLinkHL = "0 0 255";
autoSizeWidth = true;
autoSizeHeight = true;
};
if(!isObject(GuiTextProfile)) new GuiControlProfile (GuiTextProfile)
{
fontColor = "0 0 0";
fontColorLink = "255 96 96";
fontColorLinkHL = "0 0 255";
autoSizeWidth = true;
autoSizeHeight = true;
};
if(!isObject(EditorTextProfile)) new GuiControlProfile (EditorTextProfile)
{
fontType = "Arial Bold";
fontColor = "0 0 0";
autoSizeWidth = true;
autoSizeHeight = true;
};
if(!isObject(EditorTextProfileWhite)) new GuiControlProfile (EditorTextProfileWhite)
{
fontType = "Arial Bold";
fontColor = "255 255 255";
autoSizeWidth = true;
autoSizeHeight = true;
};
if(!isObject(GuiMediumTextProfile)) new GuiControlProfile (GuiMediumTextProfile)
{
fontType = "Arial Bold";
fontColor = "0 0 0";
autoSizeWidth = true;
autoSizeHeight = true;
fontSize = 24;
};
if(!isObject(GuiBigTextProfile)) new GuiControlProfile (GuiBigTextProfile)
{
fontType = "Arial Bold";
fontColor = "0 0 0";
autoSizeWidth = true;
autoSizeHeight = true;
fontSize = 36;
};
if(!isObject(GuiCenterTextProfile)) new GuiControlProfile (GuiCenterTextProfile)
{
fontType = "Arial Bold";
fontColor = "0 0 0";
autoSizeWidth = true;
autoSizeHeight = true;
justify = "center";
};
if(!isObject(MissionEditorProfile)) new GuiControlProfile (MissionEditorProfile)
{
canKeyFocus = true;
};
if(!isObject(EditorScrollProfile)) new GuiControlProfile (EditorScrollProfile)
{
opaque = true;
fillColor = "192 192 192 192";
border = 3;
borderThickness = 2;
borderColor = "0 0 0";
bitmap = "gui/darkScroll";
hasBitmapArray = true;
};
if(!isObject(GuiTextEditProfile)) new GuiControlProfile (GuiTextEditProfile)
{
opaque = true;
fillColor = "255 255 255";
fillColorHL = "128 128 128";
border = 3;
borderThickness = 2;
borderColor = "0 0 0";
fontColor = "0 0 0";
fontColorHL = "255 255 255";
fontColorNA = "128 128 128";
textOffset = "0 2";
autoSizeWidth = false;
autoSizeHeight = true;
tab = true;
canKeyFocus = true;
};
if(!isObject(GuiControlListPopupProfile)) new GuiControlProfile (GuiControlListPopupProfile)
{
opaque = true;
fillColor = "255 255 255";
fillColorHL = "128 128 128";
border = true;
borderColor = "0 0 0";
fontColor = "0 0 0";
fontColorHL = "255 255 255";
fontColorNA = "128 128 128";
textOffset = "0 2";
autoSizeWidth = false;
autoSizeHeight = true;
tab = true;
canKeyFocus = true;
bitmap = "gui/darkScroll";
hasBitmapArray = true;
};
if(!isObject(GuiTextArrayProfile)) new GuiControlProfile (GuiTextArrayProfile)
{
fontType = "Arial Bold";
fontColor = "0 0 0";
autoSizeWidth = true;
autoSizeHeight = true;
fontColorHL = "32 100 100";
fillColorHL = "200 200 200";
};
if(!isObject(GuiTextListProfile)) new GuiControlProfile (GuiTextListProfile)
{
fontType = "Arial Bold";
fontColor = "0 0 0";
autoSizeWidth = true;
autoSizeHeight = true;
} ;
if(!isObject(GuiTreeViewProfile)) new GuiControlProfile (GuiTreeViewProfile)
{
fontSize = 13; // dhc - trying a better fit...
fontColor = "0 0 0";
fontColorHL = "64 150 150";
};
if(!isObject(GuiCheckBoxProfile)) new GuiControlProfile (GuiCheckBoxProfile)
{
opaque = false;
fillColor = "232 232 232";
border = false;
borderColor = "0 0 0";
fontSize = 14;
fontColor = "0 0 0";
fontColorHL = "32 100 100";
fixedExtent = true;
justify = "left";
bitmap = "gui/darkScroll";
hasBitmapArray = true;
};
if(!isObject(GuiPopUpMenuProfile)) new GuiControlProfile (GuiPopUpMenuProfile)
{
opaque = true;
mouseOverSelected = true;
border = 4;
borderThickness = 2;
borderColor = "0 0 0";
fontSize = 14;
fontColor = "0 0 0";
fontColorHL = "32 100 100";
fontColorSEL = "32 100 100";
fixedExtent = true;
justify = "center";
bitmap = "gui/darkScroll";
hasBitmapArray = true;
};
if(!isObject(GuiEditorClassProfile)) new GuiControlProfile (GuiEditorClassProfile)
{
opaque = true;
fillColor = "232 232 232";
border = true;
borderColor = "0 0 0";
borderColorHL = "127 127 127";
fontColor = "0 0 0";
fontColorHL = "32 100 100";
fixedExtent = true;
justify = "center";
bitmap = "gui/darkScroll";
hasBitmapArray = true;
};
if(!isObject(LoadTextProfile)) new GuiControlProfile ("LoadTextProfile")
{
fontColor = "66 219 234";
autoSizeWidth = true;
autoSizeHeight = true;
};
if(!isObject(GuiMLTextProfile)) new GuiControlProfile ("GuiMLTextProfile")
{
fontColorLink = "255 96 96";
fontColorLinkHL = "0 0 255";
};
if(!isObject(GuiMLTextEditProfile)) new GuiControlProfile (GuiMLTextEditProfile)
{
fontColorLink = "255 96 96";
fontColorLinkHL = "0 0 255";
fillColor = "255 255 255";
fillColorHL = "128 128 128";
fontColor = "0 0 0";
fontColorHL = "255 255 255";
fontColorNA = "128 128 128";
autoSizeWidth = true;
autoSizeHeight = true;
tab = true;
canKeyFocus = true;
};
//--------------------------------------------------------------------------
// Console Window
if(!isObject(GuiConsoleProfile)) new GuiControlProfile ("GuiConsoleProfile")
{
fontType = ($platform $= "macos") ? "Courier New" : "Lucida Console";
fontSize = 12;
fontColor = "0 0 0";
fontColorHL = "130 130 130";
fontColorNA = "255 0 0";
fontColors[6] = "50 50 50";
fontColors[7] = "50 50 0";
fontColors[8] = "0 0 50";
fontColors[9] = "0 50 0";
};
if(!isObject(GuiProgressProfile)) new GuiControlProfile ("GuiProgressProfile")
{
opaque = false;
fillColor = "44 152 162 100";
border = true;
borderColor = "78 88 120";
};
if(!isObject(GuiProgressTextProfile)) new GuiControlProfile ("GuiProgressTextProfile")
{
fontColor = "0 0 0";
justify = "center";
};
//--------------------------------------------------------------------------
// Gui Inspector
if(!isObject(GuiInspectorTextEditProfile)) new GuiControlProfile ("GuiInspectorTextEditProfile")
{
opaque = true;
fillColor = "255 255 255";
fillColorHL = "128 128 128";
border = true;
borderColor = "0 0 0";
fontColor = "0 0 0";
fontColorHL = "255 255 255";
autoSizeWidth = false;
autoSizeHeight = true;
tab = false;
canKeyFocus = true;
};
//-------------------------------------- Cursors
//
if(!isObject(DefaultCursor)) new GuiCursor(DefaultCursor)
{
hotSpot = "1 1";
bitmapName = "gui/CUR_3darrow";
};

1827
scripts/GameGui.cs Normal file

File diff suppressed because it is too large Load diff

BIN
scripts/GameGui.cs.dso Normal file

Binary file not shown.

110
scripts/ISCredits.cs Normal file
View file

@ -0,0 +1,110 @@
//credits
function ISC_setDefaultCredits()
{
deleteVariables("$ISCredits*");
$ISCreditsCount = 0;
ISC_addSubHeading("<just:center>Third Team");
ISC_addSubHeading("<just:left> Project Leads/Coordinators");
ISC_addPerson("Shinji");
ISC_addSubHeading("Co-Project Lead");
ISC_addSubHeading("Scripting");
ISC_addPerson("Shinji");
ISC_addSubHeading("Artists");
ISC_addSubHeading("Mapping");
ISC_addPerson("Shinji");
ISC_addSubHeading("Audio");
ISC_addPerson("Shinji");
ISC_addSubHeading("Testers");
ISC_addPerson("kmjn");
ISC_addPerson("Minehem");
ISC_addSubHeading("<just:center>Second Team");
ISC_addSubHeading("<just:left>Project Leads");
ISC_addPerson("Shinji");
ISC_addPerson("Thalagyrt");
ISC_addSubHeading("Co-Project Lead");
ISC_addPerson("Phantom139");
ISC_addSubHeading("Scripting");
ISC_addPerson("KeyboardCat (Signal360)");
ISC_addPerson("Shinji");
ISC_addPerson("Thalagyrt");
ISC_addPerson("Tricon2 Elf");
ISC_addPerson("Phantom139");
ISC_addPerson("DarkDragonDX (Nyoka)");
ISC_addSubHeading("Artists");
ISC_addPerson("Zaxxman - Modeller");
ISC_addPerson("Tricon2 Elf - Textures");
ISC_addPerson("GADGET44 - Textures");
ISC_addSubHeading("Mapping");
ISC_addPerson("Shinji");
ISC_addSubHeading("Testers");
ISC_addPerson("Castiger");
ISC_addPerson("ChuckConnors");
ISC_addPerson("Chutriel");
ISC_addPerson("Damaso");
ISC_addPerson("Drakethesly");
ISC_addPerson("FURB");
ISC_addPerson("Iplop");
ISC_addPerson("LLJKH");
ISC_addPerson("m31ster");
ISC_addPerson("MightyZuex");
ISC_addPerson("Noodude");
ISC_addPerson("Zipperdude");
ISC_addSubHeading("<just:center>First Team");
ISC_addSubHeading("Original Team");
ISC_addPerson("Goodie - WorldCraft Modeller");
ISC_addPerson("Gul'Dar - WorldCraft Modeller and Mapper");
ISC_addPerson("HiVoltage - Modeller");
ISC_addPerson("JeremyIrons - Original Creator");
ISC_addPerson("Lone Predator - Skinner");
ISC_addPerson("Scourage - Coder");
ISC_addPerson("SoulSlayer - WorldCraft Modeller");
ISC_addPerson("Trident_RX - Head Coder, Creator");
ISC_addPerson("Toaster - Documentation");
ISC_addPerson("Twister - WorldCraft Modeller");
ISC_addPerson("Fina - Head Mapper, Worldcraft Modeller");
ISC_addPerson("Sirsteven - Lead Tester");
ISC_addPerson("Jardin De Cecile - Music Score");
}
function ISC_addSubHeading(%str)
{
$ISCredits[$ISCreditsCount++] = "<font:Verdana Bold:22>" @ %str;
$ISCreditsCount++;
}
function ISC_addPerson(%str)
{
$ISCredits[$ISCreditsCount] = "<font:Verdana:18>" @ %str;
$ISCreditsCount++;
}
function ISCredits::onWake(%this)
{
ISC_setDefaultCredits();
ISCredits_Text.setValue("");
for (%i = 0; %i < $ISCreditsCount; %i++)
ISCredits_Text.addText($ISCredits[%i] @ "\n", false);
}
loadGui("ISCredits");

BIN
scripts/ISCredits.cs.dso Normal file

Binary file not shown.

381
scripts/LaunchLanGui.cs Normal file
View file

@ -0,0 +1,381 @@
//--------------------------------------------------------
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();
}
}
//--------------------------------------------------------
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, "TRAINING" );
LaunchToolbarMenu.add( 0, "GAME" );
LaunchToolbarMenu.add( 2, "NEWS" );
}
else if ( $PlayingOnline )
{
LaunchToolbarMenu.add( 0, "GAME" );
LaunchToolbarMenu.add( 4, "EMAIL" );
LaunchToolbarMenu.add( 5, "CHAT" );
LaunchToolbarMenu.add( 6, "BROWSER" );
}
else
{
LaunchToolbarMenu.add( 1, "TRAINING" );
LaunchToolbarMenu.add( 0, "LAN GAME" );
}
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( "TRAINING", 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;
default: %launchGui = GameGui;
}
}
else
{
LaunchTabView.addLaunchTab( "TRAINING", 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 );
}

BIN
scripts/LaunchLanGui.cs.dso Normal file

Binary file not shown.

616
scripts/LobbyGui.cs Normal file
View file

@ -0,0 +1,616 @@
//------------------------------------------------------------------------------
//
// LobbyGui.cs
//
//------------------------------------------------------------------------------
$InLobby = false;
//------------------------------------------------------------------------------
function LobbyGui::onAdd( %this )
{
// Add the Player popup menu:
new GuiControl(LobbyPlayerActionDlg) {
profile = "GuiModelessDialogProfile";
horizSizing = "width";
vertSizing = "height";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
new ShellPopupMenu( LobbyPlayerPopup ) {
profile = "ShellPopupProfile";
position = "0 0";
extent = "0 0";
minExtent = "0 0";
visible = "1";
maxPopupHeight = "200";
noButtonStyle = "1";
};
};
}
//------------------------------------------------------------------------------
function LobbyGui::onWake( %this )
{
echo("LobbyGui::onWake("@ %this @");-lobbygui.cs");
//if ( !%this.initialized )
//{
// LobbyPlayerList.setSortColumn( $pref::Lobby::SortColumnKey );
// LobbyPlayerList.setSortIncreasing( $pref::Lobby::SortInc );
//
// %this.initialized = true;
//}
$InLobby = true;
//pop any key maps
moveMap.pop();
if ( isObject( passengerkeys ) )
passengerKeys.pop();
if ( isObject( observerBlockMap ) )
observerBlockMap.pop();
if ( isObject( observerMap ) )
observerMap.pop();
$enableDirectInput = "0";
deactivateDirectInput();
LobbyMessageVector.attach(HudMessageVector);
LobbyMessageScroll.scrollToBottom();
updateLobbyPlayerList();
LobbyServerName.setText( $clServerName );
%headerStyle = "<font:" @ $ShellLabelFont @ ":" @ $ShellFontSize @ "><color:00DC00>";
%statusText = "<spop><spush>" @ %headerStyle @ "MISSION TYPE:<spop>" SPC $clMissionType
NL "<spush>" @ %headerStyle @ "MISSION:<spop>" SPC $clMissionName
NL "<spush>" @ %headerStyle @ "OBJECTIVES:<spop>";
for ( %line = 0; %this.objLine[%line] !$= ""; %line++ )
%statusText = %statusText NL "<lmargin:10>* <lmargin:24>" @ %this.objLine[%line];
LobbyStatusText.setText( %statusText );
//fillLobbyVoteMenu();
}
//------------------------------------------------------------------------------
function LobbyGui::onSleep( %this )
{
if ( %this.playerDialogOpen )
LobbyPlayerPopup.forceClose();
LobbyVoteMenu.clear();
LobbyVoteMenu.mode = "";
LobbyCancelBtn.setVisible( false );
LobbyStatusText.setText( "" );
$InLobby = false;
}
//------------------------------------------------------------------------------
function lobbyDisconnect()
{
MessageBoxYesNo( "CONFIRM", "Are you sure you want to leave this game?", "lobbyLeaveGame();", "" );
}
//------------------------------------------------------------------------------
function lobbyLeaveGame()
{
Canvas.popDialog( LobbyGui );
Disconnect();
}
//------------------------------------------------------------------------------
function lobbyReturnToGame()
{
Canvas.setContent( PlayGui );
}
//------------------------------------------------------------------------------
function LobbyChatEnter::onEscape( %this )
{
%this.setValue( "" );
}
//------------------------------------------------------------------------------
function LobbyChatEnter::send( %this )
{
%text = %this.getValue();
if ( %text $= "" )
%text = " ";
commandToServer( 'MessageSent', %text );
%this.setValue( "" );
}
//------------------------------------------------------------------------------
function LobbyPlayerList::initColumns( %this )
{
%this.clear();
%this.clearColumns();
%this.addColumn( 0, " ", 24, 24, 24, "center" ); // Flag column
%this.addColumn( 6, "lobby_headset", 36, 36, 36, "headericon" ); // Voice Com column
%this.addColumn( 1, "Player", $pref::Lobby::Column1, 50, 200 );
if ( $clTeamCount > 1 )
%this.addColumn( 2, "Team", $pref::Lobby::Column2, 50, 200 );
%this.addColumn( 3, "Score", $pref::Lobby::Column3, 25, 200, "numeric center" );
%this.addColumn( 4, "Ping", $pref::Lobby::Column4, 25, 200, "numeric center" );
%this.addColumn( 5, "PL", $pref::Lobby::Column5, 25, 200, "numeric center" );
commandToServer( 'getScores' );
}
//------------------------------------------------------------------------------
function LobbyPlayerList::onColumnResize( %this, %col, %size )
{
$pref::Lobby::Column[%this.getColumnKey( %col )] = %size;
}
//------------------------------------------------------------------------------
function LobbyPlayerList::onSetSortKey( %this, %key, %increasing )
{
$pref::Lobby::SortColumnKey = %key;
$pref::Lobby::SortInc = %increasing;
}
//------------------------------------------------------------------------------
function updateLobbyPlayerList()
{
if ( $InLobby )
{
// Let the server know we want an update:
commandToServer( 'getScores' );
schedule( 4000, 0, updateLobbyPlayerList );
}
}
//------------------------------------------------------------------------------
function lobbyUpdatePlayer( %clientId )
{
%player = $PlayerList[%clientId];
if ( !isObject( %player ) )
{
warn( "lobbyUpdatePlayer( " @ %clientId @ " ) - there is no client object with that id!" );
return;
}
// Build the text:
if ( %player.isSuperAdmin )
%tag = "SA";
else if ( %player.isAdmin )
%tag = "A";
else if ( %player.isBot )
%tag = "B";
else
%tag = " ";
if ( %player.canListen )
{
if ( %player.voiceEnabled )
{
%voiceIcons = "lobby_icon_speak";
if ( %player.isListening )
%voiceIcons = %voiceIcons @ ":lobby_icon_listen";
}
else
%voiceIcons = %player.isListening ? "lobby_icon_listen" : "";
}
else
%voiceIcons = "shll_icon_timedout";
if ( $clTeamCount > 1 )
{
if ( %player.teamId == 0 )
%teamName = "Observer";
else
%teamName = $clTeamScore[%player.teamId, 0] $= "" ? "-" : $clTeamScore[%player.teamId, 0];
%text = %tag TAB %voiceIcons TAB %player.name TAB %teamName TAB %player.score TAB %player.ping TAB %player.packetLoss;
}
else
%text = %tag TAB %voiceIcons TAB %player.name TAB %player.score TAB %player.ping TAB %player.packetLoss;
if ( LobbyPlayerList.getRowNumById( %clientId ) == -1 )
LobbyPlayerList.addRow( %clientId, %text );
else
LobbyPlayerList.setRowById( %clientId, %text );
if ( $InLobby )
LobbyPlayerList.sort();
}
//------------------------------------------------------------------------------
function lobbyRemovePlayer( %clientId )
{
LobbyPlayerList.removeRowById( %clientId );
}
//------------------------------------------------------------------------------
function LobbyPlayerList::onRightMouseDown( %this, %column, %row, %mousePos )
{
// Open the action menu:
%clientId = %this.getRowId( %row );
LobbyPlayerPopup.player = $PlayerList[%clientId];
if ( LobbyPlayerPopup.player !$= "" )
{
LobbyPlayerPopup.position = %mousePos;
Canvas.pushDialog( LobbyPlayerActionDlg );
LobbyPlayerPopup.forceOnAction();
}
}
//------------------------------------------------------------------------------
function LobbyPlayerActionDlg::onWake( %this )
{
LobbyGui.playerDialogOpen = true;
fillPlayerPopupMenu();
}
//------------------------------------------------------------------------------
function LobbyPlayerActionDlg::onSleep( %this )
{
LobbyGui.playerDialogOpen = false;
}
//------------------------------------------------------------------------------
function LobbyPlayerPopup::onSelect( %this, %id, %text )
{
return; // not used in T2rpg
//the id's for these are used in DefaultGame::sendGamePlayerPopupMenu()...
//mute: 1
//admin: 2
//kick: 3
//ban: 4
//force observer: 5
//switch team: 6
switch( %id )
{
case 1: // Mute/Unmute
togglePlayerMute(%this.player.clientId);
case 2: // Admin
MessageBoxYesNo( "CONFIRM", "Are you sure you want to make " @ %this.player.name @ " an admin?",
"lobbyPlayerVote( VoteAdminPlayer, \"ADMIN player\", " @ %this.player.clientId @ " );" );
case 3: // Kick
MessageBoxYesNo( "CONFIRM", "Are you sure you want to kick " @ %this.player.name @ "?",
"lobbyPlayerVote( VoteKickPlayer, \"KICK player\", " @ %this.player.clientId @ " );" );
case 4: // Ban
MessageBoxYesNo( "CONFIRM", "Are you sure you want to ban " @ %this.player.name @ "?",
"lobbyPlayerVote( BanPlayer, \"BAN player\", " @ %this.player.clientId @ " );" );
case 5: // force observer
forceToObserver(%this.player.clientId);
case 6: //change team 1
changePlayersTeam(%this.player.clientId, 1);
case 7: //change team 2
changePlayersTeam(%this.player.clientId, 2);
case 8:
adminAddPlayerToGame(%this.player.clientId);
case 9: // enable/disable voice communication
togglePlayerVoiceCom( %this.player );
case 10:
confirmAdminListAdd( %this.player, false );
case 11:
confirmAdminListAdd( %this.player, true );
}
Canvas.popDialog( LobbyPlayerActionDlg );
}
function confirmAdminListAdd( %client, %super )
{
if( %super )
MessageBoxYesNo( "CONFIRM", "Are you sure you want to add " @ %client.name @ " to the server super admin list?", "toSuperList( " @ %client.clientId @ " );" );
else
MessageBoxYesNo( "CONFIRM", "Are you sure you want to add " @ %client.name @ " to the server admin list?", "toAdminList( " @ %client.clientId @ " );" );
}
function toSuperList( %client )
{
commandToServer( 'AddToSuperAdminList', %client );
}
function toAdminList( %client )
{
commandToServer( 'AddToAdminList', %client );
}
//------------------------------------------------------------------------------
function LobbyPlayerPopup::onCancel( %this )
{
Canvas.popDialog( LobbyPlayerActionDlg );
}
//------------------------------------------------------------------------------
function togglePlayerMute(%client)
{
commandToServer( 'togglePlayerMute', %client );
}
//------------------------------------------------------------------------------
function togglePlayerVoiceCom( %playerRep )
{
commandToServer( 'ListenTo', %playerRep.clientId, !%playerRep.voiceEnabled, true );
}
//------------------------------------------------------------------------------
function forceToObserver( %client )
{
commandToServer( 'forcePlayerToObserver', %client );
}
function AdminAddPlayerToGame(%client)
{
CommandToServer( 'clientAddToGame', %client );
}
//------------------------------------------------------------------------------
function changePlayersTeam(%client, %team)
{
commandToServer( 'changePlayersTeam', %client, %team);
}
//------------------------------------------------------------------------------
function fillLobbyVoteMenu()
{
LobbyVoteMenu.key++;
LobbyVoteMenu.clear();
LobbyVoteMenu.tourneyChoose = 0;
commandToServer( 'GetVoteMenu', LobbyVoteMenu.key );
}
//------------------------------------------------------------------------------
function fillLobbyTeamMenu()
{
LobbyVoteMenu.key++;
LobbyVoteMenu.clear();
LobbyVoteMenu.mode = "team";
commandToServer( 'GetTeamList', LobbyVoteMenu.key );
LobbyCancelBtn.setVisible( true );
}
//------------------------------------------------------------------------------
function fillPlayerPopupMenu()
{
LobbyPlayerPopup.key++;
LobbyPlayerPopup.clear();
LobbyPlayerPopup.add(LobbyPlayerPopup.player.name, 0);
commandToServer( 'GetPlayerPopupMenu', LobbyPlayerPopup.player.clientId, LobbyPlayerPopup.key );
}
//------------------------------------------------------------------------------
function fillLobbyMissionTypeMenu()
{
LobbyVoteMenu.key++;
LobbyVoteMenu.clear();
LobbyVoteMenu.mode = "type";
commandToServer( 'GetMissionTypes', LobbyVoteMenu.key );
LobbyCancelBtn.setVisible( true );
}
//------------------------------------------------------------------------------
function fillLobbyMissionMenu( %type, %typeName )
{
LobbyVoteMenu.key++;
LobbyVoteMenu.clear();
LobbyVoteMenu.mode = "mission";
LobbyVoteMenu.missionType = %type;
LobbyVoteMenu.typeName = %typeName;
commandToServer( 'GetMissionList', LobbyVoteMenu.key, %type );
}
//------------------------------------------------------------------------------
function fillLobbyTimeLimitMenu()
{
LobbyVoteMenu.key++;
LobbyVoteMenu.clear();
LobbyVoteMenu.mode = "timeLimit";
commandToServer( 'GetTimeLimitList', LobbyVoteMenu.key );
LobbyCancelBtn.setVisible( true );
}
//------------------------------------------------------------------------------
addMessageCallback( 'MsgVoteItem', handleVoteItemMessage );
addMessageCallback( 'MsgPlayerPopupItem', handlePlayerPopupMessage );
addMessageCallback( 'MsgVotePassed', handleVotePassedMessage );
addMessageCallback( 'MsgVoteFailed', handleVoteFailedMessage );
addMessageCallback( 'MsgAdminPlayer', handleAdminPlayerMessage );
addMessageCallback( 'MsgAdminAdminPlayer', handleAdminAdminPlayerMessage );
addMessageCallback( 'MsgSuperAdminPlayer', handleSuperAdminPlayerMessage );
addMessageCallback( 'MsgAdminForce', handleAdminForceMessage );
//------------------------------------------------------------------------------
function handleAdminForceMessage()
{
alxPlay(AdminForceSound, 0, 0, 0);
}
//------------------------------------------------------------------------------
function handleAdminAdminPlayerMessage( %msgType, %msgString, %client )
{
%player = $PlayerList[%client];
if(%player)
%player.isAdmin = true;
alxPlay(AdminForceSound, 0, 0, 0);
}
//------------------------------------------------------------------------------
function handleAdminPlayerMessage( %msgType, %msgString, %client )
{
%player = $PlayerList[%client];
if(%player)
%player.isAdmin = true;
alxPlay(VotePassSound, 0, 0, 0);
}
//------------------------------------------------------------------------------
function handleSuperAdminPlayerMessage( %msgType, %msgString, %client )
{
%player = $PlayerList[%client];
if(%player)
{
%player.isSuperAdmin = true;
%player.isAdmin = true;
}
alxPlay(AdminForceSound, 0, 0, 0);
}
//------------------------------------------------------------------------------
function handleVoteItemMessage( %msgType, %msgString, %key, %voteName, %voteActionMsg, %voteText, %sort )
{
if ( %key != LobbyVoteMenu.key )
return;
%index = LobbyVoteMenu.rowCount();
LobbyVoteMenu.addRow( %index, detag( %voteText ) );
if ( %sort )
LobbyVoteMenu.sort( 0 );
$clVoteCmd[%index] = detag( %voteName );
$clVoteAction[%index] = detag( %voteActionMsg );
}
//------------------------------------------------------------------------------
function handlePlayerPopupMessage( %msgType, %msgString, %key, %voteName, %voteActionMsg, %voteText, %popupEntryId )
{
if ( %key != LobbyPlayerPopup.key )
return;
LobbyPlayerPopup.add( " " @ detag( %voteText ), %popupEntryId );
}
//------------------------------------------------------------------------------
function handleVotePassedMessage( %msgType, %msgString, %voteName, %voteText )
{
if ( $InLobby )
fillLobbyVoteMenu();
alxPlay(VotePassSound, 0, 0, 0);
}
//------------------------------------------------------------------------------
function handleVoteFailedMessage( %msgType, %msgString, %voteName, %voteText )
{
if ( $InLobby )
fillLobbyVoteMenu();
alxPlay(VoteNotPassSound, 0, 0, 0);
}
//------------------------------------------------------------------------------
function lobbyVote()
{
%id = LobbyVoteMenu.getSelectedId();
%text = LobbyVoteMenu.getRowTextById( %id );
switch$ ( LobbyVoteMenu.mode )
{
case "": // Default case...
// Test for special cases:
switch$ ( $clVoteCmd[%id] )
{
case "JoinGame":
CommandToServer( 'clientJoinGame' );
schedule( 100, 0, lobbyReturnToGame );
return;
case "ChooseTeam":
fillLobbyTeamMenu();
return;
case "VoteTournamentMode":
LobbyVoteMenu.tourneyChoose = 1;
fillLobbyMissionTypeMenu();
return;
case "VoteMatchStart":
startNewVote( "VoteMatchStart" );
schedule( 100, 0, lobbyReturnToGame );
return;
case "MakeObserver":
commandToServer( 'ClientMakeObserver' );
schedule( 100, 0, lobbyReturnToGame );
return;
case "VoteChangeMission":
fillLobbyMissionTypeMenu();
return;
case "VoteChangeTimeLimit":
fillLobbyTimeLimitMenu();
return;
case "Addbot":
commandToServer( 'addBot' );
return;
}
case "team":
commandToServer( 'ClientJoinTeam', %id++ );
LobbyVoteMenu.reset();
return;
case "type":
fillLobbyMissionMenu( $clVoteCmd[%id], %text );
return;
case "mission":
if( !LobbyVoteMenu.tourneyChoose )
{
startNewVote( "VoteChangeMission",
%text, // Mission display name
LobbyVoteMenu.typeName, // Mission type display name
$clVoteCmd[%id], // Mission id
LobbyVoteMenu.missionType ); // Mission type id
}
else
{
startNewVote( "VoteTournamentMode",
%text, // Mission display name
LobbyVoteMenu.typeName, // Mission type display name
$clVoteCmd[%id], // Mission id
LobbyVoteMenu.missionType ); // Mission type id
LobbyVoteMenu.tourneyChoose = 0;
}
LobbyVoteMenu.reset();
return;
case "timeLimit":
startNewVote( "VoteChangeTimeLimit", $clVoteCmd[%id] );
LobbyVoteMenu.reset();
return;
}
startNewVote( $clVoteCmd[%id], $clVoteAction[%id] );
fillLobbyVoteMenu();
}
//------------------------------------------------------------------------------
function LobbyVoteMenu::reset( %this )
{
%this.mode = "";
%this.tourneyChoose = 0;
LobbyCancelBtn.setVisible( false );
fillLobbyVoteMenu();
}
//------------------------------------------------------------------------------
function lobbyPlayerVote(%voteType, %actionMsg, %playerId)
{
startNewVote(%voteType, %playerId, 0, 0, 0, true);
fillLobbyVoteMenu();
}

BIN
scripts/LobbyGui.cs.dso Normal file

Binary file not shown.

2761
scripts/OptionsDlg.cs Normal file

File diff suppressed because it is too large Load diff

BIN
scripts/OptionsDlg.cs.dso Normal file

Binary file not shown.

33
scripts/PantherXL.cs Normal file
View file

@ -0,0 +1,33 @@
//--------------------------------------------------------------------------
//
// PantherXL.cs
//
// These are the default control bindings for the Mad Catz Panther XL Pro
//
//--------------------------------------------------------------------------
moveMap.bind( joystick, xaxis, D, "-0.1 0.1", joystickMoveX );
moveMap.bind( joystick, yaxis, D, "-0.1 0.1", joystickMoveY );
moveMap.bind( joystick, rxaxis, I, joystickPitch );
moveMap.bind( joystick, ryaxis, joystickYaw );
moveMap.bind( joystick, button0, mouseFire );
moveMap.bind( joystick, button1, mouseJet );
moveMap.bindCmd( joystick, button2, "setFov(30);", "setFov($pref::player::defaultFOV);" );
moveMap.bind( joystick, button3, jump );
moveMap.bindCmd( joystick, upov, "use(Plasma);", "" );
moveMap.bindCmd( joystick, rpov, "use(Chaingun);", "" );
moveMap.bindCmd( joystick, dpov, "use(Disc);", "" );
moveMap.bindCmd( joystick, lpov, "use(GrenadeLauncher);", "" );
moveMap.bindCmd( joystick, button4, "use(SniperRifle);", "" ); // Second POV buttons...
moveMap.bindCmd( joystick, button5, "use(ELFGun);", "" );
moveMap.bindCmd( joystick, button6, "use(Mortar);", "" );
moveMap.bindCmd( joystick, button7, "use(MissileLauncher);", "" );
moveMap.bindCmd( joystick, button8, "use(RepairKit);", "" );
moveMap.bind( joystick, button9, toggleFirstPerson );
moveMap.bindCmd( joystick, button10, "prevWeapon();", "" );
moveMap.bindCmd( joystick, button11, "use(Backpack);", "" );
moveMap.bindCmd( joystick, button12, "nextWeapon();", "" );

110
scripts/PathEdit.cs Normal file
View file

@ -0,0 +1,110 @@
//
// PathEdit.cs
//
function PathEdit::initInteriorEditor()
{
echo("interior editor startup...");
aiEdit.setPathMode();
new ActionMap(PathEditMap);
PathEditMap.bindCmd(keyboard, g, "PathEdit::grabNode();", "");
PathEditMap.bindCmd(keyboard, f, "PathEdit::dropNode();", "");
PathEditMap.bindCmd(keyboard, u, "PathEdit::undoNodeGrab();", "");
PathEditMap.bindCmd(keyboard, t, "PathEdit::createEdge();", "");
PathEditMap.bindCmd(keyboard, r, "PathEdit::connectEdge();", "");
PathEditMap.bindCmd(keyboard, "alt r", "PathEdit::grabEdge();", "");
PathEditMap.bindCmd(keyboard, "alt t", "PathEdit::deleteEdge();", "");
PathEditMap.bindCmd(keyboard, "alt g", "PathEdit::deleteNode();", "");
PathEditMap.bindCmd(keyboard, "alt d", "PathEdit::beginEnd();", "");
PathEditMap.bindCmd(keyboard, "j", "PathEdit::setJet();", "");
PathEditMap.bindCmd(keyboard, "alt j", "PathEdit::setNotJet();", "");
PathEditMap.bindCmd(keyboard, "alt s", "PathEdit::saveGraph();", "");
PathEditMap.bindCmd(keyboard, "h", "PathEdit::createNode();", "");
PathEditMap.push();
}
//------------------------------------------------------------------------------
function PathEdit::closeInteriorEdit()
{
aiEdit.setUninitMode();
PathEditMap.pop();
}
//------------------------------------------------------------------------------
function PathEdit::grabNode()
{
aiEdit.grabNode();
}
//-------------------------------------------------
function PathEdit::createNode()
{
aiEdit.createNode();
}
//-------------------------------------------------
function PathEdit::grabEdge()
{
aiEdit.grabEdge();
}
//-------------------------------------------------
function PathEdit::dropNode()
{
aiEdit.placeNode();
}
//-------------------------------------------------
function PathEdit::undoNodeGrab()
{
aiEdit.putBackNode();
}
//-------------------------------------------------
function PathEdit::deleteNode()
{
aiEdit.deleteNode();
}
//-------------------------------------------------
function PathEdit::deleteEdge()
{
aiEdit.deleteEdge();
}
//-------------------------------------------------
function PathEdit::createEdge()
{
aiEdit.createEdge();
}
//-------------------------------------------------
function PathEdit::connectEdge()
{
aiEdit.connectEdge();
}
//-------------------------------------------------
function PathEdit::setJet()
{
aiEdit.setJetting(true);
}
//-------------------------------------------------
function PathEdit::setNotJet()
{
aiEdit.setJetting(false);
}
//-------------------------------------------------

726
scripts/RPGClient.cs Normal file
View file

@ -0,0 +1,726 @@
//exec("scripts/rpgitems.cs");
exec("scripts/version.cs");
function clientCmdMissionStartPhase3(%seq, %missionName)
{
$MSeq = %seq;
//Reset Inventory Hud...
if($Hud['RPGinventoryScreen'] !$= "")
{
%favList = $Hud['RPGinventoryScreen'].data[0, 1].type TAB $Hud['RPGinventoryScreen'].data[0, 1].getValue();
for ( %i = 1; %i < $Hud['RPGinventoryScreen'].count; %i++ )
if($Hud['RPGinventoryScreen'].data[%i, 1].getValue() $= invalid)
%favList = %favList TAB $Hud['RPGinventoryScreen'].data[%i, 1].type TAB "EMPTY";
else
%favList = %favList TAB $Hud['RPGinventoryScreen'].data[%i, 1].type TAB $Hud['RPGinventoryScreen'].data[%i, 1].getValue();
commandToServer( 'setClientFav', %favList );
}
else
commandToServer( 'setClientFav', $pref::Favorite[$pref::FavCurrentSelect]);
// needed?
$MissionName = %missionName;
//commandToServer( 'getScores' );
// only show dialog if actually lights
if(lightScene("sceneLightingComplete", $LaunchMode $= "SceneLight" ? "forceWritable" : ""))
{
error("beginning SceneLighting....");
schedule(1, 0, "updateLightingProgress");
$lightingMission = true;
LoadingProgress.setValue( 0 );
DB_LoadingProgress.setValue( 0 );
LoadingProgressTxt.setValue( "LIGHTING MISSION" );
DB_LoadingProgressTxt.setValue( "LIGHTING MISSION" );
$missionLightStarted = true;
Canvas.repaint();
}
deletevariables("$inv::*");
deletevariables("$menu::*");
}
function logecho(%something)
{
//annoying
}
function rpgtoggle()
{
if($rpgbottomPrintActive)
clientCmdCloseRPGbottomPrint();
}
//--------------------------------------------------------- gui auto downloader!
function clientCmdStartRecastDelayCountdown(%value)
{
if(isobject(rpgrecastdelay))
{
rpgrecastdelay.text = %value / 1000;
rpgrecastdelay.setvalue("Delay:" SPC %value / 1000);
rpgrecastdelay.schedule(10, "tickdown", mfloor(%value/10)-1);
}
}
function RPGrecastDelay::tickdown(%this, %value)
{
if(%value <= 0)
{
rpgrecastdelay.text = 0;
%this.setValue("Delay: 0.00");
return;
}
%this.schedule(10, "tickdown", %value-1);
%txt = %value / 100;
if((%value % 100) == 0)
%extra = ".0";
else
%extra = "";
if((%value % 10) == 0)
%extra = %extra @ "0";
%this.setValue("Delay:" SPC %txt @ %extra);
}
function clientCmdExecGUI(%file)
{
exec("gui/" @ %file @ ".cs");//whoo hoo!
}
//------------------------------------------------------------------------------
function clientCmdRPGPlayMusic(%type)
{
//play us some music!
//count off how many and take a random number
for(%i = 0; $music::file[%type, %i] !$= ""; %i++)
{}
//%i is how many.
//echo(%type);
if(%i != 0)//Tribes 2 will CTD if %i = 0; Check this
%i = 100*getRandom() % %i;//take modulus. this way it gives us a number from 0 to %i - 1. (if %i is 3, then it will give us a number from 0 to 2).
else
%i = 0;
%music = $music::file[%type, %i];
clientCMDPlayMusic(%music);//play the song!
}
function placeBeacon( %val )
{
if(%val)
{
OpenGuildManagementGUI();
}
}
function setupObjHud(%gameType)
{
return;
switch$ (%gameType)
{
case BountyGame:
// set separators
objectiveHud.setSeparators("56 156");
objectiveHud.disableHorzSeparator();
// Your score label ("SCORE")
objectiveHud.scoreLabel = new GuiTextCtrl() {
profile = "GuiTextObjGreenLeftProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "4 3";
extent = "50 16";
visible = "1";
text = "SCORE";
};
// Your score
objectiveHud.yourScore = new GuiTextCtrl() {
profile = "GuiTextObjGreenCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "60 3";
extent = "90 16";
visible = "1";
};
// Target label ("TARGET")
objectiveHud.targetLabel = new GuiTextCtrl() {
profile = "GuiTextObjGreenLeftProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "4 19";
extent = "50 16";
visible = "1";
text = "TARGET";
};
// your target's name
objectiveHud.yourTarget = new GuiTextCtrl() {
profile = "GuiTextObjGreenCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "60 19";
extent = "90 16";
visible = "1";
};
objectiveHud.add(objectiveHud.scoreLabel);
objectiveHud.add(objectiveHud.yourScore);
objectiveHud.add(objectiveHud.targetLabel);
objectiveHud.add(objectiveHud.yourTarget);
case CnHGame:
// set separators
objectiveHud.setSeparators("96 162 202");
objectiveHud.enableHorzSeparator();
// Team names
objectiveHud.teamName[1] = new GuiTextCtrl() {
profile = "GuiTextObjGreenLeftProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "4 3";
extent = "90 16";
visible = "1";
};
objectiveHud.teamName[2] = new GuiTextCtrl() {
profile = "GuiTextObjHudLeftProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "4 19";
extent = "90 16";
visible = "1";
};
// Team scores
objectiveHud.teamScore[1] = new GuiTextCtrl() {
profile = "GuiTextObjGreenCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "105 3";
extent = "50 16";
visible = "1";
};
objectiveHud.teamScore[2] = new GuiTextCtrl() {
profile = "GuiTextObjHudCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "105 19";
extent = "50 16";
visible = "1";
};
// Hold label ("HOLD")
objectiveHud.holdLabel[1] = new GuiTextCtrl() {
profile = "GuiTextObjGreenCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "165 3";
extent = "35 16";
visible = "1";
text = "HOLD";
};
objectiveHud.holdLabel[2] = new GuiTextCtrl() {
profile = "GuiTextObjHudCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "165 19";
extent = "35 16";
visible = "1";
text = "HOLD";
};
// number of points held
objectiveHud.numHeld[1] = new GuiTextCtrl() {
profile = "GuiTextObjGreenCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "205 3";
extent = "30 16";
visible = "1";
};
objectiveHud.numHeld[2] = new GuiTextCtrl() {
profile = "GuiTextObjHudCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "205 19";
extent = "30 16";
visible = "1";
};
for(%i = 1; %i <= 2; %i++)
{
objectiveHud.add(objectiveHud.teamName[%i]);
objectiveHud.add(objectiveHud.teamScore[%i]);
objectiveHud.add(objectiveHud.holdLabel[%i]);
objectiveHud.add(objectiveHud.numHeld[%i]);
}
case CTFGame:
// set separators
objectiveHud.setSeparators("72 97 130");
objectiveHud.enableHorzSeparator();
// Team names
objectiveHud.teamName[1] = new GuiTextCtrl() {
profile = "GuiTextObjGreenLeftProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "4 3";
extent = "65 16";
visible = "1";
};
objectiveHud.teamName[2] = new GuiTextCtrl() {
profile = "GuiTextObjHudLeftProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "4 19";
extent = "65 16";
visible = "1";
};
// Team scores
objectiveHud.teamScore[1] = new GuiTextCtrl() {
profile = "GuiTextObjGreenCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 3";
extent = "20 16";
visible = "1";
};
objectiveHud.teamScore[2] = new GuiTextCtrl() {
profile = "GuiTextObjHudCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 19";
extent = "20 16";
visible = "1";
};
// Flag label ("FLAG")
objectiveHud.flagLabel[1] = new GuiTextCtrl() {
profile = "GuiTextObjGreenCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "100 3";
extent = "30 16";
visible = "1";
text = "FLAG";
};
objectiveHud.flagLabel[2] = new GuiTextCtrl() {
profile = "GuiTextObjHudCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "100 19";
extent = "30 16";
visible = "1";
text = "FLAG";
};
// flag location (at base/in field/player carrying it)
objectiveHud.flagLocation[1] = new GuiTextCtrl() {
profile = "GuiTextObjGreenLeftProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "135 3";
extent = "105 16";
visible = "1";
};
objectiveHud.flagLocation[2] = new GuiTextCtrl() {
profile = "GuiTextObjHudLeftProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "135 19";
extent = "105 16";
visible = "1";
};
for(%i = 1; %i <= 2; %i++)
{
objectiveHud.add(objectiveHud.teamName[%i]);
objectiveHud.add(objectiveHud.teamScore[%i]);
objectiveHud.add(objectiveHud.flagLabel[%i]);
objectiveHud.add(objectiveHud.flagLocation[%i]);
}
case DMGame:
// set separators
objectiveHud.setSeparators("56 96 156");
objectiveHud.disableHorzSeparator();
// Your score label ("SCORE")
objectiveHud.scoreLabel = new GuiTextCtrl() {
profile = "GuiTextObjGreenLeftProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "4 3";
extent = "50 16";
visible = "1";
text = "SCORE";
};
// Your score
objectiveHud.yourScore = new GuiTextCtrl() {
profile = "GuiTextObjGreenCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "60 3";
extent = "30 16";
visible = "1";
};
// Your kills label ("KILLS")
objectiveHud.killsLabel = new GuiTextCtrl() {
profile = "GuiTextObjGreenLeftProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "4 19";
extent = "50 16";
visible = "1";
text = "KILLS";
};
// Your kills
objectiveHud.yourKills = new GuiTextCtrl() {
profile = "GuiTextObjGreenCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "60 19";
extent = "30 16";
visible = "1";
};
// Your deaths label ("DEATHS")
objectiveHud.deathsLabel = new GuiTextCtrl() {
profile = "GuiTextObjGreenLeftProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "100 19";
extent = "50 16";
visible = "1";
text = "DEATHS";
};
// Your deaths
objectiveHud.yourDeaths = new GuiTextCtrl() {
profile = "GuiTextObjGreenCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "160 19";
extent = "30 16";
visible = "1";
};
objectiveHud.add(objectiveHud.scoreLabel);
objectiveHud.add(objectiveHud.yourScore);
objectiveHud.add(objectiveHud.killsLabel);
objectiveHud.add(objectiveHud.yourKills);
objectiveHud.add(objectiveHud.deathsLabel);
objectiveHud.add(objectiveHud.yourDeaths);
case DnDGame:
case HuntersGame:
// set separators
objectiveHud.setSeparators("96 132");
objectiveHud.disableHorzSeparator();
// Your score label ("SCORE")
objectiveHud.scoreLabel = new GuiTextCtrl() {
profile = "GuiTextObjGreenLeftProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "4 3";
extent = "90 16";
visible = "1";
text = "SCORE";
};
// Your score
objectiveHud.yourScore = new GuiTextCtrl() {
profile = "GuiTextObjGreenCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "100 3";
extent = "30 16";
visible = "1";
};
// flags label ("FLAGS")
objectiveHud.flagLabel = new GuiTextCtrl() {
profile = "GuiTextObjGreenLeftProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "4 19";
extent = "90 16";
visible = "1";
text = "FLAGS";
};
// number of flags
objectiveHud.yourFlags = new GuiTextCtrl() {
profile = "GuiTextObjGreenCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "100 19";
extent = "30 16";
visible = "1";
};
objectiveHud.add(objectiveHud.scoreLabel);
objectiveHud.add(objectiveHud.yourScore);
objectiveHud.add(objectiveHud.flagLabel);
objectiveHud.add(objectiveHud.yourFlags);
case RabbitGame:
// set separators
objectiveHud.setSeparators("56 156");
objectiveHud.disableHorzSeparator();
// Your score label ("SCORE")
objectiveHud.scoreLabel = new GuiTextCtrl() {
profile = "GuiTextObjGreenLeftProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "4 3";
extent = "50 16";
visible = "1";
text = "SCORE";
};
// Your score
objectiveHud.yourScore = new GuiTextCtrl() {
profile = "GuiTextObjGreenCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "60 3";
extent = "90 16";
visible = "1";
};
// Rabbit label ("RABBIT")
objectiveHud.rabbitLabel = new GuiTextCtrl() {
profile = "GuiTextObjGreenLeftProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "4 19";
extent = "50 16";
visible = "1";
text = "RABBIT";
};
// rabbit name
objectiveHud.rabbitName = new GuiTextCtrl() {
profile = "GuiTextObjGreenCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "60 19";
extent = "90 16";
visible = "1";
};
objectiveHud.add(objectiveHud.scoreLabel);
objectiveHud.add(objectiveHud.yourScore);
objectiveHud.add(objectiveHud.rabbitLabel);
objectiveHud.add(objectiveHud.rabbitName);
case SiegeGame:
// set separators
objectiveHud.setSeparators("96 122 177");
objectiveHud.enableHorzSeparator();
// Team names
objectiveHud.teamName[1] = new GuiTextCtrl() {
profile = "GuiTextObjGreenLeftProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "4 3";
extent = "90 16";
visible = "1";
};
objectiveHud.teamName[2] = new GuiTextCtrl() {
profile = "GuiTextObjHudLeftProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "4 19";
extent = "90 16";
visible = "1";
};
// Team scores
objectiveHud.teamScore[1] = new GuiTextCtrl() {
profile = "GuiTextObjGreenCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "100 3";
extent = "20 16";
visible = "1";
};
objectiveHud.teamScore[2] = new GuiTextCtrl() {
profile = "GuiTextObjGreenCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "100 19";
extent = "20 16";
visible = "1";
};
// Role label ("PROTECT" or "DESTROY")
objectiveHud.roleLabel[1] = new GuiTextCtrl() {
profile = "GuiTextObjGreenCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "125 3";
extent = "50 16";
visible = "1";
};
objectiveHud.roleLabel[2] = new GuiTextCtrl() {
profile = "GuiTextObjHudCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "125 19";
extent = "50 16";
visible = "1";
};
// number of objectives to protect/destroy
objectiveHud.objectives[1] = new GuiTextCtrl() {
profile = "GuiTextObjGreenCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "180 3";
extent = "60 16";
visible = "1";
};
objectiveHud.objectives[2] = new GuiTextCtrl() {
profile = "GuiTextObjHudCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "180 19";
extent = "60 16";
visible = "1";
};
for(%i = 1; %i <= 2; %i++)
{
objectiveHud.add(objectiveHud.teamName[%i]);
objectiveHud.add(objectiveHud.teamScore[%i]);
objectiveHud.add(objectiveHud.roleLabel[%i]);
objectiveHud.add(objectiveHud.objectives[%i]);
}
case TeamHuntersGame:
// set separators
objectiveHud.setSeparators("57 83 197");
objectiveHud.enableHorzSeparator();
// flags label ("FLAGS")
objectiveHud.flagLabel = new GuiTextCtrl() {
profile = "GuiTextObjGreenLeftProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "4 3";
extent = "50 16";
visible = "1";
text = "FLAGS";
};
// number of flags
objectiveHud.yourFlags = new GuiTextCtrl() {
profile = "GuiTextObjGreenCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "60 3";
extent = "20 16";
visible = "1";
};
// team names
objectiveHud.teamName[1] = new GuiTextCtrl() {
profile = "GuiTextObjGreenCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "85 3";
extent = "110 16";
visible = "1";
};
objectiveHud.teamName[2] = new GuiTextCtrl() {
profile = "GuiTextObjHudCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "85 19";
extent = "110 16";
visible = "1";
};
// team scores
objectiveHud.teamScore[1] = new GuiTextCtrl() {
profile = "GuiTextObjGreenCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "200 3";
extent = "40 16";
visible = "1";
};
objectiveHud.teamScore[2] = new GuiTextCtrl() {
profile = "GuiTextObjHudCenterProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "200 19";
extent = "40 16";
visible = "1";
};
objectiveHud.add(objectiveHud.flagLabel);
objectiveHud.add(objectiveHud.yourFlags);
for(%i = 1; %i <= 2; %i++)
{
objectiveHud.add(objectiveHud.teamName[%i]);
objectiveHud.add(objectiveHud.teamScore[%i]);
}
case SinglePlayerGame:
// no separator lines
objectiveHud.setSeparators("");
objectiveHud.disableHorzSeparator();
// two lines to print objectives
objectiveHud.spText[1] = new GuiTextCtrl() {
profile = "GuiTextObjHudLeftProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "4 3";
extent = "235 16";
visible = "1";
};
objectiveHud.spText[2] = new GuiTextCtrl() {
profile = "GuiTextObjHudLeftProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "4 19";
extent = "235 16";
visible = "1";
};
objectiveHud.add(objectiveHud.spText[1]);
objectiveHud.add(objectiveHud.spText[2]);
case RPGGame:
// no separator lines
objectiveHud.setSeparators("");
objectiveHud.disableHorzSeparator();
// two lines to print objectives
objectiveHud.spText[1] = new GuiTextCtrl() {
profile = "GuiTextObjHudLeftProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "4 3";
extent = "235 16";
visible = "1";
};
objectiveHud.spText[2] = new GuiTextCtrl() {
profile = "GuiTextObjHudLeftProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "4 19";
extent = "235 16";
visible = "1";
};
objectiveHud.add(objectiveHud.spText[1]);
objectiveHud.add(objectiveHud.spText[2]);
}
chatPageDown.setVisible(false);
}
function clientCmdSetReticle(%ret, %vis)
{
reticleHud.setBitmap(%ret);
ReticleFrameHud.setVisible(%vis);
}
function clientCmdgetClientRPGversion()
{
//echo("CALLED");
commandToServer('setClientVersion', $rpgver);
}
function isSet(%v) {
return (%v !$= "");
}

29
scripts/RPGEnterZone.cs Normal file
View file

@ -0,0 +1,29 @@
function RPGZoneEntry::newZone(%this, %zoneName, %rzs, %goodZone, %entered)
{
%cTag = (%goodZone) ? "66FF00" : "990000";
if (%goodZone)
%t = "<just:center><font:Verdana Bold:30><color:66FF00>" @ %zoneName;
else
%t = "<just:center><font:Verdana Bold:30><color:990000>" @ %zoneName;
RPGZoneEntryText.setValue(collapseEscape(%t));
RPGZoneEntryTitle.setValue("<just:center><font:Verdana Bold:20><color:666666>You have ");
RPGZoneEntryTitle.addText(%entered ? "entered" : "left", false);
RPGZoneEntryInfo.setValue("<just:center><font:Verdana Bold:18><color:666666>" @ %rzs);
%this.showText();
}
function RPGZoneEntry::showText(%this)
{
canvas.pushDialog(%this);
if (isEventPending(%this.dSch))
cancel(%this.dSch);
%this.dSch = canvas.schedule(5000, "popDialog", %this);
}
function clientCmdRPGEnterZone(%zoneName, %rzs, %goodZone, %entered)
{
RPGZoneEntry.newZone(%zoneName, %rzs, %goodZone, %entered);
}

BIN
scripts/RPGEnterZone.cs.dso Normal file

Binary file not shown.

24
scripts/RPGEscapeMenu.cs Normal file
View file

@ -0,0 +1,24 @@
function RPGEscapeMenu::onWake(%this)
{
if (!isObject(EscMM))
{
new ActionMap(EscMM);
EscMM.bindCmd(keyboard, "escape", "", "RPGReturnToGame();");
}
MoveMap.pop();
EscMM.push();
}
function RPGEscapeMenu::onSleep(%this)
{
EscMM.pop();
MoveMap.push();
}
function escapeFromGame()
{
canvas.pushDialog(RPGEscapeMenu);
}
function RPGReturnToGame()
{
canvas.popDialog(RPGEscapeMenu);
}
loadgui("RPGEscapeMenu");

Binary file not shown.

3244
scripts/RPGGame.cs Normal file

File diff suppressed because it is too large Load diff

50
scripts/RPGLoadscreen.cs Normal file
View file

@ -0,0 +1,50 @@
function RPGLSFindPictures()
{
%search = "textures/gui/loadingPictures/*.PNG";
$lsPicCount = -1;
for (%f = findFirstFile(%search); %f !$= ""; %f = findNextFile(%search))
$lsPic[$lsPicCount++] = %f;
}
function RPGLoadingScreen::onWake(%this)
{
%lpic = nameToID("RPGLoadingPic");
%res = getResolution();
%x = getWord(%res,0);
%y = getWord(%res,1);
%lpic.setExtent(%x,%y);
%randpic = getRandom(0, $lspicCount);
%pic = $lsPic[%randpic];
%lpic.setBitmap("gui/loadingPictures/" @ fileBase(%pic) @ fileExt(%pic));
RPGLoadingCInfo.setValue("<just:center><font:Verdana Bold:20>Press ESCAPE to cancel.");
createESCKeybind();
CloseMessagePopup();
}
function RPGLoadingScreen::onSleep(%this)
{
alxStop($HudHandle[shellScreen]);
}
function clientCmdRPGLoadscreen(%use)
{
if (%use)
canvas.setContent(RPGLoadingscreen);
}
function clientCmdRPGLoadscreenTitle(%title)
{
RPGLoadingTitle.setValue("<just:center><font:Verdana Bold:30>Ironsphere RPG II\n" @ %title);
}
function createESCKeybind()
{
if (isObject(RPGLSMap))
return;
echo("keybinded esc");
new ActionMap(RPGLSMap);
RPGLSMap.bindCmd(keyboard, "escape", "", "disconnect();");
RPGLSMap.push();
}
loadgui("RPGLoadingScreen");
schedule(750,0,loadgui, "RPGloadingScreen");
schedule(1000,0,RPGLSFindPictures);

Binary file not shown.

115
scripts/RPGQuickBinder.cs Normal file
View file

@ -0,0 +1,115 @@
//RPGQuickBinder.cs
//Goes hand in hand with the quick cast dialog
//Globals
$MinimumSkillID = 1;
$MaximumSkillID = 22;
// Skill List
// KEEP UPDATED WITH RPGSKILLS.CS!!!
//Cleaving
$SkillSet["Cleaving", 0] = "cleave\t15";
$SkillSet["Cleaving", 1] = "berserk\t50";
$SkillSet["Cleaving", 2] = "targetleg\t150";
//Bashing
$SkillSet["Bashing", 0] = "shove\t5";
$SkillSet["Bashing", 1] = "bash\t15";
$SkillSet["Bashing", 2] = "disrupt\t50";
$SkillSet["Bashing", 3] = "stun\t170";
//Hiding
$SkillSet["Hiding", 0] = "hide\t15";
//Focus
$SkillSet["Focus", 0] = "focus\t15";
//IgniteArrow
$SkillSet["IgniteArrow", 0] = "ignite\t15";
//Backstabbing
$SkillSet["Backstabbing", 0] = "backstab\t15";
$SkillSet["Backstabbing", 1] = "surge\t50";
$SkillSet["Backstabbing", 2] = "encumber\t150";
//Sense Heading
$SkillSet["Sense Heading", 0] = "compass\t3";
$SkillSet["Sense Heading", 1] = "track\t15";
$SkillSet["Sense Heading", 2] = "advcompass\t20";
$SkillSet["Sense Heading", 3] = "zonelist\t45";
$SkillSet["Sense Heading", 4] = "trackpack\t85";
//Stealing
$SkillSet["Stealing", 0] = "steal\t15";
$SkillSet["Stealing", 1] = "pickpocket\t270";
$SkillSet["Stealing", 2] = "mug\t620";
//Offensive Casting
$SkillSet["Offensive Casting", 0] = "bolt\t5";
$SkillSet["Offensive Casting", 1] = "thorn\t15";
$SkillSet["Offensive Casting", 2] = "fireball\t20";
$SkillSet["Offensive Casting", 3] = "firebomb\t35";
$SkillSet["Offensive Casting", 4] = "icespike\t45";
$SkillSet["Offensive Casting", 5] = "icestorm\t85";
$SkillSet["Offensive Casting", 6] = "ironfist\t110";
$SkillSet["Offensive Casting", 7] = "cloud\t145";
$SkillSet["Offensive Casting", 8] = "melt\t220";
$SkillSet["Offensive Casting", 9] = "powercloud\t340";
$SkillSet["Offensive Casting", 10] = "spikes\t380";
$SkillSet["Offensive Casting", 11] = "hellstorm\t420";
$SkillSet["Offensive Casting", 12] = "beam\t520";
$SkillSet["Offensive Casting", 13] = "snowstorm\t750";
$SkillSet["Offensive Casting", 14] = "dimensionrift\t950";
//Defensive Casting
$SkillSet["Defensive Casting", 0] = "heal\t10";
$SkillSet["Defensive Casting", 1] = "shield\t20";
$SkillSet["Defensive Casting", 2] = "fireshield\t60";
$SkillSet["Defensive Casting", 3] = "earthshield\t70";
$SkillSet["Defensive Casting", 4] = "watershield\t80";
$SkillSet["Defensive Casting", 5] = "strongheal\t80";
$SkillSet["Defensive Casting", 6] = "windshield\t90";
$SkillSet["Defensive Casting", 7] = "energyshield\t100";
$SkillSet["Defensive Casting", 8] = "advheal\t110";
$SkillSet["Defensive Casting", 9] = "gravityshield\t140";
$SkillSet["Defensive Casting", 10] = "expertheal\t200";
$SkillSet["Defensive Casting", 11] = "advshield\t290";
$SkillSet["Defensive Casting", 12] = "advfireshield\t420";
$SkillSet["Defensive Casting", 13] = "advearthhhield\t440";
$SkillSet["Defensive Casting", 14] = "advwatershield\t480";
$SkillSet["Defensive Casting", 15] = "advwindshield\t500";
$SkillSet["Defensive Casting", 16] = "advenergyshield\t520";
$SkillSet["Defensive Casting", 17] = "advgravityshield\t540";
$SkillSet["Defensive Casting", 18] = "godlyheal\t600";
$SkillSet["Defensive Casting", 19] = "godlyshield\t635";
$SkillSet["Defensive Casting", 20] = "massshield\t680";
$SkillSet["Defensive Casting", 21] = "fullheal\t750";
$SkillSet["Defensive Casting", 22] = "massheal\t850";
$SkillSet["Defensive Casting", 23] = "massfullheal\t950";
$SkillSet["Defensive Casting", 24] = "heavenlyshield\t1100";
//Functions
function serverCmdGatherOpenSkills(%client) {
for(%i = $MinimumSkillID; %i <= $MaximumSkillID; %i++) {
%primaryString = $SkillDesc[%i];
%x = 0;
%finalSecond = "";
while(isSet($SkillSet[%primaryString, %x])) {
%secondaryString = $SkillSet[%primaryString, %x];
//
%skillName = getField(%secondaryString, 0);
%requiredSkillLv = getField(%secondaryString, 1);
//
if(GetPlayerSkill(%client, %i) >= %requiredSkillLv) {
if(!isSet(%finalSecond)) {
%finalSecond = %skillName;
}
else {
%finalSecond = %finalSecond TAB %skillName;
}
}
%x++;
}
//
if(isSet(%finalSecond)) {
//no point in sending blank secondary skill sets.
commandToClient(%client, 'ReturnOpenSkills', %primaryString, %finalSecond);
}
}
}
//Assets
function isSet(%v) {
return (%v !$= "");
}

739
scripts/RabbitGame.cs Normal file
View file

@ -0,0 +1,739 @@
//-------------------------------------------------------------------
// Team Rabbit script
// -------------------------------------------------------------------
//--- GAME RULES BEGIN ---
//Grab the flag
//Run like crazy
//EVERYONE tries to kill the person with the flag (the Rabbit)
//The longer the Rabbit keeps the flag, the more points he scores
//--- GAME RULES END ---
package RabbitGame {
function Flag::objectiveInit(%data, %flag)
{
$flagStatus = "<At Home>";
%flag.carrier = "";
%flag.originalPosition = %flag.getTransform();
%flag.isHome = true;
// create a waypoint to the flag's starting place
%flagWaypoint = new WayPoint()
{
position = %flag.position;
rotation = "1 0 0 0";
name = "Flag Home";
dataBlock = "WayPointMarker";
team = $NonRabbitTeam;
};
$AIRabbitFlag = %flag;
MissionCleanup.add(%flagWaypoint);
}
};
//exec the AI scripts
exec("scripts/aiRabbit.cs");
$InvBanList[Rabbit, "TurretOutdoorDeployable"] = 1;
$InvBanList[Rabbit, "TurretIndoorDeployable"] = 1;
$InvBanList[Rabbit, "ElfBarrelPack"] = 1;
$InvBanList[Rabbit, "MortarBarrelPack"] = 1;
$InvBanList[Rabbit, "PlasmaBarrelPack"] = 1;
$InvBanList[Rabbit, "AABarrelPack"] = 1;
$InvBanList[Rabbit, "MissileBarrelPack"] = 1;
$InvBanList[Rabbit, "MissileLauncher"] = 1;
$InvBanList[Rabbit, "Mortar"] = 1;
$InvBanList[Rabbit, "Mine"] = 1;
function RabbitGame::setUpTeams(%game)
{
// Force the numTeams variable to one:
DefaultGame::setUpTeams(%game);
%game.numTeams = 1;
setSensorGroupCount(3);
//team damage should always be off for Rabbit
$teamDamage = 0;
//make all the sensor groups visible at all times
if (!Game.teamMode)
{
setSensorGroupAlwaysVisMask($NonRabbitTeam, 0xffffffff);
setSensorGroupAlwaysVisMask($RabbitTeam, 0xffffffff);
// non-rabbits can listen to the rabbit: all others can only listen to self
setSensorGroupListenMask($NonRabbitTeam, (1 << $RabbitTeam) | (1 << $NonRabbitTeam));
}
}
function RabbitGame::initGameVars(%game)
{
%game.playerBonusValue = 1;
%game.playerBonusTime = 3 * 1000; //3 seconds
%game.teamBonusValue = 1;
%game.teamBonusTime = 15 * 1000; //15 seconds
%game.flagReturnTime = 45 * 1000; //45 seconds
%game.waypointFrequency = 24000;
%game.waypointDuration = 6000;
}
$RabbitTeam = 2;
$NonRabbitTeam = 1;
// ----- These functions supercede those in DefaultGame.cs
function RabbitGame::allowsProtectedStatics(%game)
{
return true;
}
function RabbitGame::clientMissionDropReady(%game, %client)
{
messageClient(%client, 'MsgClientReady', "", %game.class);
messageClient(%client, 'MsgYourScoreIs', "", 0);
//messageClient(%client, 'MsgYourRankIs', "", -1);
messageClient(%client, 'MsgRabbitFlagStatus', "", $flagStatus);
messageClient(%client, 'MsgMissionDropInfo', '\c0You are in mission %1 (%2).', $MissionDisplayName, $MissionTypeDisplayName, $ServerName );
DefaultGame::clientMissionDropReady(%game,%client);
}
function RabbitGame::AIHasJoined(%game, %client)
{
//let everyone know the player has joined the game
//messageAllExcept(%client, -1, 'MsgClientJoinTeam', '%1 has joined the hunt.', %client.name, "", %client, $NonRabbitTeam);
}
function RabbitGame::clientJoinTeam( %game, %client, %team, %respawn )
{
%game.assignClientTeam( %client );
// Spawn the player:
%game.spawnPlayer( %client, %respawn );
}
function RabbitGame::assignClientTeam(%game, %client)
{
// all players start on team 1
%client.team = $NonRabbitTeam;
// 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 hunt.', %client.name, "", %client, %client.team );
updateCanListenState( %client );
}
function RabbitGame::playerSpawned(%game, %player)
{
//call the default stuff first...
DefaultGame::playerSpawned(%game, %player);
//find the rabbit
%clRabbit = -1;
for (%i = 0; %i < ClientGroup.getCount(); %i++)
{
%cl = ClientGroup.getObject(%i);
if (isObject(%cl.player) && isObject(%cl.player.holdingFlag))
{
%clRabbit = %cl;
break;
}
}
//now set a waypoint just for that client...
cancel(%player.client.waypointSchedule);
if (isObject(%clRabbit) && !%player.client.isAIControlled())
%player.client.waypointSchedule = %game.showRabbitWaypointClient(%clRabbit, %player.client);
}
function RabbitGame::pickPlayerSpawn(%game, %client, %respawn)
{
// all spawns come from team 1
return %game.pickTeamSpawn($NonRabbitTeam);
}
function RabbitGame::createPlayer(%game, %client, %spawnLoc, %respawn)
{
%client.team = $NonRabbitTeam;
DefaultGame::createPlayer(%game, %client, %spawnLoc, %respawn);
}
function RabbitGame::recalcScore(%game, %client)
{
//score is grabs + kills + (totalTime / 15 seconds);
%timeHoldingFlagMS = %client.flagTimeMS;
if (isObject(%client.player.holdingFlag))
%timeHoldingFlagMS += getSimTime() - %client.startTime;
%client.score = %client.flagGrabs + %client.kills + mFloor(%timeHoldingFlagMS / 15000);
messageClient(%client, 'MsgYourScoreIs', "", %client.score);
%game.recalcTeamRanks(%client);
%game.checkScoreLimit(%client);
}
function RabbitGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %sourceObject)
{
//if the victim is the rabbit, and the attacker is not the rabbit, set the damage time...
if (isObject(%clAttacker) && %clAttacker != %clVictim)
{
if (%clVictim.team == $RabbitTeam)
%game.rabbitDamageTime = getSimTime();
}
//call the default
DefaultGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %sourceObject);
}
function RabbitGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLoc)
{
//see if the killer was the rabbit and the victim was someone else...
if (isObject(%clKiller) && (%clKiller != %clVictim) && (%clKiller.team == $RabbitTeam))
{
%clKiller.kills++;
%game.recalcScore(%clKiller);
}
DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLoc);
}
function RabbitGame::playerDroppedFlag(%game, %player)
{
//set the flag status
%flag = %player.holdingFlag;
%player.holdingFlag = "";
%flag.carrier = "";
$flagStatus = "<In the Field>";
%player.unmountImage($FlagSlot);
%flag.hide(false);
//hide the rabbit waypoint
cancel(%game.waypointSchedule);
%game.hideRabbitWaypoint(%player.client);
//set the client status
%player.client.flagTimeMS += getSimTime() - %player.client.startTime;
%player.client.team = $NonRabbitTeam;
%player.client.setSensorGroup($NonRabbitTeam);
setTargetSensorGroup(%player.getTarget(), $NonRabbitTeam);
messageAllExcept(%player.client, -1, 'MsgRabbitFlagDropped', '\c2%1 dropped the flag!~wfx/misc/flag_drop.wav', %player.client.name);
// if the player left the mission area, he's already been notified
if(!%player.outArea)
messageClient(%player.client, 'MsgRabbitFlagDropped', '\c2You dropped the flag!~wfx/misc/flag_drop.wav');
logEcho(%player.client.nameBase@" (pl "@%player@"/cl "@%player.client@") dropped flag");
%flag.returnThread = %game.schedule(%game.flagReturnTime, "returnFlag", %flag);
}
function RabbitGame::playerTouchFlag(%game, %player, %flag)
{
if ((%flag.carrier $= "") && (%player.getState() !$= "Dead"))
{
%player.client.startTime = getSimTime();
%player.holdingFlag = %flag;
%flag.carrier = %player;
%player.mountImage(FlagImage, $FlagSlot, true); //, $teamSkin[$RabbitTeam]);
cancel(%flag.returnThread);
%flag.hide(true);
%flag.isHome = false;
$flagStatus = %client.name;
messageAll('MsgRabbitFlagTaken', '\c2%1 has taken the flag!~wfx/misc/flag_snatch.wav', %player.client.name);
logEcho(%player.client.nameBase@" (pl "@%player@"/cl "@%player.client@") took flag");
%player.client.team = $RabbitTeam;
%player.client.setSensorGroup($RabbitTeam);
setTargetSensorGroup(%player.getTarget(), $RabbitTeam);
//increase the score
%player.client.flagGrabs++;
%game.recalcScore(%player.client);
%game.schedule(5000, "RabbitFlagCheck", %player);
//show the rabbit waypoint
%game.rabbitDamageTime = 0;
cancel(%game.waypointSchedule);
%game.showRabbitWaypoint(%player.client);
}
}
function RabbitGame::rabbitFlagCheck(%game, %player)
{
// this function calculates the score for the rabbit. It must be done periodically
// since the rabbit's score is based on how long the flag has been in possession.
if((%player.holdingFlag != 0) && (%player.getState() !$= "Dead"))
{
%game.recalcScore(%player.client);
//reschedule this flagcheck for 5 seconds
%game.schedule(5000, "RabbitFlagCheck", %player);
}
}
function RabbitGame::returnFlag(%game, %flag)
{
messageAll('MsgRabbitFlagReturned', '\c2The flag was returned to its starting point.~wfx/misc/flag_return.wav');
logEcho("flag return (timeout)");
%game.resetFlag(%flag);
}
function RabbitGame::resetFlag(%game, %flag)
{
%flag.setVelocity("0 0 0");
%flag.setTransform(%flag.originalPosition);
%flag.isHome = true;
%flag.carrier = "";
$flagStatus = "<At Home>";
%flag.hide(false);
}
// ----- These functions are native to Rabbit
function RabbitGame::timeLimitReached(%game)
{
logEcho("game over (timelimit)");
%game.gameOver();
cycleMissions();
}
function RabbitGame::scoreLimitReached(%game)
{
logEcho("game over (scorelimit)");
%game.gameOver();
cycleMissions();
}
function RabbitGame::checkScoreLimit(%game, %client)
{
%scoreLimit = MissionGroup.Rabbit_scoreLimit;
// default of 1200 if scoreLimit not defined (that's 1200 seconds worth - 20 minutes)
if(%scoreLimit $= "")
%scoreLimit = 1200;
if(%client.score >= %scoreLimit)
%game.scoreLimitReached();
}
function RabbitGame::gameOver(%game)
{
//call the default
DefaultGame::gameOver(%game);
//send the message
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.gameover.wav" );
cancel(%game.rabbitWaypointThread);
messageAll('MsgClearObjHud', "");
for(%i = 0; %i < ClientGroup.getCount(); %i++)
{
%client = ClientGroup.getObject(%i);
%game.resetScore(%client);
cancel(%client.waypointSchedule);
}
cancel(%game.waypointSchedule);
}
function RabbitGame::resetScore(%game, %client)
{
%client.score = 0;
%client.kills = 0;
%client.deaths = 0;
%client.suicides = 0;
%client.flagGrabs = 0;
%client.flagTimeMS = 0;
}
function RabbitGame::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 RabbitGame::leaveMissionArea(%game, %playerData, %player)
{
if(%player.getState() $= "Dead")
return;
%player.client.outOfBounds = true;
if (%player.client.team == $RabbitTeam)
messageClient(%player.client, 'LeaveMissionArea', '\c1You have left the mission area. Return or take damage.~wfx/misc/warning_beep.wav');
else
messageClient(%player.client, 'LeaveMissionArea', '\c1You have left the mission area.~wfx/misc/warning_beep.wav');
logEcho(%player.client.nameBase@" (pl "@%player@"/cl "@%player.client@") left mission area");
%player.alertThread = %game.schedule(1000, "AlertPlayer", 3, %player);
}
function RabbitGame::AlertPlayer(%game, %count, %player)
{
if (%player.client.team == $RabbitTeam)
{
if(%count > 1)
%player.alertThread = %game.schedule(1000, "AlertPlayer", %count - 1, %player);
else
%player.alertThread = %game.schedule(1000, "MissionAreaDamage", %player);
}
//keep the thread going for non rabbits, but give the new rabbit time to return to the mission area...
else
%player.alertThread = %game.schedule(1000, "AlertPlayer", 3, %player);
}
function RabbitGame::MissionAreaDamage(%game, %player)
{
if(%player.getState() !$= "Dead") {
%player.setDamageFlash(0.1);
%damageRate = 0.05;
%pack = %player.getMountedImage($BackpackSlot);
if(%pack.getName() $= "RepairPackImage")
if(%player.getMountedImage($WeaponSlot).getName() $= "RepairGunImage")
%damageRate = 0.15;
%prevHurt = %player.getDamageLevel();
%player.setDamageLevel(%prevHurt + %damageRate);
// a little redundancy to see if the lastest damage killed the player
if(%player.getState() $= "Dead")
%game.onClientKilled(%player.client, 0, $DamageType::OutOfBounds);
else
%player.alertThread = %game.schedule(1000, "MissionAreaDamage", %player);
}
else
{
%game.onClientKilled(%player.client, 0, $DamageType::OutOfBounds);
}
}
function RabbitGame::dropFlag(%game, %player)
{
//you can no longer throw the flag in Rabbit...
}
function RabbitGame::updateScoreHud(%game, %client, %tag)
{
//tricky stuff here... use two columns if we have more than 15 clients...
%numClients = $TeamRank[0, count];
if ( %numClients > $ScoreHudMaxVisible )
%numColumns = 2;
// Clear the header:
messageClient( %client, 'SetScoreHudHeader', "", "" );
// Send subheader:
if (%numColumns == 2)
messageClient(%client, 'SetScoreHudSubheader', "", '<tab:5,155,225,305,455,525>\tPLAYER\tSCORE\tTIME\tPLAYER\tSCORE\tTIME');
else
messageClient(%client, 'SetScoreHudSubheader', "", '<tab:15,235,335>\tPLAYER\tSCORE\tTIME');
//recalc the score for whoever is holding the flag
if (isObject($AIRabbitFlag.carrier))
%game.recalcScore($AIRabbitFlag.carrier.client);
%countMax = %numClients;
if ( %countMax > ( 2 * $ScoreHudMaxVisible ) )
{
if ( %countMax & 1 )
%countMax++;
%countMax = %countMax / 2;
}
else if ( %countMax > $ScoreHudMaxVisible )
%countMax = $ScoreHudMaxVisible;
for (%index = 0; %index < %countMax; %index++)
{
//get the client info
%col1Client = $TeamRank[0, %index];
%col1ClientScore = %col1Client.score $= "" ? 0 : %col1Client.score;
%col1Style = "";
if (isObject(%col1Client.player.holdingFlag))
{
%col1ClientTimeMS = %col1Client.flagTimeMS + getSimTime() - %col1Client.startTime;
%col1Style = "<color:00dc00>";
}
else
{
%col1ClientTimeMS = %col1Client.flagTimeMS;
if ( %col1Client == %client )
%col1Style = "<color:dcdcdc>";
}
if (%col1ClientTimeMS <= 0)
%col1ClientTime = "";
else
{
%minutes = mFloor(%col1ClientTimeMS / (60 * 1000));
if (%minutes <= 0)
%minutes = "0";
%seconds = mFloor(%col1ClientTimeMS / 1000) % 60;
if (%seconds < 10)
%seconds = "0" @ %seconds;
%col1ClientTime = %minutes @ ":" @ %seconds;
}
//see if we have two columns
if (%numColumns == 2)
{
%col2Client = "";
%col2ClientScore = "";
%col2ClientTime = "";
%col2Style = "";
//get the column 2 client info
%col2Index = %index + %countMax;
if (%col2Index < %numClients)
{
%col2Client = $TeamRank[0, %col2Index];
%col2ClientScore = %col2Client.score $= "" ? 0 : %col2Client.score;
if (isObject(%col2Client.player.holdingFlag))
{
%col2ClientTimeMS = %col2Client.flagTimeMS + getSimTime() - %col2Client.startTime;
%col2Style = "<color:00dc00>";
}
else
{
%col2ClientTimeMS = %col2Client.flagTimeMS;
if ( %col2Client == %client )
%col2Style = "<color:dcdcdc>";
}
if (%col2ClientTimeMS <= 0)
%col2ClientTime = "";
else
{
%minutes = mFloor(%col2ClientTimeMS / (60 * 1000));
if (%minutes <= 0)
%minutes = "0";
%seconds = mFloor(%col2ClientTimeMS / 1000) % 60;
if (%seconds < 10)
%seconds = "0" @ %seconds;
%col2ClientTime = %minutes @ ":" @ %seconds;
}
}
}
//if the client is not an observer, send the message
if (%client.team != 0)
{
if ( %numColumns == 2 )
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:10><spush>%7\t<clip:150>%1</clip><rmargin:205><just:right>%2<rmargin:270><just:right>%3<spop><rmargin:505><lmargin:310>%8<just:left>%4<rmargin:505><just:right>%5<rmargin:570><just:right>%6',
%col1Client.name, %col1ClientScore, %col1ClientTime, %col2Client.name, %col2ClientScore, %col2ClientTime, %col1Style, %col2Style );
else
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:20>%4\t<clip:200>%1</clip><rmargin:280><just:right>%2<rmargin:375><just:right>%3',
%col1Client.name, %col1ClientScore, %col1ClientTime, %col1Style );
}
//else for observers, create an anchor around the player name so they can be observed
else
{
if ( %numColumns == 2 )
{
//this is really crappy, but I need to save 1 tag - can only pass in up to %9, %10 doesn't work...
if (%col2Style $= "<color:00dc00>")
{
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:10><spush>%7\t<clip:150><a:gamelink\t%8>%1</a></clip><rmargin:205><just:right>%2<rmargin:270><just:right>%3<spop><rmargin:505><lmargin:310><color:00dc00><just:left><clip:150><a:gamelink\t%9>%4</a></clip><rmargin:505><just:right>%5<rmargin:570><just:right>%6',
%col1Client.name, %col1ClientScore, %col1ClientTime,
%col2Client.name, %col2ClientScore, %col2ClientTime,
%col1Style, %col1Client, %col2Client );
}
else if (%col2Style $= "<color:dcdcdc>")
{
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:10><spush>%7\t<clip:150><a:gamelink\t%8>%1</a></clip><rmargin:205><just:right>%2<rmargin:270><just:right>%3<spop><rmargin:505><lmargin:310><color:dcdcdc><just:left><clip:150><a:gamelink\t%9>%4</a></clip><rmargin:505><just:right>%5<rmargin:570><just:right>%6',
%col1Client.name, %col1ClientScore, %col1ClientTime,
%col2Client.name, %col2ClientScore, %col2ClientTime,
%col1Style, %col1Client, %col2Client );
}
else
{
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:10><spush>%7\t<clip:150><a:gamelink\t%8>%1</a></clip><rmargin:205><just:right>%2<rmargin:270><just:right>%3<spop><rmargin:505><lmargin:310><just:left><clip:150><a:gamelink\t%9>%4</a></clip><rmargin:505><just:right>%5<rmargin:570><just:right>%6',
%col1Client.name, %col1ClientScore, %col1ClientTime,
%col2Client.name, %col2ClientScore, %col2ClientTime,
%col1Style, %col1Client, %col2Client );
}
}
else
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:20>%4\t<clip:200><a:gamelink\t%5>%1</a></clip><rmargin:280><just:right>%2<rmargin:375><just:right>%3',
%col1Client.name, %col1ClientScore, %col1ClientTime, %col1Style, %col1Client );
}
}
// 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 RabbitGame::showRabbitWaypointClient(%game, %clRabbit, %client)
{
//make sure we have a rabbit
if (!isObject(%clRabbit) || !isObject(%clRabbit.player) || !isObject(%clRabbit.player.holdingFlag))
return;
//no waypoints for bots
if (%client.isAIControlled())
return;
//scope the client, then set the always vis mask...
%clRabbit.player.scopeToClient(%client);
%visMask = getSensorGroupAlwaysVisMask(%clRabbit.getSensorGroup());
%visMask |= (1 << %client.getSensorGroup());
setSensorGroupAlwaysVisMask(%clRabbit.getSensorGroup(), %visMask);
//now issue a command to kill the target
%client.setTargetId(%clRabbit.target);
commandToClient(%client, 'TaskInfo', %client, -1, false, "Kill the Rabbit!");
%client.sendTargetTo(%client, true);
//send the "waypoint is here sound"
messageClient(%client, 'MsgRabbitWaypoint', '~wfx/misc/target_waypoint.wav');
//and hide the waypoint
%client.waypointSchedule = %game.schedule(%game.waypointDuration, "hideRabbitWaypointClient", %clRabbit, %client);
}
function RabbitGame::hideRabbitWaypointClient(%game, %clRabbit, %client)
{
//no waypoints for bots
if (%client.isAIControlled())
return;
//unset the always vis mask...
%visMask = getSensorGroupAlwaysVisMask(%clRabbit.getSensorGroup());
%visMask &= ~(1 << %client.getSensorGroup());
setSensorGroupAlwaysVisMask(%clRabbit.getSensorGroup(), %visMask);
//kill the actually task...
removeClientTargetType(%client, "AssignedTask");
}
function RabbitGame::showRabbitWaypoint(%game, %clRabbit)
{
//make sure we have a rabbit
if (!isObject(%clRabbit) || !isObject(%clRabbit.player) || !isObject(%clRabbit.player.holdingFlag))
return;
//only show the rabbit waypoint if the rabbit hasn't been damaged within the frequency period
if (getSimTime() - %game.rabbitDamageTime < %game.waypointFrequency)
{
%game.waypointSchedule = %game.schedule(%game.waypointFrequency, "showRabbitWaypoint", %clRabbit);
return;
}
//loop through all the clients and flash a waypoint at the rabbits position
for (%i = 0; %i < ClientGroup.getCount(); %i++)
{
%cl = ClientGroup.getObject(%i);
if (%cl.isAIControlled() || %cl == %clRabbit)
continue;
//scope the client, then set the always vis mask...
%clRabbit.player.scopeToClient(%cl);
%visMask = getSensorGroupAlwaysVisMask(%clRabbit.getSensorGroup());
%visMask |= (1 << %cl.getSensorGroup());
setSensorGroupAlwaysVisMask(%clRabbit.getSensorGroup(), %visMask);
//now issue a command to kill the target
%cl.setTargetId(%clRabbit.target);
commandToClient(%cl, 'TaskInfo', %cl, -1, false, "Kill the Rabbit!");
%cl.sendTargetTo(%cl, true);
//send the "waypoint is here sound"
messageClient(%cl, 'MsgRabbitWaypoint', '~wfx/misc/target_waypoint.wav');
}
//schedule the time to hide the waypoint
%game.waypointSchedule = %game.schedule(%game.waypointDuration, "hideRabbitWaypoint", %clRabbit);
}
function RabbitGame::hideRabbitWaypoint(%game, %clRabbit)
{
//make sure we have a valid client
if (!isObject(%clRabbit))
return;
//loop through all the clients and hide the waypoint
for (%i = 0; %i < ClientGroup.getCount(); %i++)
{
%cl = ClientGroup.getObject(%i);
if (%cl.isAIControlled())
continue;
//unset the always vis mask...
%visMask = getSensorGroupAlwaysVisMask(%clRabbit.getSensorGroup());
%visMask &= ~(1 << %cl.getSensorGroup());
setSensorGroupAlwaysVisMask(%clRabbit.getSensorGroup(), %visMask);
//kill the actually task...
removeClientTargetType(%cl, "AssignedTask");
}
//make sure we have a rabbit before scheduling the next showRabbitWaypoint...
if (isObject(%clRabbit.player) && isObject(%clRabbit.player.holdingFlag))
%game.waypointSchedule = %game.schedule(%game.waypointFrequency, "showRabbitWaypoint", %clRabbit);
}
function RabbitGame::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);
}
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 RabbitGame::applyConcussion(%game, %player)
{
// MES -- this won't do anything, the function RabbitGame::dropFlag is empty
%game.dropFlag( %player );
}

1213
scripts/SiegeGame.cs Normal file

File diff suppressed because it is too large Load diff

1310
scripts/SinglePlayerGame.cs Normal file

File diff suppressed because it is too large Load diff

1539
scripts/Training1.cs Normal file

File diff suppressed because it is too large Load diff

1416
scripts/Training2.cs Normal file

File diff suppressed because it is too large Load diff

567
scripts/Training3.cs Normal file
View file

@ -0,0 +1,567 @@
// don't want this executing when building graphs
if($OFFLINE_NAV_BUILD)
return;
// script fror training mission 3
//-------------------------------------------------------------
//init
//-------------------------------------------------------------
echo("Running Mission 3 Script");
activatePackage(Training3);
$numberOfEnemies[1] = 5;
$numberOfEnemies[2] = 7;
$numberOfEnemies[3] = 7;
$numberOfTeammates = 0;
$missionBotSkill[1] = 0.0;
$missionBotSkill[2] = 0.5;
$missionBotSkill[3] = 0.9;
$missionEnemyThreshold[1] = 0;
$missionEnemyThreshold[2] = 3;
$missionEnemyThreshold[3] = 7;
//the Scout is very important
$Shrike = nameToId("Ride");
// activate the wings on the flyer
$Shrike.playThread($ActivateThread, "activate");
// for the distance checking
addMessageCallback('MsgWeaponMount', playerMountWeapon);
package training3 {
//===============================================begin the training 3 package stuff====
function SinglePlayerGame::initGameVars(%game)
{
// for many of the objectives we are going to periodically
// check the players distance vs some object
// you could do this much prettier but its going to be very specific
// so a cut and paste eyesore will be fine
echo("initializing training3 game vars");
%game.base = nameToId("Shield");
%game.baseLocation = game.base.getTransform();
%game.base.threshold = 400;
%game.end = nameToId("PlayerDropPoint");
%game.endLocation = game.end.getTransform();
}
function MP3Audio::play(%this)
{
//too bad...no mp3 in training
}
// force always scope for testing
function singlePlayerGame::onAIRespawn(%game, %client)
{
if(! isObject("MissionCleanup/TeamDrops2")) {
//this is the snippet of script from default games that puts teamdrops
// into the mission cleanup group...slightly modified to suit our needs
%dropSet = new SimSet("TeamDrops2");
MissionCleanup.add(%dropSet);
%spawns = nameToID("MissionGroup/Teams/team2/TeamDrops");
if(%spawns != -1)
{
%count = %spawns.getCount();
for(%i = 0; %i < %count; %i++)
%dropSet.add(%spawns.getObject(%i));
}
}
// error("Forcing AI Scope!!!!!!!!!!!!!");
// %client.player.scopeToClient($player);
parent:: onAIRespawn(%game, %client);
}
function getTeammateGlobals()
{
echo("You have no teammates in this mission");
}
function toggleScoreScreen(%val)
{
if ( %val )
//error("No Score Screen in training.......");
messageClient($player, 0, $player.miscMsg[noScoreScreen]);
}
function toggleCommanderMap(%val)
{
if ( %val )
messageClient($player, 0, $player.miscMsg[noCC]);
}
function toggleTaskListDlg( %val )
{
if ( %val )
messageClient( $player, 0, $player.miscMsg[noTaskListDlg] );
}
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 kobayashi_maru()
{
$testcheats = true;
commandToServer('giveAll');
}
function AIEngageTask::assume(%task, %client)
{
Parent::assume(%task, %client);
if(%client.team != $playerTeam)
game.biodermAssume(%client);
}
function countTurretsAllowed(%type)
{
return $TeamDeployableMax[%type];
}
function FlipFlop::objectiveInit(%data, %flipflop)
{
}
function ClientCmdSetHudMode(%mode, %type, %node)
{
parent::ClientCmdSetHudMode(%mode, %type, %node);
//TrainingMap.push();
}
// get the ball rolling
function startCurrentMission(%game)
{
//just in case
setFlipFlopSkins();
schedule(5000, %game, opening);
schedule(30000, %game, objectiveDistanceChecks);
updateTrainingObjectiveHud(obj1);
if($pref::trainingDifficulty == 1) {
nameToId(BackEnterSentry).hide(true);
freeTarget(nameToId(BackEnterSentry).getTarget());
}
}
function opening()
{
if(game.vehicleMount)
return;
doText(T3_01);
//doText(T3_02);
doText(T3_cloaking);
doText(T3_tipCloaking01);
doText(T3_tipCloaking02);
}
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();
//echo("Light Assassin Config");
%player.setArmor("Light");
%player.setInventory(CloakingPack, 1);
%player.setInventory(RepairKit,1);
%player.setInventory(FlashGrenade,5);
%player.setInventory(Mine,3);
%player.setInventory(Plasma, 1);
%player.setInventory(PlasmaAmmo, 20);
%player.setInventory(Disc,1);
%player.setInventory(DiscAmmo, 15);
%player.setInventory(TargetingLaser, 1);
%player.setInventory(ShockLance,1);
%player.weaponCount = 3;
%player.use("Disc");
}
// ============================================================================
function singlePlayerGame::onAIKilled(%game, %clVictim, %clAttacker, %damageType, %implement)
{
%teamCount = getPlayersOnTeam(%clVictim.team);
//echo("Team count:" SPC %teamCount);
%maintNum = $missionEnemyThreshold[$pref::trainingDifficulty];
//echo("Maintain:" SPC %maintNum);
%clVictim.useSpawnSphere = true;
// this will respawn the AI if
if( %teamCount < %maintNum )
DefaultGame::onAIKilled(%game, %clVictim, %clAttacker, %damageType, %implement);
}
function singleplayerGame::pickTeamSpawn(%game, %client, %respawn)
{
if(%client.useSpawnSphere)
DefaultGame::pickTeamSpawn(%game, %client.team);
else
parent::pickTeamSpawn(%game, %client, %respawn);
}
function clientCmdVehicleMount()
{
if(game.vehicleMount++ == 1) {
doText(Any_Waypoint01, 2000);
//doText(Any_Waypoint03, 4000);
doText(T3_tipPiloting01);
doText(T3_02);
doText(T3_05);
schedule(4000, game, setWaypointAt, game.baseLocation, "Icefell Ridge Base");
updateTrainingObjectiveHud(obj2);
game.pilotingTips = schedule(60000, game, PilotingTips);
}
if(game.phase == 4) {
setWaypointAt(game.endLocation, "Extraction Point");
updateTrainingObjectiveHud(obj3);
doText(T3_11);
doText(T3_12);
game.phase = 5;
if(!nameToId(AATurretGen).isDisabled())
doText(t3_12a);
}
}
function RepairPack::onCollision(%this,%obj,%col)
{
if($player.player.getInventory(CloakingPack) && $player.player.getDamageLevel() > 0.2
&& !game.msgtipEquip && %col == $player.player) {
game.msgTipEquip = true;
doText(T3_tipEquipment02);
}
parent::onCollision(%this,%obj,%col);
}
// 86 the vehicle removal on dying
function vehicleAbandonTimeOut(%vehicle)
{
// dont mess it up
}
function playerMountWeapon(%tag, %text, %image, %player, %slot)
{
if( game.firstTime++ < 2)
return; // initial weapon mount doesnt count
if(%image.getName() $= "ShockLanceImage" && !game.msgShock) {
game.msgShock = true;
//doText(T3_TipShockLance);
}
}
function FlipFlop::playerTouch(%data, %flipFlop, %player )
{
//echo("singlePlayer::playerTouchFlipFlop");
%client = %player.client;
%flipTeam = %flipflop.team;
if(%flipTeam == %client.team)
return false;
nameToId(Shield).delete();
//just the sound
messageAll( 'MsgClaimFlipFlop', '~wfx/misc/flipflop_taken.wav', %client.name, Game.cleanWord( %flipflop.name ), $TeamName[%client.team] );
if(%player == $player.player)
schedule( 1500, game, flipFlopFlipped);
objectiveDistanceChecks();
//change the skin on the switch to claiming team's logo
setTargetSkin(%flipflop.getTarget(), $teamSkin[%player.team]);
setTargetSensorGroup(%flipflop.getTarget(), %player.team);
// convert the resources associated with the flipflop
Game.claimFlipflopResources(%flipflop, %client.team);
Game.AIplayerCaptureFlipFlop(%player, %flipflop);
return true;
}
function scoutFlyer::onRemove(%this, %obj)
{
error("scoutFlyer::onRemove("@ %obj@") called");
if ( ! isObject( ServerConnection ) )
return;
if(%obj == $Shrike ) {
// we dont want the player to die hitting the ground
cancel(game.pilotingTips);
$player.player.invincible = true;
missionFailed($player.miscMsg[training3shrikeLoss]);
}
}
function WeaponImage::onMount(%this,%obj,%slot)
{
messageClient(%obj.client, 'MsgWeaponMount', "", %this, %obj, %slot);
Parent::onMount(%this,%obj,%slot);
}
function GeneratorLarge::onDestroyed(%dataBlock, %destroyedObj, %prevState)
{
if(%destroyedObj == nameToId("PrisonGen") && !game.msgGenDestroyed)
{
game.msgGenDestroyed = true;
doText(Any_ObjComplete01);
updateTrainingObjectiveHud(obj6);
}
else if(%destroyedObj == nameToId(AATurretGen))
$player.AAGenWaypoint.delete();
}
// If the forcefield is shot we play this little wav file
function ProjectileData::onCollision(%data, %projectile, %targetObject, %modifier, %position, %normal)
{
//error("ProjectileData::onCollision("@%data@", "@%projectile@", "@%targetObject@", "@%modifier@", "@%position@", "@%normal@")");
parent::onCollision(%data, %projectile, %targetObject, %modifier, %position, %normal);
if(game.msgGenDestroyed)
return;
else if(%targetObject.getDataBlock().getName() $= nameToId(Shield).dataBlock) {
//error("someone shot the force field");
if(%projectile.sourceObject == $player.player){
//error("it was you f00");
if(!game.msgMustDestroyGen) {
game.msgMustDestroyGen = true;
doText(T3_07b);
}
}
}
}
function addTraining3Waypoints()
{
//do the hud updating also
$player.currentWaypoint.delete();
updateTrainingObjectiveHud(obj5);
%Training3WaypointsGroup = new simGroup(Training3Waypoints);
MissionCleanup.add(%Training3WaypointsGroup);
%waypoint = new WayPoint() {
position = nameToId(FF).position;
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "WayPointMarker";
lockCount = "0";
homingCount = "0";
name = "Control Point";
team = "0";
locked = "true";
};
%Training3WaypointsGroup.add(%waypoint);
%waypoint = new WayPoint() {
position = nameToId(BaseGen).getWorldBoxCenter();
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "WayPointMarker";
lockCount = "0";
homingCount = "0";
name = "Main Base Power";
team = "0";
locked = "true";
};
%Training3WaypointsGroup.add(%waypoint);
%waypoint = new WayPoint() {
position = nameToId(sensorNetGen).getWorldBoxCenter();
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "WayPointMarker";
lockCount = "0";
homingCount = "0";
name = "Sensor Power";
team = "0";
locked = "true";
};
%Training3WaypointsGroup.add(%waypoint);
%waypoint = new WayPoint() {
position = nameToId(AATurretGen).getWorldBoxCenter();
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "WayPointMarker";
lockCount = "0";
homingCount = "0";
name = "AntiAircraft Turret Power";
team = "0";
locked = "true";
};
//%Training3WaypointsGroup.add(%waypoint);
$player.AAGenWaypoint = %waypoint;
%waypoint = new WayPoint() {
position = nameToId(prisonGen).getWorldBoxCenter();
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "WayPointMarker";
lockCount = "0";
homingCount = "0";
name = "Forcefield Power";
team = "0";
locked = "true";
};
%Training3WaypointsGroup.add(%waypoint);
}
function RandomPilotingTips()
{
// this is unused as testers claimed it sounded 'disjointed and random'
if(pilotingTips())
game.pilotingTips = schedule(20000, $player.player, RandomPilotingTips);
}
function pilotingTips()
{
%num = 2;
if(game.Training3tips == %num)
return false;
%tip = getRandom(1, %num);
if( game.training3TipUsed[%tip] )
return true;
switch(%tip){
case 1:
doText(T3_tipfreelook);
case 2:
doText(T3_tipPiloting04);
// case 3:
// doText(T3_tipPiloting02);
// case 4:
// doText(T3_tipUnderwater01);
}
game.training3Tips++;
game.training3TipUsed[%tip] = true;
return true;
}
//misc
//-------------------------------------------------------------
function objectiveDistanceChecks()
{
%playerPos = $player.player.getTransform();
if(!%playerPos) {
schedule(2000, game, objectiveDistanceChecks);
return;
}
%cont = true;
%basedistance = vectorDist( %playerPos, game.baseLocation );
if(game.phase == 0 && %basedistance < game.base.threshold ) {
doText(T3_06, 4000);
doText(T3_tipCloaking03);
doText(T3_07);
game.phase = 1;
%cont = false;
cancel(game.pilotingTips);
addTraining3Waypoints();
game.respawnPoint = 1;
}
if(game.phase == 5 && vectorDist(%playerPos, game.baseLocation) > 1000 )
{
game.phase = 6;
serverConnection.setBlackout(true, 3000);
schedule(3000, game, finishMission);
}
if(%cont)
schedule(2000, game, objectiveDistanceChecks);
}
function finishMission()
{
$shrike.setFrozenState(true);
nameToId(AATurretGen).setDamageState(Disabled); //hack! cheating!
doText(T3_13);
//messageAll(0, "Nya, nya, nyanyanay...this missions oh-ohover!");
missionComplete($player.miscMsg[training3win]);
%cont = false;
}
function flipFlopFlipped()
{
//error("flip flop flipped");
if(!game.flipFlopped) {
game.flipFlopped = true;
// if we need a message modify this.
//messageTeam( %client.team, 'MsgClaimFlipFlop', '\c2%1 claimed %2 for %3.~wfx/misc/flipflop_taken.wav', %client.name, Game.cleanWord( %flipflop.name ), $TeamName[%client.team] );
doText(T3_09, 8000);
doText(T3_10);
game.phase = 4;
if(!nameToId(AATurretGen).isDisabled())
doText(t3_09a);
// new waypoint at the shrike
setWaypointAt($shrike.getTransform(), "Shrike");
updateTrainingObjectiveHud(obj4);
//get rid of the other waypoints
nameToId(Training3Waypoints).delete();
}
}
// Mission area is pointless this time out
function SinglePlayerGame::leaveMissionArea(%game, %player)
{
}
function SinglePlayerGame::enterMissionArea(%game, %player)
{
}
//===============================================END the training 3 package stuff====
};

988
scripts/Training4.cs Normal file
View file

@ -0,0 +1,988 @@
// don't want this executing when building graphs
if($OFFLINE_NAV_BUILD)
return;
echo("Running Mission 4 Script");
activatePackage(Training4);
activatePackage(singlePlayerMissionAreaEnforce);
//special sound
datablock AudioProfile(HudFlashSound)
{
filename = "gui/buttonover.wav";
description = AudioDefault3d;
preload = true;
};
$numberOfEnemies[1] = 0;
$numberOfEnemies[2] = 0;
$numberOfEnemies[3] = 0;
// Mission Variables
$numberOfWaves[1] = 3;
$numberOfWaves[2] = 5;
$numberOfWaves[3] = 7;
$numberInWave[1] = 3;
$numberInWave[2] = 5;
$numberInWave[3] = 7;
$delayBeforeFirstWave[1] = 300000;
$delayBeforeFirstWave[2] = 200000;
$delayBeforeFirstWave[3] = 20000;
$missionBotSkill[1] = 0.0;
$missionBotSkill[2] = 0.5;
$missionBotSkill[3] = 0.8;
$numberOfTeammates = 2;
package training4 {
//===============================================begin the training 4 package stuff====
function getTeammateGlobals()
{
$TeammateWarnom0 = "Firecrow";
$teammateskill0 = 0.5;
$teammateVoice0 = Fem3;
$teammateEquipment0 = 0;
$teammateGender0 = Female;
$TeammateWarnom1 = "Proteus";
$teammateSkill1 = 0.5;
$teammateVoice1 = Male4;
$teammateEquipment1 = 0;
$teammateGender1 = Male;
}
function MP3Audio::play(%this)
{
//too bad...no mp3 in training
}
function ClientCmdSetHudMode(%mode, %type, %node)
{
parent::ClientCmdSetHudMode(%mode, %type, %node);
//TrainingMap.push();
}
// get the ball rolling
function startCurrentMission(%game)
{
game.equip($player.player);
if($pref::TrainingDifficulty == 3)
updateTrainingObjectiveHud(obj10);
else{
schedule(5000, game, repairSensorTower);
updateTrainingObjectiveHud(obj1);
}
$player.beginSpawn = schedule($delayBeforeFirstWave[$pref::TrainingDifficulty], %game, spawnWave, 1);
$AIDisableChat = true;
game.missionTime = getSimTime();
activateskillSpecificTrainingSettings();
}
function activateskillSpecificTrainingSettings()
{
%skill = $pref::TrainingDifficulty;
// all
nameToId("Team1SensorLargePulse1").setDamageLevel(1.5);
nameToId("Team1SensorLargePulse2").setDamageLevel(1.5);
//skill 2 & 3 :
//no forcefield, no upstairs Inventory deploy, aaturret(in the mis file)
if(%skill > 1) {
%invDepObj = findObjByDescription("Deploy Upstairs Station", 1);
removeDescribedObj(%invDepObj, 1);
}
// skill 3: no turret, no destroy turret or upstairs gen objectives
if(%skill > 2) {
nameToId(Team1TurretBaseLarge1).hide(true);
freeTarget(nameToId(Team1TurretBaseLarge1).getTarget());
nameToId(GenForceField).delete();
}
}
function countTurretsAllowed(%type)
{
return $TeamDeployableMax[%type];
}
function giveall()
{
error("When the going gets tough...wussies like you start cheating!");
messageClient($player, 0, "Cheating eh? What\'s next? Camping?");
}
function kobayashi_maru()
{
$testcheats = true;
commandToServer('giveAll');
}
function pickEquipment()
{
return getRandom(10);
}
function AIEngageTask::assume(%task, %client)
{
Parent::assume(%task, %client);
if(%client.team != $playerTeam)
game.biodermAssume(%client);
}
function toggleScoreScreen(%val)
{
if ( %val )
messageClient($player, 0, $player.miscMsg[noScoreScreen]);
}
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 singlePlayerGame::pickTeamSpawn(%game, %client)
{
if(%client.team == $player.team)
return parent::pickTeamSpawn(%game, %client);
%dp = game.pickRandomDropPoint(%client);
InitContainerRadiusSearch(%dp.position, 2, $TypeMasks::PlayerObjectType);
if( containerSearchNext() ) {
//echo("Too close object, picking again?");
if(game.DPRetries++ > 100)
return "0 0 300";
else return game.pickTeamSpawn(%client);
}
else {
game.DPRetries = 0;
return %dp.getTransform();
}
}
function singlePlayerGame::pickRandomDropPoint(%game, %client)
{
error("picking random point for "@%client);
%group = nameToID("MissionGroup/Teams/team" @ %client.team @ "/DropPoints");
%num = %group.getCount();
%random = getRandom(1,%num);
%dp = %group.getObject( %random );
return %dp;
}
function spawnSinglePlayer()
{
$player.lives--;
%spawn = DefaultGame::pickTeamSpawn(game, $playerTeam);
game.createPlayer($player, %spawn);
$player.setControlObject($player.player);
//messageClient($player, 0, "Respawns Remaining: "@$player.lives);
game.equip($player.player, 0);
}
function Generator::onDisabled(%data, %obj, %prevState)
{
Parent::onDisabled(%data, %obj, %prevState);
if(%obj == nameToId(BaseGen)) //its our primary gen
{
doText(T4_Warning02);
game.MissionCounter = schedule(60000, 0, MissionFailedTimer);
setWaypointAt(%obj.position, "Repair Generator");
clockHud.setTime(1);
updateTrainingObjectiveHud(obj5);
}
else if($pref::trainingDifficulty < 2)
{
if (getRandom() < 0.5 )
doText(T4_ForceFields01);
else doText(T4_FFGenDown01);
}
}
function Generator::onEnabled(%data, %obj, %prevState)
{
Parent::onEnabled(%data, %obj, %prevState);
//error("Gen up somewhere");
if(%obj == nameToId(BaseGen)) {
cancel(game.MissionCounter);
objectiveHud.trainingTimer.setVisible(false);
updateTrainingObjectiveHud(obj10);
$player.currentWaypoint.delete();
cancel($player.player.trainingTimerHide);
doText(T4_GenUp);
checkForWin();
//error("its the main gen");
//restore the clock
%time = getSimTime() - game.missionTime;
%dif = %time /60000;
clockHud.setTime(%dif * -1);
}
}
// mortar mount
function playerMountWeapon(%tag, %text, %image, %player, %slot)
{
if( game.firstTime++ < 2)
return; // initial weapon mount doesnt count
if(%image.getName() $= "MortarImage" && !game.msgMortar) {
game.msgMortar = true;
doText(T4_TipMortar);
}
}
// station use
function StationInvEnter(%a1, %a2, %data, %obj, %colObj)
{
if(%colObj != $player.player)
return;
//clearQueue();
//if(!game.blowoff)
//blowoff();
if(game.msgEnterInv++ == 1){
doText(T4_tipDefense05);
}
}
function stationTrigger::onEnterTrigger(%data, %obj, %colObj)
{
Parent::onEnterTrigger(%data, %obj, %colObj);
messageClient(%colObj.client, 'msgEnterInvStation', "", %data, %obj, %colObj);
}
function serverCmdBuildClientTask(%client, %task, %team)
{
parent::serverCmdBuildClientTask(%client, %task, %team);
error("serverCmdBuildClientTask(" @%client@", "@%task@", "@%team@")");
if($pref::trainingDifficulty > 2)
return;
//hack: we have to get %objective from the parent function
// this seems to work
%objective = %client.currentAIObjective;
error(%client.currentAIObjective SPC %objective.getName());
if ((%objective.getName() $= "AIORepairObject") &&
(%objective.targetObjectId.getDataBlock().getName() $= "SensorLargePulse")) {
//error("repair order issued and forced");
// force the ai
%objective.weightLevel1 = 10000;
if(!game.issueRepairOrder && game.expectingRepairOrder) {
game.issueRepairOrder = true;
doText(Any_good, 2000);
cameraSpiel();
}
}
}
function CommanderMapGui::onWake(%this)
{
parent::onWake(%this);
if(game.firstSpawn)
return;
//error("Waking the command map.");
messageClient($player, 'commandMapWake', "");
}
function CommanderTree::onCategoryOpen(%this, %category, %open)
{
//error("commander tree button pressed");
parent::onCategoryOpen(%this, %category, %open);
if(%category $= "Support" && game.ExpectiongSupportButton) {
game.ExpectiongSupportButton = false;
doText(ANY_check01);
doText(T4_03i, 1000);
doText(T4_03j);
}
if(%category $= "Tactical" && game.ExpectiongTacticalButton) {
game.ExpectiongTacticalButton = false;
doText(ANY_check02);
messageClient($player, 0, "Click on the control box after the turrets name to control the turret.");
game.CheckingTurretControl = true;
}
}
// control turret/camera
//------------------------------------------------------------------------------
function serverCmdControlObject(%client, %targetId)
{
parent::serverCmdControlObject(%client, %targetId);
if(game.firstSpawn)
return;
error("Training 4 serverCmdControlObject");
%obj = getTargetObject(%targetId);
echo("what do we get back from the parent funtion ? "@%obj);
%objType = %obj.getDataBlock().getName();
echo("it is a "@%objType);
if(game.CheckingTurretControl) {
if(%objType $= "TurretBaseLarge") {
game.CheckingTurretControl = false;
schedule(3000, game, turretSpielEnd);
//error("Debug: You are controlling a turret f00!");
}
}
// if(game.CheckingCameraControl) {
// if(%objType $= "TurretDeployedCamera") {
// game.CheckingCameraControl = false;
// schedule(3000, $player.player, cameraSpielEnd);
// //error("Debug: You are controlling a camera, w00t!");
// }
// }
}
function singlePlayerGame::sensorOnRepaired(%obj, %objName)
{
//error("singlePlayerGame::sensorOnRepaired called");
Parent::sensorOnRepaired(%obj, %objName);
if(game.expectingTowerRepair && !game.playedOpening && !game.firstSpawn)
openingSpiel();
}
function cameraSpiel()
{
if(game.firstSpawn)
return;
doText(T4_tipCamera01);
updateTrainingObjectiveHud(obj3);
$player.player.setInventory(CameraGrenade , 8); // cheating just in case the player is a dufas
game.CheckingCameraControl = true;
}
function CameraGrenadeThrown::onThrow(%this, %camGren)
{
Parent::onThrow(%this, %camGren);
if(game.CheckingCameraControl && !game.firstSpawn) {
messageClient($player, 0, "Go back to the command map to access camera view.");
game.CheckingCameraControl = false;
game.wakeExpectingCamera = true;
updateTrainingObjectiveHud(obj2);
doText(T4_tipCamera02);
}
}
//like mission 1 and 2 there is a spiel at the begining
function repairSensorTower()
{
if(game.firstSpawn)
return;
setWaypointAt(nameToId(Team1SensorLargePulse2).position, "Repair Sensor");
game.expectingTowerRepair = true;
doText(T4_01);
doText(T4_01b);
}
function openingSpiel()
{
if(game.firstSpawn)
return;
$player.currentWaypoint.delete();
updateTrainingObjectiveHud(obj7);
game.playedOpening = true;
//doText(T4_01c);
doText(T4_02a);
doText(T4_03);
doText(T4_02);
//doText(T4_02b);
doText(T4_03a);
}
function ThreeAEval()
{
if(game.firstSpawn)
return;
game.wakeExpectingSquadOrder = true;
updateTrainingObjectiveHud(obj2);
}
function missionSpawnedAI()
{
if(!game.firstSpawn) {
game.firstspawn = true;
doText(ANY_warning05);
doText(ANY_warning03); // does a playgui check
//updateTrainingObjectiveHud(obj5);
}
}
function singlePlayerPlayGuiCheck()
{
if(CommanderMapGui.open)
CommanderMapGui.close();
updateTrainingObjectiveHud(obj10);
}
function missionWaveDestroyed(%wave)
{
if(%wave == 1) {
doText(T4_06);
doText(T4_tipDefense02);
}
else if(%wave == 2)
doText(T4_08);
else if( %wave == $numberOfWaves[$pref::TrainingDifficulty] ) {
//MessageAll(0, "The last wave is destroyed. This mission would end.");
game.allEnemiesKilled = true;
checkForWin();
}
}
function checkForWin()
{
if(game.allEnemiesKilled && nameToId(BaseGen).isEnabled()) {
clearQueue();
doText(T4_10);
doText(T4_11);
schedule(4000, game, missionComplete, $player.miscMsg[training4win]);
}
}
function cameraSpielEnd()
{
if(game.firstSpawn)
return;
doText(T4_tipCamera03);
doText(T4_tipCamera04, 2000);
doText(T4_controlTurret);
game.CheckingTurretControl = true;
game.wakeExpectingTurret = true;
updateTrainingObjectiveHud(obj4);
}
function turretSpielEnd()
{
if(game.firstSpawn)
return;
doText(T4_tipObjects);
doText(T4_CCend, 4000);
doText(T4_TipGenerator01, 2000);
doText(T4_TipGenerator01a);
doText(T4_TipGenerator01b);
doText(T4_TipGenerator02, 2000);
doText(T4_tipDefense01);
// doText(T4_tipDefense06);
// doText(T4_tipDefense07);
// doText(T4_tipDefense08);
// doText(T4_tipDefense09);
updateTrainingObjectiveHud(obj9);
//game.blowOff = true; //feel free to use the inventory stations
}
// turret deployment advice and messages
function singlePlayerFailDeploy(%tag, %message)
{
%text = detag(%message);
%phrase = getWord(%text, 0) SPC getWord(%text, 1);
//echo(%phrase);
switch$(%phrase) {
case "\c2Item must":
if(!game.tipDep1) {
game.tipDep1 = true;
doText(T4_tipDeploy01);
}
case "\c2You cannot":
if(!game.tipDep2) {
game.tipDep2 = true;
doText(T4_tipDeploy02);
}
case "\c2Interference from":
if(!game.tipDepT) {
game.tipDepT = true;
doText(T4_tipDepTurret);
}
}
}
// not really a callback but this prolly goes here
function cloakingUnitAdded()
{
if(game.addedCloak++ < 2) {
doText(T4_TipDefense03);
}
}
function RepairingObj(%tag, %text, %name, %obj)
{
if(%obj.getDataBlock().getName() $= "SensorLargePulse" && !game.repairingSensor) {
game.repairingSensor = true;
schedule(2000, $player.player, doText, T4_01c);
}
}
// equipment =======================================================================
//===================================================================================
//there are a plethora of configs in this mission
function SinglePlayerGame::equip(%game, %player, %set)
{
if(!isObject(%player))
return;
//ya start with nothing...NOTHING!
%player.clearInventory();
for(%i =0; %i<$InventoryHudCount; %i++)
%player.client.setInventoryHudItem($InventoryHudData[%i, itemDataName], 0, 1);
%player.client.clearBackpackIcon();
//error("equping Player "@%player@" with set"@%set);
switch (%set)
{
case 0:
//echo("player Heavy");
%player.setArmor("Heavy");
%player.setInventory(RepairPack, 1);
%player.setInventory(RepairKit,1);
%player.setInventory(CameraGrenade,8);
%player.setInventory(Mine,3);
%player.setInventory(Chaingun, 1);
%player.setInventory(ChaingunAmmo, 200);
%player.setInventory(Disc,1);
%player.setInventory(DiscAmmo, 15);
%player.setInventory(Mortar, 1);
%player.setInventory(MortarAmmo, 10);
%player.setInventory(Blaster,1);
%player.setInventory(GrenadeLauncher,1);
%player.setInventory(GrenadeLauncherAmmo,15);
%player.setInventory(TargetingLaser, 1);
%player.use("Disc");
%player.weaponCount = 5;
case 1:
//echo("Light Skirmisher");
%player.setArmor("Light");
%player.setInventory(EnergyPack, 1);
%player.setInventory(RepairKit,1);
%player.setInventory(ConcussionGrenade,5);
%player.setInventory(Blaster,1);
%player.setInventory(Disc,1);
%player.setInventory(DiscAmmo, 15);
%player.setInventory(Chaingun, 1);
%player.setInventory(ChaingunAmmo, 100);
%player.setInventory(TargetingLaser, 1);
%player.use("Chaingun");
%player.weaponCount = 3;
case 2:
//script hook in our equip stuff also
cloakingUnitAdded();
//echo("Light Assassin Config");
%player.setArmor("Light");
%player.setInventory(CloakingPack, 1);
%player.setInventory(RepairKit,1);
%player.setInventory(FlashGrenade,5);
%player.setInventory(Mine,3);
%player.setInventory(Plasma, 1);
%player.setInventory(PlasmaAmmo, 20);
%player.setInventory(Disc,1);
%player.setInventory(DiscAmmo, 15);
%player.setInventory(ShockLance,1);
%player.setInventory(TargetingLaser, 1);
%player.use("Disc");
%player.weaponCount = 3;
case 3:
//echo("Light Sniper");
%player.setArmor("Light");
%player.setInventory(EnergyPack, 1);
%player.setInventory(RepairKit,1);
%player.setInventory(ConcussionGrenade,5);
%player.setInventory(Chaingun,1);
%player.setInventory(ChaingunAmmo,100);
%player.setInventory(Disc,1);
%player.setInventory(DiscAmmo, 15);
%player.setInventory(SniperRifle, 1);
%player.setInventory(TargetingLaser, 1);
%player.use("SniperRifle");
%player.weaponCount = 3;
case 4:
echo("Medium Base Rape");
%player.setArmor("Medium");
%player.setInventory(ShieldPack, 1);
%player.setInventory(RepairKit,1);
%player.setInventory(Grenade,6);
%player.setInventory(Mine,3);
%player.setInventory(Plasma, 1);
%player.setInventory(PlasmaAmmo, 40);
%player.setInventory(Disc,1);
%player.setInventory(DiscAmmo, 15);
%player.setInventory(ElfGun, 1);
%player.setInventory(GrenadeLauncher,1);
%player.setInventory(GrenadeLauncherAmmo, 10);
%player.setInventory(TargetingLaser, 1);
%player.use("GrenadeLauncher");
%player.weaponCount = 4;
case 5:
//echo("Medium Killing Machine");
%player.setArmor("Medium");
%player.setInventory(AmmoPack, 1);
%player.setInventory(RepairKit,1);
%player.setInventory(Grenade,6);
%player.setInventory(Mine,3);
%player.setInventory(Plasma, 1);
%player.setInventory(PlasmaAmmo, 40);
%player.setInventory(Disc,1);
%player.setInventory(DiscAmmo, 15);
%player.setInventory(GrenadeLauncher, 1);
%player.setInventory(GrenadeLauncherAmmo, 10);
%player.setInventory(MissileLauncher,1);
%player.setInventory(MissileLauncherAmmo, 10);
%player.setInventory(TargetingLaser, 1);
%player.use("Plasma");
%player.weaponCount = 4;
case 6:
//echo("Medium Wuss");
%player.setArmor("Medium");
%player.setInventory(EnergyPack, 1);
%player.setInventory(RepairKit,1);
%player.setInventory(ConcussionGrenade,6);
%player.setInventory(Blaster, 1);
%player.setInventory(Disc,1);
%player.setInventory(DiscAmmo, 15);
%player.setInventory(Elf, 1);
%player.setInventory(Chaingun,1);
%player.setInventory(ChaingunAmmo, 150);
%player.setInventory(TargetingLaser, 1);
%player.use("Disc");
%player.weaponCount = 4;
case 7:
//echo("Heavy Long Range");
%player.setArmor("Heavy");
%player.setInventory(EnergyPack, 1);
%player.setInventory(RepairKit,1);
%player.setInventory(Grenade,8);
%player.setInventory(Mine,3);
%player.setInventory(Plasma, 1);
%player.setInventory(PlasmaAmmo, 50);
%player.setInventory(Disc,1);
%player.setInventory(DiscAmmo, 15);
%player.setInventory(Mortar, 1);
%player.setInventory(MortarAmmo, 10);
%player.setInventory(MissileLauncher,1);
%player.setInventory(MissileLauncherAmmo, 15);
%player.setInventory(GrenadeLauncher,1);
%player.setInventory(GrenadeLauncherAmmo,15);
%player.setInventory(TargetingLaser, 1);
%player.use("Mortar");
%player.weaponCount = 5;
case 8:
//echo("Default Config");
%player.setArmor("Light");
%player.setInventory(RepairKit,1);
%player.setInventory(Blaster,1);
%player.setInventory(Disc,1);
%player.setInventory(DiscAmmo, 15);
%player.setInventory(Chaingun, 1);
%player.setInventory(ChaingunAmmo, 100);
%player.setInventory(TargetingLaser, 1);
%player.use("Blaster");
%player.weaponCount = 3;
case 9:
//echo("Heavy Rate of Fire");
%player.setArmor("Heavy");
%player.setInventory(AmmoPack, 1);
%player.setInventory(RepairKit,1);
%player.setInventory(Grenade,8);
%player.setInventory(Mine,3);
%player.setInventory(Chaingun, 1);
%player.setInventory(ChaingunAmmo, 200);
%player.setInventory(Disc,1);
%player.setInventory(DiscAmmo, 15);
%player.setInventory(Mortar, 1);
%player.setInventory(MortarAmmo, 10);
%player.setInventory(Plasma,1);
%player.setInventory(PlasmaAmmo, 50);
%player.setInventory(GrenadeLauncher,1);
%player.setInventory(GrenadeLauncherAmmo,15);
%player.setInventory(TargetingLaser, 1);
%player.use("Mortar");
%player.weaponCount = 5;
case 10:
//echo("Heavy Inside Attacker");
%player.setArmor("Heavy");
%player.setInventory(ShieldPack, 1);
%player.setInventory(RepairKit,1);
%player.setInventory(ConcussionGrenade,8);
%player.setInventory(Mine,3);
%player.setInventory(Plasma, 1);
%player.setInventory(PlasmaAmmo, 50);
%player.setInventory(Disc,1);
%player.setInventory(DiscAmmo, 15);
%player.setInventory(Mortar, 1);
%player.setInventory(MortarAmmo, 10);
%player.setInventory(ShockLance,1);
%player.setInventory(Chaingun,1);
%player.setInventory(ChaingunAmmo,200);
%player.setInventory(TargetingLaser, 1);
%player.use("Mortar");
%player.weaponCount = 5;
}
}
// silly littly functions
function flashButton(%buttonName)
{
%time = 800;
%num = 6;
for(%i=0; %i<%num; %i++) {
schedule( %time*%i, $player.player, "eval", %buttonName@".setVisible(false);");
schedule(%time*%i + %time/2, $player.player, "eval", %buttonName@".setVisible(true);");
schedule(%time*%i, $player.player, serverPlay2d, HudFlashSound);
}
}
function showCommandPulldown(%button)
{
//this is what I hacked in to make pretty with the showing off of the command tree
commanderTree.openCategory(%button, true);
mentionPulldown(%button);
commanderTree.schedule(3000, openCategory, %button, false);
}
function affectAllCommandPulldown(%open)
{
commanderTree.openCategory(Clients, %open);
commanderTree.openCategory(Tactical, %open);
commanderTree.openCategory(Support, %open);
commanderTree.openCategory(Waypoints, %open);
commanderTree.openCategory(Objectives, %open);
}
function mentionPulldown(%button)
{
switch$(%button)
{
case "Clients":
doText(T4_03b);
case "Tactical":
doText(T4_03c);
case "Support":
doText(T4_03d);
case "Waypoints":
doText(T4_03e);
case "Objectives":
doText(T4_03f);
doText(T4_03g);
doText(t4_03h);
}
}
function training4CommandMapWake()
{
error("training4CommandMapWake Called");
if(game.wakeExpectingSquadOrder && !game.firstSpawn) {
game.wakeExpectingSquadOrder = false;
// commander map waypoint
%pos = nameToId(Base).position;
%obj = createClientTarget(-1, %pos);
%obj.createWaypoint("Nagakhun Base");
// cmap objective
commanderTree.registerEntryType("Objectives", getTag('Base'), false, "commander/MiniIcons/com_flag_grey", "255 255 255");
createTarget(%id, 'Defend', "", "", 'Base', $player.getSensorGroup());
affectAllCommandPulldown(false);
//here we go...drop down the thingies
schedule( 2500, $player.player, showCommandPulldown, Clients);
schedule( 6000, $player.player, showCommandPulldown, Tactical);
schedule(10000, $player.player, showCommandPulldown, Support);
schedule(14000, $player.player, showCommandPulldown, Waypoints);
schedule(18000, $player.player, showCommandPulldown, Objectives);
//schedule(24000, $player.player, affectAllCommandPulldown, true);
}
else if(game.wakeExpectingTurret && !game.firstSpawn) {
messageClient($player, 0, "Click on \"Tactical Assets\" to view turrets.");
//flashButton(CMDTacticalButton);
game.ExpectiongTacticalButton = true;
game.wakeExpectingTurret = false;
}
else if(game.wakeExpectingCamera && !game.firstSpawn) {
messageClient($player, 0, "Click on the control box to the right of the camera\'s name to control the camera.");
cameraSpielEnd();
game.wakeExpectingCamera = false;
}
}
// Objectives ==================================================================
//================================================================================
function missionFailedTimer()
{
missionFailed($player.miscMsg[training4GenLoss]);
}
function blowoff()
{
game.blowoff = true;
clearQueue();
doText(Any_Blowoff02, 2000, 1);
// okay, the player wants to play huh?
// if we are still waiting for the enemies to spawn at this point
// cancel that and spawn them now...well, soon
if($player.beginSpawn){
cancel($player.beginSpawn);
%time = getRandom(1, 20);
//error("Blowing off the training: spawning enemies in "@ %time * 1000 @" seconds.");
schedule(%time*1000, game, beginTraining4Enemies);
}
}
function findObjbyDescription(%desc, %team)
{
%q = $objectiveQ[%team];
for(%i = 0; %i < %q.getCount(); %i++)
{
%objective = %q.getObject(%i);
if(%objective.description $= %desc)
return %objective;
}
}
function removeDescribedObj( %obj )
{
%invDepObj.weightLevel1 = 0;
%invDepObj.weightLevel2 = 0;
%invDepObj.weightLevel3 = 0;
%invDepObj.weightLevel4 = 0;
$ObjectiveQ[1].remove(%invDepObj);
// clear it in case anyone has picked it up
AIClearObjective(%invDepObj);
}
//===============================================END the training 4 package stuff====
};
// Dialog stuff ===================================================================
//=================================================================================
// Callbacks //==================================================================
//================================================================================
//add callbacks
addMessageCallback('MsgDeployFailed', singlePlayerFailDeploy);
addMessageCallback('MsgWeaponMount', playerMountWeapon);
addMessageCallback('msgEnterInvStation', StationInvEnter);
addMessageCallback('MsgRepairPackRepairingObj', RepairingObj);
addMessageCallback('commandMapWake', training4CommandMapWake);

613
scripts/Training5.cs Normal file
View file

@ -0,0 +1,613 @@
// don't want this executing when building graphs
if($OFFLINE_NAV_BUILD)
return;
echo("-----------------Running Training5");
activatePackage(Training5);
//BaseExplosion sound
datablock EffectProfile(Training5BaseExplosionEffect)
{
effectname = "explosions/explosion.xpl27";
minDistance = 20;
maxDistance = 100;
};
datablock AudioProfile(Training5BaseExplosionSound)
{
filename = "fx/explosions/explosion.xpl27.wav";
description = AudioDefault3d;
effect = Training5BaseExplosionEffect;
preload = true;
};
//mission variables
$numberOfTeammates = 0;
$numberOfEnemies[1] = 6;
$numberOfEnemies[2] = 6;
$numberOfEnemies[3] = 8;
$missionBotSkill[1] = 0.0;
$missionBotSkill[2] = 0.5;
$missionBotSkill[3] = 0.9;
$missionEnemyThreshold[1] = 1;
$missionEnemyThreshold[2] = 3;
$missionEnemyThreshold[3] = 8;
$bridgeTime[1] = 30;
$bridgeTime[2] = 20;
$bridgeTime[3] = 5;
package Training5 {
//Training5 package functions begin=======================================================
function SinglePlayerGame::initGameVars(%game)
{
// for many of the objectives we are going to periodically
// check the players distance vs some object
// you could do this much prettier but its going to be very specific
// so a cut and paste eyesore will be fine
echo("initializing training5 game vars");
%game.targetObject1 = nameToId("ObjectiveGen1");
%game.targetObject2 = nameToId("ObjectiveGen2");
%game.tower = nameToId("MissionGroup/Teams/Team2/tower/tower");
%game.base = nameToId("DBase2");
%game.minimumSafeDistance = 500;
%game.West = nameToId(WestBridgeGen);
%game.East = nameToId(EastBridgeGen);
%game.North = nameToId(NorthBridgeGen);
%game.South = nameToId(SouthBridgeGen);
}
function MP3Audio::play(%this)
{
//too bad...no mp3 in training
}
function toggleScoreScreen(%val)
{
if ( %val )
//error("No Score Screen in training.......");
messageClient($player, 0, $player.miscMsg[noScoreScreen]);
}
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 ClientCmdSetHudMode(%mode, %type, %node)
{
parent::ClientCmdSetHudMode(%mode, %type, %node);
//TrainingMap.push();
}
// get the ball rolling
function startCurrentMission(%game)
{
setFlipFlopSkins();
doText(Any_Waypoint01, 2000);
if(getRandom(3) == 1)
doText(Any_warning01);
setWaypointAt(nameToId(TowerSwitch).position, "Periphery Tower Control");
objectiveDistanceChecks();
updateTrainingObjectiveHud(obj1);
// adding a little something for the players followers to do
//training5AddEscort($teammate0);
// Tower FFs all start off by default
// we cheat and disable their hidden generators
nameToId(CatwalkFFGen).setDamageState(Disabled);
game.West.setDamageState(Disabled);
game.East.setDamageState(Disabled);
game.North.setDamageState(Disabled);
game.South.setDamageState(Disabled);
// but we start the rotation
%skill = $pref::trainingDifficulty;
//%time = 1000 * (10 - %skill * skill );
%time = $bridgeTime[%skill] * 1000;
rotateDrawbridgeFFs(%time);
setUpDifficultySettings($pref::trainingDifficulty);
}
function setUpDifficultySettings(%skill)
{
if(%skill < 2)
{
nameToId(DownStairsSentry).hide(true);
freeTarget(nameToId(DownStairsSentry).getTarget());
nameToId(UpstairsTurret).hide(true);
freeTarget(nameToId(UpstairsTurret).getTarget());
}
if(%skill == 3)
nameToId(SatchelChargePack).hide(true);
}
function countTurretsAllowed(%type)
{
return $TeamDeployableMax[%type];
}
function getTeammateGlobals()
{
echo("You have no teammates in this mission");
}
function FlipFlop::objectiveInit(%data, %flipflop)
{
}
function giveall()
{
error("When the going gets tough...wussies like you start cheating!");
messageClient($player, 0, "Cheating eh? What\'s next? Camping?");
}
function kobayashi_maru()
{
$testCheats = true;
commandToServer('giveAll');
}
// Distance Check =============================================================
// Ive never done this before :P but im going to use a periodic self-scheduling
// distance checking mechanism in this mission also
function objectiveDistanceChecks()
{
%playerLocation = $player.player.position;
if(!%playerLocation) {
schedule(5000, game, objectiveDistanceChecks);
return;
}
// %baseDist = vectorDist(%playerLocation, %game.base.position);
// if(%baseDist < 600 && !%game.training5SwitchObjective && !%game.turretsWarn){
// %game.turretsWarn = true;
// doText(Any_warning06);
// }
%baseDist = vectorDist(%playerLocation, game.base.position);
if(%baseDist < 200 && game.respawnPoint == 1) {
game.respawnPoint = 2;
return; // kill the distCheck
}
%dist = vectorDist(%playerLocation, game.tower.position);
//error("Tower Dist = "@%dist);
if( %dist < 400 && !game.t5distcheck1) {
game.t5distcheck1 = true;
doText(T5_04);
return;
}
if( %dist > 200 && game.training5SwitchObjective && !game.tipFirepower) {
%packImage = $player.player.getMountedImage($backPackSlot).getName();
if(%packImage !$= "SatchelChargeImage" && %packImage !$= "InventoryDeployableImage") {
game.tipFirepower = true;
doText(T5_tipFirepower);
}
}
schedule(5000, game, objectiveDistanceChecks);
}
//======================================================================================
// Objective Generators
//======================================================================================
function GeneratorLarge::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType)
{
if(%targetObject == game.targetObject1 || %targetObject == game.targetObject2)
%message = training5ObjectiveGenDamaged(%targetObject, %damageType);
else
Parent::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType);
if(%message)
training5messageDamageFailed();
}
function training5ObjectiveGenDamaged(%targetObject, %damageType)
{
//error("training5ObjectiveGenDamaged("@%targetObject@", "@%damageType@")");
if(game.genDestroyed[%targetObject])
return false;
if(%damageType != $DamageType::SatchelCharge)
{
return true;
}
game.objectiveDestroyed = true;
%targetObject.applyDamage(%targetObject.getDataBlock().maxDamage);
return false;
}
function training5messageDamageFailed()
{
if(!game.tooSoonMsg && !game.objectiveDestroyed) {
game.tooSoonMsg = true;
schedule(15000, game, eval, "game.tooSoonMsg = false;");
messageClient($player, 0, $player.miscMsg[genAttackNoSatchel]);
training5easySatchelWaypoint();
}
}
function training5easySatchelWaypoint()
{
if($pref::trainingDifficulty == 1 &&
$player.player.getMountedImage($backPackSlot).getName() !$= "SatchelChargeImage" && !game.satchelWaypointSet) {
%waypoint = new WayPoint() {
position = nameToId(SatchelChargePack).position;
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "WayPointMarker";
lockCount = "0";
homingCount = "0";
name = "Satchel Charge";
team = 1;
locked = "true";
};
$player.satchelWaypoint = %waypoint;
game.satchelWaypointSet = true;
}
}
//======================================================================================
function AIEngageTask::assume(%task, %client)
{
Parent::assume(%task, %client);
if(%client.team != $playerTeam)
game.biodermAssume(%client);
}
// ============================================================================
function singlePlayerGame::onAIRespawn(%game, %client)
{
if(! isObject("MissionCleanup/TeamDrops2")) {
//this is the snippet of script from default games that puts teamdrops
// into the mission cleanup group...slightly modified to suit our needs
%dropSet = new SimSet("TeamDrops2");
MissionCleanup.add(%dropSet);
%spawns = nameToID("MissionGroup/Teams/team2/TeamDrops");
if(%spawns != -1)
{
%count = %spawns.getCount();
for(%i = 0; %i < %count; %i++)
%dropSet.add(%spawns.getObject(%i));
}
}
parent:: onAIRespawn(%game, %client);
}
// ============================================================================
function singlePlayerGame::onAIKilled(%game, %clVictim, %clAttacker, %damageType, %implement)
{
%teamCount = getPlayersOnTeam(%clVictim.team);
//echo("Team count:" SPC %teamCount);
%maintNum = $missionEnemyThreshold[$pref::trainingDifficulty];
//echo("Maintain:" SPC %maintNum);
%clVictim.useSpawnSphere = true;
// this will respawn the AI if
if( %teamCount < %maintNum )
DefaultGame::onAIKilled(%game, %clVictim, %clAttacker, %damageType, %implement);
}
function singleplayerGame::pickTeamSpawn(%game, %client, %respawn)
{
if(%client.useSpawnSphere)
DefaultGame::pickTeamSpawn(%game, %client.team);
else
parent::pickTeamSpawn(%game, %client, %respawn);
}
function SinglePlayerGame::equip(%game, %player, %set)
{
if(!isObject(%player))
return;
%player.clearInventory();
if(!%set)
%set = %player.client.equipment;
for(%i =0; %i<$InventoryHudCount; %i++)
%player.client.setInventoryHudItem($InventoryHudData[%i, itemDataName], 0, 1);
%player.client.clearBackpackIcon();
%player.setArmor("Medium");
%player.setInventory(SatchelCharge, 1);
%player.setInventory(RepairKit, 1);
%player.setInventory(ConcussionGrenade, 8);
%player.setInventory(Mine, 3);
%player.setInventory(Plasma, 1);
%player.setInventory(PlasmaAmmo, 40);
%player.setInventory(Chaingun, 1);
%player.setInventory(ChaingunAmmo, 200);
%player.setInventory(Disc, 1);
%player.setInventory(DiscAmmo, 15);
%player.setInventory(GrenadeLauncher, 1);
%player.setInventory(GrenadeLauncherAmmo, 15);
%player.setInventory(TargetingLaser, 1);
%player.use("Disc");
%player.weaponCount = 4;
}
//the generator destroyed trigers the detonation sequence
function Generator::onDestroyed(%data, %destroyedObj)
{
//error("GeneratorLarge::onDestroyed");
if(%destroyedObj == game.targetObject1 || %destroyedObj == game.targetObject2)
if(!game.detonationSequenceStarted) {
game.detonationSequenceStarted = true;
error("The satchel waypoint is:" SPC $player.satchelWaypoint);
$player.satchelWaypoint.delete();
detonationSequence();
updateTrainingObjectiveHud(obj4);
game.respawnPoint = 3;
$missionEnemyThreshold[1] = 0;
$missionEnemyThreshold[2] = 0;
$missionEnemyThreshold[3] = 0;
}
Parent::onDestroyed(%data, %destroyedObj);
}
function FlipFlop::objectiveInit(%data, %flipflop)
{
}
function FlipFlop::playerTouch(%data, %flipFlop, %player)
{
//error("singlePlayer::playerTouchFlipFlop Training5");
//echo("has been touched before? " SPC game.training5SwitchObjective);
Parent::playerTouch(%data, %flipFlop, %player);
//This disables the base door FFs
%state = (%flipFlop.team == $playerTeam ? "Disabled" : "Enabled");
game.targetObject2.setDamageState(%state);
if(!game.training5SwitchObjective) {
game.training5SwitchObjective = true;
doText(T5_05, 10000);
doText(T5_05b);
doText(T5_05a);
schedule(10000, game, setWaypointAt, game.targetObject2.getWorldBoxCenter(), "Reactor Regulator" );
schedule(10000, game, updateTrainingObjectiveHud , obj2);
//start the distance check again
objectiveDistanceChecks();
game.respawnPoint = 1;
rotateDrawbridgeFFs(false);
}
}
//EndingExplosionStuff=========================================================================
function detonationSequence()
{
// first a little eye candy
%oldEmitter = nameToId(LavaSmoke);
%oldEmitter.delete();
%newEmitter = new ParticleEmissionDummy(LavaSmoke) {
position = "-462.4 -366.791 5.12867";
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "defaultEmissionDummy";
emitter = "AfterT5";
velocity = "1";
};
%detonationTime = 1000 * 90; // 90 is a guess, at least 67 before you cut lines
schedule(3000, game, doText, T5_06); //Get Out Hurry!
schedule(%detonationTime, game, detonateBase ); //BOOM //moved to t5_08d,eval
schedule(%detonationTime - 5000, game, doText, T5_08urgent); //5..4..3..2..1
schedule(%detonationTime - 9000, game, doText, T5_07); //ComeOn
schedule(%detonationTime - 10000, game, doText, T5_06d); //10
schedule(%detonationTime - 30000, game, doText, T5_06c); // 30 secs
schedule(%detonationTime - 64000, game, doText, T5_06a); //reaction building fast
schedule(%detonationTime - 60000, game, doText, T5_06b); //1 min
}
function detonateBase()
{
%playerDist = vectorDist($player.player.position, game.base.position);
//BOOM
//schedule(0.33 * %playerDist, game, serverplay2d, Training5BaseExplosionSound);
schedule(0.33 * %playerDist, game, damagePlayersInBlast, game.minimumSafeDistance);
$player.player.setWhiteOut(8);
//messageAll(0, "You were "@%playerDist@"meters away. Minimum safe distance is "@game.minimumSafeDistance);
if( %playerDist < game.minimumSafeDistance || !$player.player) {
schedule(5000, game, missionFailed, $player.miscMsg[training5loss] );
moveMap.pop();
}
else {
//messageAll(0, "You won!");
schedule(5000, game, doText, T5_09, 3000);
schedule(13000, game, messageBoxOK, "Victory", $player.miscMsg[training5win], "Canvas.popDialog(MessageBoxOKDlg); schedule(1000, game, trainingComplete);");
moveMap.schedule(13000, "pop");
}
}
function trainingComplete()
{
%skill = $pref::trainingDifficulty;
switch (%skill)
{
case 2:
%msg = "trainingOverMed";
case 3:
%msg = "trainingOverHard";
default:
%msg = "trainingOverEasy";
}
missionComplete( $player.miscMsg[%msg] );
}
function damagePlayersInBlast(%minDist)
{
Canvas.popDialog(MessageBoxOKDlg);
Canvas.popDialog(MessageBoxYesNoDlg);
serverPlay2d(Training5BaseExplosionSound);
%num = ClientGroup.getCount();
for(%i = 0; %i < %num; %i++)
{
%client = clientGroup.getObject(%i);
if(%client.player)
{
%Dist = vectorDist(%client.player.position, game.base.position);
if(%dist < %minDist)
{
if(%client != $player)
%client.player.scriptKill($DamageType::Explosion);
else {
moveMap.pop();
if($firstperson)
toggleFirstPerson($player);
serverConnection.setBlackout(true, 3000);
%client.player.setActionThread(Death11, true);
%client.player.setDamageFlash(0.75);
}
}
else
$player.player.setWhiteOut(12);
}
}
}
// turninig off the Mission area on this one too folks
function SinglePlayerGame::leaveMissionArea(%game, %player)
{
}
function SinglePlayerGame::enterMissionArea(%game, %player)
{
}
function rotateDrawbridgeFFs(%time)
{
if(%time == 0)
{
// catwalks on
nameToId(CatwalkFFGen).setDamageState(Enabled);
// stop rotation
cancel(game.FFRotate);
// set Enabled All bridges
game.West.setDamageState(Enabled);
game.East.setDamageState(Enabled);
game.North.setDamageState(Enabled);
game.South.setDamageState(Enabled);
}
else
{
// start these bad boys rotating
if(game.activeBridgeSet == 1) {
game.West.setDamageState(Enabled);
game.East.setDamageState(Enabled);
game.North.setDamageState(Disabled);
game.South.setDamageState(Disabled);
game.activeBridgeSet = 2;
}
else {
game.West.setDamageState(Disabled);
game.East.setDamageState(Disabled);
game.North.setDamageState(Enabled);
game.South.setDamageState(Enabled);
game.activeBridgeSet = 1;
}
game.FFRotate = schedule(%time, game, rotateDrawbridgeFFs, %time);
}
}
// helpful satchel charge instructions
function armSatchelCharge(%satchel)
{
%deployer = %satchel.sourceObject;
messageClient(%deployer.client, 0, "\c2Satchel Charge Armed! Press" SPC findTrainingControlButtons(useBackPack) SPC"to detonate.");
if(!game.msgSatchelActivate)
{
game.msgSatchelActivate = true;
doText(T5_tipSatchel01);
}
parent::armSatchelCharge(%satchel);
}
function Pack::onInventory(%data, %obj, %amount)
{
%oldSatchelCharge = (%obj.thrownChargeId ? true : false);
Parent::onInventory(%data, %obj, %amount);
%nowSatchelCharge = (%obj.thrownChargeId ? true : false);
if(%oldSatchelCharge && !%nowSatchelCharge)
messageClient(%obj.client, 0, "\c2You got a pack and nullified your satchel charge.");
}
function singlePlayerGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement)
{
%hadSatchelCharge = (%clvictim.player.thrownChargeId ? true : false);
if(%hadSatchelCharge)
schedule(1500, game, messageClient, %clVictim, 0, "Your satchel charge has been nullified.");
Parent::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement);
}
function missionClientKilled()
{
//no console spam
}
//Training5 package functions end=======================================================
};

264
scripts/TrainingGui.cs Normal file
View file

@ -0,0 +1,264 @@
//------------------------------------------------------------------------------
//
// TrainingGui.cs
//
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
function LaunchTraining()
{
LaunchTabView.viewTab( "TRAINING", TrainingGui, 0 );
}
//------------------------------------------------------------------------------
function TrainingGui::onWake( %this )
{
Canvas.pushDialog( LaunchToolbarDlg );
%this.soundHandle = 0;
%this.briefEventCount = 0;
%this.briefWAV = "";
%ct = 1;
%fobject = new FileObject();
%search = "missions/*.mis";
TrainingMissionList.clear();
for ( %file = findFirstFile( %search ); %file !$= ""; %file = findNextFile( %search ) )
{
%name = fileBase(%file); // get the mission name
if ( !%fobject.openForRead( %file ) )
continue;
%typeList = "None";
while( !%fobject.isEOF() )
{
%line = %fobject.readLine();
if ( getSubStr( %line, 0, 18 ) $= "// MissionTypes = " )
{
%typeList = getSubStr( %line, 18, 1000 );
break;
}
}
if ( strstr( %typeList, "SinglePlayer" ) != -1 )
{
// Get the mission display name:
%displayName = %name;
while ( !%fobject.isEOF() )
{
%line = %fobject.readLine();
if ( getSubStr( %line, 0, 16 ) $= "// PlanetName = " )
{
%displayName = getSubStr( %line, 16, 1000 );
// Strip the date:
%pos = strpos( %displayName, "," );
if ( %pos != -1 )
%displayName = getSubStr( %displayName, 0, %pos );
break;
}
}
TrainingMissionList.addRow( %ct++, %displayName TAB %name );
}
%fobject.close();
}
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::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 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();
//if ( TrainingPlayTgl.getValue() )
// TrainingGui.startBriefing();
}
//------------------------------------------------------------------------------
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();
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" );
localConnect( "Lone Wolf", "Human Male", "swolf", "Male1" );
}

BIN
scripts/TrainingGui.cs.dso Normal file

Binary file not shown.

407
scripts/admin.cs Normal file
View file

@ -0,0 +1,407 @@
// These have been secured against all those wanna-be-hackers.
$VoteMessage["VoteAdminPlayer"] = "Admin Player";
$VoteMessage["VoteKickPlayer"] = "Kick Player";
$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)
{
//DEMO VERSION - only voteKickPlayer is allowed
if ((isDemo()) && %typeName !$= "VoteKickPlayer")
{
messageClient(%client, '', "All voting options except to kick a player are disabled in the DEMO VERSION.");
return;
}
// haha - who gets the last laugh... No admin for you!
if( %typeName $= "VoteAdminPlayer" && !$Host::allowAdminPlayerVotes )
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. This was busted, BanPlayer was never delt with.
if( %typeName $= "BanPlayer" )
{
if( !%client.isSuperAdmin || %arg1.isAdmin )
{
return; // -> bye ;)
}
else
{
ban( %arg1, %client );
return;
}
}
%isAdmin = ( %client.isAdmin || %client.isSuperAdmin );
// 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 ) ) ) )
{
%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
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
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);
}
}

908
scripts/ai.cs Normal file
View file

@ -0,0 +1,908 @@
//-----------------------------------//
// AI SCRIPT FUNCTIONS //
//-----------------------------------//
//first, exec the supporting scripts
exec("scripts/aiDebug.cs");
exec("scripts/aiDefaultTasks.cs");
exec("scripts/aiObjectives.cs");
exec("scripts/aiInventory.cs");
exec("scripts/aiChat.cs");
exec("scripts/aiHumanTasks.cs");
exec("scripts/aiObjectiveBuilder.cs");
exec("scripts/aiBotProfiles.cs");
$AIModeStop = 0;
$AIModeWalk = 1;
$AIModeGainHeight = 2;
$AIModeExpress = 3;
$AIModeMountVehicle = 4;
$AIClientLOSTimeout = 15000; //how long a client has to remain out of sight of the bot
//before the bot "can't see" the client anymore...
$AIClientMinLOSTime = 10000; //how long a bot will search for a client
//-----------------------------------//
//Objective weights - level 1
$AIWeightCapFlag[1] = 5000; //range 5100 to 5320
$AIWeightKillFlagCarrier[1] = 4800; //range 4800 to 5120
$AIWeightReturnFlag[1] = 5001; //range 5101 to 5321
$AIWeightDefendFlag[1] = 3900; //range 4000 to 4220
$AIWeightGrabFlag[1] = 3850; //range 3950 to 4170
$AIWeightDefendFlipFlop[1] = 3900; //range 4000 to 4220
$AIWeightCaptureFlipFlop[1] = 3850; //range 3850 to 4170
$AIWeightAttackGenerator[1] = 3100; //range 3200 to 3520
$AIWeightRepairGenerator[1] = 3200; //range 3300 to 3620
$AIWeightDefendGenerator[1] = 3100; //range 3200 to 3420
$AIWeightMortarTurret[1] = 3400; //range 3500 to 3600
$AIWeightLazeObject[1] = 3200; //range 3300 to 3400
$AIWeightRepairTurret[1] = 3100; //range 3200 to 3420
$AIWeightAttackInventory[1] = 2900; //range 2800 to 2920
$AIWeightRepairInventory[1] = 2900; //range 2800 to 2920
$AIWeightEscortOffense[1] = 2900; //range 2800 to 2920
$AIWeightEscortCapper[1] = 3250; //range 3350 to 3470
//used to allow a bot to finish tasks once started.
$AIWeightContinueDeploying = 4250;
$AIWeightContinueRepairing = 4250;
//Objective weights from human
$AIWeightHumanIssuedCommand = 4450;
$AIWeightHumanIssuedEscort = 4425;
//Objective weights - level 2
$AIWeightCapFlag[2] = 0; //only one person can ever cap a flag
$AIWeightKillFlagCarrier[2] = 4800; //range 4800 to 5020
$AIWeightReturnFlag[2] = 4100; //range 4200 to 4320
$AIWeightDefendFlag[2] = 2000; //range 2100 to 2220
$AIWeightGrabFlag[2] = 2000; //range 2100 to 2220
$AIWeightDefendFlipFlop[2] = 2000; //range 2100 to 2220
$AIWeightDefendFlipFlop[3] = 1500; //range 1600 to 1720
$AIWeightDefendFlipFlop[4] = 1000; //range 1100 to 1220
$AIWeightAttackGenerator[2] = 1600; //range 1700 to 1920
$AIWeightRepairGenerator[2] = 1600; //range 1700 to 1920
$AIWeightDefendGenerator[2] = 1500; //range 1600 to 1720
$AIWeightAttackInventory[2] = 1400; //range 1500 to 1720
$AIWeightRepairInventory[2] = 1400; //range 1500 to 1720
$AIWeightMortarTurret[2] = 1000; //range 1100 to 1320
$AIWeightLazeObject[2] = 0; //no need to have more than one targetter
$AIWeightRepairTurret[2] = 1000; //range 1100 to 1320
$AIWeightEscortOffense[2] = 2900; //range 3300 to 3420
$AIWeightEscortCapper[2] = 3000; //range 3100 to 3220
function AIInit()
{
AISlicerInit();
installNavThreats();
NavDetectForceFields();
// ShowFPS();
//enable the use of grenades
$AIDisableGrenades = false;
$AIDisableChat = false;
//create the "objective delete set"
if(nameToId("AIBombLocationSet") <= 0)
{
$AIBombLocationSet = new SimSet("AIBombLocationSet");
MissionCleanup.add($AIBombLocationSet);
}
//create the Inventory group
if(nameToId("AIStationInventorySet") <= 0)
{
$AIInvStationSet = new SimSet("AIStationInventorySet");
MissionCleanup.add($AIInvStationSet);
}
//create the Item group
if (nameToId("AIItemSet") <= 0)
{
$AIItemSet = new SimSet("AIItemSet");
MissionCleanup.add($AIItemSet);
}
//create the Item group
if (nameToId("AIGrenadeSet") <= 0)
{
$AIGrenadeSet = new SimSet("AIGrenadeSet");
MissionCleanup.add($AIGrenadeSet);
}
//create the weapon group
if (nameToId("AIWeaponSet") <= 0)
{
$AIWeaponSet = new SimSet("AIWeaponSet");
MissionCleanup.add($AIWeaponSet);
}
//create the deployed turret group
if (nameToID("AIRemoteTurretSet") <= 0)
{
$AIRemoteTurretSet = new SimSet("AIRemoteTurretSet");
MissionCleanup.add($AIRemoteTurretSet);
}
//create the deployed turret group
if (nameToID("AIDeployedMineSet") <= 0)
{
$AIDeployedMineSet = new SimSet("AIDeployedMineSet");
MissionCleanup.add($AIDeployedMineSet);
}
//create the deployed turret group
if (nameToID("AIVehicleSet") <= 0)
{
$AIVehicleSet = new SimSet("AIVehicleSet");
MissionCleanup.add($AIVehicleSet);
}
%missionGroupFolder = nameToID("MissionGroup");
%missionGroupFolder.AIMissionInit();
}
// this is called at mission load by the specific game type
function AIInitObjectives(%team, %game)
{
%group = nameToID("MissionGroup/Teams/team" @ %team @ "/AIObjectives");
if(%group < 0)
return; // opps, there is no Objectives set for this team.
// add the grouped objectives to the teams Q
%count = %group.getCount();
for (%i = 0; %i < %count; %i++)
{
%objective = %group.getObject(%i);
if (%objective.getClassName() !$= "AIObjective")
{
%grpCount = %objective.getCount();
for (%j = 0; %j < %grpCount; %j++)
{
%grpObj = %objective.getObject(%j);
if (%objective.gameType $= "" || %objective.gameType $= "all")
%objType = "";
else
%objType = %objective.gameType @ "Game";
if (%objType $= "" || %objType $= %game.class)
{
%grpObj.group = %objective;
$ObjectiveQ[%team].add(%grpObj);
}
}
}
}
// add the non-grouped objectives to the teams Q
%count = %group.getCount();
for(%i = 0; %i < %count; %i++)
{
%objective = %group.getObject(%i);
//if the objective is not an "AIObjective", assume it's a group and continue
if (%objective.getClassName() !$= "AIObjective")
continue;
if (%objective.gameType $= "" || %objective.gameType $= "all")
%objType = "";
else
%objType = %objective.gameType @ "Game";
if (%objType $= "" || %objType $= %game.class)
{
%objective.group = "";
$ObjectiveQ[%team].add(%objective);
}
}
// initialize the objectives
%count = $ObjectiveQ[%team].getCount();
for(%i = 0; %i < %count; %i++)
{
%objective = $ObjectiveQ[%team].getObject(%i);
//clear out any dynamic fields
%objective.clientLevel1 = "";
%objective.clientLevel2 = "";
%objective.clientLevel3 = "";
%objective.isInvalid = false;
%objective.repairObjective = "";
//set the location, if required
if (%objective.position !$= "0 0 0")
%objective.location = %objective.position;
// find targeted object ID's
if(%objective.targetObject !$= "")
%objective.targetObjectId = NameToId(%objective.targetObject);
else
%objective.targetObjectId = -1;
if(%objective.targetClientObject !$= "")
%objective.targetClientId = NameToId(%objective.targetClient);
else
%objective.targetClientId = -1;
if (%objective.position $= "0 0 0")
{
if (%objective.location $= "0 0 0")
{
if (%objective.targetObjectId > 0)
%objective.position = %objective.targetObjectId.position;
}
else
%objective.position = %objective.location;
}
}
//finally, sort the objectiveQ
$ObjectiveQ[%team].sortByWeight();
}
//This function is designed to clear out the objective Q's, and clear the task lists from all the AIs
function AIMissionEnd()
{
//disable the AI system
AISystemEnabled(false);
//loop through the client list, and clear the tasks of each bot
%count = ClientGroup.getCount();
for (%i = 0; %i < %count; %i++)
{
%client = ClientGroup.getObject(%i);
if (%client.isAIControlled())
{
//cancel the respawn thread and the objective thread...
cancel(%client.respawnThread);
cancel(%client.objectiveThread);
//reset the clients tasks, variables, etc...
AIUnassignClient(%client);
%client.stop();
%client.clearTasks();
%client.clearStep();
%client.lastDamageClient = -1;
%client.lastDamageTurret = -1;
%client.shouldEngage = -1;
%client.setEngageTarget(-1);
%client.setTargetObject(-1);
%client.pilotVehicle = false;
%client.defaultTasksAdded = false;
//do the nav graph cleanup
%client.missionCycleCleanup();
}
}
//clear the objective Q's
for (%i = 0; %i <= Game.numTeams; %i++)
{
if (isObject($ObjectiveQ[%i]))
{
$ObjectiveQ[%i].clear();
$ObjectiveQ[%i].delete();
}
$ObjectiveQ[%i] = "";
}
//now delete all the sets used by the AI system...
if (isObject($AIBombLocationSet))
$AIBombLocationSet.delete();
$AIBombLocationSet = "";
if (isObject($AIInvStationSet))
$AIInvStationSet.delete();
$AIInvStationSet = "";
if (isObject($AIItemSet))
$AIItemSet.delete();
$AIItemSet = "";
if (isObject($AIGrenadeSet))
$AIGrenadeSet.delete();
$AIGrenadeSet = "";
if (isObject($AIWeaponSet))
$AIWeaponSet.delete();
$AIWeaponSet = "";
if (isObject($AIRemoteTurretSet))
$AIRemoteTurretSet.delete();
$AIRemoteTurretSet = "";
if (isObject($AIDeployedMineSet))
$AIDeployedMineSet.delete();
$AIDeployedMineSet = "";
if (isObject($AIVehicleSet))
$AIVehicleSet.delete();
$AIVehicleSet = "";
}
//FUNCTIONS ON EACH OBJECT EXECUTED AT MISSION LOAD TIME
function SimGroup::AIMissionInit(%this)
{
for(%i = 0; %i < %this.getCount(); %i++)
%this.getObject(%i).AIMissionInit(%this);
}
function GameBase::AIMissionInit(%this)
{
%this.getDataBlock().AIMissionInit(%this);
}
function StationInventory::AIMissionInit(%data, %object)
{
$AIInvStationSet.add(%object);
}
function Flag::AIMissionInit(%data, %object)
{
if (%object.team >= 0)
$AITeamFlag[%object.team] = %object;
}
function SimObject::AIMissionInit(%this)
{
//this function is declared to prevent console error msg spam...
}
function ItemData::AIMissionInit(%data, %object)
{
$AIItemSet.add(%object);
}
function AIThrowObject(%object)
{
$AIItemSet.add(%object);
}
function AIGrenadeThrown(%object)
{
$AIGrenadeSet.add(%object);
}
function AIDeployObject(%client, %object)
{
//first, set the object id on the client
%client.lastDeployedObject = %object;
//now see if it was a turret...
%type = %object.getDataBlock().getName();
if (%type $= "TurretDeployedFloorIndoor" || %type $= "TurretDeployedWallIndoor" ||
%type $= "TurretDeployedCeilingIndoor" || %type $= "TurretDeployedOutdoor")
{
$AIRemoteTurretSet.add(%object);
}
}
function AIDeployMine(%object)
{
$AIDeployedMineSet.add(%object);
}
function AIVehicleMounted(%vehicle)
{
$AIVehicleSet.add(%vehicle);
}
function AICorpseAdded(%corpse)
{
if (isObject(%corpse))
{
%corpse.isCorpse = true;
$AIItemSet.add(%corpse);
}
}
//OTHER UTILITY FUNCTIONS
function AIConnection::onAIDrop(%client)
{
//make sure we're trying to drop an AI
if (!isObject(%client) || !%client.isAIControlled())
return;
//clear the ai from any objectives, etc...
AIUnassignClient(%client);
%client.clearTasks();
%client.clearStep();
%client.defaultTasksAdded = false;
//kill the player, which should cause the Game object to perform whatever cleanup is required.
if (isObject(%client.player))
%client.player.delete();
//do the nav graph cleanup
%client.missionCycleCleanup();
}
function AIConnection::endMission(%client)
{
//cancel the respawn thread, and spawn them manually
cancel(%client.respawnThread);
cancel(%client.objectiveThread);
}
function AIConnection::startMission(%client)
{
//assign the team
if (%client.team <= 0)
Game.assignClientTeam(%client);
//set the client's sensor group...
setTargetSensorGroup( %client.target, %client.team );
%client.setSensorGroup( %client.team );
//sends a message so everyone know the bot is in the game...
Game.AIHasJoined(%client);
%client.matchStartReady = true;
//spawn the bot...
onAIRespawn(%client);
}
function AIConnection::onAIConnect(%client, %name, %team, %skill, %offense, %voice, %voicePitch)
{
// Sex/Race defaults
%client.sex = "Male";
%client.race = "Human";
%client.armor = "Light";
//setup the voice and voicePitch
if (%voice $= "")
%voice = "Derm2";
//echo(%voice);
%client.voice = %voice;
%client.voiceTag = addTaggedString(%voice);
if (%voicePitch $= "" || %voicePitch < 0.5 || %voicePitch > 2.0)
%voicePitch = 1.0;
%client.voicePitch = %voicePitch;
%client.name = addTaggedString( "\cp\c9" @ %name @ "\co" );
%client.nameBase = %name;
echo(%client.name);
echo("CADD: " @ %client @ " " @ %client.getAddress());
//$HostGamePlayerCount++;
//set the initial team - Game.assignClientTeam() should be called later on...
%client.team = %team;
if ( %client.team & 1 )
%client.skin = addTaggedString( "basebot" );
else
%client.skin = addTaggedString( "basebbot" );
//setup the target for use with the sensor net, etc...
%client.target = allocClientTarget(%client, %client.name, %client.skin, %client.voiceTag, '_ClientConnection', 0, 0, %client.voicePitch);
//i need to send a "silent" version of this for single player but still use the callback -jr`
if($currentMissionType $= "SinglePlayer")
messageAllExcept(%client, -1, 'MsgClientJoin', "", %name, %client, %client.target, true);
else
messageAllExcept(%client, -1, 'MsgClientJoin', '\c1%1 joined the game.', %name, %client, %client.target, true);
//assign the skill
%client.setSkillLevel(%skill);
//assign the affinity
%client.offense = %offense;
//clear any flags
%client.stop(); // this will clear the players move state
%client.clearStep();
%client.lastDamageClient = -1;
%client.lastDamageTurret = -1;
%client.setEngageTarget(-1);
%client.setTargetObject(-1);
%client.objective = "";
//clear the defaulttasks flag
%client.defaultTasksAdded = false;
//if the mission is already running, spawn the bot
if ($missionRunning)
%client.startMission();
}
// This routes through C++ code so profiler can register it. Also, the console function
// ProfilePatch1() tracks time spent (at MS resolution), # calls, average time per call.
// See console variables $patch1Total (MS so far in routine), $patch1Avg (average MS
// per call), and $patch1Calls (# of calls).
function patchForTimeTest(%client)
{
if( isObject( Game ) )
Game.AIChooseGameObjective(%client);
}
function AIReassessObjective(%client)
{
ProfilePatch1(patchForTimeTest, %client);
// Game.AIChooseGameObjective(%client);
%client.objectiveThread = schedule(5000, %client, "AIReassessObjective", %client);
}
function onAIRespawn(%client)
{
%markerObj = Game.pickPlayerSpawn(%client, true);
Game.createPlayer(%client, %markerObj);
//make sure the player object is the AI's control object - even during the mission warmup time
//the function AISystemEnabled(true/false) will control whether they actually move...
%client.setControlObject(%client.player);
if (%client.objective)
error("ERROR!!! " @ %client @ " is still assigned to objective: " @ %client.objective);
//clear the objective and choose a new one
AIUnassignClient(%client);
%client.stop();
%client.clearStep();
%client.lastDamageClient = -1;
%client.lastDamageTurret = -1;
%client.shouldEngage = -1;
%client.setEngageTarget(-1);
%client.setTargetObject(-1);
%client.pilotVehicle = false;
//set the spawn time
%client.spawnTime = getSimTime();
%client.respawnThread = "";
//timeslice the objective reassessment for the bots
if (!isEventPending(%client.objectiveThread))
{
%curTime = getSimTime();
%remainder = %curTime % 5000;
%schedTime = $AITimeSliceReassess - %remainder;
if (%schedTime <= 0)
%schedTime += 5000;
%client.objectiveThread = schedule(%schedTime, %client, "AIReassessObjective", %client);
//set the next time slice "slot"
$AITimeSliceReassess += 300;
if ($AITimeSliceReassess > 5000)
$AITimeSliceReassess -= 5000;
}
//call the game specific spawn function
Game.onAIRespawn(%client);
}
function AIClientIsAlive(%client, %duration)
{
if(%client < 0 || %client.player <= 0)
return false;
if (isObject(%client.player))
{
%state = %client.player.getState();
if (%state !$= "Dead" && %state !$= "" && (%duration $= "" || getSimTime() - %client.spawnTime >= %duration))
return true;
else
return false;
}
else
return false;
}
//------------------------------
function AIFindClosestEnemy(%srcClient, %radius, %losTimeout)
{
//see if there's an enemy near our defense location...
if (isObject(%srcClient.player))
%srcLocation = %srcClient.player.getWorldBoxCenter();
else
%srcLocation = "0 0 0";
return AIFindClosestEnemyToLoc(%srcClient, %srcLocation, %radius, %losTimeout, false, true);
}
function AIFindClosestEnemyToLoc(%srcClient, %srcLocation, %radius, %losTimeout, %ignoreLOS, %distFromClient)
{
if (%ignoreLOS $= "")
%ignoreLOS = false;
if (%distFromClient $= "")
%distFromClient = false;
%count = ClientGroup.getCount();
%closestClient = -1;
%closestDistance = 32767;
for(%i = 0; %i < %count; %i++)
{
%cl = ClientGroup.getObject(%i);
//make sure we find someone who's alive
if (AIClientIsAlive(%cl) && %cl.team != %srcClient.team)
{
%clIsCloaked = !isTargetVisible(%cl.target, %srcClient.getSensorGroup());
//make sure the client can see the enemy
%hasLOS = %srcClient.hasLOSToClient(%cl);
%losTime = %srcClient.getClientLOSTime(%cl);
if (%ignoreLOS || %hasLOS || (%losTime < %losTimeout && AIClientIsAlive(%cl, %losTime + 1000)))
{
%testPos = %cl.player.getWorldBoxCenter();
if (%distFromClient)
%distance = %srcClient.getPathDistance(%testPos);
else
%distance = AIGetPathDistance(%srcLocation, %testPos);
if (%distance > 0 && (%radius < 0 || %distance < %radius) && %distance < %closestDistance && (!%clIsCloaked || %distance < 8))
{
%closestClient = %cl;
%closestDistance = %distance;
}
}
}
}
return %closestClient SPC %closestDistance;
}
function AIFindClosestEnemyPilot(%client, %radius, %losTimeout)
{
//loop through the vehicle set, looking for pilotted vehicles...
%closestPilot = -1;
%closestDist = %radius;
%count = $AIVehicleSet.getCount();
for (%i = 0; %i < %count; %i++)
{
//first, make sure the vehicle is mounted by pilotted
%vehicle = $AIVehicleSet.getObject(%i);
%pilot = %vehicle.getMountNodeObject(0);
if (%pilot <= 0 || !AIClientIsAlive(%pilot.client))
continue;
//make sure the pilot is an enemy
if (%pilot.client.team == %client.team)
continue;
//see if the pilot has been seen by the client
%hasLOS = %client.hasLOSToClient(%pilot.client);
%losTime = %client.getClientLOSTime(%pilot.client);
if (%hasLOS || (%losTime < %losTimeout && AIClientIsAlive(%pilot.client, %losTime + 1000)))
{
//see if it's the closest
%clientPos = %client.player.getWorldBoxCenter();
%pilotPos = %pilot.getWorldBoxCenter();
%dist = VectorDist(%clientPos, %pilotPos);
if (%dist < %closestDist)
{
%closestPilot = %pilot.client;
%closestDist = %dist;
}
}
}
return %closestPilot SPC %closestDist;
}
function AIFindAIClientInView(%srcClient, %team, %radius)
{
//make sure the player is alive
if (! AIClientIsAlive(%srcClient))
return -1;
//get various info about the player's eye
%srcEyeTransform = %srcClient.player.getEyeTransform();
%srcEyePoint = firstWord(%srcEyeTransform) @ " " @ getWord(%srcEyeTransform, 1) @ " " @ getWord(%srcEyeTransform, 2);
%srcEyeVector = VectorNormalize(%srcClient.player.getEyeVector());
//see if there's an enemy near our defense location...
%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 srcClient
if (%cl != %srcClient && AIClientIsAlive(%cl) && %cl.isAIControlled() && (%team < 0 || %cl.team == %team))
{
//make sure the player is within range
%clPos = %cl.player.getWorldBoxCenter();
%distance = VectorDist(%clPos, %srcEyePoint);
if (%radius <= 0 || %distance <= %radius)
{
//create the vector from the srcClient 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)
{
%viewedClient = %cl;
%clientDot = %dot;
}
}
}
}
return %viewedClient;
}
//-----------------------------------------------------------------------------
//AI VEHICLE FUNCTIONS
function Armor::AIonMount(%this, %obj, %vehicle, %node)
{
//set the client var...
%client = %obj.client;
%client.turretMounted = -1;
//make sure the AI was *supposed* to mount the vehicle
if (!%client.isMountingVehicle())
{
AIDisembarkVehicle(%client);
return;
}
//get the vehicle's pilot
%pilot = %vehicle.getMountNodeObject(0);
//make sure the bot is in node 0 if'f the bot is piloting the vehicle
if ((%node == 0 && !%client.pilotVehicle) || (%node > 0 && %client.pilotVehicle))
{
AIDisembarkVehicle(%client);
return;
}
//make sure the bot didn't is on the same team as the pilot
if (%pilot > 0 && isObject(%pilot) && %pilot.client.team != %client.team)
{
AIDisembarkVehicle(%client);
return;
}
//if we're supposed to pilot the vehicle, set the control object
if (%client.pilotVehicle)
%client.setControlObject(%vehicle);
//each vehicle may be built differently...
if (%vehicle.getDataBlock().getName() $= "AssaultVehicle")
{
//node 1 is this vehicle's turret seat
if (%node == 1)
{
%turret = %vehicle.getMountNodeObject(10);
%skill = %client.getSkillLevel();
%turret.setSkill(%skill);
%client.turretMounted = %turret;
%turret.setAutoFire(true);
}
}
else if (%vehicle.getDataBlock().getName() $= "BomberFlyer")
{
//node 1 is this vehicle's turret seat
if (%node == 1)
{
%turret = %vehicle.getMountNodeObject(10);
%skill = %client.getSkillLevel();
%turret.setSkill(%skill);
%client.turretMounted = %turret;
%client.setTurretMounted(%turret);
%turret.setAutoFire(true);
}
}
}
function Armor::AIonUnMount(%this, %obj, %vehicle, %node)
{
//get the client var
%client = %obj.client;
//reset the control object
if (%client.pilotVehicle)
%client.setControlObject(%client.player);
%client.pilotVehicle = false;
//if the client had mounted a turret, turn the turret back off
if (%client.turretMounted > 0)
%client.turretMounted.setAutoFire(false);
%client.turretMounted = -1;
%client.setTurretMounted(-1);
// reset the turret skill level
if(%vehicle.getDataBlock().getName() $= "AssaultVehicle")
if (%node == 1)
%vehicle.getMountNodeObject(10).setSkill(1.0);
if(%vehicle.getDataBlock().getName() $= "BomberFlyer")
if(%node == 1)
%vehicle.getMountNodeObject(10).setSkill(1.0);
}
function AIDisembarkVehicle(%client)
{
if (%client.player.isMounted())
{
if (%client.pilotVehicle)
%client.setControlObject(%client.player);
%client.pressJump();
}
}
function AIProcessVehicle(%client)
{
//see if we're mounted on a turret, and if that turret has a target
if (%client.turretMounted > 0)
{
%turretDB = %client.turretMounted.getDataBlock();
//see if we're in a bomber close to a bomb site...
if (%turretDB.getName() $= "BomberTurret")
{
%clientPos = getWords(%client.player.position, 0, 1) @ " 0";
%found = false;
%count = $AIBombLocationSet.getCount();
for (%i = 0; %i < %count; %i++)
{
%bombObj = $AIBombLocationSet.getObject(%i);
%bombLocation = %bombObj.location;
//make sure the objective was issued by someone in the vehicle
if (%bombObj.issuedByClientId.vehicleMounted == %client.vehicleMounted)
{
//find out where the bomb is going to drop... first, how high up are we...
%bombLocation2D = getWord(%bombLocation, 0) SPC getWord(%bombLocation, 1) SPC "0";
%height = getWord(%client.vehicleMounted.position, 2) - getWord(%bombLocation, 2);
//find out how long it'll take the bomb to fall that far...
//assume no initial velocity in the Z axis...
%timeToFall = mSqrt((2.0 * %height) / 9.81);
//how fast is the vehicle moving in the XY plane...
%myLocation = %client.vehicleMounted.position;
%myLocation2D = getWord(%myLocation, 0) SPC getWord(%myLocation, 1) SPC "0";
%vel = %client.vehicleMounted.getVelocity();
%vel2D = getWord(%vel, 0) SPC getWord(%vel, 1) SPC "0";
%bombImpact2D = VectorAdd(%myLocation2D, VectorScale(%vel2D, %timeToFall));
//see if the bomb inpact position is within 20m of the desired bomb site...
%distToBombsite2D = VectorDist(%bombImpact2D, %bombLocation2D);
if (%height > 20 && %distToBombsite2D < 25)
{
%found = true;
break;
}
}
}
//see if we found a bomb site
if (%found)
{
%client.turretMounted.selectedWeapon = 2;
%turretDB.onTrigger(%client.turretMounted, 0, true);
return;
}
}
//we're not bombing, make sure we have the regular weapon selected
%client.turretMounted.selectedWeapon = 1;
if (isObject(%client.turretMounted.getTargetObject()))
%turretDB.onTrigger(%client.turretMounted, 0, true);
else
%turretDB.onTrigger(%client.turretMounted, 0, false);
}
}
function AIPilotVehicle(%client)
{
//this is not very well supported, but someone will find a use for this function...
}

551
scripts/aiBotProfiles.cs Normal file
View file

@ -0,0 +1,551 @@
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;
return aiConnect($BotProfile[%index, name], %team, $BotProfile[%index, skill], $BotProfile[%index, offense], $BotProfile[%index, voice], $BotProfile[%index, voicePitch]);
}
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;
}
}
}
$BotProfile[0, name] = "Kidney BOT";
$BotProfile[0, skill] = 0.99;
$BotProfile[0, offense] = true;
$BotProfile[0, voicePitch] = 0.875;
$BotProfile[1, name] = "BOT Milk?";
$BotProfile[1, skill] = 0.99;
$BotProfile[1, offense] = true;
$BotProfile[1, voicePitch] = 0.89;
$BotProfile[2, name] = "UberBOT";
$BotProfile[2, skill] = 0.99;
$BotProfile[2, offense] = true;
$BotProfile[2, voicePitch] = 0.95;
$BotProfile[3, name] = "SymBOT";
$BotProfile[3, skill] = 0.99;
$BotProfile[3, offense] = true;
$BotProfile[3, voicePitch] = 1.1;
$BotProfile[4, name] = "QIX BOT";
$BotProfile[4, skill] = 0.99;
$BotProfile[4, offense] = false;
$BotProfile[4, voicePitch] = 1.12;
$BotProfile[5, name] = "Rated BOT";
$BotProfile[5, skill] = 0.99;
$BotProfile[5, offense] = true;
$BotProfile[5, voicePitch] = 0.92;
$BotProfile[6, name] = "Dr.BOTward";
$BotProfile[6, skill] = 0.99;
$BotProfile[6, offense] = true;
$BotProfile[6, voicePitch] = 0.96;
$BotProfile[7, name] = "Frank BOTzo";
$BotProfile[7, skill] = 0.99;
$BotProfile[7, offense] = true;
$BotProfile[7, voicePitch] = 0.88;
$BotProfile[8, name] = "Missing BOT";
$BotProfile[8, skill] = 0.99;
$BotProfile[8, offense] = true;
$BotProfile[8, voicePitch] = 1.125;
$BotProfile[9, name] = "Jett BOT";
$BotProfile[9, skill] = 0.99;
$BotProfile[9, offense] = false;
$BotProfile[9, voicePitch] = 1.12;
$BotProfile[10, name] = "HexaBOTic";
$BotProfile[10, skill] = 0.99;
$BotProfile[10, offense] = true;
$BotProfile[10, voicePitch] = 0.895;
$BotProfile[11, name] = "Sne/\\kBOT";
$BotProfile[11, skill] = 0.99;
$BotProfile[11, offense] = true;
$BotProfile[11, voicePitch] = 0.885;
$BotProfile[12, name] = "DiamondBOT";
$BotProfile[12, skill] = 0.99;
$BotProfile[12, offense] = true;
$BotProfile[12, voicePitch] = 1.05;
$BotProfile[13, name] = "Jimmy BOT";
$BotProfile[13, skill] = 0.99;
$BotProfile[13, offense] = true;
$BotProfile[13, voicePitch] = 1.09;
$BotProfile[14, name] = "Skeet BOT";
$BotProfile[14, skill] = 0.99;
$BotProfile[14, offense] = false;
$BotProfile[14, voicePitch] = 1.0;
$BotProfile[15, name] = "BigBOTDawg";
$BotProfile[15, skill] = 0.99;
$BotProfile[15, offense] = true;
$BotProfile[15, voicePitch] = 0.9;
$BotProfile[16, name] = "BOTIN8R";
$BotProfile[16, skill] = 0.99;
$BotProfile[16, offense] = true;
$BotProfile[16, voicePitch] = 0.97;
$BotProfile[17, name] = "OrphanKazBOT";
$BotProfile[17, skill] = 0.99;
$BotProfile[17, offense] = true;
$BotProfile[17, voicePitch] = 0.925;
$BotProfile[18, name] = "Terrible BOT";
$BotProfile[18, skill] = 0.99;
$BotProfile[18, offense] = true;
$BotProfile[18, voicePitch] = 1.115;
$BotProfile[19, name] = "Mongo BOT";
$BotProfile[19, skill] = 0.99;
$BotProfile[19, offense] = false;
$BotProfile[19, voicePitch] = 1.12;
$BotProfile[20, name] = "East BOT";
$BotProfile[20, skill] = 0.99;
$BotProfile[20, offense] = true;
$BotProfile[20, voicePitch] = 1.125;
$BotProfile[21, name] = "Snow LeoBOT";
$BotProfile[21, skill] = 0.99;
$BotProfile[21, offense] = true;
$BotProfile[21, voicePitch] = 1.05;
$BotProfile[22, name] = "Twitch BOT";
$BotProfile[22, skill] = 0.99;
$BotProfile[22, offense] = true;
$BotProfile[22, voicePitch] = 0.893;
$BotProfile[23, name] = "ShazBOT";
$BotProfile[23, skill] = 0.99;
$BotProfile[23, offense] = true;
$BotProfile[23, voicePitch] = 0.879;
$BotProfile[24, name] = "Fishbait";
$BotProfile[24, skill] = 0.00;
$BotProfile[24, offense] = true;
$BotProfile[24, voicePitch] = 1.125;
$BotProfile[25, name] = "Skulker";
$BotProfile[25, skill] = 0.00;
$BotProfile[25, offense] = false;
$BotProfile[25, voicePitch] = 1.1;
$BotProfile[26, name] = "Dogstar";
$BotProfile[26, skill] = 0.00;
$BotProfile[26, offense] = false;
$BotProfile[26, voicePitch] = 1.02;
$BotProfile[27, name] = "Bonehead";
$BotProfile[27, skill] = 0.00;
$BotProfile[27, offense] = false;
$BotProfile[27, voicePitch] = 0.975;
$BotProfile[28, name] = "Torus";
$BotProfile[28, skill] = 0.00;
$BotProfile[28, offense] = false;
$BotProfile[28, voicePitch] = 0.9;
$BotProfile[29, name] = "Glitter";
$BotProfile[29, skill] = 0.05;
$BotProfile[29, offense] = true;
$BotProfile[29, voicePitch] = 1.1;
$BotProfile[30, name] = "Wirehead";
$BotProfile[30, skill] = 0.05;
$BotProfile[30, offense] = false;
$BotProfile[30, voicePitch] = 1.03;
$BotProfile[31, name] = "Ironbreath";
$BotProfile[31, skill] = 0.10;
$BotProfile[31, offense] = false;
$BotProfile[31, voicePitch] = 1.02;
$BotProfile[32, name] = "Hagstomper";
$BotProfile[32, skill] = 0.10;
$BotProfile[32, offense] = false;
$BotProfile[32, voicePitch] = 0.899;
$BotProfile[33, name] = "Doormat";
$BotProfile[33, skill] = 0.15;
$BotProfile[33, offense] = false;
$BotProfile[33, voicePitch] = 0.97;
$BotProfile[34, name] = "TickTock";
$BotProfile[34, skill] = 0.15;
$BotProfile[34, offense] = true;
$BotProfile[34, voicePitch] = 1.07;
$BotProfile[35, name] = "ElectroJag";
$BotProfile[35, skill] = 0.20;
$BotProfile[35, offense] = false;
$BotProfile[35, voicePitch] = 0.915;
$BotProfile[36, name] = "Jetsam";
$BotProfile[36, skill] = 0.20;
$BotProfile[36, offense] = false;
$BotProfile[36, voicePitch] = 1.09;
$BotProfile[37, name] = "Newguns";
$BotProfile[37, skill] = 0.25;
$BotProfile[37, offense] = false;
$BotProfile[37, voicePitch] = 0.885;
$BotProfile[38, name] = "WrongWay";
$BotProfile[38, skill] = 0.25;
$BotProfile[38, offense] = false;
$BotProfile[38, voicePitch] = 0.875;
$BotProfile[39, name] = "Ragbinder";
$BotProfile[39, skill] = 0.30;
$BotProfile[39, offense] = true;
$BotProfile[39, voicePitch] = 1.1;
$BotProfile[40, name] = "Retch";
$BotProfile[40, skill] = 0.30;
$BotProfile[40, offense] = false;
$BotProfile[40, voicePitch] = 1.12;
$BotProfile[41, name] = "Hotfoot";
$BotProfile[41, skill] = 0.35;
$BotProfile[41, offense] = false;
$BotProfile[41, voicePitch] = 0.93;
$BotProfile[42, name] = "Trail of Rust";
$BotProfile[42, skill] = 0.35;
$BotProfile[42, offense] = false;
$BotProfile[42, voicePitch] = 0.88;
$BotProfile[43, name] = "Zigzag";
$BotProfile[43, skill] = 0.40;
$BotProfile[43, offense] = false;
$BotProfile[43, voicePitch] = 0.89;
$BotProfile[44, name] = "Gray Sabot";
$BotProfile[44, skill] = 0.40;
$BotProfile[44, offense] = true;
$BotProfile[44, voicePitch] = 0.879;
$BotProfile[45, name] = "Hellefleur";
$BotProfile[45, skill] = 0.45;
$BotProfile[45, offense] = false;
$BotProfile[45, voicePitch] = 1.11;
$BotProfile[46, name] = "Slicer";
$BotProfile[46, skill] = 0.45;
$BotProfile[46, offense] = false;
$BotProfile[46, voicePitch] = 1.12;
$BotProfile[47, name] = "Rampant";
$BotProfile[47, skill] = 0.45;
$BotProfile[47, offense] = false;
$BotProfile[47, voicePitch] = 0.935;
$BotProfile[48, name] = "Troglodyte";
$BotProfile[48, skill] = 0.45;
$BotProfile[48, offense] = true;
$BotProfile[48, voicePitch] = 1.121;
$BotProfile[49, name] = "Evenkill";
$BotProfile[49, skill] = 0.50;
$BotProfile[49, offense] = false;
$BotProfile[49, voicePitch] = 1.05;
$BotProfile[50, name] = "Simrionic";
$BotProfile[50, skill] = 0.50;
$BotProfile[50, offense] = false;
$BotProfile[50, voicePitch] = 0.895;
$BotProfile[51, name] = "Cathode Kiss";
$BotProfile[51, skill] = 0.50;
$BotProfile[51, offense] = false;
$BotProfile[51, voicePitch] = 0.97;
$BotProfile[52, name] = "So Dark";
$BotProfile[52, skill] = 0.55;
$BotProfile[52, offense] = true;
$BotProfile[52, voicePitch] = 1.01;
$BotProfile[53, name] = "Deathwind";
$BotProfile[53, skill] = 0.55;
$BotProfile[53, offense] = false;
$BotProfile[53, voicePitch] = 1.12;
$BotProfile[54, name] = "Dharmic Sword";
$BotProfile[54, skill] = 0.55;
$BotProfile[54, offense] = false;
$BotProfile[54, voicePitch] = 1.0;
$BotProfile[55, name] = "Demonshriek";
$BotProfile[55, skill] = 0.60;
$BotProfile[55, offense] = false;
$BotProfile[55, voicePitch] = 1.05;
$BotProfile[56, name] = "Terrapin";
$BotProfile[56, skill] = 0.60;
$BotProfile[56, offense] = true;
$BotProfile[56, voicePitch] = 1.085;
$BotProfile[57, name] = "No-Dachi";
$BotProfile[57, skill] = 0.60;
$BotProfile[57, offense] = true;
$BotProfile[57, voicePitch] = 0.905;
$BotProfile[58, name] = "Irrelevant Smoke";
$BotProfile[58, skill] = 0.65;
$BotProfile[58, offense] = false;
$BotProfile[58, voicePitch] = 0.935;
$BotProfile[59, name] = "Red Ghost";
$BotProfile[59, skill] = 0.65;
$BotProfile[59, offense] = false;
$BotProfile[59, voicePitch] = 1.21;
$BotProfile[60, name] = "Perilous";
$BotProfile[60, skill] = 0.65;
$BotProfile[60, offense] = true;
$BotProfile[60, voicePitch] = 0.895;
$BotProfile[61, name] = "The Golden";
$BotProfile[61, skill] = 0.70;
$BotProfile[61, offense] = true;
$BotProfile[61, voicePitch] = 0.88;
$BotProfile[62, name] = "Vanguard";
$BotProfile[62, skill] = 0.70;
$BotProfile[62, offense] = false;
$BotProfile[62, voicePitch] = 1.1;
$BotProfile[63, name] = "Heretik";
$BotProfile[63, skill] = 0.70;
$BotProfile[63, offense] = true;
$BotProfile[63, voicePitch] = 0.945;
$BotProfile[64, name] = "Akhiles";
$BotProfile[64, skill] = 0.75;
$BotProfile[64, offense] = true;
$BotProfile[64, voicePitch] = 0.915;
$BotProfile[65, name] = "Nova-9";
$BotProfile[65, skill] = 0.75;
$BotProfile[65, offense] = false;
$BotProfile[65, voicePitch] = 1.12;
$BotProfile[66, name] = "Hotspur";
$BotProfile[66, skill] = 0.75;
$BotProfile[66, offense] = true;
$BotProfile[66, voicePitch] = 1.11;
$BotProfile[67, name] = "DustWitch";
$BotProfile[67, skill] = 0.80;
$BotProfile[67, offense] = true;
$BotProfile[67, voicePitch] = 0.875;
$BotProfile[68, name] = "Mojo Savage";
$BotProfile[68, skill] = 0.80;
$BotProfile[68, offense] = true;
$BotProfile[68, voicePitch] = 1.05;
$BotProfile[69, name] = "Velomancer";
$BotProfile[69, skill] = 0.80;
$BotProfile[69, offense] = false;
$BotProfile[69, voicePitch] = 1.085;
$BotProfile[70, name] = "Mohican";
$BotProfile[70, skill] = 0.85;
$BotProfile[70, offense] = true;
$BotProfile[70, voicePitch] = 1.045;
$BotProfile[71, name] = "Widowmaker";
$BotProfile[71, skill] = 0.85;
$BotProfile[71, offense] = true;
$BotProfile[71, voicePitch] = 1.04;
$BotProfile[72, name] = "Punch";
$BotProfile[72, skill] = 0.85;
$BotProfile[72, offense] = true;
$BotProfile[72, voicePitch] = 0.89;
$BotProfile[73, name] = "Mameluke";
$BotProfile[73, skill] = 0.90;
$BotProfile[73, offense] = false;
$BotProfile[73, voicePitch] = 0.882;
$BotProfile[74, name] = "King Snake";
$BotProfile[74, skill] = 0.90;
$BotProfile[74, offense] = true;
$BotProfile[74, voicePitch] = 1.05;
$BotProfile[75, name] = "Sorrow";
$BotProfile[75, skill] = 0.90;
$BotProfile[75, offense] = true;
$BotProfile[75, voicePitch] = 1.09;
$BotProfile[76, name] = "Devourer";
$BotProfile[76, skill] = 0.95;
$BotProfile[76, offense] = true;
$BotProfile[76, voicePitch] = 0.929;
$BotProfile[77, name] = "Fated to Glory";
$BotProfile[77, skill] = 0.95;
$BotProfile[77, offense] = true;
$BotProfile[77, voicePitch] = 0.915;
$BotProfile[78, name] = "Neon Blossom";
$BotProfile[78, skill] = 0.95;
$BotProfile[78, offense] = false;
$BotProfile[78, voicePitch] = 1.125;
$BotProfile[79, name] = "Shiver";
$BotProfile[79, skill] = 0.95;
$BotProfile[79, offense] = true;
$BotProfile[79, voicePitch] = 0.875;

737
scripts/aiChat.cs Normal file
View file

@ -0,0 +1,737 @@
//------------------------------
//AI Message functions
function AIFindCommanderAI(%omitClient)
{
%count = ClientGroup.getCount();
for (%i = 0; %i < %count; %i++)
{
%client = ClientGroup.getObject(%i);
if (%client != %omitClient && AIClientIsAlive(%client) && %client.isAIControlled())
return %client;
}
//didn't find anyone
return -1;
}
$AIMsgThreadId = 0;
$AIMsgThreadActive = false;
$AIMsgThreadIndex = 0;
$AIMsgThreadDelay = 0;
$AIMsgThreadTable[0] = "";
function AIProcessMessageTable(%threadId)
{
//make sure we're still on the same thread
if (%threadId != $AIMsgThreadId)
return;
//get the speaker, the message, and the delay
%speaker = getWord($AIMsgThreadTable[$AIMsgThreadIndex], 0);
%msg = getWord($AIMsgThreadTable[$AIMsgThreadIndex], 1);
%delay = getWord($AIMsgThreadTable[$AIMsgThreadIndex], 2);
//make sure the speaker is still alive
if (%speaker $= "" || ! AIClientIsAlive(%speaker, $AIMsgThreadDelay))
AIEndMessageThread(%threadId);
else
{
//play the msg, schedule the next msg, and increment the index
%tag = addTaggedString( %msg );
serverCmdCannedChat(%speaker, %tag, true);
removeTaggedString( %tag );
schedule(%delay, 0, "AIProcessMessageTable", %threadId);
$AIMsgThreadDelay = %delay;
$AIMsgThreadIndex++;
}
}
function AIEndMessageThread(%threadId)
{
if (%threadId == $AIMsgThreadId)
$AIMsgThreadActive = false;
}
function AIMessageThreadTemplate(%type, %msg, %clSpeaker, %clListener)
{
//abort if AI chat has been disabled
if ($AIDisableChat)
return;
//initialize the params
if (%clListener $= "")
%clListener = 0;
//abort if we're already in a thread
if ($AIMsgThreadActive)
return;
//initialize the new thread vars
$AIMsgThreadId++;
$AIMsgThreadActive = true;
$AIMsgThreadIndex = 0;
$AIMsgThreadTable[1] = "";
switch$ (%type)
{
case "DefendBase":
if (%clListener < 0)
%clListener = AIFindCommanderAI(%clSpeaker);
if (%clListener > 0)
{
//we have two people, create a semi-random conversation:
%index = -1;
//see if we issue a command first
if (getRandom() < 0.30)
{
//which version of "defend our base"?
%randNum = getRandom();
if (%randNum < 0.33)
$AIMsgThreadTable[%index++] = %clListener @ " ChatCmdDefendBase " @ 1250;
else if (%randNum < 0.66)
$AIMsgThreadTable[%index++] = %clListener @ " ChatCmdDefendReinforce " @ 1500;
else
$AIMsgThreadTable[%index++] = %clListener @ " ChatCmdDefendEntrances " @ 1250;
//do we acknowledge the command first?
if (getRandom() < 0.5)
{
if (getRandom() < 0.5)
$AIMsgThreadTable[%index++] = %clSpeaker @ " ChatCmdAcknowledged " @ 1500;
else
$AIMsgThreadTable[%index++] = %clSpeaker @ " ChatTeamYes " @ 1500;
}
}
//the actual msg to be used
$AIMsgThreadTable[%index++] = %clSpeaker @ " " @ %msg @ " " @ 1750;
//do we say "thanks"?
if (getRandom() < 0.3)
{
$AIMsgThreadTable[%index++] = %clListener @ " ChatTeamThanks " @ 1000;
//do we say "you're welcom?"
if (getRandom() < 0.5)
$AIMsgThreadTable[%index++] = %clSpeaker @ " ChatWelcome " @ 1500;
}
//end the thread
$AIMsgThreadTable[%index++] = "";
}
else
{
//just stick with the original
$AIMsgThreadTable[0] = %clSpeaker @ " " @ %msg @ " " @ 1750;
}
//now process the table
AIProcessMessageTable($AIMsgThreadId);
case "AttackBase":
if (%clListener < 0)
%clListener = AIFindCommanderAI(%clSpeaker);
if (%clListener > 0)
{
//we have two people, create a semi-random conversation:
%index = -1;
//see if we issue a command first
if (getRandom() < 0.30)
{
//which version of "attack the enemy base"?
%randNum = getRandom();
if (%randNum < 0.33)
$AIMsgThreadTable[%index++] = %clListener @ " ChatCmdAttack " @ 1250;
else if (%randNum < 0.66)
$AIMsgThreadTable[%index++] = %clListener @ " ChatCmdAttackBase " @ 1500;
else
$AIMsgThreadTable[%index++] = %clListener @ " ChatCmdAttackReinforce " @ 1250;
//do we acknowledge the command first?
if (getRandom() < 0.5)
{
if (getRandom() < 0.5)
$AIMsgThreadTable[%index++] = %clSpeaker @ " ChatCmdAcknowledged " @ 1500;
else
$AIMsgThreadTable[%index++] = %clSpeaker @ " ChatTeamYes " @ 1500;
}
}
//the actual msg to be used
$AIMsgThreadTable[%index++] = %clSpeaker @ " " @ %msg @ " " @ 1750;
//do we say "thanks"?
if (getRandom() < 0.3)
{
$AIMsgThreadTable[%index++] = %clListener @ " ChatTeamThanks " @ 1000;
//do we say "you're welcom?"
if (getRandom() < 0.5)
$AIMsgThreadTable[%index++] = %clSpeaker @ " ChatWelcome " @ 1500;
}
//end the thread
$AIMsgThreadTable[%index++] = "";
}
else
{
//just stick with the original
$AIMsgThreadTable[0] = %clSpeaker @ " " @ %msg @ " " @ 1750;
}
//now process the table
AIProcessMessageTable($AIMsgThreadId);
case "RepairBase":
if (%clListener < 0)
%clListener = AIFindCommanderAI(%clSpeaker);
if (%clListener > 0)
{
//we have two people, create a semi-random conversation:
%index = -1;
//see if we issue a command first
if (getRandom() < 0.30)
{
//which version of "repair"?
$AIMsgThreadTable[%index++] = %clListener @ " ChatRepairBase " @ 1250;
//do we acknowledge the command first?
if (getRandom() < 0.5)
{
if (getRandom() < 0.5)
$AIMsgThreadTable[%index++] = %clSpeaker @ " ChatCmdAcknowledged " @ 1500;
else
$AIMsgThreadTable[%index++] = %clSpeaker @ " ChatTeamYes " @ 1500;
}
}
//the actual msg to be used
$AIMsgThreadTable[%index++] = %clSpeaker @ " " @ %msg @ " " @ 1750;
//do we say "thanks"?
if (getRandom() < 0.3)
{
$AIMsgThreadTable[%index++] = %clListener @ " ChatTeamThanks " @ 1000;
//do we say "you're welcom?"
if (getRandom() < 0.5)
$AIMsgThreadTable[%index++] = %clSpeaker @ " ChatWelcome " @ 1500;
}
//end the thread
$AIMsgThreadTable[%index++] = "";
}
else
{
//just stick with the original
$AIMsgThreadTable[0] = %clSpeaker @ " " @ %msg @ " " @ 1750;
}
//now process the table
AIProcessMessageTable($AIMsgThreadId);
}
}
function AIMessageThread(%msg, %clSpeaker, %clListener, %force, %index, %threadId)
{
//abort if AI chat has been disabled
if ($AIDisableChat)
return;
//initialize the params
if (%index $= "")
%index = 0;
if (%clListener $= "")
%clListener = 0;
if (%force $= "")
%force = false;
//if this is the initial call, see if we're already in a thread, and if we should force this one
if (%index == 0 && $AIMsgThreadActive && !%force)
{
error("DEBUG msg thread already in progress - aborting: " @ %msg @ " from client: " @ %clSpeaker);
return;
}
//if this is an ongoing thread, make sure it wasn't pre-empted
if (%index > 0 && %threadId != $AIMsgThreadId)
return;
//if this is a new thread, set a new thread id
if (%index == 0)
{
$AIMsgThreadId++;
$AIMsgThreadActive = true;
%threadId = $AIMsgThreadId;
}
switch$ (%msg)
{
//this is an example of how to use the chat system without using the table...
case "ChatHi":
serverCmdCannedChat(%clSpeaker, 'ChatHi', true);
%responsePending = false;
if (%index == 0)
{
if (%clListener < 0)
%clListener = AIFindCommanderAI(%clSpeaker);
if (%clListener > 0 && (getRandom() < 0.5))
{
%responsePending = true;
schedule(1000, 0, "AIMessageThread", %msg, %clListener, 0, false, 1, %threadId);
}
}
if (! %responsePending)
schedule(1000, 0, "AIEndMessageThread", $AIMsgThreadId);
//this method of using the chat system sets up a table instead...
//the equivalent is commented out below - same effect - table is much better.
case "ChatSelfDefendGenerator":
if (%index == 0)
{
//initialize the table
$AIMsgThreadIndex = 0;
$AIMsgThreadTable[1] = "";
%commander = AIFindCommanderAI(%clSpeaker);
if (%commander > 0)
{
$AIMsgThreadTable[0] = %commander @ " ChatCmdDefendBase " @ 1000;
$AIMsgThreadTable[1] = %clSpeaker @ " ChatCmdAcknowledged " @ 1250;
$AIMsgThreadTable[2] = %clSpeaker @ " " @ %msg @ " " @ 1000;
$AIMsgThreadTable[3] = "";
}
else
$AIMsgThreadTable[0] = %clSpeaker @ " " @ %msg @ " " @ 1000;
//now process the table
AIProcessMessageTable(%threadId);
}
// case "ChatSelfDefendGenerator":
// %responsePending = false;
// if (%index == 0)
// {
// //find the commander
// %commander = AIFindCommanderAI(%clSpeaker);
// if (%commander > 0)
// {
// %responsePending = true;
// serverCmdCannedChat(%commander, "ChatCmdDefendBase", true);
// schedule("AIMessageThread(" @ %msg @ ", " @ %clSpeaker @ ", 0, 1, " @ %type @ ", false, " @ %threadId @ ");", 1000);
// }
// else
// serverCmdCannedChat(%commander, "ChatSelfDefendGenerator", true);
// }
// else if (%index == 1)
// {
// //make sure the client is still alive
// if (AIClientIsAlive(%clSpeaker, 1000))
// {
// %responsePending = true;
// serverCmdCannedChat(%clSpeaker, "ChatCmdAcknowledged", true);
// schedule("AIMessageThread(" @ %msg @ ", " @ %clSpeaker @ ", 0, 2, " @ %type @ ", false, " @ %threadId @ ");", 1000);
// }
// else
// AIEndMessageThread($AIMsgThreadId);
// }
// else if (%index == 2)
// {
// //make sure the client is still alive
// if (AIClientIsAlive(%clSpeaker, 1000))
// serverCmdCannedChat(%clSpeaker, "ChatSelfDefendGenerator", true);
// else
// AIEndMessageThread($AIMsgThreadId);
// }
// if (! %responsePending)
// schedule("AIEndMessageThread(" @ $AIMsgThreadId @ ");", 1000);
default:
%tag = addTaggedString( %msg );
serverCmdCannedChat( %clSpeaker, %tag, true );
removeTaggedString( %tag ); // Don't keep incrementing the string ref count...
schedule( 1500, 0, "AIEndMessageThread", $AIMsgThreadId );
}
}
function AIPlay3DSound(%client, %sound)
{
%player = %client.player;
if (!isObject(%player))
return;
playTargetAudio(%client.target, addTaggedString(%sound), AudioClosest3d, true);
}
function AIPlayAnimSound(%client, %location, %sound, %minCel, %maxCel, %index)
{
//make sure the client is still alive
if (! AIClientIsAlive(%client, 500))
return;
switch (%index)
{
case 0:
//if we can set the client's aim, we can also try the animation
if (%client.aimAt(%location, 2500))
schedule(250, %client, "AIPlayAnimSound", %client, %location, %sound, %minCel, %maxCel, 1);
else
schedule(750, %client, "AIPlay3DSound", %client, %sound);
case 1:
//play the animation and schedule the next phase
%randRange = %maxCel - %minCel + 1;
%celNum = %minCel + mFloor(getRandom() * (%randRange - 0.1));
if (%celNum > 0)
%client.player.setActionThread("cel" @ %celNum);
schedule(500, %client, "AIPlayAnimSound", %client, %location, %sound, %minCel, %maxCel, 2);
case 2:
//say 'hi'
AIPlay3DSound(%client, %sound);
}
}
$AIAnimSalute = 1;
$AIAnimWave = 2;
function AIRespondToEvent(%client, %eventTag, %targetClient)
{
//record the event time
$EventTagTimeArray[%eventTag] = getSimTime();
//abort if AI chat has been disabled
if ($AIDisableChatResponse)
return;
%clientPos = %client.player.getWorldBoxCenter();
switch$ (%eventTag)
{
case 'ChatHi' or 'ChatAnimWave':
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
{
%setHumanControl = false;
if (!%client.isAIControlled() && %client.controlAI != %targetClient)
%setHumanControl = aiAttemptHumanControl(%client, %targetClient);
if (%setHumanControl)
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.hi", $AIAnimSalute, $AIAnimSalute, 0);
else
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.hi", $AIAnimWave, $AIAnimWave, 0);
}
case 'ChatBye' or 'ChatTeamDisembark' or 'ChatAnimBye':
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
{
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.bye", $AIAnimWave, $AIAnimWave, 0);
//see if we need to release the bot
if (aiHumanHasControl(%client, %targetClient))
{
%objective = %targetClient.objective;
if (%objective.issuedByClientId == %client && %objective.targetClientId == %client && %objective.getName() $= "AIOEscortPlayer")
{
AIClearObjective(%objective);
%objective.delete();
}
aiReleaseHumanControl(%client, %targetClient);
}
}
case 'ChatTeamYes' or 'ChatGlobalYes' or 'ChatCheer' or 'ChatAnimDance':
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
{
//choose the animation range
%minCel = 5;
%maxCel = 8;
if (getRandom() > 0.5)
%sound = "gbl.thanks";
else
%sound = "gbl.awesome";
schedule(500, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, %sound, %minCel, %maxCel, 0);
}
case 'ChatAnimSalute':
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
schedule(500, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.thanks", $AIAnimSalute, $AIAnimSalute, 0);
case 'ChatAwesome' or 'ChatGoodGame' or 'ChatGreatShot' or 'ChatNice' or 'ChatYouRock' or 'ChatAnimSpec3':
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
{
//choose the animation range
%minCel = 5;
%maxCel = 8;
if (getRandom() > 0.5)
%sound = "gbl.thanks";
else
%sound = "gbl.yes";
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, %sound, %minCel, %maxCel, 0);
}
case 'ChatAww' or 'ChatObnoxious' or 'ChatSarcasm' or 'ChatAnimSpec1' or 'ChatAnimSpec2':
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
{
if (%targetClient.controlByHuman == %client)
schedule(1500, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.oops", $AIAnimSalute, $AIAnimSalute, 0);
else
schedule(1500, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.quiet", -1, -1, 0);
}
case 'ChatBrag' or 'ChatAnimGetSome':
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
{
if (%targetClient.controlByHuman == %client)
schedule(1500, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.yes", $AIAnimSalute, $AIAnimSalute, 0);
else
schedule(1500, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.no", -1, -1, 0);
}
case 'ChatAnimAnnoyed' or 'ChatMove':
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
{
if (%targetClient.controlByHuman == %client)
{
schedule(750, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "vqk.sorry", $AIAnimSalute, $AIAnimSalute, 0);
%targetClient.schedule(2750, "setDangerLocation", %clientPos , 20);
}
else
schedule(750, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.no", -1, -1, 0);
}
case 'ChatQuiet':
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
{
if (%targetClient.controlByHuman == %client)
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.yes", $AIAnimSalute, $AIAnimSalute, 0);
else
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.no", -1, -1, 0);
}
case 'ChatWait' or 'ChatShazbot':
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
{
if (%targetClient.controlByHuman == %client)
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.yes", $AIAnimSalute, $AIAnimSalute, 0);
else
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.no", -1, -1, 0);
}
case 'ChatLearn' or 'ChatIsBaseSecure':
schedule(750, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.dunno", -1, -1, 0);
case 'ChatWelcome' or 'ChatSorry' or 'ChatAnyTime':
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.thanks", $AIAnimWave, $AIAnimWave, 0);
case 'ChatDunno' or 'ChatDontKnow':
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.yes", -1, -1, 0);
case 'ChatTeamNo' or 'ChatOops' or 'ChatGlobalNo':
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.shazbot", -1, -1, 0);
case 'ChatTeamThanks' or 'ChatThanks':
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "vqk.anytime", $AIAnimWave, $AIAnimWave, 0);
case 'ChatWarnShoot':
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "vqk.sorry", -1, -1, 0);
case 'ChatCmdWhat':
//see if the weight for the escort is higher than what he might otherwise be doing
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
{
//first, find the chat message
%objective = %targetClient.objective;
if (%objective > 0)
{
if (%objective.chat)
%sound = getWord(%objective.chat, 0) @ "Sound";
else
{
%type = %objective.getName();
switch$ (%type)
{
case "AIOAttackLocation":
%sound = "att.base";
case "AIOAttackObject":
if (%objective.targetObjectId > 0)
{
%objType = %objective.targetObjectId.getDataBlock().getName();
switch$ (%objType)
{
case "GeneratorLarge":
%sound = "slf.att.generator";
case "SensorLargePulse":
%sound = "slf.att.sensors";
case "SensorMediumPulse":
%sound = "slf.att.sensors";
case "TurretBaseLarge":
%sound = "slf.att.turrets";
case "StationVehicle":
%sound = "slf.att.vehicle";
default:
%sound = "slf.att.base";
}
}
else
%sound = "slf.att.base";
case "AIODefendLocation":
if (%objective.targetObjectId > 0)
{
%objType = %objective.targetObjectId.getDataBlock().getName();
switch$ (%objType)
{
case "Flag":
%sound = "slf.def.flag";
case "GeneratorLarge":
%sound = "slf.def.generator";
case "SensorLargePulse":
%sound = "slf.def.sensors";
case "SensorMediumPulse":
%sound = "slf.def.sensors";
case "TurretBaseLarge":
%sound = "slf.def.turrets";
case "StationVehicle":
%sound = "slf.def.vehicle";
default:
%sound = "slf.def.base";
}
}
else
%sound = "slf.def.defend";
case "AIOAttackPlayer":
%sound = "slf.att.attack";
case "AIOEscortPlayer":
%sound = "slf.def.defend";
case "AIORepairObject":
if (%objective.targetObjectId > 0)
{
%objType = %objective.targetObjectId.getDataBlock().getName();
switch$ (%objType)
{
case "GeneratorLarge":
%sound = "slf.rep.generator";
case "SensorLargePulse":
%sound = "slf.rep.sensors";
case "SensorMediumPulse":
%sound = "slf.rep.sensors";
case "TurretBaseLarge":
%sound = "slf.rep.turrets";
case "StationVehicle":
%sound = "slf.rep.vehicle";
default:
%sound = "slf.rep.equipment";
}
}
else
%sound = "slf.rep.base";
case "AIOLazeObject":
%sound = "slf.att.base";
case "AIOMortarObject":
if (%objective.targetObjectId > 0)
{
%objType = %objective.targetObjectId.getDataBlock().getName();
switch$ (%objType)
{
case "GeneratorLarge":
%sound = "slf.att.generator";
case "SensorLargePulse":
%sound = "slf.att.sensors";
case "SensorMediumPulse":
%sound = "slf.att.sensors";
case "TurretBaseLarge":
%sound = "slf.att.turrets";
case "StationVehicle":
%sound = "slf.att.vehicle";
default:
%sound = "slf.att.base";
}
}
else
%sound = "slf.att.base";
case "AIOTouchObject":
if (%objective.mode $= "FlagGrab")
%sound = "slf.att.flag";
else if (%objective.mode $= "FlagCapture")
%sound = "flg.flag";
else
%sound = "slf.att.base";
case "AIODeployEquipment":
%sound = "slf.tsk.defense";
default:
%sound = "gbl.dunno";
}
}
}
else
%sound = "gbl.dunno";
//now that we have a sound, play it with the salute animation
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, %sound, 1, 1, 0);
}
//these here are all "self" messages requiring a "thank you"
case 'ChatRepairBase' or 'ChatSelfAttack' or 'ChatSelfAttackBase' or 'ChatSelfAttackFlag' or 'ChatSelfAttackGenerator' or 'ChatSelfAttackSensors' or 'ChatSelfAttackTurrets' or 'ChatSelfAttackVehicle':
schedule(750, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.thanks", 1, 1, 0);
case 'ChatSelfDefendBase' or 'ChatSelfDefend' or 'ChatSelfDefendFlag' or 'ChatSelfDefendGenerator' or 'ChatSelfDefendNexus' or 'ChatSelfDefendSensors' or 'ChatSelfDefendTurrets' or 'ChatSelfDefendVehicle':
schedule(750, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.thanks", 1, 1, 0);
case 'ChatSelfRepairBase' or 'ChatSelfRepairEquipment' or 'ChatSelfRepairGenerator' or 'ChatSelfRepair' or 'ChatSelfRepairSensors' or 'ChatSelfRepairTurrets' or 'ChatSelfRepairVehicle':
schedule(750, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.thanks", 1, 1, 0);
case 'ChatTaskCover' or 'ChatTaskSetupD' or 'ChatTaskOnIt' or 'ChatTaskSetupRemote' or 'ChatTaskSetupSensors' or 'ChatTaskSetupTurrets' or 'ChatTaskVehicle':
schedule(750, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.thanks", 1, 1, 0);
case 'EnemyFlagCaptured':
//find all the clients within 100 m of the home flag, and get them all to cheer
%flagPos = %client.player.getWorldBoxCenter();
%count = ClientGroup.getCount();
for(%i = 0; %i < %count; %i++)
{
%cl = ClientGroup.getObject(%i);
//make sure the client is alive, and on the same team
if (%cl.isAIControlled() && %cl.team == %client.team && AIClientIsAlive(%cl))
{
//see if they're within 100 m
%distance = %cl.getPathDistance(%flagPos);
if (%distance > 0 && %distance < 100)
{
//choose the animation range
%minCel = 5;
%maxCel = 8;
%randTime = mFloor(getRandom() * 1500) + 1;
//pick a random sound
if (getRandom() > 0.25)
%sound = "gbl.awesome";
else if (getRandom() > 0.5)
%sound = "gbl.thanks";
else if (getRandom() > 0.75)
%sound = "gbl.nice";
else
%sound = "gbl.rock";
schedule(%randTime, %cl, "AIPlayAnimSound", %cl, %flagPos, %sound, %minCel, %maxCel, 0);
}
}
}
case 'ChatCmdHunterGiveFlags' or 'ChatCmdGiveMeFlag':
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
{
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "cmd.acknowledge", $AIAnimSalute, $AIAnimSalute, 0);
schedule(750, %targetClient.player, "serverCmdThrowFlag", %targetClient);
}
}
}

25
scripts/aiDeathMatch.cs Normal file
View file

@ -0,0 +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;
}

1053
scripts/aiDebug.cs Normal file

File diff suppressed because it is too large Load diff

1028
scripts/aiDefaultTasks.cs Normal file

File diff suppressed because it is too large Load diff

292
scripts/aiHumanTasks.cs Normal file
View file

@ -0,0 +1,292 @@
function aiAddHumanObjective(%client, %objective, %targetClient, %fromCmdMap)
{
//first, make sure the objective Q for the given team exists
if (!isObject($ObjectiveQ[%client.team]))
return 0;
//if a target client is specified, create a link if we can...
if (%targetClient > 0)
{
if (aiHumanHasControl(%client, %targetClient) || (%targetClient.isAIControlled() && !aiAlreadyControlled(%targetClient)))
aiSetHumanControl(%client, %targetClient);
else
return 0;
}
//special (hacky) case here for AIOBombLocation objectives
if (%objective.getName() $= "AIOBombLocation")
{
if (!isObject($AIBombLocationSet))
return 0;
%objective.team = %client.team;
$AIBombLocationSet.add(%objective);
return %objective;
}
//parse the type of objective, and see if it already exists...
%useThisObjective = -1;
%objQ = $ObjectiveQ[%client.team];
if (%objective.getName() $= "AIOEscortPlayer" || %objective.getName() $= "AIOAttackPlayer")
{
//first, make sure the objective is legit
if (!AIClientIsAlive(%objective.targetClientId))
return 0;
//fill in the description:
%objective.description = %objective.getName() SPC getTaggedString(%objective.targetClientId.name);
//now see if the objective already exists...
%count = %objQ.getCount();
for (%i = 0; %i < %count; %i++)
{
%obj = %objQ.getObject(%i);
if (%obj.getName() $= %objective.getName())
{
//if we've found a previously existing version, use it instead of the new objective
if (%obj.issuedByClientId == %client && %obj.targetClientId == %objective.targetClientId)
{
%useThisObjective = %obj;
break;
}
}
}
}
else if (%objective.getName() $= "AIODefendLocation" || %objective.getName() $= "AIOAttackLocation")
{
//make sure it's a valid objective
if (%objective.location $= "" || %objective.location $= "0 0 0")
return 0;
//fill in the description:
%objective.description = %objective.getName() @ " at" SPC %objective.location;
//look for a duplicate...
%count = %objQ.getCount();
for (%i = 0; %i < %count; %i++)
{
%obj = %objQ.getObject(%i);
if (%obj.getName() $= %objective.getName())
{
if (%obj.issuedByClientId == %client && VectorDist(%objective.location, %obj.location) < 30)
{
%useThisObjective = %obj;
break;
}
}
}
}
else if (%objective.getName() $= "AIOAttackObject" || %objective.getName() $= "AIORepairObject" ||
%objective.getName() $= "AIOLazeObject" || %objective.getName() $= "AIOMortarObject" ||
%objective.getName() $= "AIOTouchObject")
{
//make sure it's a valid objective
if (!isObject(%objective.targetObjectId))
return 0;
//fill in the description:
%objective.description = %objective.getName() SPC %objective.targetObjectId.getDataBlock().getName();
//look for a duplicate...
%count = %objQ.getCount();
for (%i = 0; %i < %count; %i++)
{
%obj = %objQ.getObject(%i);
if (%obj.getName() $= %objective.getName())
{
if (%obj.issuedByClientId == %client && %objective.targetObjectId == %obj.targetObjectId)
{
%useThisObjective = %obj;
break;
}
}
}
}
else if (%objective.getName() $= "AIODeployEquipment")
{
//make sure it's a valid objective
if (%objective.location $= "" || %objective.location $= "0 0 0" || %objective.equipment $= "")
return 0;
//fill in the description:
%objective.description = %objective.getName() SPC %objective.equipment SPC "at" SPC %objective.location;
//look for a duplicate...
%count = %objQ.getCount();
for (%i = 0; %i < %count; %i++)
{
%obj = %objQ.getObject(%i);
if (%obj.getName() $= %objective.getName())
{
if (%obj.issuedByClientId == %client && VectorDist(%objective.location, %obj.location) < 8 && %objective.equipment == %obj.equipment)
{
%useThisObjective = %obj;
break;
}
}
}
}
//if we found a previously added objective, delete the submitted one
if (%useThisObjective > 0)
{
%objective.delete();
}
//otherwise add it to the objective Q
else
{
%useThisObjective = %objective;
$ObjectiveQ[%client.team].add(%useThisObjective);
%objective.shouldAcknowledge = true;
//now that it's been added, see if anyone picks it up within 10 seconds
schedule(10000, %objective, "AIReassessHumanObjective", %objective);
}
//now see if we're supposed to force the target to the objective
//the link will have already been checked at the top...
if (%targetClient > 0)
{
//if we were previously assigned to an objective which was forced on this client, we need to delete it...
%prevObjective = %targetClient.objective;
if (%prevObjective != %useThisObjective && %prevObjective.issuedByClientId == %targetClient.controlByHuman)
{
AIClearObjective(%prevObjective);
%prevObjective.delete();
}
//if the command is an escort command, issue it at the forced escort weight instead
%forcedWeight = $AIWeightHumanIssuedCommand;
if (%useThisObjective.getName() $= "AIOEscortPlayer")
%forcedWeight = $AIWeightHumanIssuedEscort;
//reweight the client's objective
%testWeight = 0;
if (isObject(%client.objective))
%testWeight = %client.objective.weight(%client, %client.objectiveLevel, 0, %inventoryStr);
if (%testWeight <= 0 || %testWeight > %client.objectiveWeight)
%client.objectiveWeight = %testWeight;
//see if we should force the objective
if (%targetClient.objectiveWeight <= %forcedWeight)
{
AIForceObjective(%targetClient, %useThisObjective, %forcedWeight);
//clearing the prev objective will undo the link - re-do it here
aiSetHumanControl(%client, %targetClient);
//send the "command accepted response"
if (!%fromCmdMap)
{
if (isObject(%client.player) && VectorDist(%targetClient.player.position, %client.player.position) <= 40)
schedule(250, %targetClient.player, "AIPlayAnimSound", %targetClient, %client.player.getWorldBoxCenter(), "cmd.acknowledge", 1, 1, 0);
}
else
serverCmdAcceptTask(%targetClient, %client, -1, %useThisObjective.ackDescription);
}
else
{
//send the "command declined response"
if (!%fromCmdMap)
{
if (isObject(%client.player) && VectorDist(%targetClient.player.position, %client.player.position) <= 40)
{
schedule(250, %targetClient.player, "AIPlayAnimSound", %targetClient, %client.player.getWorldBoxCenter(), "cmd.decline", -1, -1, 0);
schedule(2000, %client.player, "AIRespondToEvent", %client, 'ChatCmdWhat', %targetClient);
}
}
else
serverCmdDeclineTask(%targetClient, %client, %useThisObjective.ackDescription);
}
}
//return the objective used, so the calling function can know whether to delete the parameter one...
return %useThisObjective;
}
function AIReassessHumanObjective(%objective)
{
if (%objective.issuedByHuman)
{
//see if there's anyone still assigned to this objective
if (!AIClientIsAlive(%objective.clientLevel1) && !AIClientIsAlive(%objective.clientLevel2) && !AIClientIsAlive(%objective.clientLevel3))
{
AIClearObjective(%objective);
%objective.delete();
}
//else reassess this objective in another 10 seconds
else
schedule(10000, %objective, "AIReassessHumanObjective", %objective);
}
}
function aiAttemptHumanControl(%humanClient, %aiClient)
{
if (!aiAlreadyControlled(%aiClient))
{
aiSetHumanControl(%humanClient, %aiClient);
return true;
}
else
return false;
}
function aiHumanHasControl(%humanClient, %aiClient)
{
if (AIClientIsAlive(%humanClient) && AIClientIsAlive(%aiClient))
if (%humanClient.controlAI == %aiClient && %aiClient.controlByHuman == %humanClient)
return true;
return false;
}
function aiAlreadyControlled(%aiClient)
{
if (AIClientIsAlive(%aiClient) && AIClientIsAlive(%aiClient.controlByHuman))
if (%aiClient.controlByHuman.controlAI == %aiClient)
return true;
return false;
}
function aiReleaseHumanControl(%humanClient, %aiClient)
{
//make sure they were actually linked
if (!aiHumanHasControl(%humanClient, %aiClient))
return;
aiBreakHumanControl(%humanClient, %aiClient);
}
function aiSetHumanControl(%humanClient, %aiClient)
{
//make sure it's from a human to an ai
if (%humanClient.isAIControlled() || !%aiClient.isAIControlled())
return;
//these checks should be redundant, but...
if (%humanClient.controlAI > 0)
aiBreakHumanControl(%humanClient, %humanClient.controlAI);
if (%aiClient.controlByHuman > 0)
aiBreakHumanControl(%aiClient.controlByHuman, %aiClient);
//create the link
%humanClient.controlAI = %aiClient;
%aiClient.controlByHuman = %humanClient;
}
function aiBreakHumanControl(%humanClient, %aiClient)
{
//make sure they were actually linked
if (!aiHumanHasControl(%humanClient, %aiClient))
return;
//for now, just break the link, and worry about unassigning objectives later...
%humanClient.controlAI = "";
%aiClient.controlByHuman = "";
}

1477
scripts/aiInventory.cs Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,645 @@
// used to automatically create all objectives for a mission
function AIgeneratorObjectiveInit(%object)
{
if(%object.isUnderTerrain)
return; // no objectives for generators that act as a simple power sources
if(%object.team > 0)
{
%homeTeam = %object.team;
if(%homeTeam == 1)
%enemyTeam = 2;
else
%enemyTeam = 1;
addAIObjective(%enemyTeam, createDefaultAttack(%object, $AIWeightAttackGenerator[1], $AIWeightAttackGenerator[2]));
addAIObjective(%homeTeam, createDefaultRepair(%object, $AIWeightRepairGenerator[1], $AIWeightRepairGenerator[2]));
addAIObjective(%homeTeam, createDefaultDefend(%object, $AIWeightDefendGenerator[1], $AIWeightDefendGenerator[2]));
}
else
{
addAIObjective(1, createDefaultRepair(%object, $AIWeightRepairGenerator[1], $AIWeightRepairGenerator[2]));
addAIObjective(1, createDefaultAttack(%object, $AIWeightAttackGenerator[1], $AIWeightAttackGenerator[2]));
addAIObjective(1, createDefaultDefend(%object, $AIWeightDefendGenerator[1], $AIWeightDefendGenerator[2]));
addAIObjective(2, createDefaultRepair(%object, $AIWeightRepairGenerator[1], $AIWeightRepairGenerator[2]));
addAIObjective(2, createDefaultAttack(%object, $AIWeightAttackGenerator[1], $AIWeightAttackGenerator[2]));
addAIObjective(2, createDefaultDefend(%object, $AIWeightDefendGenerator[1], $AIWeightDefendGenerator[2]));
}
}
//--------------------------------------------------------------------------------------------------------
function AIsensorObjectiveInit(%object)
{
if(%object.team > 0)
{
%homeTeam = %object.team;
if(%homeTeam == 1)
%enemyTeam = 2;
else
%enemyTeam = 1;
addAIObjective(%homeTeam, createDefaultRepair(%object, $AIWeightRepairTurret[1], $AIWeightRepairTurret[2]));
addAIObjective(%enemyTeam, createDefaultMortar(%object, $AIWeightMortarTurret[1], $AIWeightMortarTurret[2]));
}
else
{
addAIObjective(1, createDefaultRepair(%object, $AIWeightRepairTurret[1], $AIWeightRepairTurret[2]));
addAIObjective(1, createDefaultMortar(%object, $AIWeightMortarTurret[1], $AIWeightMortarTurret[2]));
addAIObjective(2, createDefaultRepair(%object, $AIWeightRepairTurret[1], $AIWeightRepairTurret[2]));
addAIObjective(2, createDefaultMortar(%object, $AIWeightMortarTurret[1], $AIWeightMortarTurret[2]));
}
}
//--------------------------------------------------------------------------------------------------------
function AIflipflopObjectiveInit(%object)
{
// this will always start out neutral (Team 0)
addAIObjective(1, createDefaultDefend(%object, $AIWeightDefendFlipFlop[1], $AIWeightDefendFlipFlop[2]));
addAIObjective(1, createDefaultTouch(%object, $AIWeightCaptureFlipFlop[1], $AIWeightCaptureFlipFlop[2]));
addAIObjective(2, createDefaultDefend(%object, $AIWeightDefendFlipFlop[1], $AIWeightDefendFlipFlop[2]));
addAIObjective(2, createDefaultTouch(%object, $AIWeightCaptureFlipFlop[1], $AIWeightCaptureFlipFlop[2]));
}
//--------------------------------------------------------------------------------------------------------
function AIturretObjectiveInit(%object)
{
if(%object.team > 0)
{
%homeTeam = %object.team;
if(%homeTeam == 1)
%enemyTeam = 2;
else
%enemyTeam = 1;
addAIObjective(%homeTeam, createDefaultRepair(%object, $AIWeightRepairTurret[1], $AIWeightRepairTurret[2]));
// attack for indoor turrets, mortar for outside turrets
if(%object.getDataBlock().getName() $= "SentryTurret")
addAIObjective(%enemyTeam, createDefaultAttack(%object, $AIWeightAttackInventory[1], $AIWeightAttackInventory[2]));
else
addAIObjective(%enemyTeam, createDefaultMortar(%object, $AIWeightMortarTurret[1], $AIWeightMortarTurret[2]));
}
else
{
addAIObjective(1, createDefaultRepair(%object, $AIWeightRepairTurret[1], $AIWeightRepairTurret[2]));
addAIObjective(1, createDefaultMortar(%object, $AIWeightMortarTurret[1], $AIWeightMortarTurret[2]));
addAIObjective(2, createDefaultRepair(%object, $AIWeightRepairTurret[1], $AIWeightRepairTurret[2]));
addAIObjective(2, createDefaultMortar(%object, $AIWeightMortarTurret[1], $AIWeightMortarTurret[2]));
}
}
//--------------------------------------------------------------------------------------------------------
function AIinventoryObjectiveInit(%object)
{
if(%object.team > 0)
{
%homeTeam = %object.team;
if(%homeTeam == 1)
%enemyTeam = 2;
else
%enemyTeam = 1;
addAIObjective(%homeTeam, createDefaultRepair(%object, $AIWeightRepairInventory[1], $AIWeightRepairInventory[2]));
addAIObjective(%enemyTeam, createDefaultAttack(%object, $AIWeightAttackInventory[1], $AIWeightAttackInventory[2]));
}
else
{
addAIObjective(1, createDefaultRepair(%object, $AIWeightRepairInventory[1], $AIWeightRepairInventory[2]));
addAIObjective(1, createDefaultAttack(%object, $AIWeightAttackInventory[1], $AIWeightAttackInventory[2]));
addAIObjective(2, createDefaultRepair(%object, $AIWeightRepairInventory[1], $AIWeightRepairInventory[2]));
addAIObjective(2, createDefaultAttack(%object, $AIWeightAttackInventory[1], $AIWeightAttackInventory[2]));
}
}
//--------------------------------------------------------------------------------------------------------
function createDefaultTouch(%object, %weight1, %weight2)
{
%objective = new AIObjective(AIOTouchObject)
{
dataBlock = "AIObjectiveMarker";
description = "Capture the " @ %object.getName();
weightLevel1 = %weight1;
weightLevel2 = %weight2;
mode = "TouchFlipFlop";
targetObject = %object.getName();
targetClientId = -1;
targetObjectId = -1;
offense = true;
location = %object.getWorldBoxCenter();
desiredEquipment = "Light EnergyPack";
buyEquipmentSet = "LightEnergyDefault";
};
if(%object.missionTypesList !$= "")
%objective.gameType = %object.missionTypesList;
%objective.position = %objective.location;
return %objective;
}
//--------------------------------------------------------------------------------------------------------
function createDefaultMortar(%object, %weight1, %weight2)
{
%objective = new AIObjective(AIOMortarObject)
{
dataBlock = "AIObjectiveMarker";
description = "Mortar the " @ %object.getDataBlock().getName();
targetObject = %object.getName();
targetObjectId = %object;
targetClientId = -1;
weightLevel1 = %weight1;
weightLevel2 = %weight2;
location = %object.getWorldBoxCenter();
offense = true;
equipment = "Mortar MortarAmmo";
buyEquipmentSet = "HeavyAmmoSet";
};
if(%object.missionTypesList !$= "")
%objective.gameType = %object.missionTypesList;
%objective.position = %objective.location;
return %objective;
}
//--------------------------------------------------------------------------------------------------------
function createDefaultRepair(%object, %weight1, %weight2)
{
%objective = new AIObjective(AIORepairObject)
{
dataBlock = "AIObjectiveMarker";
description = "Repair the " @ %object.getDataBlock().getName();
targetObject = %object.getName();
targetObjectId = %object;
targetClientId = -1;
weightLevel1 = %weight1;
weightLevel2 = %weight2;
location = %object.getWorldBoxCenter();
defense = true;
equipment = "RepairPack";
buyEquipmentSet = "MediumRepairSet";
};
if(%object.missionTypesList !$= "")
%objective.gameType = %object.missionTypesList;
%objective.position = %objective.location;
return %objective;
}
//--------------------------------------------------------------------------------------------------------
function createDefaultAttack(%object, %weight1, %weight2)
{
%objective = new AIObjective(AIOAttackObject)
{
dataBlock = "AIObjectiveMarker";
description = "Attack the " @ %object.getDataBlock().getName();
targetObject = %object.getName();
targetObjectId = %object;
targetClientId = -1;
weightLevel1 = %weight1;
weightLevel2 = %weight2;
location = %object.getWorldBoxCenter();
offense = true;
desiredEquipment = "ShieldPack";
buyEquipmentSet = "HeavyAmmoSet";
};
if(%object.missionTypesList !$= "")
%objective.gameType = %object.missionTypesList;
%objective.position = %objective.location;
return %objective;
}
//--------------------------------------------------------------------------------------------------------
function createDefaultDefend(%object, %weight1, %weight2)
{
%objective = new AIObjective(AIODefendLocation)
{
dataBlock = "AIObjectiveMarker";
description = "Defend the " @ %object.getDataBlock().getName();
targetObject = %object.getName();
targetObjectId = %object;
targetClientId = -1;
weightLevel1 = %weight1;
weightLevel2 = %weight2;
location = %object.getWorldBoxCenter();
defense = true;
desiredEquipment = "ShieldPack Plasma PlasmaAmmo";
buyEquipmentSet = "HeavyShieldSet";
};
if(%object.missionTypesList !$= "")
%objective.gameType = %object.missionTypesList;
%objective.position = %objective.location;
return %objective;
}
//--------------------------------------------------------------------------------------------------------
function AIflagObjectiveInit(%flag)
{
%homeTeam = %flag.team;
if(%homeTeam == 1)
%enemyTeam = 2;
else
%enemyTeam = 1;
if(%flag.missionTypesList !$= "")
{
%missionSpecific = true;
%misType = %flag.missionTypesList;
}
%newObjective = new AIObjective(AIODefendLocation)
{
dataBlock = "AIObjectiveMarker";
weightLevel1 = $AIWeightDefendFlag[1];
weightLevel2 = $AIWeightDefendFlag[2];
description = "Defend our flag";
targetObject = %flag.getName();
targetObjectId = %flag;
targetClientId = -1;
location = %flag.getWorldBoxCenter();
defense = true;
desiredEquipment = "ShieldPack Plasma PlasmaAmmo";
buyEquipmentSet = "HeavyShieldSet";
chat = "ChatSelfDefendFlag DefendBase";
};
if(%missionSpecific)
%newObjective.gameType = %misType;
else
%newObjective.gameType = "all";
%newObjective.position = %newObjective.location;
addAIObjective(%homeTeam, %newObjective);
%newObjective = new AIObjective(AIOTouchObject)
{
dataBlock = "AIObjectiveMarker";
weightLevel1 = $AIWeightGrabFlag[1];
weightLevel2 = $AIWeightGrabFlag[2];
description = "Grab the enemy flag";
targetObject = %flag.getName();
targetObjectId = %flag;
targetClientId = -1;
location = %flag.getWorldBoxCenter();
mode = "FlagGrab";
offense = true;
desiredEquipment = "Light EnergyPack";
buyEquipmentSet = "LightEnergyDefault";
};
if(%missionSpecific)
%newObjective.gameType = %misType;
else
%newObjective.gameType = "all";
%newObjective.position = %newObjective.location;
addAIObjective(%enemyTeam, %newObjective);
//NOTE: for this objective, we need to fill in the targetClientId when the flag is taken
%newObjective = new AIObjective(AIOAttackPlayer)
{
dataBlock = "AIObjectiveMarker";
weightLevel1 = $AIWeightKillFlagCarrier[1];
weightLevel2 = $AIWeightKillFlagCarrier[2];
description = "Kill the enemy flag carrier";
mode = "FlagCarrier";
targetObject = %flag.getName();
targetObjectId = -1;
targetClientId = -1;
offense = true;
desiredEquipment = "Light EnergyPack";
buyEquipmentSet = "LightEnergySniper";
};
if(%missionSpecific)
%newObjective.gameType = %misType;
else
%newObjective.gameType = "all";
%newObjective.position = %flag.getWorldBoxCenter();
addAIObjective(%homeTeam, %newObjective);
//NOTE: for this objective, we need to fill in the location when the flag is grabbed
%newObjective = new AIObjective(AIOTouchObject)
{
dataBlock = "AIObjectiveMarker";
weightLevel1 = $AIWeightCapFlag[1];
weightLevel2 = $AIWeightCapFlag[2];
description = "Capture the flag!";
targetObject = %flag.getName();
targetObjectId = %flag;
targetClientId = -1;
mode = "FlagCapture";
offense = true;
defense = true;
};
if(%missionSpecific)
%newObjective.gameType = %misType;
else
%newObjective.gameType = "all";
%newObjective.position = %flag.getWorldBoxCenter();
addAIObjective(%enemyTeam, %newObjective);
%newObjective = new AIObjective(AIOTouchObject)
{
dataBlock = "AIObjectiveMarker";
weightLevel1 = $AIWeightReturnFlag[1];
weightLevel2 = $AIWeightReturnFlag[2];
description = "Return our flag";
targetObject = %flag.getName();
targetObjectId = %flag;
targetClientId = -1;
location = %flag.getWorldBoxCenter();
mode = "FlagDropped";
offense = true;
defense = true;
};
if(%missionSpecific)
%newObjective.gameType = %misType;
else
%newObjective.gameType = "all";
%newObjective.position = %newObjective.location;
addAIObjective(%homeTeam, %newObjective);
%newObjective = new AIObjective(AIOTouchObject)
{
dataBlock = "AIObjectiveMarker";
weightLevel1 = $AIWeightReturnFlag[1];
weightLevel2 = $AIWeightReturnFlag[2];
description = "Grab the dropped enemy flag";
targetObject = %flag.getName();
targetObjectId = %flag;
targetClientId = -1;
mode = "FlagDropped";
offense = true;
defense = true;
};
if(%missionSpecific)
%newObjective.gameType = %misType;
else
%newObjective.gameType = "all";
%newObjective.position = %flag.getWorldBoxCenter();
addAIObjective(%enemyTeam, %newObjective);
}
//--------------------------------------------------------------------------------------------------------
function addAIObjective(%team, %objective)
{
if(AIObjectiveExists(%objective, %team) == false)
nameToId("MissionGroup/Teams/team" @ %team @ "/AIObjectives").add(%objective);
else
%objective.delete();
}
//--------------------------------------------------------------------------------------------------------
function AICreateObjectives()
{
messageBoxOkCancel("Build Objectives", "Are you sure you want to build all mission objectives?", "AIBuildObjectives();");
}
function AIBuildObjectives()
{
// make sure there exists our objectives group
for(%i = 0; %i <= Game.numTeams; %i++)
{
%objGroup = nameToId("MissionGroup/Teams/team" @ %i @ "/AIObjectives");
%teamGroup = nameToID("MissionGroup/Teams/team" @ %i);
if(%objGroup <= 0)
{
%set = new SimGroup(AIObjectives);
%teamGroup.add(%set);
}
else
{
// there already exists a folder for AIobjectives
// remove any objectives that are not locked
%count = 0;
while(%objGroup.getCount() && (%count != %objGroup.getCount()))
{
%obj = %objGroup.getObject(%count);
if(!%obj.locked)
%objGroup.remove(%obj);
else
%count++;
}
}
}
for(%k = 0; %k <= Game.numTeams; %k++)
{
%teamGroup = nameToID("MissionGroup/Teams/team" @ %k);
%teamGroup.AIobjectiveInit(false);
}
}
//--------------------------------------------------------------------------------------------------------
function SimGroup::AIobjectiveInit(%this)
{
for(%i = 0; %i < %this.getCount(); %i++)
%this.getObject(%i).AIobjectiveInit();
}
//--------------------------------------------------------------------------------------------------------
function GameBase::AIobjectiveInit(%this)
{
%this.getDataBlock().AIobjectiveInit(%this);
}
//--------------------------------------------------------------------------------------------------------
function AssignName(%object)
{
%root = %object.getDataBlock().getName();
if (%root $= "")
%root = "Unknown";
if (%object.team >= 0)
%newName = "Team" @ %object.team @ %root;
else
%newName = "Unnamed" @ %root;
%i = 1;
while (isObject(%newName @ %i))
%i++;
%object.setName(%newName @ %i);
}
//--------------------------------------------------------------------------------------------------------
function StationInventory::AIobjectiveInit(%data, %object)
{
if(%object.getName() $= "")
AssignName(%object);
AIinventoryObjectiveInit(%object);
}
//--------------------------------------------------------------------------------------------------------
function Generator::AIobjectiveInit(%data, %object)
{
if(%object.getName() $= "")
AssignName(%object);
if(!%object.isUnderTerrain)
AIgeneratorObjectiveInit(%object);
}
//--------------------------------------------------------------------------------------------------------
function TurretData::AIobjectiveInit(%data, %object)
{
if(%object.getName() $= "")
AssignName(%object);
AIturretObjectiveInit(%object);
}
//--------------------------------------------------------------------------------------------------------
function Sensor::AIobjectiveInit(%data, %object)
{
if(%object.getName() $= "")
AssignName(%object);
AIsensorObjectiveInit(%object);
}
//--------------------------------------------------------------------------------------------------------
function Flag::AIobjectiveInit(%data, %object)
{
if(%object.getName() $= "")
AssignName(%object);
AIflagObjectiveInit(%object);
}
//--------------------------------------------------------------------------------------------------------
function FlipFlop::AIobjectiveInit(%data, %object)
{
if(%object.getName() $= "")
AssignName(%object);
AIflipflopObjectiveInit(%object);
}
//--------------------------------------------------------------------------------------------------------
function saveObjectives()
{
for(%i = 1; %i <= 2; %i++)
saveObjectives(%i);
}
//--------------------------------------------------------------------------------------------------------
function saveObjectiveFile(%team)
{
// check for read-only
%fileName = $CurrentMission @ "team" @ %team @ ".cs";
%file = "base/missions/" @ %fileName;
if(!isWriteableFileName(%file))
{
error("Objectives file '" @ %fileName @ "' is not writeable.");
return;
}
// ok, were good to save.
%objectives = nameToId("MissionGroup/Teams/team" @ %team @ "/AIObjectives");
%objectives.save("missions/" @ %fileName);
}
//--------------------------------------------------------------------------------------------------------
function LoadObjectives(%numTeams)
{
for(%i = 1; %i <= %numTeams; %i++)
loadObjectivesFile(%i);
}
//--------------------------------------------------------------------------------------------------------
function LoadObjectivesFile(%team)
{
%file = $CurrentMission @ "team" @ %team;
exec("missions/" @ %file);
%newObjSet = nameToId("MissionCleanup/AIObjectives");
if(%newObjSet > 0)
{
%group = NameToId("MissionGroup/Teams/team" @ %team);
%oldObjSet = NameToId("MissionGroup/Teams/team" @ %team @ "/AIObjectives");
if(%oldObjSet > 0)
{
%oldObjSet.delete();
%group.add(%newObjSet);
}
}
else
error("no objectives file for team" @ %team @ ". Loading defaults...");
}
//--------------------------------------------------------------------------------------------------------
function AIObjectiveExists(%newObjective, %team)
{
%objGroup = nameToId("MissionGroup/Teams/team" @ %team @ "/AIObjectives");
%objCount = %objGroup.getCount();
%exists = false;
for(%i = 0; %i < %objCount; %i++)
{
%obj = %objGroup.getObject(%i);
if(%obj.getName() $= %newObjective.getName())
{
if((%obj.getName() $= "AIOMortarObject") ||
(%obj.getName() $= "AIORepairObject") ||
(%obj.getName() $= "AIOAttackObject") ||
(%obj.getName() $= "AIODefendLocation"))
{
if(%obj.targetObjectId == %newObjective.targetObjectId)
%exists = true;
}
else if((%obj.getName() $= "AIOTouchObject") ||
(%obj.getName() $= "AIOAttackPlayer"))
{
if(%obj.mode $= %newObjective.mode)
if(%obj.description $= %newObjective.description)
%exists = true;
}
}
}
return %exists;
}

3809
scripts/aiObjectives.cs Normal file

File diff suppressed because it is too large Load diff

915
scripts/aiRPG.cs Normal file
View file

@ -0,0 +1,915 @@
function AIConnection::onAIConnect(%client, %name, %team, %skill, %offense, %voice, %voicePitch)
{
if ($DebugMode) echo("AIConnection::onAIConnect(" @ %client @ ", " @ %name @ ", " @ %team @ ", " @ %skill @ ", " @ %offense @ ", " @ %voice @ ", " @ %voicePitch @ ")");
// Sex/Race defaults
//%client.sex = "Male";
//%client.race = "Orc";
//%client.armor = "Light";
//storedata(%client, "RACE", %client.sex @ %client.race);
//setup the voice and voicePitch
if (%voice $= "" && %name !$= "fish")
%voice = "Derm2";
%client.voice = %voice;
%client.voiceTag = addTaggedString(%voice);
if (%voicePitch $= "" || %voicePitch < 0.5 || %voicePitch > 2.0)
%voicePitch = 1.0;
%client.voicePitch = %voicePitch;
if(getRandom() > 0.5)
%client.skin = addTaggedString("basebot");
else
%client.skin = addTaggedString("basebbot");
%client.name = addTaggedString( "\cp\c9" @ %name @ "\co" );
%client.nameBase = %name;
//echo(%client.name);
//echo("CADD: " @ %client @ " " @ %client.getAddress());
//$HostGamePlayerCount++;
//setup the target for use with the sensor net, etc...
// console spam fix:
if ($DebugMode)
{
echo("calling allocclienttarget with these vars:");
echo("%client: " @ %client);
echo("%client.name: " @ %client.name);
echo("%client.voiceTag: " @ %client.voiceTag);
}
%client.target = allocClientTarget(%client, %client.name, "", %client.voiceTag, '_BOTConnection', 0, 0, %client.voicePitch);//_ClientConnection
//lets see if this removes the client from the server window =/
//messageAllExcept(%client, -1, 'MsgClientJoin', "", %name, %client, %client.target, true);
//set the initial team - Game.assignClientTeam() should be called later on...
%client.team = %team;
//assign the skill
%client.setSkillLevel(100);
//%client.displayonmasterserver = false;
//assign the affinity
%client.offense = true;
//clear any flags
%client.stop(); // this will clear the players move state
%client.clearStep();
%client.lastDamageClient = -1;
%client.lastDamageTurret = -1;
%client.setEngageTarget(-1);
%client.setTargetObject(-1);
%client.objective = "";
//clear the defaulttasks flag
%client.defaultTasksAdded = false;
//if the mission is already running, spawn the bot
if($missionRunning)
%client.startMission();
}
function AIConnection::startMission(%client)
{
if ($DebugMode) echo("AIConnection::startMission(" @ %client @ ")");
%client.matchStartReady = true;
//spawn the bot...
onAIspawn(%client);
}
function AIConnection::onAIDrop(%client)
{
if ($DebugMode) echo("AIConnection::onAIDrop(" @ %client @ ")");
//make sure we're trying to drop an AI
if(!isObject(%client) || !%client.isAIControlled())
return;
AIUnassignClient(%client);
%client.clearTasks();
%client.clearStep();
if($numAIperSpawnPoint[%client.mySpawnPoint]>0)
{
$numAIperSpawnPoint[%client.mySpawnPoint]--;
}//release the spawnpoint number
//clear the ai from any objectives, etc...
aiReleaseHumanControl(%client.controlByHuman, %client);
//kill the player, which should cause the Game object to perform whatever cleanup is required.
if(isObject(%client.player) && $missionrunning)
{
%client.player.scriptKill(0);
}
//do the nav graph cleanup
%client.missionCycleCleanup();
//%client.delete();
//RPG stuff
}
function AIConnection::endMission(%client)
{
//cancel the respawn thread, and spawn them manually
cancel(%client.respawnThread);
cancel(%client.objectiveThread);
}
function onAIspawn(%client)
{
return 0;//bleh
}
function RPGGame::onAIEnterLiquid(%game, %data, %player, %type)
{
%player.client.wet = true;
if(%player.client.targetpos)
%player.client.stepMove(%player.client.targetPos, 0, 3);
}
function RPGGame::onAILeaveLiquid(%game, %data, %player, %type)
{
%player.client.wet = false;
if(%player.client.targetpos)
%player.client.stepMove(%player.client.targetPos, 0, 3);
}
function RPGGame::onAIDoDamage(%game, %clvictim, %bot, %damagetype, %sourceobject)
{
if(!IsSameRace(%clVictim, %bot))
%bot.lastAttackCounter = %bot.AttackCounter;
}
function RPGGame::onAIDamaged(%game, %clVictim, %clAttacker, %damageType, %sourceObject)
{
if(%clVictim.isAiControlled())
StartDefendSelf(%clVictim, %clAttacker);
if(!IsSameRace(%clVictim, %clAttacker))
%clVictim.AttackCounter++;
}
function RPGGame::onAIFriendlyFire(%game, %clVictim, %clAttacker, %damageType, %sourceObject)
{
}
function RPGGame::onAIKilled(%game, %clVictim, %clKiller, %damageType, %implement)
{
if($debugMode == true)
echo("RPGGame::onAIKilled(" SPC %game SPC "," SPC %clvictim SPC "," SPC %clKiller SPC "," SPC %damagetype SPC "," SPC %implement SPC ") -aiRPG.cs");
%ai = %clVictim;
%ai.stop();
%ai.clearTasks();
%ai.clearStep();
%ai.lastDamageClient = -1;
%ai.lastDamageTurret = -1;
%ai.shouldEngage = -1;
%ai.lastAttackCounter = 0;
%ai.AttackCounter = 0;
%ai.CountStuck = 0;
%ai.setEngageTarget(-1);
%ai.setTargetObject(-1);
storedata(%ai, "guardzone", 0);
if(%ai.wandertaskid != 0)
{
%ai.wandertaskid.delete();
%ai.wandertaskid = 0;
}
if(%ai.attacktaskid != 0)
{
%ai.attacktaskid.delete();
%ai.attacktaskid = 0;
}
if(%ai.weapontaskid != 0)
{
%ai.weapontaskid.delete();
%ai.weapontaskid = 0;
}
$numAIperSpawnPoint[%clVictim.mySpawnPoint]--;
%ai.defendself = 1;
EndDefendSelf(%ai);
%ai.player = 0;
$aistack[fetchData(%ai,"SpawnIndex")].push(%ai);//push onto stack so we wont have to reconnect a NEW ai each time
return;
}
function RPGGame::onAIKilledClient(%game, %clVictim, %clAttacker, %damageType, %implement)
{
%clAttacker.setVictim(%clVictim, %clVictim.player);
%clattacker.defendself = 1;
EndDefendSelf(%clattacker);
}
function RPGGame::AIInit(%game)
{
AIInit();
}
function AIFindClosestEnemy(%srcClient, %radius, %losTimeout)
{
//see if there's an enemy near our defense location...
if (isObject(%srcClient.player))
%srcLocation = %srcClient.player.getWorldBoxCenter();
else
%srcLocation = "0 0 0";
return AIFindClosestEnemyToLoc(%srcClient, %srcLocation, %radius, %losTimeout, false, true);
}
function AIFindClosestEnemyToLoc(%srcClient, %srcLocation, %radius, %losTimeout, %ignoreLOS, %distFromClient)
{
if(%ignoreLOS $= "")
%ignoreLOS = false;
if(%distFromClient $= "")
%distFromClient = false;
%count = ClientGroup.getCount();
%closestClient = -1;
%closestDistance = 32767;
for(%i = 0; %i < %count; %i++)
{
%cl = ClientGroup.getObject(%i);
//make sure we find someone who's alive
if(AIClientIsAlive(%cl) && !IsSameRace(%cl, %srcClient))
{
//make sure we don't do extra LOS commands on players who are guaranteed to be out of LOS range
if(vectorDist(%cl.player.getPosition(), %srcLocation) <= %radius)
{
//make sure the client can see the enemy
if(%cl.sleepMode > 0)
{
%cast = containerRayCast(%cl.player.getWorldBoxCenter(), %srcClient.player.getWorldBoxCenter(), $TypeMasks::TerrainObjectType | $TypeMasks::InteriorObjectType, 0);
if(!%cast)
%hasLOS = true;
}
else
%hasLOS = %srcClient.hasLOSToClient(%cl);
if(fetchdata(%cl, "invisible"))
continue;
//%losTime = %srcClient.getClientLOSTime(%cl);
if(%haslos || %ignorelos)
{
%testPos = %cl.player.getWorldBoxCenter();
if(%distFromClient)
%distance = %srcClient.getPathDistance(%testPos);
else
%distance = AIGetPathDistance(%srcLocation, %testPos);
if(%distance > 0 && (%radius < 0 || %distance < %radius) && %distance < %closestDistance)
{
%closestClient = %cl;
%closestDistance = %distance;
}
}
}
}
}
return %closestClient SPC %closestDistance;
}
//---------------------------------------------------------------------------
function StartDefendSelf(%client, %attacker)
{
if(%client.hasattacktask && !IsSameRace(%client, %attacker))// client must have an attack task...
{
%client.overrideattacktask = true;//override the attack and wander tasks!
%client.overridewandertask = true;
%client.setEngageTarget(%attacker.player);
%client.setTargetObject(%attacker.player, 0, "Destroy");
%client.defendself++;
%client.currenttarget = %attacker;
%weaponrange = Game.getRange(Game.GetItem(fetchdata(%client, "weaponinhand")));
%client.stepMove(%attacker.player.getPosition(), %weaponrange , $AIModeWalk);
schedule(60*1000, %client, "EndDefendSelf", %client);
}
}
function EndDefendSelf(%client)
{
%client.defendself--;
if(%client.defendself <= 0)
{
//client hasnt been hit for over a min, cancel chase.
%client.defendself = 0;
%client.overrideattacktask = false;
%client.overridewandertask = false;
}
}
function AIRPGAttackTask::init(%task, %client)
{
%client.monitorTicker = "";
%client.attacktaskid = %task;
}
function AIRPGAttackTask::assume(%task, %client)
{
//%task.setWeightFreq(40);
%min = 40;
%max = 80;
%freq = mfloor((getRandom() * (%max - %min)) + %min);
%task.setMonitorFreq(%freq);
%client.hasattacktask = true;
}
function AIRPGAttackTask::retire(%task, %client)
{
}
function AIRPGAttackTask::weight(%task, %client)
{
%player = %client.player;
%task.setWeight(2000);
}
function AIRPGAttackTask::monitor(%task, %client)
{
%player = %client.player;
%player.attackThread = "";
%losrange = 40;
%afce = AIFindClosestEnemy(%client, %losrange, 15000);
%targetId = firstWord(%afce);
%targetDist = GetWord(%afce, 1);
if(%targetId !$= -1)
{
%client.lastTimeSpotEnemy = getTime();
//time to do a check for the bots in guard mode
if(fetchdata(%client, "attb") == 1)
{
if( fetchdata(%client, "guardzone") !$= fetchdata(%targetid, "zone") )
{
%targetid = -1;
}
}
}
if(%client.overrideattacktask && %client.currenttarget > 0)
{
%targetid = %client.currenttarget;
}
%clientPos = %client.player.getPosition();
%wrange = Game.GetRange(%client, fetchData(%client, "weaponInHand"));
%wdelay = Game.GetDelay(%client, fetchData(%client, "weaponInHand"));
%tolerance = %wrange;
if(%targetId !$= -1 && isobject(%targetid.player))
%targetPos = %targetId.player.getPosition();
else
%targetPos = -1;
//if targetId is -1, it will cancel these tasks out
%client.setEngageTarget(%targetId.player);
%client.setTargetObject(%targetId.player, 0, "Destroy");
%itemid = fetchdata(%client, "weaponinhand");
%dt = $ItemDamageType[Game.getItem(%client, %itemId)];
if(%client.trapped)
%wrange *= 5;
//check if using magic as a main way of attacking
if(%targetId !$= -1)
{
if(!fetchdata(%client, "magic"))
{
%weapon = (%client.player.getMountedImage($WeaponSlot) == 0) ? "" : %client.player.getMountedImage($WeaponSlot);
%ammo = $itemAmmo[Game.getItem(%itemid)];
if(%dt == $DamageType::Archery)
{
%ammo = $itemAmmo[Game.getItem(%itemid)];
if(%client.invcount[%ammo] <= 0)
serverCmdCycleWeapon(%client, "next");//no ammo switch weapon again.
%wrange = %wrange / 3;
}
//if( %targetDist <= %wrange && (%client.lastfire +%wdelay < getSimTime()))
//{
// schedule(250,0,"doaifire", %weapon, %player);
// %client.lastfire = getSimTime();
//}
//randomize target position by tolerance (%wrange).
%targetpos = (GetWord(%targetPos, 0) + %wrange * (getrandom()-0.5)) SPC (GetWord(%targetPos, 1) + %wrange * (getrandom()-0.5)) SPC (GetWord(%targetPos, 2) + %wrange * (getrandom()-0.5));
%hd = GetWord(%targetpos, 2) - GetWord(%client.player.getposition(), 2);
if(%targetid.player)
{
%vel = %targetid.player.getVelocity();
%targetpos = vectoradd(%targetpos, %vel);//should make better bots when chasing.
}
if(%client.wet)
{
%nvec = VectorSub( %targetid.player.getPosition(), %client.player.getPosition()) ;
%targetpos = VectorAdd(%nvec, VectorAdd(%nvec, %targetpos));
}
if(%client.trapped)
%mode = $AIModeExpress;
else if (%client.wet)
if(%hd > 15)
%mode = $AIModeGainHeight;
else
%mode = $AiModeExpress;
else
%mode = $AIModeWalk;
if(%client.trapped)
{
if(getRandom(0,1))
%targetpos = %client.player.getPosition();
}
%client.stepMove(%targetPos, 0, %mode);
%client.targetpos = %targetpos;
%client.overridewandertask = true;
%client.countStuck = 2;//backup for one step and pounce back. should be better.
%client.trapped = false;
}
else
{
//see if you have LOS to the target... if los is aquired FIRE else move
%client.overridewandertask = true;
%haslos = newhasLOStoclient(%client, %targetid);
if(%haslos)
{
//allowed spells for bots
%spell[1] = "thorn";
%spell[2] = "fireball";
%spell[3] = "icespike";
%spell[4] = "icestorm";
%spell[5] = "spikes";
%spell[6] = "melt";
%spell[7] = "cloud";
%spell[8] = "powercloud";
%spell[9] = "beam";
%spell[10] = "hellstorm";
%spell[11] = "snowstorm";
%spell[12] = "dimensionrift";
%spell[13] = "ironfist";
for(%i = 0; %i < 3; %i++)
{
%d = getRandom(1,10);
%spell = %spell[%d];
if(SkillCanUse(%client, %spell))
{
break;
}
}
if(!SkillCanUse(%client, %spell)) %spell = "thorn";
//FIRE!
RPGchat(%client, 0, "#cast " @ %spell);
%client.stepmove(%targetpos, 30, $AIModeExpress);
}
else
{
%hd = GetWord(%targetpos, 2) - GetWord(%client.player.getposition(), 2);
if(%client.trapped)
%mode = $AIModeExpress;
else if (%client.wet)
if(%hd > 15)
%mode = $AIModeGainHeight;
else
%mode = $AiModeExpress;
else
%mode = $AIModeWalk;
if(%client.trapped)
{
if(getRandom(0,4))
%targetpos = %client.player.getPosition();
}
%targetpos = (GetWord(%targetPos, 0) + %wrange * (getrandom()-0.5)) SPC (GetWord(%targetPos, 1) + %wrange * (getrandom()-0.5)) SPC (GetWord(%targetPos, 2) + %wrange * (getrandom()-0.5));
%client.stepmove(%targetpos, 0, %mode);//walk but keep distance!
%client.targetpos = %targetpos;
}
}
//are we hitting our target????
if(%client.lastAttackCounter >= %client.AttackCounter && %client.checkCounter >= %client.attackCounter)
{
// yes
%client.countStuck = 0;
%client.trapped = false;
}
else
{
%client.checkCounter = %client.attackCounter;
%client.countStuck++;
}
if(%client.countStuck > 2)
{
//echo(%client SPC "IS TRAPPED!!!" SPC %client.namebase);
%client.trapped = true;
%client.trappcounter++;
if(%client.trappcounter > 10)
%client.lastAttackCounter = %client.attackCounter;//break the running around like a madman.
}
}
else
if(!%client.overrideattacktask)
%client.overridewandertask = false;
%client.lastPos = %clientPos;
}
function doaifire(%weapon,%player)
{
ShapeBaseImageData::onFire(%weapon, %player, $weaponslot);
}
//----
function AIRPGWanderTask::init(%task, %client)
{
%client.wandertaskid = %task;
}
function AIRPGWanderTask::assume(%task, %client)
{
%client.lastStuckPos = %client.player.getPosition();
%min = 50;
%max = 120;
%freq = mfloor((getRandom() * (%max - %min)) + %min);
%task.setWeightFreq(%freq);
}
function AIRPGWanderTask::retire(%task, %client)
{
%client.stepIdle();
}
function AIRPGWanderTask::monitor(%task, %client)
{
%player = %client.player;
%task.setWeight(900);
}
function AIRPGWanderTask::weight(%task, %client)
{
if(!shouldAIBeAt(%client.player.position))
{
if(%client.despawntime == 0)
%client.despawntime = getSimTime() + 30000;
if(getSimTime() > %client.despawntime)
{
%client.deSpawn();
}
}
else
%client.despawntime = 0;
if(%client.overridewandertask == true)
return; //overridden for now. This should result in smarter bots.
%player = %client.player;
if(%client.getEngageTarget() != -1)
return;
%clientPos = %client.player.getPosition();
//until i figure out more of this AI, use the stepEngage line if you want the bot to avoid the player,
//or use the stepMove line to make the bot attack the player head-on. Make sure that the skill
//level is set to 10 in order for the bots to turn fast enough.
//something to think about: once i can get AI to damage others, then it would be a good idea to keep the last
//time of damage, and if the bot sticks around a player without getting any damage thru to its target for too
//long, then make the bot run away somewhere else.
%minrad = 5;
%maxrad = 30;
%tolerance = %maxrad;
%m = VectorDist(%clientPos, %client.lastPos);
if(%m <= 0.4)
{
//the bot might be stuck against something, take proper action
if(%client.stuckCounter $= "")
{
%distTravelled = vectorDist(%client.player.getPosition(), %client.lastStuckPos);
%client.stuckCounter = 0;
%min = Cap(mfloor(%distTravelled / 40), 1, 500);
%max = %min + 5;
%client.stuckCounterLimit = mfloor(getRandom() * (%max - %min)) + %min + 1;
%client.stepIdle(%clientPos);
%client.stepName = "";
%client.stepPos = "";
}
%client.stuckCounter++;
if(%client.stuckCounter >= %client.stuckCounterLimit)
{
//max out tolerance
%tolerance = 99999;
//make sure the other conditions aren't blocked by the 2 second jumping around thing
cancel(%client.TSEsched);
%client.TempStepEngage = "";
//stop idling the bot
%client.clearStep();
%client.lastStuckPos = %client.player.getPosition();
%client.stuckCounter = "";
}
}
if(!%client.TempStepEngage)
{
%movePos = -1;
%stepname = %client.getStepName();
%stepstatus = %client.getStepStatus();
if(%stepname $= "NONE" && %client.stepName $= "stepMove")
{
//limitation to getStepName involving stepMove, workaround follows:
%stepname = "AIStepMove";
if(VectorDist(%clientPos, %client.stepNamePos) <= %tolerance)
{
%stepname = "NONE";
%stepstatus = "Finished";
%client.stepName = "";
%client.stepPos = "";
}
else
%stepstatus = "InProgress";
}
if(%stepstatus !$= "InProgress")
{
//Select a random InteriorInstance, and go towards it
//%interiorId = selectRandomObjectWithRaceID("MissionGroup/Interiors", $RaceID[fetchData(%client, "RACE")]);
//%originalPos = %interiorId.position;
%originalPos = %client.player.getPosition();
%r = 0;
for(%i = 0; $ai::attackPos[$aiattack[%client], %i] !$= ""; %i++)
{
%d++;
}
if(%d != 0)
%r = %d*getRandom() % %d;
if(%r < 0) %r = 0;
if($Ai::AttackPos[$aiAttack[%client],%r] !$="")
%originalPos = $Ai::AttackPos[$aiAttack[%client],%r];
%p = randomPositionXY(%minrad, %maxrad);
%x = firstWord(%p);
%y = GetWord(%p, 1);
%ox = firstWord(%originalPos);
%oy = GetWord(%originalPos, 1);
%oxx = %ox + %x;
%oyy = %oy + %y;
%ozz = getTerrainHeight(%oxx @ " " @ %oyy @ " 0");
%movePos = %oxx @ " " @ %oyy @ " " @ %ozz;
if(getRpgRoll("1r3") == 1 )
%moveMode = $AIModeWalk;
else
%movemode = $AIModeExpress;
}
else if(%stepname $= "AIStepIdlePatrol")
{
//no need to make the bot do a stepMove, a stepIdle has already been issued
%movePos = -1;
}
else
{
%movePos = %client.stepPos;
%moveMode = $AIModeWalk;
}
if(%movePos !$= -1)
{
%client.stepMove(%movePos, %tolerance, %moveMode);
//%client.setPath(%movePos);
//getStepName doesn't recognize stepMove (stupid limitation?? dunno)
//workaround follows: (which turns out to be more powerful because I can determine position)
%client.stepName = "stepMove";
%client.stepPos = %movePos;
}
}
%client.lastPos = %clientPos;
}
function RPGGame::clearTempStepEngage(%game, %client)
{
%client.TempStepEngage = "";
}
//----
function AIRPGSelectWeaponTask::init(%task, %client)
{
%client.weapontaskid = %task;
}
function AIRPGSelectWeaponTask::assume(%task, %client)
{
%task.setWeightFreq(100);
}
function AIRPGSelectWeaponTask::retire(%task, %client)
{
}
function AIRPGSelectWeaponTask::monitor(%task, %client)
{
%player = %client.player;
%task.setWeight(900);
}
function AIRPGSelectWeaponTask::weight(%task, %client)
{
%player = %client.player;
%task.selectWeaponTaskTicker++;
if(%task.selectWeaponTaskTicker > %task.selectWeaponTaskLimit)
{
%min = 20;
%max = 150;
%nlimit = mfloor((getRandom() * (%max - %min)) + %min);
%task.selectWeaponTaskLimit = %nlimit;
%task.selectWeaponTaskTicker = 0;
//serverCmdCycleWeapon(%client, "next");//need to change this so the bots discard useless items..
Game.ShapeBasecycleWeapon(%client.player, "next");
%itemid = fetchdata(%client, "weaponinhand");
if(%itemid == 0)
{
Game.ShapeBasecycleWeapon(%client.player, "next");
%itemid = fetchdata(%client, "weaponinhand");
}
if($ItemDamageType[Game.getItem(%client, %itemId)] == $DamageType::Archery)
{
%ammo = $itemAmmo[Game.getItem(%client, %itemid)];
if(%client.data.invcount[%ammo, 3, 1] <= 0)
Game.ShapeBasecycleWeapon(%client.player, "next");//no ammo switch weapon again.
}
}
}
function AIRPGFishWanderTask::init(%task, %client)
{
%client.wandertaskid = %task;
}
function AIRPGFishWanderTask::assume(%task, %client)
{
%client.lastStuckPos = %client.player.getPosition();
%min = 50;
%max = 120;
%freq = mfloor((getRandom() * (%max - %min)) + %min);
%task.setWeightFreq(%freq/2);
}
function AIRPGFishWanderTask::retire(%task, %client)
{
}
function AIRPGFishWanderTask::monitor(%task, %client)
{
//%player = %client.player;
%task.setWeight(600);
}
function AIRPGFishWanderTask::weight(%task, %client)
{
%player = %client.player;
if(!isobject(%client.player))
{
if ($DebugMode) echo("ERROR: Task should not have been called - aiRPG.cs AIRPGFishWanderTask Client:" SPC %client SPC " Playerid:" SPC %client.player SPC "Task:" SPC %task);
//%task.delete();
return;
}
if(%client.getEngageTarget() !$= -1)
return;
%clientPos = %client.player.getPosition();
//until i figure out more of this AI, use the stepEngage line if you want the bot to avoid the player,
//or use the stepMove line to make the bot attack the player head-on. Make sure that the skill
//level is set to 10 in order for the bots to turn fast enough.
%minrad = -50;
%maxrad = 50;
%tolerance = %maxrad;
%stuck = false;
%m = VectorDist(%clientPos, %client.lastPos);
%d = VectorDist(%clientPos, %client.stepPos);
if(%m <= 0.5 && %d > 1.5 )
{
%unstuckpos = getword(%clientPos, 0)+(getword(%clientPos, 0) - getWord(%client.stepPos, 0)) SPC getword(%clientPos, 1)+(getword(%clientPos, 1) - getWord(%client.stepPos, 1)) SPC getword(%clientPos, 2)+(getword(%clientPos, 2) - getWord(%client.stepPos, 2));
%stuck = true;
%client.stuckcounter++;
if(%client.stuckcounter > 2)
{
%unstuckpos = "";
//if(%client.stuckcounter > 30)
// %client.player.scriptkill($damagetype::suicide);
}
}
else
{
%client.unstuckpos = "";
%client.stuckcounter = 0;
}
%movePos = -1;
%stepname = %client.getStepName();
%stepstatus = "none";
%originalPos = %clientPos;
if($Ai::AttackPos[$aiAttack[%client],0] !$="")
%originalPos = $Ai::AttackPos[$aiAttack[%client],0];
if(%stuck)
{
%originalPos = %unstuckPos;
}
%p = randomPositionXY(%minrad, %maxrad);
%x = firstWord(%p);
%y = GetWord(%p, 1);
%ox = firstWord(%originalPos);
%oy = GetWord(%originalPos, 1);
%oxx = %ox + %x;
%oyy = %oy + %y;
%ozz = getTerrainHeight(%oxx @ " " @ %oyy @ " 0");
%movePos = %oxx @ " " @ %oyy @ " " @ %ozz +5;
if(getRpgRoll("1r5") == 1 )
%moveMode = $AIModeGainHeight;
else
%movemode = $AIModeExpress;
if(%movePos !$= -1)
{
%client.stepMove(%movePos, %tolerance, %moveMode);
//%client.setPath(%movePos);
//getStepName doesn't recognize stepMove (stupid limitation?? dunno)
//workaround follows: (which turns out to be more powerful because I can determine position)
%client.stepName = "stepMove";
%client.tempmovemode = %moveMode;
if(!%stuck)
%client.stepPos = %movePos;
}
%client.lastPos = %clientPos;
}

View file

@ -0,0 +1,5 @@
//This adds Env mapping to the Minotaur's Lair marble textures
addMaterialMapping("MinoLair/Mino_Marble", "environment: Minolair/Mino_Emap 0.20");
addMaterialMapping("MinoLair/Mino_OldRoof", "environment: Minolair/Mino_Emap 0.20");
addMaterialMapping("MinoLair/Mino_OldRoof2", "environment: Minolair/Mino_Emap 0.20");
addMaterialMapping("MinoLair/Mino_MossMarble", "environment: Minolair/Mino_Emap 0.20");

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,17 @@
//-------------------------------------- Desert interior texture property mapping
addMaterialMapping("badlands/bd_ichute01", "environment: special/chuteTexture 0.25");
addMaterialMapping("badlands/bd_ichute02a", "environment: special/chuteTexture 0.25");
//"Color: red green blue startAlpha endAlpha"
//Soft sound = 0
//Hard sound = 1
//Metal sound = 2
//Snow sound = 3
addMaterialMapping("terrain/BadLands.DirtBumpy", "color: 0.5 0.36 0.16 0.4 0.0", "sound: 0");
addMaterialMapping("terrain/BadLands.DirtChipped", "color: 0.5 0.36 0.16 0.4 0.0", "sound: 0");
addMaterialMapping("terrain/BadLands.DirtYellow", "color: 0.5 0.36 0.16 0.4 0.0", "sound: 0");
addMaterialMapping("terrain/BadLands.DirtYellowCracked", "color: 0.5 0.36 0.16 0.4 0.0", "sound: 0");
addMaterialMapping("terrain/BadLands.RockBrown", "color: 0.5 0.36 0.16 0.4 0.0", "sound: 0");
addMaterialMapping("terrain/BadLands.RockChipped", "color: 0.5 0.36 0.16 0.4 0.0", "sound: 0");
addMaterialMapping("terrain/BadLands.RockCracked", "color: 0.5 0.36 0.16 0.4 0.0", "sound: 0");

Binary file not shown.

41
scripts/bioderm_heavy.cs Normal file
View file

@ -0,0 +1,41 @@
datablock TSShapeConstructor(BiodermHeavyDts)
{
baseShape = "bioderm_heavy.dts";
sequence0 = "bioderm_heavy_root.dsq root";
sequence1 = "bioderm_heavy_forward.dsq run";
sequence2 = "bioderm_heavy_back.dsq back";
sequence3 = "bioderm_heavy_side.dsq side";
sequence4 = "bioderm_heavy_lookde.dsq look";
sequence5 = "bioderm_heavy_lookms.dsq lookms";
sequence6 = "bioderm_heavy_head.dsq head";
sequence7 = "bioderm_heavy_headside.dsq headside";
sequence8 = "bioderm_heavy_jet.dsq jet";
sequence9 = "bioderm_heavy_land.dsq land";
sequence10 = "bioderm_heavy_fall.dsq fall";
sequence11 = "bioderm_heavy_jump.dsq jump";
sequence12 = "bioderm_heavy_recoilde.dsq light_recoil";
sequence13 = "bioderm_heavy_idlePDA.dsq idlePDA";
sequence14 = "bioderm_heavy_diehead.dsq death1";
sequence15 = "bioderm_heavy_diechest.dsq death2";
sequence16 = "bioderm_heavy_dieback.dsq death3";
sequence17 = "bioderm_heavy_dieknees.dsq death4";
sequence18 = "bioderm_heavy_diesidelft.dsq death5";
sequence19 = "bioderm_heavy_diesidert.dsq death6";
sequence20 = "bioderm_heavy_dieleglft.dsq death7";
sequence21 = "bioderm_heavy_dielegrt.dsq death8";
sequence22 = "bioderm_heavy_dieslump.dsq death9";
sequence23 = "bioderm_heavy_dieforward.dsq death10";
sequence24 = "bioderm_heavy_diespin.dsq death11";
sequence25 = "bioderm_heavy_celsalute.dsq cel1";
sequence26 = "bioderm_heavy_celyeah.dsq cel2";
sequence27 = "bioderm_heavy_tauntbest.dsq cel3";
sequence28 = "bioderm_heavy_celroar.dsq cel4";
sequence29 = "bioderm_heavy_tauntbull.dsq cel5";
sequence30 = "bioderm_heavy_celflex2.dsq cel6";
sequence31 = "bioderm_heavy_celgora.dsq cel7";
sequence32 = "bioderm_heavy_celjump.dsq cel8";
sequence33 = "bioderm_heavy_ski.dsq ski";
sequence34 = "bioderm_heavy_standjump.dsq standjump";
sequence35 = "bioderm_heavy_looknw.dsq looknw";
};

42
scripts/bioderm_light.cs Normal file
View file

@ -0,0 +1,42 @@
datablock TSShapeConstructor(BiodermLightDts)
{
baseShape = "bioderm_light.dts";
sequence0 = "bioderm_light_root.dsq root";
sequence1 = "bioderm_light_forward.dsq run";
sequence2 = "bioderm_light_back.dsq back";
sequence3 = "bioderm_light_side.dsq side";
sequence4 = "bioderm_light_lookde.dsq look";
sequence5 = "bioderm_light_lookms.dsq lookms";
sequence6 = "bioderm_light_head.dsq head";
sequence7 = "bioderm_light_headside.dsq headSide";
sequence8 = "bioderm_light_jet.dsq jet";
sequence9 = "bioderm_light_land.dsq land";
sequence10 = "bioderm_light_fall.dsq fall";
sequence11 = "bioderm_light_jump.dsq jump";
sequence12 = "bioderm_light_recoilde.dsq light_recoil";
sequence13 = "bioderm_light_idlePDA.dsq idlePDA";
sequence14 = "bioderm_light_scoutroot.dsq scoutroot";
sequence15 = "bioderm_light_dieback.dsq death1";
sequence16 = "bioderm_light_diespin.dsq death2";
sequence17 = "bioderm_light_diechest.dsq death3";
sequence18 = "bioderm_light_dieforward.dsq death4";
sequence19 = "bioderm_light_diehead.dsq death5";
sequence20 = "bioderm_light_dieknees.dsq death6";
sequence21 = "bioderm_light_dieleglft.dsq death7";
sequence22 = "bioderm_light_dielegrt.dsq death8";
sequence23 = "bioderm_light_diesidelft.dsq death9";
sequence24 = "bioderm_light_diesidert.dsq death10";
sequence25 = "bioderm_light_dieslump.dsq death11";
sequence26 = "bioderm_light_celsalute.dsq cel1";
sequence27 = "bioderm_light_celyeah.dsq cel2";
sequence28 = "bioderm_light_tauntbest.dsq cel3";
sequence29 = "bioderm_light_celroar.dsq cel4";
sequence30 = "bioderm_light_tauntbull.dsq cel5";
sequence31 = "bioderm_light_celflex2.dsq cel6";
sequence32 = "bioderm_light_celgora.dsq cel7";
sequence33 = "bioderm_light_celjump.dsq cel8";
sequence34 = "bioderm_light_sitting.dsq sitting";
sequence35 = "bioderm_light_ski.dsq ski";
sequence36 = "bioderm_light_standjump.dsq standjump";
sequence37 = "bioderm_light_looknw.dsq looknw";
};

41
scripts/bioderm_medium.cs Normal file
View file

@ -0,0 +1,41 @@
datablock TSShapeConstructor(BiodermMediumDts)
{
baseShape = "bioderm_medium.dts";
sequence0 = "bioderm_medium_root.dsq root";
sequence1 = "bioderm_medium_forward.dsq run";
sequence2 = "bioderm_medium_back.dsq back";
sequence3 = "bioderm_medium_side.dsq side";
sequence4 = "bioderm_medium_lookde.dsq look";
sequence5 = "bioderm_medium_head.dsq head";
sequence6 = "bioderm_medium_headside.dsq headside";
sequence7 = "bioderm_medium_jet.dsq jet";
sequence8 = "bioderm_medium_land.dsq land";
sequence9 = "bioderm_medium_fall.dsq fall";
sequence10 = "bioderm_medium_jump.dsq jump";
sequence11 = "bioderm_medium_idlePDA.dsq idlePDA";
sequence12 = "bioderm_medium_lookms.dsq lookms";
sequence13 = "bioderm_medium_sitting.dsq sitting";
sequence14 = "bioderm_medium_recoilde.dsq light_recoil";
sequence15 = "bioderm_medium_dieback.dsq death1";
sequence16 = "bioderm_medium_diespin.dsq death2";
sequence17 = "bioderm_medium_diehead.dsq death3";
sequence18 = "bioderm_medium_diechest.dsq death4";
sequence19 = "bioderm_medium_dieforward.dsq death5";
sequence20 = "bioderm_medium_dieknees.dsq death6";
sequence21 = "bioderm_medium_dieleglft.dsq death7";
sequence22 = "bioderm_medium_dielegrt.dsq death8";
sequence23 = "bioderm_medium_diesidelft.dsq death9";
sequence24 = "bioderm_medium_diesidert.dsq death10";
sequence25 = "bioderm_medium_dieslump.dsq death11";
sequence26 = "bioderm_medium_celsalute.dsq cel1";
sequence27 = "bioderm_medium_celyeah.dsq cel2";
sequence28 = "bioderm_medium_tauntbest.dsq cel3";
sequence29 = "bioderm_medium_celroar.dsq cel4";
sequence30 = "bioderm_medium_tauntbull.dsq cel5";
sequence31 = "bioderm_medium_celflex2.dsq cel6";
sequence32 = "bioderm_medium_celgora.dsq cel7";
sequence33 = "bioderm_medium_celjump.dsq cel8";
sequence34 = "bioderm_medium_ski.dsq ski";
sequence35 = "bioderm_medium_standjump.dsq standjump";
sequence36 = "bioderm_medium_looknw.dsq looknw";
};

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);
if(!isobject(%markerobj))
return;
%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)
{
//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);
}

277
scripts/cannedChatItems.cs Normal file
View file

@ -0,0 +1,277 @@
//--------------------------------------------------------------------------
//
// cannedChatItems.cs
//
//--------------------------------------------------------------------------
$MinChatItemId = 0;
$MaxChatItemId = 0;
if ( !isObject( CannedChatItems ) )
new SimGroup( CannedChatItems );
//--------------------------------------------------------------------------
function installChatItem( %command, %text, %audioFile, %animCel, %teamOnly, %defaultkeys, %play3D )
{
%cmdId = getSubStr( %command, 1, strlen( %command ) - 1 );
%name = getTaggedString(%command);
//echo( "** cmdId = " @ %cmdId @ " **" );
if ( !isObject( $ChatTable[%cmdId] ) )
{
if ( %animCel == 0 )
%animation = "";
else
%animation = "cel" @ %animCel;
//error("defvoicebinds="@$defaultVoiceBinds@",keyPress="@%keyPress@",keyCmd="@%keyCmd);
$ChatTable[%cmdId] = new CannedChatItem()
{
name = %name;
text = %text;
audioFile = %audioFile;
animation = %animation;
teamOnly = %teamOnly;
defaultKeys = %defaultkeys;
play3D = %play3D;
};
CannedChatItems.add( $ChatTable[%cmdId] );
if ( $MinChatItemId == 0 || %cmdId < $MinChatItemId )
$MinChatItemId = %cmdId;
if ( %cmdId > $MaxChatItemId )
$MaxChatItemId = %cmdId;
}
}
//--------------------------------------------------------------------------
function installChatItemCallback( %command, %callback )
{
%cmdId = getSubStr( %command, 1, strlen( %command ) - 1 );
// make sure there is a chat item created
if(isObject($ChatTable[%cmdId]))
{
for(%i = 0; (%aCallback = $ChatCallbacks[%cmdId, %i]) !$= ""; %i++)
{
// dont allow multiple instances
if(%aCallback == %callback)
return;
}
$ChatCallbacks[%cmdId, %i] = %callback;
}
}
function processChatItemCallbacks( %command )
{
%cmdId = getSubStr( %command, 1, strlen( %command ) - 1 );
// make sure an actual chat item
if(isObject($ChatTable[%cmdId]))
for(%i = 0; (%callback = $ChatCallbacks[%cmdId, %i]) !$= ""; %i++)
call(%callback, $ChatTable[%cmdId]);
}
//--------------------------------------------------------------------------
// ANIMATIONS
installChatItem( 'ChatAnimAnnoyed', "", "vqk.move", 4, false, "VGAA", true );
installChatItem( 'ChatAnimGetSome', "", "gbl.brag", 3, false, "VGAG", true );
installChatItem( 'ChatAnimDance', "", "gbl.woohoo", 5, false, "VGAD", true );
installChatItem( 'ChatAnimSalute', "", "slf.tsk.generic", 1, false, "VGAS", true );
installChatItem( 'ChatAnimWave', "", "gbl.hi", 2, false, "VGAW", true );
installChatItem( 'ChatAnimSpec1', "", "gbl.obnoxious", 6, false, "VGAZ", true );
installChatItem( 'ChatAnimSpec2', "", "gbl.aww", 7, false, "VGAX", true );
installChatItem( 'ChatAnimSpec3', "", "gbl.awesome", 8, false, "VGAC", true );
//--------------------------------------------------------------------------
// ATTACK
installChatItem( 'ChatCmdAttack', "Attack!", "att.attack", 0, true, "VAA", false );
installChatItem( 'ChatCmdAttackBase', "Attack the enemy base!", "att.base", 0, true, "VAB", false );
installChatItem( 'ChatCmdAttackChase', "Recover our flag!", "att.chase", 0, true, "VAC", false );
installChatItem( 'ChatCmdAttackDistract', "Disrupt the enemy defense!", "att.distract", 0, true, "VAD", false );
installChatItem( 'ChatCmdAttackFlag', "Get the enemy flag!", "att.flag", 0, true, "VAF", false );
installChatItem( 'ChatCmdAttackGenerator', "Destroy the enemy generator!", "att.generator", 0, true, "VAG", false );
installChatItem( 'ChatCmdAttackObjective', "Attack the objective!", "att.objective", 0, true, "VAO", false );
installChatItem( 'ChatCmdAttackReinforce', "Reinforce the offense!", "att.reinforcements", 0, true, "VAR", false );
installChatItem( 'ChatCmdAttackSensors', "Destroy enemy sensors!", "att.sensors", 0, true, "VAS", false );
installChatItem( 'ChatCmdAttackTurrets', "Destroy enemy turrets!", "att.turrets", 0, true, "VAT", false );
installChatItem( 'ChatCmdAttackWait', "Wait for my signal before attacking!", "att.wait", 0, true, "VAW", false );
installChatItem( 'ChatCmdAttackVehicle', "Destroy the enemy vehicle!", "att.vehicle", 0, true, "VAV", false );
//--------------------------------------------------------------------------
// BASE
installChatItem( 'ChatBaseTaken', "Our base is taken.", "bas.taken", 0, true, "VBT", false );
installChatItem( 'ChatEnemyInBase', "The enemy's in our base.", "bas.enemy", 0, true, "VBE", false );
installChatItem( 'ChatBaseClear', "Our base is clear.", "bas.clear", 0, true, "VBC", false );
installChatItem( 'ChatCmdRetakeBase', "Retake our base!", "bas.retake", 0, true, "VBR", false );
installChatItem( 'ChatBaseSecure', "Our base is secure.", "bas.secure", 0, true, "VBS", false );
//--------------------------------------------------------------------------
// DEFENSE
installChatItem( 'ChatCmdDefendBase', "Defend our base!", "def.base", 0, true, "VDB", false );
installChatItem( 'ChatCmdDefendCarrier', "Cover our flag carrier!", "def.carrier", 0, true, "VDC", false );
installChatItem( 'ChatCmdDefendEntrances', "Defend the entrances!", "def.entrances", 0, true, "VDE", false );
installChatItem( 'ChatCmdDefendFlag', "Defend our flag!", "def.flag", 0, true, "VDF", false );
installChatItem( 'ChatCmdDefendGenerator', "Protect the generator!", "def.generator", 0, true, "VDG", false );
installChatItem( 'ChatCmdDefendMe', "Cover me!", "def.me", 0, true, "VDM", false );
installChatItem( 'ChatCmdDefendObjective', "Defend the objective!", "def.objective", 0, true, "VDO", false );
installChatItem( 'ChatCmdDefendReinforce', "Reinforce our defense!", "def.reinforce", 0, true, "VDR", false );
installChatItem( 'ChatCmdDefendSensors', "Defend our sensors!", "def.sensors", 0, true, "VDS", false );
installChatItem( 'ChatCmdDefendTurrets', "Defend our turrets!", "def.turrets", 0, true, "VDT", false );
installChatItem( 'ChatCmdDefendVehicle', "Defend our vehicle!", "def.vehicle", 0, true, "VDV", false );
installChatItem( 'ChatCmdDefendNexus', "Defend the nexus!", "def.nexus", 0, true, "VDN", false );
//--------------------------------------------------------------------------
// COMMAND RESPONSE
installChatItem( 'ChatCmdAcknowledged', "Command acknowledged.", "cmd.acknowledge", 0, true, "VCA", false );
installChatItem( 'ChatCmdWhat', "What's your assignment?", "cmd.bot", 0, true, "VCW", false );
installChatItem( 'ChatCmdCompleted', "Command completed.", "cmd.completed", 0, true, "VCC", false );
installChatItem( 'ChatCmdDeclined', "Command declined.", "cmd.decline", 0, true, "VCD", false );
//--------------------------------------------------------------------------
// ENEMY STATUS
installChatItem( 'ChatEnemyBaseDisabled', "Enemy base is disabled.", "ene.base", 0, true, "VEB", false );
installChatItem( 'ChatEnemyDisarray', "The enemy is disrupted. Attack!", "ene.disarray", 0, true, "VED", false );
installChatItem( 'ChatEnemyGeneratorDestroyed', "Enemy generator destroyed.", "ene.generator", 0, true, "VEG", false );
installChatItem( 'ChatEnemyRemotesDestroyed', "Enemy remote equipment destroyed.", "ene.remotes", 0, true, "VER", false );
installChatItem( 'ChatEnemySensorsDestroyed', "Enemy sensors destroyed.", "ene.sensors", 0, true, "VES", false );
installChatItem( 'ChatEnemyTurretsDestroyed', "Enemy turrets destroyed.", "ene.turrets", 0, true, "VET", false );
installChatItem( 'ChatEnemyVehicleDestroyed', "Enemy vehicle station destroyed.", "ene.vehicle", 0, true, "VEV", false );
//--------------------------------------------------------------------------
// FLAG
installChatItem( 'ChatFlagGotIt', "I have the enemy flag!", "flg.flag", 0, true, "VFF", false );
installChatItem( 'ChatCmdGiveMeFlag', "Give me the flag!", "flg.give", 0, true, "VFG", false );
installChatItem( 'ChatCmdReturnFlag', "Retrieve our flag!", "flg.retrieve", 0, true, "VFR", false );
installChatItem( 'ChatFlagSecure', "Our flag is secure.", "flg.secure", 0, true, "VFS", false );
installChatItem( 'ChatCmdTakeFlag', "Take the flag from me!", "flg.take", 0, true, "VFT", false );
installChatItem( 'ChatCmdHunterGiveFlags', "Give your flags to me!", "flg.huntergive", 0, true, "VFO", false );
installChatItem( 'ChatCmdHunterTakeFlags', "Take my flags!", "flg.huntertake", 0, true, "VFP", false );
//--------------------------------------------------------------------------
// GLOBAL COMPLIMENTS
installChatItem( 'ChatAwesome', "Awesome!", "gbl.awesome", 0, false, "VGCA", false );
installChatItem( 'ChatGoodGame', "Good game!", "gbl.goodgame", 0, false, "VGCG", false );
installChatItem( 'ChatNice', "Nice move!", "gbl.nice", 0, false, "VGCN", false );
installChatItem( 'ChatYouRock', "You rock!", "gbl.rock", 0, false, "VGCR", false );
installChatItem( 'ChatGreatShot', "Great shot!", "gbl.shooting", 0, false , "VGCS");
//--------------------------------------------------------------------------
// GLOBAL
installChatItem( 'ChatHi', "Hi.", "gbl.hi", 0, false, "VGH", false );
installChatItem( 'ChatBye', "Bye.", "gbl.bye", 0, false, "VGB", false );
installChatItem( 'ChatGlobalYes', "Yes.", "gbl.yes", 0, false, "VGY", false );
installChatItem( 'ChatGlobalNo', "No.", "gbl.no", 0, false, "VGN", false );
installChatItem( 'ChatAnyTime', "Any time.", "gbl.anytime", 0, false, "VGRA", false );
installChatItem( 'ChatDontKnow', "I don't know.", "gbl.dunno", 0, false, "VGRD", false );
installChatItem( 'ChatOops', "Oops!", "gbl.oops", 0, false, "VGO", false );
installChatItem( 'ChatQuiet', "Quiet!", "gbl.quiet", 0, false, "VGQ", false );
installChatItem( 'ChatShazbot', "Shazbot!", "gbl.shazbot", 0, false, "VGS", false );
installChatItem( 'ChatCheer', "Woohoo!", "gbl.woohoo", 0, false, "VGW", false );
installChatItem( 'ChatThanks', "Thanks.", "gbl.thanks", 0, false, "VGRT", false );
installChatItem( 'ChatWait', "Wait a sec.", "gbl.wait", 0, false, "VGRW", false );
//--------------------------------------------------------------------------
// TRASH TALK
installChatItem( 'ChatAww', "Aww, that's too bad!", "gbl.aww", 0, false, "VGTA", false );
installChatItem( 'ChatBrag', "I am the greatest!", "gbl.brag", 0, false, "VGTG", false );
installChatItem( 'ChatObnoxious', "That's the best you can do?", "gbl.obnoxious", 0, false, "VGTB", false );
installChatItem( 'ChatSarcasm', "THAT was graceful!", "gbl.sarcasm", 0, false, "VGTT", false );
installChatItem( 'ChatLearn', "When ya gonna learn?", "gbl.when", 0, false, "VGTW", false );
//--------------------------------------------------------------------------
// NEED
installChatItem( 'ChatNeedBombardier', "Need a bombardier.", "need.bombardier", 0, true, "VNB", false );
installChatItem( 'ChatNeedCover', "Need covering fire.", "need.cover", 0, true, "VNC", false );
installChatItem( 'ChatNeedDriver', "Need driver for ground vehicle.", "need.driver", 0, true, "VND", false );
installChatItem( 'ChatNeedEscort', "Vehicle needs escort.", "need.escort", 0, true, "VNE", false );
installChatItem( 'ChatNeedPilot', "Need pilot for turbograv.", "need.flyer", 0, true, "VNP", false );
installChatItem( 'ChatNeedPassengers', "Gunship ready! Need a ride?", "need.gunship", 0, true, "VNG", false );
installChatItem( 'ChatNeedHold', "Hold that vehicle! I'm coming!", "need.hold", 0, true, "VNH", false );
installChatItem( 'ChatNeedRide', "I need a ride!", "need.ride", 0, true, "VNR", false );
installChatItem( 'ChatNeedSupport', "Need vehicle support!", "need.support", 0, true, "VNS", false );
installChatItem( 'ChatNeedTailgunner', "Need a tailgunner.", "need.tailgunner", 0, true, "VNT", false );
installChatItem( 'ChatNeedDestination', "Where to?", "need.where", 0, true, "VNW", false );
//--------------------------------------------------------------------------
// REPAIR
installChatItem( 'ChatRepairBase', "Repair our base!", "rep.base", 0, true, "VRB", false );
installChatItem( 'ChatRepairGenerator', "Repair our generator!", "rep.generator", 0, true, "VRG", false );
installChatItem( 'ChatRepairMe', "Repair me!", "rep.me", 0, true, "VRM", false );
installChatItem( 'ChatRepairSensors', "Repair our sensors!", "rep.sensors", 0, true, "VRS", false );
installChatItem( 'ChatRepairTurrets', "Repair our turrets!", "rep.turrets", 0, true, "VRT", false );
installChatItem( 'ChatRepairVehicle', "Repair our vehicle station!", "rep.vehicle", 0, true, "VRV", false );
//--------------------------------------------------------------------------
// SELF ATTACK
installChatItem( 'ChatSelfAttack', "I will attack.", "slf.att.attack", 0, true, "VSAA", false );
installChatItem( 'ChatSelfAttackBase', "I'll attack the enemy base.", "slf.att.base", 0, true, "VSAB", false );
installChatItem( 'ChatSelfAttackFlag', "I'll go for the enemy flag.", "slf.att.flag", 0, true, "VSAF", false );
installChatItem( 'ChatSelfAttackGenerator', "I'll attack the enemy generator.", "slf.att.generator", 0, true, "VSAG", false );
installChatItem( 'ChatSelfAttackSensors', "I'll attack the enemy sensors.", "slf.att.sensors", 0, true, "VSAS", false );
installChatItem( 'ChatSelfAttackTurrets', "I'll attack the enemy turrets.", "slf.att.turrets", 0, true, "VSAT", false );
installChatItem( 'ChatSelfAttackVehicle', "I'll attack the enemy vehicle station.", "slf.att.vehicle", 0, true, "VSAV", false );
//--------------------------------------------------------------------------
// SELF DEFEND
installChatItem( 'ChatSelfDefendBase', "I'll defend our base.", "slf.def.base", 0, true, "VSDB", false );
installChatItem( 'ChatSelfDefend', "I'm defending.", "slf.def.defend", 0, true, "VSDD", false );
installChatItem( 'ChatSelfDefendFlag', "I'll defend our flag.", "slf.def.flag", 0, true, "VSDF", false );
installChatItem( 'ChatSelfDefendGenerator', "I'll defend our generator.", "slf.def.generator", 0, true, "VSDG", false );
installChatItem( 'ChatSelfDefendNexus', "I'll defend the nexus.", "slf.def.nexus", 0, true, "VSDN", false );
installChatItem( 'ChatSelfDefendSensors', "I'll defend our sensors.", "slf.def.sensors", 0, true, "VSDS", false );
installChatItem( 'ChatSelfDefendTurrets', "I'll defend our turrets.", "slf.def.turrets", 0, true, "VSDT", false );
installChatItem( 'ChatSelfDefendVehicle', "I'll defend our vehicle bay.", "slf.def.vehicle", 0, true, "VSDV", false );
//--------------------------------------------------------------------------
// SELF REPAIR
installChatItem( 'ChatSelfRepairBase', "I'll repair our base.", "slf.rep.base", 0, true, "VSRB", false );
installChatItem( 'ChatSelfRepairEquipment', "I'll repair our equipment.", "slf.rep.equipment", 0, true, "VSRE", false );
installChatItem( 'ChatSelfRepairGenerator', "I'll repair our generator.", "slf.rep.generator", 0, true, "VSRG", false );
installChatItem( 'ChatSelfRepair', "I'm on repairs.", "slf.rep.repairing", 0, true, "VSRR", false );
installChatItem( 'ChatSelfRepairSensors', "I'll repair our sensors.", "slf.rep.sensors", 0, true, "VSRS", false );
installChatItem( 'ChatSelfRepairTurrets', "I'll repair our turrets.", "slf.rep.turrets", 0, true, "VSRT", false );
installChatItem( 'ChatSelfRepairVehicle', "I'll repair our vehicle station.", "slf.rep.vehicle", 0, true, "VSRV", false );
//--------------------------------------------------------------------------
// SELF TASK
installChatItem( 'ChatTaskCover', "I'll cover you.", "slf.tsk.cover", 0, true, "VSTC", false );
installChatItem( 'ChatTaskSetupD', "I'll set up defenses.", "slf.tsk.defense", 0, true, "VSTD", false );
installChatItem( 'ChatTaskOnIt', "I'm on it.", "slf.tsk.generic", 0, true, "VSTO", false );
installChatItem( 'ChatTaskSetupRemote', "I'll deploy remote equipment.", "slf.tsk.remotes", 0, true, "VSTR", false );
installChatItem( 'ChatTaskSetupSensors', "I'll deploy sensors.", "slf.tsk.sensors", 0, true, "VSTS", false );
installChatItem( 'ChatTaskSetupTurrets', "I'll deploy turrets.", "slf.tsk.turrets", 0, true, "VSTT", false );
installChatItem( 'ChatTaskVehicle', "I'll get a vehicle ready.", "slf.tsk.vehicle", 0, true, "VSTV", false );
//--------------------------------------------------------------------------
// TARGET
installChatItem( 'ChatTargetAcquired', "Target acquired.", "tgt.acquired", 0, true, "VTA", false );
installChatItem( 'ChatCmdTargetBase', "Target the enemy base! I'm in position.", "tgt.base", 0, true, "VTB", false );
installChatItem( 'ChatTargetDestroyed', "Target destroyed!", "tgt.destroyed", 0, true, "VTD", false );
installChatItem( 'ChatCmdTargetFlag', "Target their flag! I'm in position.", "tgt.flag", 0, true, "VTF", false );
installChatItem( 'ChatTargetFire', "Fire on my target!", "tgt.my", 0, true, "VTM", false );
installChatItem( 'ChatTargetNeed', "Need a target painted!", "tgt.need", 0, true, "VTN", false );
installChatItem( 'ChatCmdTargetSensors', "Target their sensors! I'm in position.", "tgt.sensors", 0, true, "VTS", false );
installChatItem( 'ChatCmdTargetTurret', "Target their turret! I'm in position.", "tgt.turret", 0, true, "VTT", false );
installChatItem( 'ChatCmdTargetWait', "Wait! I'll be in range soon.", "tgt.wait", 0, true, "VTW", false );
//--------------------------------------------------------------------------
// WARNING
installChatItem( 'ChatWarnBomber', "Incoming bomber!", "wrn.bomber", 0, true, "VWB", false );
installChatItem( 'ChatWarnEnemies', "Incoming hostiles!", "wrn.enemy", 0, true, "VWE", false );
installChatItem( 'ChatWarnVehicles', "Incoming vehicles!", "wrn.vehicles", 0, true, "VWV", false );
installChatItem( 'ChatWarnShoot', "Watch where you're shooting!", "wrn.watchit", 0, true, "VWW", false );
//--------------------------------------------------------------------------
// VERY QUICK
installChatItem( 'ChatWelcome', "Any time.", "vqk.anytime", 0, true, "VVA", false );
installChatItem( 'ChatIsBaseSecure', "Is our base secure?", "vqk.base", 0, true, "VVB", false );
installChatItem( 'ChatCeaseFire', "Cease fire!", "vqk.ceasefire", 0, true, "VVC", false );
installChatItem( 'ChatDunno', "I don't know.", "vqk.dunno", 0, true, "VVD", false );
installChatItem( 'ChatHelp', "HELP!", "vqk.help", 0, true, "VVH", false );
installChatItem( 'ChatMove', "Move, please!", "vqk.move", 0, true, "VVM", false );
installChatItem( 'ChatTeamNo', "No.", "vqk.no", 0, true, "VVN", false );
installChatItem( 'ChatSorry', "Sorry.", "vqk.sorry", 0, true, "VVS", false );
installChatItem( 'ChatTeamThanks', "Thanks.", "vqk.thanks", 0, true, "VVT", false );
installChatItem( 'ChatTeamWait', "Wait, please.", "vqk.wait", 0, true, "VVW", false );
installChatItem( 'ChatTeamYes', "Yes.", "vqk.yes", 0, true, "VVY", false );

Binary file not shown.

BIN
scripts/centerPrint.cs.dso Normal file

Binary file not shown.

233
scripts/chatMenuHud.cs Normal file
View file

@ -0,0 +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 !$= "" )
serverCmdPlayAnim(%client, %chatItem.animation);
// 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" );

BIN
scripts/chatMenuHud.cs.dso Normal file

Binary file not shown.

2084
scripts/client.cs Normal file

File diff suppressed because it is too large Load diff

BIN
scripts/client.cs.dso Normal file

Binary file not shown.

434
scripts/clientAudio.cs Normal file
View file

@ -0,0 +1,434 @@
//--------------------------------------------------------------------------
//
//
//
//--------------------------------------------------------------------------
// ordered list of providers
$AudioProviders[0, name] = "Creative Labs EAX 2 (TM)";
$AudioProviders[0, isHardware] = true;
$AudioProviders[0, enableEnvironment] = true;
$AudioProviders[1, name] = "Creative Labs EAX (TM)";
$AudioProviders[1, isHardware] = true;
$AudioProviders[1, enableEnvironment] = true;
$AudioProviders[2, name] = "DirectSound3D Hardware Support";
$AudioProviders[2, isHardware] = true;
$AudioProviders[2, enableEvironment] = false;
$AudioProviders[3, name] = "Miles Fast 2D Positional Audio";
$AudioProviders[3, isHardware] = false;
$AudioProviders[3, enableEvironment] = false;
// defaults
$Audio::defaultDriver = "miles";
$Audio::innerFalloffScale = "1.0";
$Audio::dynamicMemorySize = (1 << 20);
function audioIsHardwareProvider(%provider)
{
for(%i = 0; $AudioProviders[%i, name] !$= ""; %i++)
if(%provider $= $AudioProviders[%i, name])
return($AudioProviders[%i, isHardware]);
return(false);
}
function audioIsEnvironmentProvider(%provider)
{
for(%i = 0; $AudioProviders[%i, name] !$= ""; %i++)
if(%provider $= $AudioProviders[%i, name])
return($AudioProviders[%i, enableEnvironment]);
return(false);
}
function audioUpdateProvider(%provider)
{
// check if should be using hardware settings by default
alxDisableOuterFalloffs(false);
for(%i = 0; $AudioProviders[%i, name] !$= ""; %i++)
{
if(%provider $= $AudioProviders[%i, name])
{
// hardware
if($AudioProviders[%i, isHardware])
{
alxDisableOuterFalloffs(true);
alxSetInnerFalloffScale($Audio::innerFalloffScale);
}
// environment
%enable = $pref::Audio::environmentEnabled && audioIsEnvironmentProvider(%provider);
alxEnableEnvironmental(%enable);
break;
}
}
}
function initAudio()
{
$Audio::originalProvider = alxGetContexti(ALC_PROVIDER);
%providerName = alxGetContextstr(ALC_PROVIDER_NAME, $Audio::originalProvider);
audioUpdateProvider(%providerName);
// voice?
if($pref::Audio::enableVoiceCapture)
$Audio::captureInitialized = alxCaptureInit();
// Set volume based on prefs:
alxListenerf( AL_GAIN_LINEAR, $pref::Audio::masterVolume );
alxContexti( ALC_BUFFER_DYNAMIC_MEMORY_SIZE, $Audio::dynamicMemorySize );
alxSetChannelVolume( $EffectAudioType, $pref::Audio::effectsVolume );
alxSetChannelVolume( $VoiceAudioType, $pref::Audio::voiceVolume );
alxSetChannelVolume( $ChatAudioType, $pref::Audio::radioVolume );
alxSetChannelVolume( $MusicAudioType, $pref::Audio::musicVolume );
alxSetChannelVolume( $GuiAudioType, $pref::Audio::guiVolume );
alxSetChannelVolume( $RadioAudioType, $pref::Audio::radioVolume );
alxSetCaptureGainScale( $pref::Audio::captureGainScale );
// cap the codec levels
if( $platform $= "linux" )
{
if( $pref::Audio::encodingLevel != 3)
$pref::Audio::encodingLevel = 3;
$pref::Audio::decodingMask &= 8;
}
else
{
if( $pref::Audio::encodingLevel > 2)
$pref::Audio::encodingLevel = 2;
$pref::Audio::decodingMask &= 7;
}
}
if($Audio::initialized)
initAudio();
//--------------------------------------------------------------------------
// MP3-Music player
new ScriptObject(MusicPlayer)
{
class = MP3Audio;
currentTrack = "";
repeat = true;
};
function MP3Audio::stop(%this)
{
alxStopMusic();
}
function getRandomTrack()
{
%val = mFloor(getRandom(0, 4));
switch(%val)
{
case 0:
return "lush";
case 1:
return "volcanic";
case 2:
return "badlands";
case 3:
return "ice";
case 4:
return "desert";
}
}
function MP3Audio::play(%this)
{
if(%this.currentTrack $= "")
%this.currentTrack = getRandomTrack();
%this.playTrack(%this.currentTrack);
}
function MP3Audio::playTrack(%this, %trackName)
{
%this.currentTrack = %trackName;
if($pref::Audio::musicEnabled)
alxPlayMusic("ironsphererpg\\music\\" @ %trackName @ ".mp3");
}
function finishedMusicStream(%stopped)
{
if(%stopped $= "true")
return;
if(MusicPlayer.repeat)
MusicPlayer.playTrack(MusicPlayer.currentTrack);
}
function clientCmdPlayMusic(%trackname)
{
if(%trackname !$= "")
MusicPlayer.playTrack(%trackName);
}
function clientCmdStopMusic()
{
MusicPlayer.stop();
}
//--------------------------------------
// Audio Profiles
//
new AudioDescription(AudioGui)
{
volume = 1.0;
isLooping= false;
is3D = false;
type = $GuiAudioType;
};
new AudioDescription(AudioChat)
{
volume = 1.0;
isLooping= false;
is3D = false;
type = $ChatAudioType;
};
new AudioDescription(AudioGuiLoop)
{
volume = 1.0;
isLooping= true;
is3D = false;
type = $GuiAudioType;
};
new AudioProfile(sButtonDown)
{
filename = "gui/buttonDown.wav";
description = "audioGui";
preload = true;
};
new AudioProfile(sButtonOver)
{
filename = "gui/buttonOver.wav";
description = "audioGui";
preload = true;
};
new AudioProfile(sGotMail)
{
filename = "gui/youvegotmail.wav";
description = "audioGui";
preload = true;
};
new AudioProfile(sLaunchMenuOpen)
{
filename = "gui/launchMenuOpen.wav";
description = "audioGui";
preload = true;
};
new AudioProfile(sLaunchMenuOver)
{
filename = "gui/buttonOver.wav";
description = "audioGui";
preload = true;
};
new AudioProfile(VoteForSound)
{
filename = "gui/buttonOver.wav";
description = "audioGui";
preload = true;
};
new AudioProfile(VoteAgainstSound)
{
filename = "gui/buttonOver.wav";
description = "audioGui";
preload = true;
};
new AudioProfile(TaskAcceptedSound)
{
filename = "fx/misc/command_accept.wav";
description = "audioGui";
preload = true;
};
new AudioProfile(TaskDeclinedSound)
{
filename = "fx/misc/command_deny.wav";
description = "audioGui";
preload = true;
};
new AudioProfile(TaskCompletedSound)
{
filename = "fx/misc/command_complete.wav";
description = "audioGui";
preload = true;
};
new AudioProfile(InputDeniedSound)
{
filename = "fx/misc/diagnostic_beep.wav";
description = "audioGui";
preload = true;
};
//--------------------------------------------------------------------------
//-------------------------------------- Shapebase lock/homing tones...
new AudioDescription(AudioLockTones)
{
volume = 1.0;
isLooping= true;
is3D = false;
type = $EffectAudioType;
};
new AudioProfile(sSearchingTone)
// Sound that the FIRER hears when SEEKING a "hot" target
{
filename = "fx/weapons/missile_firer_search.wav";
description = "audioLockTones";
preload = true;
};
new AudioProfile(sLockedTone)
// Sound that the FIRER hears when a "hot" target is LOCKED
{
filename = "fx/weapons/missile_firer_lock.wav";
description = "audioLockTones";
preload = true;
};
new AudioProfile(sMissileLockWarningTone)
// Sound that the TARGET hears when a LOCK has been achieved
{
filename = "fx/weapons/missile_target_lock.wav";
description = "audioLockTones";
preload = true;
};
new AudioProfile(sMissileHomingWarningTone)
// Sound that the TARGET hears when a missile has been locked onto the target and is IN THE AIR
{
filename = "fx/weapons/missile_target_inbound.wav";
description = "audioLockTones";
preload = true;
};
//--------------------------------------------------------------------------
new AudioProfile(HudInventoryHumSound)
{
filename = "gui/inventory_hum.wav";
description = "AudioGuiLoop";
preload = true;
};
new AudioProfile(HudInventoryActivateSound)
{
filename = "gui/inventory_on.wav";
description = "AudioGui";
preload = true;
};
new AudioProfile(HudInventoryDeactivateSound)
{
filename = "gui/inventory_off.wav";
description = "AudioGui";
preload = true;
};
new AudioProfile(CommandMapHumSound)
{
filename = "gui/command_hum.wav";
description = "AudioGuiLoop";
preload = true;
};
new AudioProfile(CommandMapActivateSound)
{
filename = "gui/command_on.wav";
description = "AudioGui";
preload = true;
};
new AudioProfile(CommandMapDeactivateSound)
{
filename = "gui/command_off.wav";
description = "AudioGui";
preload = true;
};
new AudioProfile(ShellScreenHumSound)
{
filename = "gui/shell_hum.wav";
description = "AudioGuiLoop";
preload = true;
};
new AudioProfile(LoadingScreenSound)
{
filename = "gui/loading_hum.wav";
description = "AudioGuiLoop";
preload = true;
};
new AudioProfile(VotePassSound)
{
filename = "fx/misc/vote_passes.wav";
description = "AudioGui";
preload = true;
};
new AudioProfile(VoteNotPassSound)
{
filename = "fx/misc/vote_fails.wav";
description = "AudioGui";
preload = true;
};
new AudioProfile(AdminForceSound)
{
filename = "fx/misc/bounty_completed.wav";
description = "AudioGui";
preload = true;
};
new AudioProfile(VoteInitiatedSound)
{
filename = "fx/misc/vote_initiated.wav";
description = "AudioGui";
preload = true;
};
// Tinman - not being used anymore...
// new AudioProfile(OutOfBoundsSound)
// {
// filename = "gui/vote_nopass.wav";
// description = "AudioGuiLoop";
// preload = true;
// };
new AudioProfile(BountyBellSound)
{
filename = "fx/misc/bounty_bonus.wav";
description = "AudioGui";
preload = true;
};
new AudioProfile(SiegeSwitchSides)
{
filename = "fx/misc/siege_switching.wav";
description = "AudioGui";
preload = true;
};
new AudioProfile(ObjectiveCompleted)
{
filename = "fx/misc/bounty_bonus.wav";
description = "AudioGui";
preload = true;
};

BIN
scripts/clientAudio.cs.dso Normal file

Binary file not shown.

174
scripts/clientDefaults.cs Normal file
View file

@ -0,0 +1,174 @@
$JoinGamePort = 28000;
$pref::Audio::activeDriver = "default";
if ( $platform $= "linux" ) {
$pref::Audio::drivers = "OpenAL";
} else {
$pref::Audio::drivers = "Miles";
}
$pref::Audio::frequency = 22050;
$pref::Audio::sampleBits = 16;
$pref::Audio::channels = 2;
$pref::Audio::enableVoiceCapture = 1;
$pref::Audio::voiceChannels = 1;
if ( $platform $= "linux" ) {
$pref::Audio::encodingLevel = 3;
$pref::Audio::decodingMask = 8;
} else {
$pref::Audio::encodingLevel = 0;
$pref::Audio::decodingMask = 1;
}
$pref::Audio::forceMaxDistanceUpdate = 0;
$pref::Audio::environmentEnabled = 0;
$pref::Audio::musicEnabled = 1;
$pref::Audio::musicVolume = 0.8;
$pref::Audio::masterVolume = 0.8;
$pref::Audio::effectsVolume = 1.0;
$pref::Audio::voiceVolume = 1.0;
$pref::Audio::guiVolume = 0.8;
$pref::Audio::radioVolume = 0.8;
$pref::Audio::captureGainScale = 1.0;
$pref::currentChatMenu = "defaultChatMenu";
$pref::Email::Column0 = 30;
$pref::Email::Column1 = 250;
$pref::Email::Column2 = 250;
$pref::Email::Column3 = 150;
$pref::Email::ComposeWindowPos = "74 32";
$pref::Email::ComposeWindowExtent = "500 408";
$pref::Email::SortColumnKey = 3;
$pref::Email::SortInc = 1;
$pref::EnableBadWordFilter = 1;
$pref::FavNames0 = "SCOUT SNIPER";
$pref::FavNames1 = "SCOUT ASSASSIN";
$pref::FavNames2 = "SCOUT DEFENSE";
$pref::FavNames3 = "ASSAULT OFFENSE";
$pref::FavNames4 = "ASSAULT DEPLOYER";
$pref::FavNames5 = "ASSAULT DEFENSE";
$pref::FavNames6 = "TAILGUNNER";
$pref::FavNames7 = "JUGGERNAUT OFFENSE";
$pref::FavNames8 = "JUGGERNAUT DEPLOYER";
$pref::FavNames9 = "JUGGERNAUT DEFENSE";
$pref::FavNames10 = "SCOUT FLAG CHASER";
$pref::FavNames11 = "ASSAULT DESTROYER";
$pref::FavNames12 = "LANDSPIKE DEPLOYER";
$pref::FavNames13 = "INVENTORY DEPLOYER";
$pref::FavNames14 = "FORWARD ASSAULT";
$pref::FavNames15 = "EARLY WARNING";
$pref::FavNames16 = "DECOY";
$pref::FavNames17 = "HEAVY LOVE";
$pref::FavNames18 = "FLAG DEFENDER";
$pref::FavNames19 = "INFILTRATOR";
$pref::Favorite0 = "armor\tScout\tweapon\tLaser Rifle\tweapon\tSpinfusor\tweapon\tGrenade Launcher\tpack\tEnergy Pack\tGrenade\tFlare Grenade\tMine\tMine";
$pref::Favorite1 = "armor\tScout\tweapon\tPlasma Rifle\tweapon\tChaingun\tweapon\tShocklance\tpack\tCloak Pack\tGrenade\tWhiteout Grenade\tMine\tMine";
$pref::Favorite2 = "armor\tScout\tweapon\tBlaster\tweapon\tSpinfusor\tweapon\tPlasma Rifle\tpack\tShield Pack\tGrenade\tGrenade\tMine\tMine";
$pref::Favorite3 = "armor\tAssault\tweapon\tPlasma Rifle\tweapon\tSpinfusor\tweapon\tGrenade Launcher\tweapon\tChaingun\tpack\tShield Pack\tGrenade\tGrenade\tMine\tMine";
$pref::Favorite4 = "armor\tAssault\tweapon\tPlasma Rifle\tweapon\tBlaster\tweapon\tSpinfusor\tweapon\tMissile Launcher\tpack\tInventory Station\tGrenade\tDeployable Camera\tMine\tMine";
$pref::Favorite5 = "armor\tAssault\tweapon\tChaingun\tweapon\tSpinfusor\tweapon\tMissile Launcher\tweapon\tELF Projector\tpack\tShield Pack\tGrenade\tConcussion Grenade\tMine\tMine";
$pref::Favorite6 = "armor\tAssault\tweapon\tChaingun\tweapon\tGrenade Launcher\tweapon\tBlaster\tweapon\tMissile Launcher\tpack\tAmmunition Pack\tGrenade\tFlare Grenade\tMine\tMine";
$pref::Favorite7 = "armor\tJuggernaut\tweapon\tPlasma Rifle\tweapon\tSpinfusor\tweapon\tGrenade Launcher\tweapon\tFusion Mortar\tweapon\tMissile Launcher\tpack\tAmmunition Pack\tGrenade\tGrenade\tMine\tMine";
$pref::Favorite8 = "armor\tJuggernaut\tweapon\tChaingun\tweapon\tMissile Launcher\tweapon\tFusion Mortar\tweapon\tPlasma Rifle\tweapon\tBlaster\tpack\tInventory Station\tGrenade\tDeployable Camera\tMine\tMine";
$pref::Favorite9 = "armor\tJuggernaut\tweapon\tBlaster\tweapon\tPlasma Rifle\tweapon\tGrenade Launcher\tweapon\tMissile Launcher\tweapon\tFusion Mortar\tpack\tShield Pack\tGrenade\tConcussion Grenade\tMine\tMine";
$pref::Favorite10 = "armor\tScout\tweapon\tChaingun\tweapon\tGrenade Launcher\tweapon\tELF Projector\tpack\tEnergy Pack\tGrenade\tConcussion Grenade\tMine\tMine";
$pref::Favorite11 = "armor\tAssault\tweapon\tBlaster\tweapon\tPlasma Rifle\tweapon\tSpinfusor\tweapon\tGrenade Launcher\tpack\tShield Pack\tGrenade\tGrenade\tMine\tMine";
$pref::Favorite12 = "armor\tAssault\tweapon\tChaingun\tweapon\tSpinfusor\tweapon\tPlasma Rifle\tweapon\tGrenade Launcher\tpack\tLandspike Turret\tGrenade\tGrenade\tMine\tMine";
$pref::Favorite13 = "armor\tAssault\tweapon\tPlasma Rifle\tweapon\tSpinfusor\tweapon\tGrenade Launcher\tweapon\tChaingun\tpack\tInventory Station\tGrenade\tGrenade\tMine\tMine";
$pref::Favorite14 = "armor\tAssault\tweapon\tELF Projector\tweapon\tGrenade Launcher\tweapon\tSpinfusor\tweapon\tMissile Launcher\tpack\tEnergy Pack\tGrenade\tWhiteout Grenade\tMine\tMine";
$pref::Favorite15 = "armor\tAssault\tweapon\tChaingun\tweapon\tSpinfusor\tweapon\tGrenade Launcher\tweapon\tELF Projector\tpack\tPulse Sensor Pack\tGrenade\tConcussion Grenade\tMine\tMine";
$pref::Favorite16 = "armor\tScout\tweapon\tChaingun\tweapon\tGrenade Launcher\tweapon\tSpinfusor\tpack\tSensor Jammer Pack\tGrenade\tWhiteout Grenade\tMine\tMine";
$pref::Favorite17 = "armor\tJuggernaut\tweapon\tChaingun\tweapon\tSpinfusor\tweapon\tPlasma Rifle\tweapon\tFusion Mortar\tweapon\tMissile Launcher\tpack\tShield Pack\tGrenade\tConcussion Grenade\tMine\tMine";
$pref::Favorite18 = "armor\tJuggernaut\tweapon\tSpinfusor\tweapon\tGrenade Launcher\tweapon\tFusion Mortar\tweapon\tPlasma Rifle\tweapon\tChaingun\tpack\tShield Pack\tGrenade\tGrenade\tMine\tMine";
$pref::Favorite19 = "armor\tScout\tweapon\tChaingun\tweapon\tSpinfusor\tweapon\tShocklance\tpack\tSatchel Charge\tGrenade\tDeployable Camera\tMine\tMine";
$pref::Forum::Column0 = 290;
$pref::Forum::Column1 = 265;
$pref::Forum::Column2 = 159;
$pref::Forum::CacheSize = 100;
$pref::Forum::PostWindowPos = "69 32";
$pref::Forum::PostWindowExtent = "500 408";
$pref::HudMessageLogSize = 40;
$pref::Input::ActiveConfig = "MyConfig";
$pref::Input::LinkMouseSensitivity = 1;
$pref::Input::KeyboardTurnSpeed = 0.1;
$pref::Interior::TexturedFog = 0;
$pref::IRCClient::autoreconnect = 1;
$pref::IRCClient::awaymsg = "Don't be alarmed. I'm going to step away from my computer.";
$pref::IRCClient::banmsg = "Get out. And stay out!";
$pref::IRCClient::kickmsg = "Alright, you're outta here!";
$pref::IRCClient::hostmsg = "left to host a game.";
$pref::IRCClient::showJoin = true;
$pref::IRCClient::showLeave = true;
$pref::Lobby::Column1 = 120;
$pref::Lobby::Column2 = 120;
$pref::Lobby::Column3 = 50;
$pref::Lobby::Column4 = 50;
$pref::Lobby::Column5 = 50;
$pref::Lobby::SortColumnKey = 3;
$pref::Lobby::SortInc = 0;
$pref::Net::graphFields = 43;
$pref::Net::simPacketLoss = 0;
$pref::Net::simPing = 0;
$pref::Net::DisplayOnMaster = "Always";
$pref::Net::RegionMask = 2;
$pref::Net::CheckEmail = 0;
$pref::Net::DisconnectChat = 0;
$pref::Net::LagThreshold = 400;
$pref::Net::Preset = 1;
$pref::Net::PacketRateToClient = 16;
$pref::Net::PacketSize = 240;
$pref::Net::PacketRateToServer = 20;
$pref::News::PostWindowPos = "85 39";
$pref::News::PostWindowExtent = "470 396";
$pref::Player::Count = 0;
$pref::Player::Current = 0;
$pref::Player::defaultFov = 90;
$pref::Player::zoomSpeed = 0;
$pref::RememberPassword = 0;
$pref::sceneLighting::cacheSize = 60000;
$pref::sceneLighting::purgeMethod = "lastModified";
$pref::sceneLighting::cacheLighting = 1;
$pref::sceneLighting::terrainGenerateLevel = 1;
$pref::ServerBrowser::activeFilter = 0;
$pref::ServerBrowser::Column0 = "0 183";
$pref::ServerBrowser::Column1 = "1 60";
$pref::ServerBrowser::Column2 = "2 30";
$pref::ServerBrowser::Column3 = "3 45";
$pref::ServerBrowser::Column4 = "4 120";
$pref::ServerBrowser::Column5 = "5 140";
$pref::ServerBrowser::Column6 = "7 80";
$pref::ServerBrowser::Column7 = "8 80";
$pref::ServerBrowser::Column8 = "9 170";
if ( !isDemo() )
{
$pref::ServerBrowser::Column9 = "6 74";
$pref::ServerBrowser::Column10 = "10 70";
$pref::ServerBrowser::Column11 = "11 100";
}
$pref::ServerBrowser::FavoriteCount = 0;
$pref::ServerBrowser::SortColumnKey = 3;
$pref::ServerBrowser::SortInc = 1;
$pref::ServerBrowser::InfoWindowOpen = 0;
$pref::ServerBrowser::InfoWindowPos = "145 105";
$pref::ServerBrowser::InfoWindowExtent = "350 270";
$pref::ServerBrowser::IgnoreCase = 1;
$pref::Shell::lastBackground = 0;
$pref::Terrain::DynamicLights = 1;
$pref::toggleVehicleView = 0;
$pref::Topics::Column0 = 245;
$pref::Topics::Column1 = 50;
$pref::Topics::Column2 = 125;
$pref::Topics::Column3 = 134;
$pref::Topics::SortColumnKey = 3;
$pref::Topics::SortInc = 0;
$pref::Video::displayDevice = "OpenGL";
$pref::chatHudLength = 1;
$pref::useImmersion = 1;
$pref::Video::fullScreen = 1;
$pref::Video::allowOpenGL = 1;
$pref::Video::allowD3D = 1;
$pref::Video::preferOpenGL = 1;
$pref::Video::appliedPref = 0;
$pref::Video::disableVerticalSync = 1;
$pref::VisibleDistanceMod = 1.0;
$pref::OpenGL::force16BitTexture = 0;
$pref::OpenGL::forcePalettedTexture = 1;
$pref::OpenGL::maxHardwareLights = 3;
$pref::OpenGL::allowTexGen = 1;
$pref::Vehicle::pilotTeleport = 1;

Binary file not shown.

342
scripts/clientTasks.cs Normal file
View file

@ -0,0 +1,342 @@
//------------------------------------------------------------------------------
// Client tasks
//------------------------------------------------------------------------------
$MAX_OUTSTANDING_TASKS = 10;
function clientCmdResetTaskList()
{
if((TaskList.currentTask != -1) && isObject(TaskList.currentTask))
{
TaskList.currentTask.delete();
TaskList.currentTask = -1;
}
TaskList.currentTask = -1;
TaskList.reset();
}
//--------------------------------------------------------------------------
function clientCmdTaskInfo(%client, %aiObjtive, %team, %description)
{
// copy the info
TaskList.currentTaskClient = %client;
TaskList.currentAIObjective = %aiObjective;
TaskList.currentTaskIsTeam = %team;
TaskList.currentTaskDescription = detag(%description);
}
function clientAcceptTask(%task)
{
%task.sendToServer();
commandToServer('AcceptTask', %task.client, %task.AIObjective, %task.description);
TaskList.removeTask(%task, true);
//play the audio
alxPlay(TaskAcceptedSound, 0, 0, 0);
}
function clientDeclineTask(%task)
{
commandToServer('DeclineTask', %task.client, %task.description, %task.team);
TaskList.removeTask(%task, false);
//play the audio
alxPlay(TaskDeclinedSound, 0, 0, 0);
}
function clientTaskCompleted()
{
if((TaskList.currentTask != -1) && isObject(TaskList.currentTask))
{
commandToServer('CompletedTask', TaskList.currentTask.client, TaskList.currentTask.description);
TaskList.currentTask.delete();
TaskList.currentTask = -1;
//play the audio
alxPlay(TaskDeclinedSound, 0, 0, 0);
}
}
//------------------------------------------------------------------------------
// HUD information
//------------------------------------------------------------------------------
function clientCmdPotentialTeamTask(%description)
{
addMessageHudLine("\c2Team:\cr " @ detag(%description) @ ".");
}
function clientCmdPotentialTask(%from, %description)
{
addMessageHudLine("\c3" @ detag(%from) @ ":\cr " @ detag(%description) @ ".");
}
function clientCmdTaskDeclined(%from, %description)
{
addMessageHudLine(detag(%from) @ " refused your task '" @ detag(%description) @ "'.");
}
function clientCmdTaskAccepted(%from, %description)
{
addMessageHudLine(detag(%from) @ " accepted your task '" @ detag(%description) @ "'.");
}
function clientCmdTaskCompleted(%from, %description)
{
addMessageHudLine(detag(%from) @ " completed your task '" @ detag(%description) @ "'.");
}
function clientCmdAcceptedTask(%description)
{
addMessageHudLine("\c3Your current task is:\cr " @ %description);
}
//------------------------------------------------------------------------------
function clientAcceptCurrentTask()
{
%task = TaskList.getCurrentTask();
if(%task != -1)
clientAcceptTask(%task);
}
function clientDeclineCurrentTask()
{
%task = TaskList.getCurrentTask();
if(%task != -1)
clientDeclineTask(%task);
}
//--------------------------------------------------------------------------
// TaskList:
//--------------------------------------------------------------------------
function TaskList::onAdd(%this)
{
%this.ownedTasks = -1;
%this.currentTask = -1;
%this.reset();
// install some chat callbacks
installChatItemCallback('ChatCmdAcknowledged', clientAcceptCurrentTask);
installChatItemCallback('ChatCmdCompleted', clientTaskCompleted);
installChatItemCallback('ChatCmdDeclined', clientDeclineCurrentTask);
}
function TaskList::reset(%this)
{
%this.currentTaskClient = -1;
%this.currentAIObjective = -1;
%this.currentTaskIsTeam = false;
%this.currentTaskDescription = "";
if((%this.ownedTasks != -1) && isObject(%this.ownedTasks))
%this.ownedTasks.delete();
%this.ownedTasks = new SimGroup();
%this.currentIndex = 1;
%this.clear();
}
function TaskList::onRemove(%this)
{
if((%this.ownedTasks != -1) && isObject(%this.ownedTasks))
%this.ownedTasks.delete();
}
function TaskList::handleDyingTask(%this, %task)
{
%this.ownedTasks.add(%task);
}
//--------------------------------------------------------------------------
function TaskList::getLastTask(%this)
{
%count = %this.rowCount();
if(%count == 0)
return(-1);
return(%this.getRowId(%count - 1));
}
function TaskList::getCurrentTask(%this)
{
if(%this.isVisible())
{
%id = %this.getSelectedId();
if(%id != -1)
return(%id);
}
return(%this.getLastTask());
}
function TaskList::addTask(%this, %task)
{
// remove any duplicate...
%count = %this.rowCount();
for(%i = 0; %i < %count; %i++)
{
%oldTask = %this.getRowId(%i);
if((%oldTask.client == %task.client) && (detag(%oldTask.description) $= detag(%task.description)))
{
%this.removeTask(%oldTask, false);
break;
}
}
// need to remove the oldest task?
if(%this.rowCount() == $MAX_OUTSTANDING_TASKS)
%this.removeTask(%this.getRowId(0), false);
%this.addRow(%task, %task.clientName @ "\t" @ detag(%task.description), %this.rowCount());
}
function TaskList::removeTask(%this, %task, %close)
{
%row = %this.getRowNumById(%task);
if(%row == -1)
return;
%select = %this.getSelectedId() == %task;
if(isObject(%task))
%task.delete();
%this.removeRow(%row);
if(%select && (%this.rowCount() != 0))
{
if(%row == %this.rowCount())
%row = %row - 1;
%this.setSelectedRow(%row);
}
if(%close && %this.isVisible())
showTaskHudDlg(false);
}
function TaskList::updateSelected(%this, %show)
{
%task = %this.getSelectedId();
if(%task == -1)
return;
if(%show)
{
%task.addPotentialTask();
if(CommanderMapGui.open)
CommanderMap.selectClientTarget(%task, true);
else
NavHud.keepClientTargetAlive(%task);
}
else
{
if(CommanderMapGui.open)
CommanderMap.selectClientTarget(%task, false);
else
NavHud.keepClientTargetAlive(0);
}
}
function TaskList::selectLatest(%this)
{
%this.setSelectedRow(-1);
%id = %this.getLastTask();
if(%id == -1)
return;
%this.setSelectedById(%id);
%this.updateSelected(true);
}
function TaskList::selectPrevious(%this)
{
%id = %this.getSelectedId();
if(%id == -1)
{
%this.selectLatest();
return;
}
%row = %this.getRowNumById(%id);
if(%row == 0)
%row = %this.rowCount() - 1;
else
%row -= 1;
%this.setSelectedRow(%row);
%this.updateSelected(true);
}
function TaskList::selectNext(%this)
{
%id = %this.getSelectedId();
if(%id == -1)
{
%this.selectLatest();
return;
}
%row = %this.getRowNumById(%id);
if(%row == (%this.rowCount() - 1))
%row = 0;
else
%row += 1;
%this.setSelectedRow(%row);
%this.updateSelected(true);
}
//--------------------------------------------------------------------------
function showTaskHudDlg(%show)
{
if(%show)
{
if(!TaskHudDlg.isVisible())
{
TaskHudDlg.setVisible(true);
Canvas.pushDialog(TaskHudDlg);
}
}
else
{
if(TaskHudDlg.isVisible())
{
TaskHudDlg.setVisible(false);
Canvas.popDialog(TaskHudDlg);
}
}
}
//--------------------------------------------------------------------------
// - toggle 'visible' so this, and other, controls can determine if it is up
function toggleTaskListDlg(%val)
{
if(%val)
{
if(ChatMenuHudDlg.isVisible() || TaskHudDlg.isVisible())
showTaskHudDlg(false);
else
showTaskHudDlg(true);
}
}
new ActionMap(TaskHudMap);
TaskHudMap.bindCmd(keyboard, "up", "TaskList.selectPrevious();", "");
TaskHudMap.bindCmd(keyboard, "down", "TaskList.selectNext();", "");
TaskHudMap.bindCmd(keyboard, "escape", "if(TaskHudDlg.isVisible()) showTaskHudDlg(false);", "");
function TaskHudDlg::onWake(%this)
{
TaskHudMap.push();
TaskList.setVisible(true);
TaskList.selectLatest();
}
function TaskHudDlg::onSleep(%this)
{
TaskHudMap.pop();
TaskList.setVisible(false);
TaskList.updateSelected(false);
//make sure the action maps are still pushed in the correct order...
updateActionMaps();
}

BIN
scripts/clientTasks.cs.dso Normal file

Binary file not shown.

995
scripts/commanderMap.cs Normal file
View file

@ -0,0 +1,995 @@
//--------------------------------------------------------------------------
// ActionMap:
//--------------------------------------------------------------------------
$CommanderMap::useMovementKeys = false;
// help overlay toggle
function toggleCmdMapHelpGui( %val )
{
if ( %val)
toggleCmdMapHelpText();
}
// shortcuts to buttons: top buttons
function toggleAction(%control)
{
%control.setValue(!%control.getValue());
%control.onAction();
}
function bindAction(%fromMap, %command, %bindCmd, %bind1, %bind2 )
{
if(!isObject(%fromMap))
return(false);
%bind = %fromMap.getBinding(%command);
if(%bind $= "")
return(false);
// only allow keyboard
%device = getField(%bind, 0);
if(%device !$= "keyboard")
return(false);
%action = getField(%bind, 1);
// bind or bindcmd?
if(%bindCmd)
CommanderKeyMap.bindCmd( %device, %action, %bind1, %bind2 );
else
CommanderKeyMap.bind( %device, %action, %bind1 );
return(true);
}
function createCommanderKeyMap()
{
if(isObject(CommanderKeyMap))
CommanderKeyMap.delete();
new ActionMap(CommanderKeyMap);
// copy in all the binds we want from the moveMap
CommanderKeyMap.copyBind( moveMap, ToggleMessageHud );
CommanderKeyMap.copyBind( moveMap, TeamMessageHud );
CommanderKeyMap.copyBind( moveMap, resizeChatHud );
CommanderKeyMap.copyBind( moveMap, pageMessageHudUp );
CommanderKeyMap.copyBind( moveMap, pageMessageHudDown );
CommanderKeyMap.copyBind( moveMap, activateChatMenuHud );
// Miscellaneous other binds:
CommanderKeyMap.copyBind( moveMap, voteYes );
CommanderKeyMap.copyBind( moveMap, voteNo );
CommanderKeyMap.copyBind( moveMap, toggleCommanderMap );
CommanderKeyMap.copyBind( moveMap, toggleHelpGui );
CommanderKeyMap.copyBind( moveMap, toggleScoreScreen);
CommanderKeyMap.copyBind( moveMap, startRecordingDemo );
CommanderKeyMap.copyBind( moveMap, stopRecordingDemo );
CommanderKeyMap.copyBind( moveMap, voiceCapture );
CommanderKeyMap.bindCmd( keyboard, escape, "", "toggleCommanderMap( true );" );
// grab help key from movemap
if(!bindAction( moveMap, toggleHelpGui, false, toggleCmdMapHelpGui ))
CommanderKeyMap.bind( keyboard, F1, toggleCmdMapHelpGui );
// Bind the command assignment/response keys as well:
CommanderKeyMap.copyBind( moveMap, toggleTaskListDlg );
CommanderKeyMap.copyBind( moveMap, fnAcceptTask );
CommanderKeyMap.copyBind( moveMap, fnDeclineTask );
CommanderKeyMap.copyBind( moveMap, fnTaskCompleted );
CommanderKeyMap.copyBind( moveMap, fnResetTaskList );
// button shortcuts
CommanderKeyMap.bindCmd( keyboard, 1, "toggleAction(CMDPlayersButton);", "" );
CommanderKeyMap.bindCmd( keyboard, 2, "toggleAction(CMDTacticalButton);", "" );
CommanderKeyMap.bindCmd( keyboard, 3, "toggleAction(CMDDeployedTacticalButton);", "" );
CommanderKeyMap.bindCmd( keyboard, 4, "toggleAction(CMDMiscButton);", "" );
CommanderKeyMap.bindCmd( keyboard, 5, "toggleAction(CMDDeployedMiscButton);", "" );
CommanderKeyMap.bindCmd( keyboard, 6, "toggleAction(CMDWaypointsButton);", "" );
CommanderKeyMap.bindCmd( keyboard, 7, "toggleAction(CMDObjectivesButton);", "" );
// bottom buttons
CommanderKeyMap.bindCmd( keyboard, w, "toggleAction(CMDShowSensorsButton);", "" );
CommanderKeyMap.bindCmd( keyboard, space, "cycleMouseMode();", "" );
CommanderKeyMap.bindCmd( keyboard, q, "toggleAction(CMDCenterButton);", "" );
CommanderKeyMap.bindCmd( keyboard, t, "toggleAction(CMDTextButton);", "" );
CommanderKeyMap.bindCmd( keyboard, b, "toggleAction(CMDCameraButton);", "" );
// camera control (always arrows)
CommanderKeyMap.bindCmd( keyboard, left, "CommanderMap.cameraMove(left, true);", "commanderMap.cameraMove(left, false);" );
CommanderKeyMap.bindCmd( keyboard, right, "CommanderMap.cameraMove(right, true);", "commanderMap.cameraMove(right, false);" );
CommanderKeyMap.bindCmd( keyboard, up, "CommanderMap.cameraMove(up, true);", "commanderMap.cameraMove(up, false);" );
CommanderKeyMap.bindCmd( keyboard, down, "CommanderMap.cameraMove(down, true);", "commanderMap.cameraMove(down, false);" );
CommanderKeyMap.bindCmd( keyboard, numpadadd, "CommanderMap.cameraMove(in, true);", "commanderMap.cameraMove(in, false);" );
CommanderKeyMap.bindCmd( keyboard, numpadminus, "CommanderMap.cameraMove(out, true);", "commanderMap.cameraMove(out, false);" );
CommanderKeyMap.bindCmd( keyboard, a, "CommanderMap.cameraMove(in, true);", "commanderMap.cameraMove(in, false);" );
CommanderKeyMap.bindCmd( keyboard, z, "CommanderMap.cameraMove(out, true);", "commanderMap.cameraMove(out, false);" );
// steal the movement keys? (more likely than others to be a duplicate binding)
if($CommanderMap::useMovementKeys)
{
bindAction( moveMap, moveleft, true, "CommanderMap.cameraMove(left, true);", "commanderMap.cameraMove(left, false);" );
bindAction( moveMap, moveright, true, "CommanderMap.cameraMove(right, true);", "commanderMap.cameraMove(right, false);" );
bindAction( moveMap, moveforward, true, "CommanderMap.cameraMove(up, true);", "commanderMap.cameraMove(up, false);" );
bindAction( moveMap, movebackward, true, "CommanderMap.cameraMove(down, true);", "commanderMap.cameraMove(down, false);" );
}
else
{
CommanderKeyMap.bindCmd( keyboard, s, "CommanderMap.cameraMove(left, true);", "commanderMap.cameraMove(left, false);" );
CommanderKeyMap.bindCmd( keyboard, f, "CommanderMap.cameraMove(right, true);", "commanderMap.cameraMove(right, false);" );
CommanderKeyMap.bindCmd( keyboard, e, "CommanderMap.cameraMove(up, true);", "commanderMap.cameraMove(up, false);" );
CommanderKeyMap.bindCmd( keyboard, d, "CommanderMap.cameraMove(down, true);", "commanderMap.cameraMove(down, false);" );
}
}
//--------------------------------------------------------------------------
// Default Icons:
new CommanderIconData(CMDDefaultIcon)
{
selectImage = "animation base_select true true looping 100";
hilightImage = "animation base_select true true flipflop 100";
};
new CommanderIconData(CMDAssignedTaskIcon)
{
baseImage = "static diamond_not_selected true true";
selectImage = "animation assigned_task_anim false true looping 100";
hilightImage = "animation assigned_task_anim false true looping 100";
};
new CommanderIconData(CMDPotentialTaskIcon)
{
baseImage = "static diamond_not_selected true true";
selectImage = "animation assigned_task_anim false true looping 100";
hilightImage = "animation assigned_task_anim false true looping 100";
};
new CommanderIconData(CMDWaypointIcon)
{
baseImage = "animation waypoint_anim false false looping 100";
};
//--------------------------------------------------------------------------
// CommanderMapGui:
//--------------------------------------------------------------------------
function clientCmdResetCommandMap()
{
CommanderMapGui.reset();
}
function clientCmdScopeCommanderMap(%scope)
{
if(!isPlayingDemo())
return;
if(%scope)
{
CommanderMap.openAllCategories();
CommanderMapGui.open();
}
else
CommanderMapGui.close();
}
function CommanderMapGui::onWake(%this)
{
clientCmdControlObjectReset();
commandToServer('ScopeCommanderMap', true);
createCommanderKeyMap();
CommanderKeyMap.push();
if ( $HudHandle[CommandScreen] )
alxStop( $HudHandle[CommandScreen] );
alxPlay(CommandMapActivateSound, 0, 0, 0);
$HudHandle[CommandScreen] = alxPlay(CommandMapHumSound, 0, 0, 0);
CMDTextButton.setValue(CommanderMap.renderText);
// follow the player the first time
if(%this.firstWake)
{
CommanderMap.selectControlObject();
CommanderMap.followLastSelected();
%this.firstWake = false;
}
if(CommanderTV.open)
CommanderTV.watchTarget(CommanderTV.target);
// chat hud dialog
Canvas.pushDialog(MainChatHud);
chatHud.attach(HudMessageVector);
%this.open = true;
}
function CommanderMapGui::onSleep(%this)
{
%this.open = false;
commandToServer('ScopeCommanderMap', false);
if(CMContextPopup.visible == true)
CMContextPopup.reset();
CommanderKeyMap.pop();
Canvas.popDialog(MainChatHud);
alxStop($HudHandle[CommandScreen]);
alxPlay(CommandMapDeactivateSound, 0, 0, 0);
$HudHandle[CommandScreen] = "";
// will reset the control object on this client.. should only be sent
// if this gui is being removed outside of CommanderMapGui::close()
if(CommanderTV.open && CommanderTV.attached)
commandToServer('AttachCommanderCamera', -1);
//always set the cursor back to an arrow when you leave...
Canvas.setCursor(CMDCursorArrow);
}
function CommanderMapGui::open(%this)
{
if(%this.open)
return;
commandToServer('SetPDAPose', true);
Canvas.setContent(%this);
}
function CommanderMapGui::close(%this)
{
if(!%this.open)
return;
// only need to have control object reset if still attached to an object
// if(CommanderTV.open && CommanderTV.attached)
// {
commandToServer('ResetControlObject');
// reset the attached state since we will not be getting an attached response
CommanderTV.attached = false;
// }
// else
// clientCmdControlObjectReset();
commandToServer('SetPDAPose', false);
}
function CommanderMapGui::toggle(%this)
{
if(%this.open)
%this.close();
else
%this.open();
}
function CommanderMapGui::onAdd(%this)
{
%this.open = false;
new GuiControl(CMContextPopupDlg)
{
profile = "GuiModelessDialogProfile";
horizSizing = "width";
vertSizing = "height";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
new GuiCommanderMapPopupMenu(CMContextPopup)
{
profile = "CommanderPopupProfile";
position = "0 0";
extent = "0 0";
minExtent = "0 0";
maxPopupHeight = "200";
};
};
CMContextPopup.numEntries = 0;
CMContextPopup.actionMap = -1;
CMContextPopup.focusedEntry = -1;
CMContextPopup.visible = false;
CMContextPopup.target = -1;
}
function CommanderMapGui::reset(%this)
{
clientCmdControlObjectReset();
CommanderMap.openAllCategories();
CommanderMap.resetCamera();
CommanderTV.watchTarget(-1);
// remove all tasks and clean task list
clientCmdResetTaskList();
// reset waypoints
if(isObject($ClientWaypoints))
$ClientWaypoints.delete();
// this can be called when not connected to a server
if(isObject(ServerConnection))
{
$ClientWaypoints = new SimGroup();
ServerConnection.add($ClientWaypoints);
}
%this.firstWake = true;
CommanderTree.currentWaypointID = 0;
}
function CommanderMapGui::openCameraControl(%this, %open)
{
%step = getWord(CommanderTV.extent, 1);
%x = getWord(CommanderTreeContainer.position, 0);
%y = getWord(CommanderTreeContainer.position, 1);
%w = getWord(CommanderTreeContainer.extent, 0);
%h = getWord(CommanderTreeContainer.extent, 1);
if(%open)
%h = %h - %step;
else
%h = %h + %step;
CommanderTreeContainer.resize(%x, %y, %w, %h);
CommanderTV.setVisible(%open);
CommanderTV.open = %open;
CommanderTV.watchTarget(CommanderTV.target);
if(!CommanderTV.open)
commandToServer('AttachCommanderCamera', -1);
}
//--------------------------------------------------------------------------
// CMContextPopup:
//--------------------------------------------------------------------------
function CMContextPopup::reset(%this)
{
if(%this.actionMap != -1)
{
%this.actionMap.pop();
%this.actionMap.delete();
}
for(%i = 0; %i < %this.numEntries; %i++)
{
%this.entryKeys[%i] = "";
%this.entryCommands[%i] = "";
}
%this.visible = false;
%this.numEntries = 0;
%this.actionMap = -1;
if(%this.focusedEntry != -1)
%this.focusedEntry.lockFocus(false);
%this.focusedEntry = -1;
%this.forceClose();
Canvas.popDialog(CMContextPopupDlg);
// need to delete the target if it was not used
if(isObject(%this.target))
{
if(%this.target.getTargetId() != -1)
%this.target.delete();
%this.target = -1;
}
}
function CMContextPopup::display(%this)
{
if(%this.numEntries == 0)
return;
%this.actionMap = new ActionMap();
for(%i = 0; %i < %this.numEntries; %i++)
if(%this.entryKeys[%i] !$= "")
%this.actionMap.bindCmd(keyboard, %this.entryKeys[%i], "", %this @ ".onKeySelect(" @ %i @ ");");
%this.actionMap.bindCmd(keyboard, escape, "", %this @ ".reset();");
%this.actionMap.push();
if(%this.focusedEntry != -1)
%this.focusedEntry.lockFocus(true);
%this.visible = true;
Canvas.pushDialog(CMContextPopupDlg);
%this.forceOnAction();
}
function CMContextPopup::addEntry(%this, %key, %text, %command)
{
%idx = %this.numEntries;
%this.entryKeys[%idx] = %key;
%this.entryCommands[%idx] = %command;
%this.numEntries++;
%this.add(%text, %idx);
}
function CMContextPopup::onKeySelect(%this, %index)
{
%this.onSelect(%index, %this.getTextById(%index));
}
function CMContextPopup::onSelect(%this, %index, %value)
{
CommanderTree.processCommand(%this.entryCommands[%index], %this.target, %this.typeTag);
%this.reset();
}
function CMContextPopup::onCancel( %this )
{
%this.reset();
}
//------------------------------------------------------------------------------
// CommanderTree:
//------------------------------------------------------------------------------
function CommanderTree::onAdd(%this)
{
%this.headerHeight = 20;
%this.entryHeight = 20;
%this.reset();
%this.addCategory("Clients", "Teammates", "clients");
%this.addCategory("Tactical", "Tactical Assets", "targets");
%this.addCategory("DTactical", "Deployed Tactical", "targets");
%this.addCategory("Support", "Support Assets", "targets");
%this.addCategory("DSupport", "Deployed Support", "targets");
%this.addCategory("Waypoints", "Waypoints", "waypoints");
%this.addCategory("Objectives", "Objectives", "targets");
// targetType entries use registered info if no ShapeBaseData exists
%this.registerEntryType("Clients", getTag('_ClientConnection'), false, "commander/MiniIcons/com_player_grey", "255 255 255");
%this.registerEntryType("Waypoints", $CMD_WAYPOINTTYPEID, false, "commander/MiniIcons/com_waypoint_grey", "0 255 0");
%this.registerEntryType("Waypoints", $CMD_ASSIGNEDTASKTYPEID, false, "commander/MiniIcons/com_waypoint_grey", "0 0 255");
// %this.registerEntryType("Waypoints", $CMD_POTENTIALTASKTYPEID, false, "commander/MiniIcons/com_waypoint_grey", "255 255 0");
}
function CommanderTree::onCategoryOpen(%this, %category, %open)
{
switch$ (%category)
{
case "Clients":
CMDPlayersButton.setValue(%open);
case "Tactical":
CMDTacticalButton.setValue(%open);
case "DTactical":
CMDDeployedTacticalButton.setValue(%open);
case "Support":
CMDMiscButton.setValue(%open);
case "DSupport":
CMDDeployedMiscButton.setValue(%open);
case "Waypoints":
CMDWaypointsButton.setValue(%open);
case "Objectives":
CMDObjectivesButton.setValue(%open);
}
}
function CommanderTree::controlObject(%this, %targetId)
{
commandToServer('ControlObject', %targetId);
}
//------------------------------------------------------------------------------
// CommanderMap:
//------------------------------------------------------------------------------
function GuiCommanderMap::onAdd(%this)
{
%this.setMouseMode(select);
%this.setTargetTypeVisible($CMD_POTENTIALTASKTYPEID, true);
%this.setTargetTypeVisible($CMD_ASSIGNEDTASKTYPEID, true);
}
function GuiCommanderMap::onSelect(%this, %targetId, %nameTag, %typeTag, %select)
{
if(%select)
{
if(CommanderTV.target != %targetId)
CommanderTV.watchTarget(%targetId);
}
else
CommanderTV.watchTarget(-1);
}
function GuiCommanderMap::openCategory(%this, %ctrl, %name, %open)
{
%ctrl.setValue(%open);
CommanderTree.openCategory(%name, %open);
}
function GuiCommanderMap::openAllCategories(%this)
{
%this.openCategory(CMDPlayersButton, "Clients", 1);
%this.openCategory(CMDTacticalButton, "Tactical", 1);
%this.openCategory(CMDDeployedTacticalButton, "DTactical", 1);
%this.openCategory(CMDMiscButton, "Support", 1);
%this.openCategory(CMDDeployedMiscButton, "DSupport", 1);
%this.openCategory(CMDWaypointsButton, "Waypoints", 1);
%this.openCategory(CMDObjectivesButton, "Objectives", 1);
}
//------------------------------------------------------------------------------
// Issuing commands
//------------------------------------------------------------------------------
// misc. tasks (sensor group -1 is considered friendly with these)
$CommandTask['PotentialTask', 0, text] = "\c1A\crccept";
$CommandTask['PotentialTask', 0, tag] = 'TaskAccepted';
$CommandTask['PotentialTask', 0, hotkey] = "a";
$CommandTask['PotentialTask', 1, text] = "\c1D\crecline";
$CommandTask['PotentialTask', 1, tag] = 'TaskDeclined';
$CommandTask['PotentialTask', 1, hotkey] = "d";
$CommandTask['AssignedTask', 0, text] = "\c1C\crompleted";
$CommandTask['AssignedTask', 0, tag] = 'TaskCompleted';
$CommandTask['AssignedTask', 0, hotkey] = "c";
$CommandTask['AssignedTask', 1, text] = "\c1R\cremove";
$CommandTask['AssignedTask', 1, tag] = 'TaskRemoved';
$CommandTask['AssignedTask', 1, hotkey] = "d";
$CommandTask['Location', 0, text] = "\c1D\crefend";
$CommandTask['Location', 0, tag] = 'DefendLocation';
$CommandTask['Location', 0, hotkey] = "d";
$CommandTask['Location', 1, text] = "\c1M\creet (at)";
$CommandTask['Location', 1, tag] = 'MeetLocation';
$CommandTask['Location', 1, hotkey] = "m";
$CommandTask['Location', 2, text] = "\c1B\cromb (at)";
$CommandTask['Location', 2, tag] = 'BombLocation';
$CommandTask['Location', 2, hotkey] = "b";
$CommandTask['Location', 3, text] = "\c1A\crttack";
$CommandTask['Location', 3, tag] = 'AttackLocation';
$CommandTask['Location', 3, hotkey] = "a";
$CommandTask['Location', 4, text] = "Deploy \c1I\crnventory";
$CommandTask['Location', 4, tag] = 'DeployEquipment';
$CommandTask['Location', 4, hotkey] = "i";
$CommandTask['Location', 5, text] = "Deploy \c1T\crurrets";
$CommandTask['Location', 5, tag] = 'DeployTurret';
$CommandTask['Location', 5, hotkey] = "t";
$CommandTask['Location', 6, text] = "Deploy \c1S\crensors";
$CommandTask['Location', 6, tag] = 'DeploySensor';
$CommandTask['Location', 6, hotkey] = "s";
$CommandTask['Location', 7, text] = "Create \c1W\craypoint";
$CommandTask['Location', 7, tag] = 'CreateWayPoint';
$CommandTask['Location', 7, hotkey] = "w";
$CommandTask['Waypoint', 0, text] = "\c1D\crelete waypoint";
$CommandTask['Waypoint', 0, tag] = 'DeleteWayPoint';
$CommandTask['Waypoint', 0, hotkey] = "d";
// object tasks
$CommandTask['Player', 0, text] = "\c1E\crscort";
$CommandTask['Player', 0, tag] = 'EscortPlayer';
$CommandTask['Player', 0, hotkey] = "e";
$CommandTask['Player', 1, text] = "\c1R\crepair";
$CommandTask['Player', 1, tag] = 'RepairPlayer';
$CommandTask['Player', 1, hotkey] = "r";
$CommandTask['Player', 2, text] = "\c1A\crttack";
$CommandTask['Player', 2, tag] = 'AttackPlayer';
$CommandTask['Player', 2, hotkey] = "a";
$CommandTask['Player', 2, enemy] = true;
$CommandTask['Flag', 0, text] = "\c1D\crefend";
$CommandTask['Flag', 0, tag] = 'DefendFlag';
$CommandTask['Flag', 0, hotkey] = "d";
$CommandTask['Flag', 1, text] = "\c1R\creturn";
$CommandTask['Flag', 1, tag] = 'ReturnFlag';
$CommandTask['Flag', 1, hotkey] = "r";
$CommandTask['Flag', 2, text] = "\c1C\crapture";
$CommandTask['Flag', 2, tag] = 'CaptureFlag';
$CommandTask['Flag', 2, hotkey] = "c";
$CommandTask['Flag', 2, enemy] = true;
$CommandTask['Objective', 0, text] = "\c1C\crapture";
$CommandTask['Objective', 0, tag] = 'CaptureObjective';
$CommandTask['Objective', 0, hotkey] = "c";
$CommandTask['Objective', 1, text] = "\c1D\crefend";
$CommandTask['Objective', 1, tag] = 'DefendObjective';
$CommandTask['Objective', 1, hotkey] = "d";
$CommandTask['Object', 0, text] = "\c1R\crepair";
$CommandTask['Object', 0, tag] = 'RepairObject';
$CommandTask['Object', 0, hotkey] = "r";
$CommandTask['Object', 1, text] = "\c1D\crefend";
$CommandTask['Object', 1, tag] = 'DefendObject';
$CommandTask['Object', 1, hotkey] = "d";
$CommandTask['Object', 2, text] = "\c1A\crttack";
$CommandTask['Object', 2, tag] = 'AttackObject';
$CommandTask['Object', 2, hotkey] = "a";
$CommandTask['Object', 2, enemy] = true;
$CommandTask['Object', 3, text] = "\c1L\craze";
$CommandTask['Object', 3, tag] = 'LazeObject';
$CommandTask['Object', 3, hotkey] = "l";
$CommandTask['Object', 3, enemy] = true;
$CommandTask['Object', 4, text] = "\c1M\crortar";
$CommandTask['Object', 4, tag] = 'MortarObject';
$CommandTask['Object', 4, hotkey] = "m";
$CommandTask['Object', 4, enemy] = true;
$CommandTask['Object', 5, text] = "\c1B\cromb";
$CommandTask['Object', 5, tag] = 'BombObject';
$CommandTask['Object', 5, hotkey] = "b";
$CommandTask['Object', 5, enemy] = true;
function GuiCommanderMap::issueCommand(%this, %target, %typeTag, %nameTag, %sensorGroup, %mousePos)
{
CMContextPopup.position = %mousePos;
CMContextPopup.clear();
CMContextPopup.target = %target;
CMContextPopup.typeTag = %typeTag;
CMContextPopup.nameTag = %nameTag;
CMContextPopup.sensorGroup = %sensorGroup;
%taskType = %this.getCommandType(%typeTag);
if(%taskType $= "")
{
// script created target?
if(%target.getTargetId() == -1)
%target.delete();
CMDContextPopup.target = -1;
return;
}
%this.buildPopupCommands(%taskType, %sensorGroup);
CMContextPopup.display();
}
function GuiCommanderMap::getCommandType(%this, %typeTag)
{
// special case (waypoints, location, tasks...)
if(%typeTag == $CMD_LOCATIONTYPEID)
return('Location');
else if(%typeTag == $CMD_WAYPOINTTYPEID)
return('Waypoint');
else if(%typeTag == $CMD_POTENTIALTASKTYPEID)
return('PotentialTask');
else if(%typeTag == $CMD_ASSIGNEDTASKTYPEID)
return('AssignedTask');
// the handled types here (default is 'Object')
switch$(getTaggedString(%typeTag))
{
case "_ClientConnection":
return('Player');
case "Flag":
return('Flag');
case "Objective":
return('Objective');
}
return('Object');
}
function GuiCommanderMap::buildPopupCommands(%this, %taskType, %sensorGroup)
{
%enemy = (%sensorGroup != ServerConnection.getSensorGroup()) && (%sensorGroup != -1);
for(%i = 0; $CommandTask[%taskType, %i, text] !$= ""; %i++)
{
if(%enemy == $CommandTask[%taskType, %i, enemy])
{
CMContextPopup.addEntry($CommandTask[%taskType, %i, hotkey],
$CommandTask[%taskType, %i, text],
$CommandTask[%taskType, %i, tag]);
}
}
}
//--------------------------------------------------------------------------
// Command processing
//--------------------------------------------------------------------------
function CommanderTree::processCommand(%this, %command, %target, %typeTag)
{
switch$(getTaggedString(%command))
{
// waypoints: tree owns the waypoint targets
case "CreateWayPoint":
%name = "Waypoint " @ %this.currentWaypointID++;
%target.createWaypoint(%name);
%id = %target.getTargetId();
if(%id != -1)
{
$ClientWaypoints.add(%target);
CMContextPopup.target = -1;
}
return;
case "DeleteWayPoint":
%target.delete();
CMContextPopup.target = -1;
return;
// tasks:
case "TaskAccepted":
clientAcceptTask(%target);
return;
case "TaskDeclined":
clientDeclineTask(%target);
return;
case "TaskCompleted":
clientTaskCompleted();
return;
case "TaskRemoved":
%target.delete();
CMContextPopup.target = -1;
return;
}
%numClients = %this.getNumTargets("Clients");
%numSelected = %this.getNumSelectedTargets("Clients");
if((%numSelected == 0) || (%numSelected == %numClients))
%team = true;
else
%team = false;
%target.sendToServer();
commandToServer('BuildClientTask', %command, %team);
if(%team)
{
commandToServer('SendTaskToTeam');
}
else
{
for(%i = 0; %i < %numSelected; %i++)
{
%targetId = %this.getSelectedTarget("Clients", %i);
commandToServer('SendTaskToClientTarget', %targetId);
}
}
// delete target?
if(%target.getTargetId() == -1)
{
CMContextPopup.target = -1;
%target.delete();
}
}
//------------------------------------------------------------------------------
function CommanderTV::watchTarget(%this, %targetId)
{
if(%targetId < 0)
%targetId = -1;
if(%this.attached)
commandToServer('AttachCommanderCamera', -1);
%this.target = %targetId;
if(%this.open && (%this.target != -1))
commandToServer('AttachCommanderCamera', %this.target);
}
function clientCmdCameraAttachResponse(%attached)
{
CommanderTV.attached = %attached;
}
//------------------------------------------------------------------------------
// CommanderTV control
//------------------------------------------------------------------------------
new ActionMap(CommanderTVControl);
CommanderTVControl.bind(mouse, xaxis, yaw);
CommanderTVControl.bind(mouse, yaxis, pitch);
function CommanderTV_ButtonPress(%val)
{
if(%val)
{
CommanderTVControl.push();
CursorOff();
}
else
{
CommanderTVControl.pop();
GlobalActionMap.unbind(mouse, button0);
if(CommanderMapGui.open)
{
CursorOn();
Canvas.setCursor(CMDCursorArrow);
}
}
}
function CommanderTVScreen::onMouseEnter(%this, %mod, %pos, %count)
{
GlobalActionMap.bind(mouse, button0, CommanderTV_ButtonPress);
}
function CommanderTVScreen::onMouseLeave(%this, %mod, %pos, %count)
{
GlobalActionMap.unbind(mouse, button0);
}
//------------------------------------------------------------------------------
// Buttons: play button down sounds here so script onAction call plays sound as well
//------------------------------------------------------------------------------
// top buttons:
function CMDPlayersButton::onAction(%this)
{
CommanderTree.openCategory("Clients", %this.getValue());
alxPlay(sButtonDown, 0, 0, 0);
}
function CMDTacticalButton::onAction(%this)
{
CommanderTree.openCategory("Tactical", %this.getValue());
alxPlay(sButtonDown, 0, 0, 0);
}
function CMDDeployedTacticalButton::onAction(%this)
{
CommanderTree.openCategory("DTactical", %this.getValue());
alxPlay(sButtonDown, 0, 0, 0);
}
function CMDMiscButton::onAction(%this)
{
CommanderTree.openCategory("Support", %this.getValue());
alxPlay(sButtonDown, 0, 0, 0);
}
function CMDDeployedMiscButton::onAction(%this)
{
CommanderTree.openCategory("DSupport", %this.getValue());
alxPlay(sButtonDown, 0, 0, 0);
}
function CMDWaypointsButton::onAction(%this)
{
CommanderTree.openCategory("Waypoints", %this.getValue());
alxPlay(sButtonDown, 0, 0, 0);
}
function CMDObjectivesButton::onAction(%this)
{
CommanderTree.openCategory("Objectives", %this.getValue());
alxPlay(sButtonDown, 0, 0, 0);
}
// bottom buttons:
function CMDShowSensorsButton::onAction(%this)
{
CommanderMap.renderSensors = %this.getValue();
alxPlay(sButtonDown, 0, 0, 0);
}
// there should be, at most, one depressed mouse mode button
function setMouseMode(%mode)
{
switch$(%mode)
{
case "select":
CMDMoveSelectButton.setValue(false);
CMDZoomButton.setValue(false);
case "move":
CMDMoveSelectButton.setValue(true);
CMDZoomButton.setValue(false);
case "zoom":
CMDMoveSelectButton.setValue(false);
CMDZoomButton.setValue(true);
}
CommanderMap.setMouseMode(%mode);
alxPlay(sButtonDown, 0, 0, 0);
}
function cycleMouseMode()
{
switch$(CommanderMap.getMouseMode())
{
case "select":
setMouseMode("move");
case "move":
setMouseMode("zoom");
case "zoom":
setMouseMode("select");
}
}
function CMDMoveSelectButton::onAction(%this)
{
if(%this.getValue())
setMouseMode(move);
else
setMouseMode(select);
}
function CMDZoomButton::onAction(%this)
{
if(%this.getValue())
setMouseMode(zoom);
else
setMouseMode(select);
}
function CMDCenterButton::onAction(%this)
{
CommanderMap.followLastSelected();
alxPlay(sButtonDown, 0, 0, 0);
}
function CMDTextButton::onAction(%this)
{
CommanderMap.renderText = %this.getValue();
alxPlay(sButtonDown, 0, 0, 0);
}
function CMDCameraButton::onAction(%this)
{
CommanderMapGui.openCameraControl(%this.getValue());
alxPlay(sButtonDown, 0, 0, 0);
}
//---------------------------------------------------------------------------
// - the server may be down and client will not be able to get out of this object
// by using the escape key; so, schedule a timeout period to reset
$ServerResponseTimeout = 1500;
function processControlObjectEscape()
{
if($ScheduledEscapeTask)
return;
$ScheduledEscapeTask = schedule($ServerResonseTimeout, 0, clientCmdControlObjectReset);
commandToServer('ResetControlObject');
}
function clientCmdControlObjectResponse(%ack, %info)
{
// if ack'd then %info is the tag for the object otherwise it is a decline message
if(%ack == true)
{
new ActionMap(ControlActionMap);
ControlActionMap.bindCmd(keyboard, escape, "processControlObjectEscape();", "");
$PlayerIsControllingObject = true;
clientCmdSetHudMode("Object", %info);
// at this point, we are not attached to an object
CommanderTV.attached = false;
Canvas.setContent(PlayGui);
}
else
addMessageHudLine("\c3Failed to control object: \cr" @ %info);
}
function clientCmdControlObjectReset()
{
if($ScheduledEscapeTask)
{
cancel($ScheduledEscapeTask);
$ScheduledEscapeTask = 0;
}
if(isObject(ControlActionMap))
ControlActionMap.delete();
if ($PlayerIsControllingObject)
{
$PlayerIsControllingObject = false;
ClientCmdSetHudMode("Standard");
}
if(CommanderMapGui.open)
Canvas.setContent(PlayGui);
}

View file

@ -0,0 +1,25 @@
$cmdMapHelpTextShown = false;
function toggleCmdMapHelpText()
{
if(CmdMapHelpTextGui.visible)
CmdMapHelpTextGui.setVisible(false);
else {
if(!$cmdMapHelpTextShown) {
teamButtonText.setValue("Left click to select, right click to give commands.");
tacticalButtonText.setValue("Turrets and friendly vehicles. Click the square after a turret's name to control it.");
supportButtonText.setValue("Your team's stations, generators, cameras, and sensors.");
waypointButtonText.setValue("All waypoints.");
objectiveButtonText.setValue("All flags and switches.");
handToolText.setValue("Toggles between hand (for moving the map) and pointer (for selecting objects and dragging selection).");
zoomToolText.setValue("When this tool is on, left click to zoom in and right click to zoom out.");
centerToolText.setValue("Centers your view on selected object. If nothing is selected, centers the view on mission area.");
textToolText.setValue("Toggles map text labels on and off.");
cameraToolText.setValue("Gives you a small camera view of the area around selected object. Waypoints and enemy objects can not be viewed.");
sensorToolText.setValue("Toggles all sensor spheres on/off so you can check your team's sensor coverage.");
generalHelpText.setValue("Right click any object to display commands. Click on the command or type the highlighted letter to issue it to your team. To command an individual, click on the player's name, then issue the command.");
$cmdMapHelpTextShown = true;
}
CmdMapHelpTextGui.setVisible(true);
}
}

View file

@ -0,0 +1,112 @@
// "type image overlay modulate {anim flags} {anim speed}"
datablock CommanderIconData(CMDPlayerIcon)
{
baseImage = "static com_player_grey_24x false true";
selectImage = "static com_player_grey_24x_glow true true";
hilightImage = "static com_player_grey_24x_glow true true";
};
datablock CommanderIconData(CMDGeneratorIcon)
{
baseImage = "static com_icon_generator false true";
selectImage = "static com_icon_generator_glow true true";
hilightImage = "static com_icon_generator_glow true true";
};
datablock CommanderIconData(CMDSolarGeneratorIcon)
{
baseImage = "static com_icon_solar_gen false true";
selectImage = "static com_icon_solar_gen_glow true true";
hilightImage = "static com_icon_solar_gen_glow true true";
};
datablock CommanderIconData(CMDHoverScoutIcon)
{
baseImage = "static com_icon_landscout false true";
selectImage = "static com_icon_landscout_glow true true";
hilightImage = "static com_icon_landscout_glow true true";
};
datablock CommanderIconData(CMDFlyingScoutIcon)
{
baseImage = "static com_icon_scout false true";
selectImage = "static com_icon_scout_glow true true";
hilightImage = "static com_icon_scout_glow true true";
};
datablock CommanderIconData(CMDFlyingBomberIcon)
{
baseImage = "static com_icon_bomber false true";
selectImage = "static com_icon_bomber_glow true true";
hilightImage = "static com_icon_bomber_glow true true";
};
datablock CommanderIconData(CMDFlyingHAPCIcon)
{
baseImage = "static com_icon_hapc false true";
selectImage = "static com_icon_hapc_glow true true";
hilightImage = "static com_icon_hapc_glow true true";
};
datablock CommanderIconData(CMDGroundTankIcon)
{
baseImage = "static com_icon_tank false true";
selectImage = "static com_icon_tank_glow true true";
hilightImage = "static com_icon_tank_glow true true";
};
datablock CommanderIconData(CMDTurretIcon)
{
baseImage = "static com_icon_turret false true";
selectImage = "static com_icon_turret_glow true true";
hilightImage = "static com_icon_turret_glow true true";
};
datablock CommanderIconData(CMDCameraIcon)
{
baseImage = "static com_icon_camera false true";
selectImage = "static com_icon_camera true true";
hilightImage = "static com_icon_camera true true";
};
datablock CommanderIconData(CMDFlagIcon)
{
baseImage = "static com_icon_flag_outside false true";
selectImage = "static com_icon_flag_outside_glow true true";
hilightImage = "static com_icon_flag_outside_glow true true";
};
datablock CommanderIconData(CMDGroundMPBIcon)
{
baseImage = "static com_icon_mpb false true";
selectImage = "static com_icon_mpb_glow true true";
hilightImage = "static com_icon_mpb_glow true true";
};
datablock CommanderIconData(CMDSwitchIcon)
{
baseImage = "static com_icon_genericswitch false true";
selectImage = "static com_icon_genericswitch_glow true true";
hilightImage = "static com_icon_genericswitch_glow true true";
};
datablock CommanderIconData(CMDStationIcon)
{
baseImage = "static com_icon_inventory false true";
selectImage = "static com_icon_inventory_glow true true";
hilightImage = "static com_icon_inventory_glow true true";
};
datablock CommanderIconData(CMDVehicleStationIcon)
{
baseImage = "static com_icon_vehicle_inventory false true";
selectImage = "static com_icon_vehicle_inventory_glow true true";
hilightImage = "static com_icon_vehicle_inventory_glow true true";
};
datablock CommanderIconData(CMDSensorIcon)
{
baseImage = "static com_icon_sensor false true";
selectImage = "static com_icon_sensor_glow true true";
hilightImage = "static com_icon_sensor_glow true true";
};

View file

@ -0,0 +1,120 @@
//------------------------------------------------------------------------------
// Cursors
//------------------------------------------------------------------------------
new GuiCursor(CMDCursorArrow)
{
hotSpot = "6 1";
bitmapName = "commander/cursors/com_cursor_arrow_icon";
};
new GuiCursor(CMDCursorHandOpen)
{
hotSpot = "13 14";
bitmapName = "commander/cursors/com_handopen_icon";
};
new GuiCursor(CMDCursorHandClosed)
{
hotSpot = "13 14";
bitmapName = "commander/cursors/com_handclose_icon";
};
new GuiCursor(CMDCursorZoom)
{
hotSpot = "8 7";
bitmapName = "commander/cursors/com_maglass_icon";
};
new GuiCursor(CMDCursorSelectAdd)
{
hotSpot = "11 11";
bitmapName = "commander/cursors/com_pointer_pos_icon";
};
new GuiCursor(CMDCursorSelectRemove)
{
hotSpot = "11 11";
bitmapName = "commander/cursors/com_pointer_icon";
};
//------------------------------------------------------------------------------
// Audio
//------------------------------------------------------------------------------
new AudioDescription(AudioLoop2D)
{
volume = "1.0";
isLooping = true;
is3D = false;
type = $GuiAudioType;
};
new AudioProfile(sStatic)
{
filename = "fx/misc/static.wav";
description = AudioLoop2D;
preload = true;
};
//------------------------------------------------------------------------------
// Profiles
//------------------------------------------------------------------------------
new GuiControlProfile("CommanderTreeContentProfile")
{
opaque = true;
fillColor = "140 140 140";
border = false;
};
new GuiControlProfile("CommanderScrollContentProfile")
{
opaque = true;
fillColor = "0 0 0";
border = false;
};
new GuiControlProfile("CommanderButtonProfile")
{
opaque = false;
fontType = $ShellButtonFont;
fontSize = $ShellButtonFontSize;
fontColor = "8 19 6";
fontColorHL = "25 68 56";
fontColorNA = "98 98 98";
fixedExtent = true;
justify = "center";
bitmap = "gui/shll_button";
textOffset = "0 11";
soundButtonOver = sButtonOver;
tab = false;
canKeyFocus = false;
};
new GuiControlProfile("CommanderGuiProfile")
{
opaque = true;
fillColor = "0 0 0";
};
new GuiControlProfile("CommanderPopupProfile")
{
fontType = "Arial Bold";
fontSize = 14;
opaque = true;
fillColor = "65 141 148";
border = true;
borderColor= "105 181 188";
justify = center;
fontColors[0] = "255 255 255"; // text color
fontColors[1] = "255 255 0"; // hotkey color
};
new GuiControlProfile("CommanderTreeProfile")
{
fontColors[0] = "220 220 220"; // CategoryNormal
fontColors[1] = "230 169 0"; // CategoryHilight
fontColors[2] = "170 170 170"; // CategoryEmpty
fontColors[3] = "255 255 0"; // ClientNoneEntry
fontColors[4] = "255 255 255"; // TargetEntry
};

208
scripts/commonDialogs.cs Normal file
View file

@ -0,0 +1,208 @@
//------------------------------------------------------------------------------
//
// 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 );
}
//------------------------------------------------------------------------------
// 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 ) );
}

Binary file not shown.

1427
scripts/controlDefaults.cs Normal file

File diff suppressed because it is too large Load diff

Binary file not shown.

144
scripts/creditsGui.cs Normal file
View file

@ -0,0 +1,144 @@
function LaunchCredits()
{
Canvas.setContent(CreditsGui);
}
function cancelCredits()
{
//delete the action map
CreditsActionMap.pop();
//kill the schedules
cancel($CreditsScrollSchedule);
cancel($CreditsSlideShow);
//kill the music
MusicPlayer.stop();
//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...
exec("scripts/creditsText.cs");
if (!isDemo())
{
$CreditsPicIndex = 1;
CREDITS_Pic.setBitmap("gui/Cred_" @ $CreditsPicIndex @ ".png");
}
else
CREDITS_Pic.setBitmap("gui/Cred_1.bm8");
//music array
if (!isDemo())
{
$CreditsMusic[0] = "badlands";
$CreditsMusic[1] = "desert";
$CreditsMusic[2] = "ice";
$CreditsMusic[3] = "lush";
$CreditsMusic[4] = "volcanic";
}
else
{
$CreditsMusic[0] = "lush";
$CreditsMusic[1] = "desert";
$CreditsMusic[2] = "desert";
$CreditsMusic[3] = "lush";
$CreditsMusic[4] = "desert";
}
//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(3000, 0, scrollTheCredits);
//start cycling the bitmaps
if (!isDemo())
$CreditsSlideShow = schedule(5000, 0, creditsNextPic);
//start some music
%chooseTrack = mFloor(getRandom() * 4.99);
MusicPlayer.playTrack($CreditsMusic[%chooseTrack]);
}
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);
}

1609
scripts/creditsText.cs Normal file

File diff suppressed because it is too large Load diff

63
scripts/cursors.cs Normal file
View file

@ -0,0 +1,63 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
//-----------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Editor Cursors
//------------------------------------------------------------------------------
new GuiCursor(EditorHandCursor)
{
hotSpot = "7 0";
bitmapName = "gui/CUR_hand.png";
};
new GuiCursor(EditorRotateCursor)
{
hotSpot = "11 18";
bitmapName = "gui/CUR_rotate.png";
};
new GuiCursor(EditorMoveCursor)
{
hotSpot = "9 13";
bitmapName = "gui/CUR_grab.png";
};
new GuiCursor(EditorArrowCursor)
{
hotSpot = "0 0";
bitmapName = "gui/CUR_3darrow.png";
};
new GuiCursor(EditorUpDownCursor)
{
hotSpot = "5 10";
bitmapName = "gui/CUR_3dupdown";
};
new GuiCursor(EditorLeftRightCursor)
{
hotSpot = "9 5";
bitmapName = "gui/CUR_3dleftright";
};
new GuiCursor(EditorDiagRightCursor)
{
hotSpot = "8 8";
bitmapName = "gui/CUR_3ddiagright";
};
new GuiCursor(EditorDiagLeftCursor)
{
hotSpot = "8 8";
bitmapName = "gui/CUR_3ddiagleft";
};
new GuiControl(EmptyControl)
{
profile = "GuiButtonProfile";
};

718
scripts/damageTypes.cs Normal file
View file

@ -0,0 +1,718 @@
//--------------------------------------------------------------------------
// TYPES OF ALLOWED DAMAGE
//--------------------------------------------------------------------------
$DamageType::Default = 0;
$DamageType::Blaster = 1;
$DamageType::Plasma = 2;
$DamageType::Bullet = 3;
$DamageType::Disc = 4;
$DamageType::Grenade = 5;
$DamageType::Laser = 6; // NOTE: This value is referenced directly in code. DO NOT CHANGE!
$DamageType::ELF = 7;
$DamageType::Mortar = 8;
$DamageType::Missile = 9;
$DamageType::ShockLance = 10;
$DamageType::Mine = 11;
$DamageType::Explosion = 12;
$DamageType::Impact = 13; // Object to object collisions
$DamageType::Ground = 14; // Object to ground collisions
$DamageType::Turret = 15;
$DamageType::PlasmaTurret = 16;
$DamageType::AATurret = 17;
$DamageType::ElfTurret = 18;
$DamageType::MortarTurret = 19;
$DamageType::MissileTurret = 20;
$DamageType::IndoorDepTurret = 21;
$DamageType::OutdoorDepTurret = 22;
$DamageType::SentryTurret = 23;
$DamageType::OutOfBounds = 24;
$DamageType::Lava = 25;
$DamageType::ShrikeBlaster = 26;
$DamageType::BellyTurret = 27;
$DamageType::BomberBombs = 28;
$DamageType::TankChaingun = 29;
$DamageType::TankMortar = 30;
$DamageType::SatchelCharge = 31;
$DamageType::MPBMissile = 32;
$DamageType::Lightning = 33;
$DamageType::VehicleSpawn = 34;
$DamageType::ForceFieldPowerup = 35;
$DamageType::Crash = 36;
// DMM -- added so MPBs that blow up under water get a message
$DamageType::Water = 97;
//Tinman - used in Hunters for cheap bastards ;)
$DamageType::NexusCamping = 98;
// MES -- added so CTRL-K can get a distinctive message
$DamageType::Suicide = 99;
// Etc, etc.
$DamageTypeText[0] = 'default';
$DamageTypeText[1] = 'blaster';
$DamageTypeText[2] = 'plasma';
$DamageTypeText[3] = 'chaingun';
$DamageTypeText[4] = 'disc';
$DamageTypeText[5] = 'grenade';
$DamageTypeText[6] = 'laser';
$DamageTypeText[7] = 'ELF';
$DamageTypeText[8] = 'mortar';
$DamageTypeText[9] = 'missile';
$DamageTypeText[10] = 'shocklance';
$DamageTypeText[11] = 'mine';
$DamageTypeText[12] = 'explosion';
$DamageTypeText[13] = 'impact';
$DamageTypeText[14] = 'ground';
$DamageTypeText[15] = 'turret';
$DamageTypeText[16] = 'plasma turret';
$DamageTypeText[17] = 'AA turret';
$DamageTypeText[18] = 'ELF turret';
$DamageTypeText[19] = 'mortar turret';
$DamageTypeText[20] = 'missile turret';
$DamageTypeText[21] = 'clamp turret';
$DamageTypeText[22] = 'spike turret';
$DamageTypeText[23] = 'sentry turret';
$DamageTypeText[24] = 'out of bounds';
$DamageTypeText[25] = 'lava';
$DamageTypeText[26] = 'shrike blaster';
$DamageTypeText[27] = 'belly turret';
$DamageTypeText[28] = 'bomber bomb';
$DamageTypeText[29] = 'tank chaingun';
$DamageTypeText[30] = 'tank mortar';
$DamageTypeText[31] = 'satchel charge';
$DamageTypeText[32] = 'MPB missile';
$DamageTypeText[33] = 'lighting';
$DamageTypeText[35] = 'ForceField';
$DamageTypeText[36] = 'Crash';
$DamageTypeText[98] = 'nexus camping';
$DamageTypeText[99] = 'suicide';
// ##### PLEASE DO NOT REORDER THE DAMAGE PROFILE TABLES BELOW #####
// (They are set up in the same order as the "Weapons Matrix.xls" sheet for ease of reference when balancing)
//----------------------------------------------------------------------------
// VEHICLE DAMAGE PROFILES
//----------------------------------------------------------------------------
//**** SHRIKE SCOUT FIGHTER ****
datablock SimDataBlock(ShrikeDamageProfile)
{
shieldDamageScale[$DamageType::Blaster] = 1.75;
shieldDamageScale[$DamageType::Bullet] = 1.75;
shieldDamageScale[$DamageType::ELF] = 1.0;
shieldDamageScale[$DamageType::ShockLance] = 0.5;
shieldDamageScale[$DamageType::Laser] = 1.0;
shieldDamageScale[$DamageType::ShrikeBlaster] = 4.0;
shieldDamageScale[$DamageType::BellyTurret] = 2.0;
shieldDamageScale[$DamageType::AATurret] = 3.0;
shieldDamageScale[$DamageType::IndoorDepTurret] = 2.5;
shieldDamageScale[$DamageType::OutdoorDepTurret] = 2.5;
shieldDamageScale[$DamageType::SentryTurret] = 2.5;
shieldDamageScale[$DamageType::Disc] = 1.5;
shieldDamageScale[$DamageType::Grenade] = 1.0;
shieldDamageScale[$DamageType::Mine] = 3.0;
shieldDamageScale[$DamageType::Missile] = 3.0;
shieldDamageScale[$DamageType::Mortar] = 2.0;
shieldDamageScale[$DamageType::Plasma] = 1.0;
shieldDamageScale[$DamageType::BomberBombs] = 3.0;
shieldDamageScale[$DamageType::TankChaingun] = 3.0;
shieldDamageScale[$DamageType::TankMortar] = 2.0;
shieldDamageScale[$DamageType::MissileTurret] = 3.0;
shieldDamageScale[$DamageType::MortarTurret] = 2.0;
shieldDamageScale[$DamageType::PlasmaTurret] = 2.0;
shieldDamageScale[$DamageType::SatchelCharge] = 3.5;
shieldDamageScale[$DamageType::Default] = 1.0;
shieldDamageScale[$DamageType::Impact] = 1.1;
shieldDamageScale[$DamageType::Ground] = 1.0;
shieldDamageScale[$DamageType::Explosion] = 3.0;
shieldDamageScale[$DamageType::Lightning] = 10.0;
damageScale[$DamageType::Blaster] = 1.0;
damageScale[$DamageType::Bullet] = 1.0;
damageScale[$DamageType::ELF] = 0.0;
damageScale[$DamageType::ShockLance] = 0.50;
damageScale[$DamageType::Laser] = 1.0;
damageScale[$DamageType::ShrikeBlaster] = 3.5;
damageScale[$DamageType::BellyTurret] = 1.2;
damageScale[$DamageType::AATurret] = 1.5;
damageScale[$DamageType::IndoorDepTurret] = 1.5;
damageScale[$DamageType::OutdoorDepTurret] = 1.5;
damageScale[$DamageType::SentryTurret] = 1.5;
damageScale[$DamageType::Disc] = 1.25;
damageScale[$DamageType::Grenade] = 0.75;
damageScale[$DamageType::Mine] = 4.0;
damageScale[$DamageType::Missile] = 2.0;
damageScale[$DamageType::Mortar] = 2.0;
damageScale[$DamageType::Plasma] = 0.5;
damageScale[$DamageType::BomberBombs] = 2.0;
damageScale[$DamageType::TankChaingun] = 2.0;
damageScale[$DamageType::TankMortar] = 2.0;
damageScale[$DamageType::MissileTurret] = 1.5;
damageScale[$DamageType::MortarTurret] = 2.0;
damageScale[$DamageType::PlasmaTurret] = 2.0;
damageScale[$DamageType::SatchelCharge] = 3.5;
damageScale[$DamageType::Default] = 1.0;
damageScale[$DamageType::Impact] = 1.1;
damageScale[$DamageType::Ground] = 1.0;
damageScale[$DamageType::Explosion] = 2.0;
damageScale[$DamageType::Lightning] = 10.0;
};
//**** THUNDERSWORD BOMBER ****
datablock SimDataBlock(BomberDamageProfile)
{
shieldDamageScale[$DamageType::Blaster] = 1.0;
shieldDamageScale[$DamageType::Bullet] = 1.0;
shieldDamageScale[$DamageType::ELF] = 1.0;
shieldDamageScale[$DamageType::ShockLance] = 0.5;
shieldDamageScale[$DamageType::Laser] = 1.0;
shieldDamageScale[$DamageType::ShrikeBlaster] = 3.5;
shieldDamageScale[$DamageType::BellyTurret] = 2.0;
shieldDamageScale[$DamageType::AATurret] = 3.0;
shieldDamageScale[$DamageType::IndoorDepTurret] = 2.25;
shieldDamageScale[$DamageType::OutdoorDepTurret] = 2.25;
shieldDamageScale[$DamageType::SentryTurret] = 2.25;
shieldDamageScale[$DamageType::Disc] = 1.0;
shieldDamageScale[$DamageType::Grenade] = 1.0;
shieldDamageScale[$DamageType::Mine] = 3.0;
shieldDamageScale[$DamageType::Missile] = 3.0;
shieldDamageScale[$DamageType::Mortar] = 2.0;
shieldDamageScale[$DamageType::Plasma] = 1.0;
shieldDamageScale[$DamageType::BomberBombs] = 3.0;
shieldDamageScale[$DamageType::TankChaingun] = 3.0;
shieldDamageScale[$DamageType::TankMortar] = 2.0;
shieldDamageScale[$DamageType::MissileTurret] = 3.0;
shieldDamageScale[$DamageType::MortarTurret] = 2.0;
shieldDamageScale[$DamageType::PlasmaTurret] = 2.0;
shieldDamageScale[$DamageType::SatchelCharge] = 3.5;
shieldDamageScale[$DamageType::Default] = 1.0;
shieldDamageScale[$DamageType::Impact] = 0.8;
shieldDamageScale[$DamageType::Ground] = 1.0;
shieldDamageScale[$DamageType::Explosion] = 3.0;
shieldDamageScale[$DamageType::Lightning] = 10.0;
damageScale[$DamageType::Blaster] = 0.75;
damageScale[$DamageType::Bullet] = 0.75;
damageScale[$DamageType::ELF] = 0.0;
damageScale[$DamageType::ShockLance] = 0.50;
damageScale[$DamageType::Laser] = 1.0;
damageScale[$DamageType::ShrikeBlaster] = 2.5;
damageScale[$DamageType::BellyTurret] = 1.2;
damageScale[$DamageType::AATurret] = 1.5;
damageScale[$DamageType::IndoorDepTurret] = 1.25;
damageScale[$DamageType::OutdoorDepTurret] = 1.25;
damageScale[$DamageType::SentryTurret] = 1.25;
damageScale[$DamageType::Disc] = 1.0;
damageScale[$DamageType::Grenade] = 0.75;
damageScale[$DamageType::Mine] = 4.0;
damageScale[$DamageType::Missile] = 1.5;
damageScale[$DamageType::Mortar] = 2.0;
damageScale[$DamageType::Plasma] = 0.5;
damageScale[$DamageType::BomberBombs] = 2.0;
damageScale[$DamageType::TankChaingun] = 2.0;
damageScale[$DamageType::TankMortar] = 2.0;
damageScale[$DamageType::MissileTurret] = 1.5;
damageScale[$DamageType::MortarTurret] = 2.0;
damageScale[$DamageType::PlasmaTurret] = 2.0;
damageScale[$DamageType::SatchelCharge] = 3.5;
damageScale[$DamageType::Default] = 1.0;
damageScale[$DamageType::Impact] = 0.8;
damageScale[$DamageType::Ground] = 1.0;
damageScale[$DamageType::Explosion] = 2.0;
damageScale[$DamageType::Lightning] = 10.0;
};
//**** HAVOC TRANSPORT ****
datablock SimDataBlock(HavocDamageProfile)
{
shieldDamageScale[$DamageType::Blaster] = 1.0;
shieldDamageScale[$DamageType::Bullet] = 1.0;
shieldDamageScale[$DamageType::ELF] = 1.0;
shieldDamageScale[$DamageType::ShockLance] = 0.5;
shieldDamageScale[$DamageType::Laser] = 1.0;
shieldDamageScale[$DamageType::ShrikeBlaster] = 3.5;
shieldDamageScale[$DamageType::BellyTurret] = 2.0;
shieldDamageScale[$DamageType::AATurret] = 3.0;
shieldDamageScale[$DamageType::IndoorDepTurret] = 2.25;
shieldDamageScale[$DamageType::OutdoorDepTurret] = 2.25;
shieldDamageScale[$DamageType::SentryTurret] = 2.25;
shieldDamageScale[$DamageType::Disc] = 1.0;
shieldDamageScale[$DamageType::Grenade] = 1.0;
shieldDamageScale[$DamageType::Mine] = 3.0;
shieldDamageScale[$DamageType::Missile] = 3.0;
shieldDamageScale[$DamageType::Mortar] = 2.0;
shieldDamageScale[$DamageType::Plasma] = 1.0;
shieldDamageScale[$DamageType::BomberBombs] = 3.0;
shieldDamageScale[$DamageType::TankChaingun] = 3.0;
shieldDamageScale[$DamageType::TankMortar] = 2.0;
shieldDamageScale[$DamageType::MissileTurret] = 3.0;
shieldDamageScale[$DamageType::MortarTurret] = 2.0;
shieldDamageScale[$DamageType::PlasmaTurret] = 2.0;
shieldDamageScale[$DamageType::SatchelCharge] = 3.5;
shieldDamageScale[$DamageType::Default] = 1.0;
shieldDamageScale[$DamageType::Impact] = 0.5;
shieldDamageScale[$DamageType::Ground] = 1.0;
shieldDamageScale[$DamageType::Explosion] = 3.0;
shieldDamageScale[$DamageType::Lightning] = 10.0;
damageScale[$DamageType::Blaster] = 0.75;
damageScale[$DamageType::Bullet] = 0.75;
damageScale[$DamageType::ELF] = 0.0;
damageScale[$DamageType::ShockLance] = 0.50;
damageScale[$DamageType::Laser] = 1.0;
damageScale[$DamageType::ShrikeBlaster] = 2.5;
damageScale[$DamageType::BellyTurret] = 1.2;
damageScale[$DamageType::AATurret] = 1.5;
damageScale[$DamageType::IndoorDepTurret] = 1.25;
damageScale[$DamageType::OutdoorDepTurret] = 1.25;
damageScale[$DamageType::SentryTurret] = 1.25;
damageScale[$DamageType::Disc] = 1.0;
damageScale[$DamageType::Grenade] = 0.75;
damageScale[$DamageType::Mine] = 4.0;
damageScale[$DamageType::Missile] = 1.5;
damageScale[$DamageType::Mortar] = 2.0;
damageScale[$DamageType::Plasma] = 0.5;
damageScale[$DamageType::BomberBombs] = 2.0;
damageScale[$DamageType::TankChaingun] = 2.0;
damageScale[$DamageType::TankMortar] = 2.0;
damageScale[$DamageType::MissileTurret] = 1.5;
damageScale[$DamageType::MortarTurret] = 2.0;
damageScale[$DamageType::PlasmaTurret] = 2.0;
damageScale[$DamageType::SatchelCharge] = 3.5;
damageScale[$DamageType::Default] = 1.0;
damageScale[$DamageType::Impact] = 0.5;
damageScale[$DamageType::Ground] = 1.0;
damageScale[$DamageType::Explosion] = 2.0;
damageScale[$DamageType::Lightning] = 10.0;
};
//**** WILDCAT GRAV CYCLE ****
datablock SimDataBlock(WildcatDamageProfile)
{
shieldDamageScale[$DamageType::Blaster] = 2.0;
shieldDamageScale[$DamageType::Bullet] = 2.5;
shieldDamageScale[$DamageType::ELF] = 1.0;
shieldDamageScale[$DamageType::ShockLance] = 1.0;
shieldDamageScale[$DamageType::Laser] = 4.0;
shieldDamageScale[$DamageType::ShrikeBlaster] = 6.0;
shieldDamageScale[$DamageType::BellyTurret] = 2.0;
shieldDamageScale[$DamageType::AATurret] = 2.0;
shieldDamageScale[$DamageType::IndoorDepTurret] = 2.5;
shieldDamageScale[$DamageType::OutdoorDepTurret] = 2.5;
shieldDamageScale[$DamageType::Disc] = 2.5;
shieldDamageScale[$DamageType::Grenade] = 2.0;
shieldDamageScale[$DamageType::Mine] = 4.0;
shieldDamageScale[$DamageType::Missile] = 4.0;
shieldDamageScale[$DamageType::Mortar] = 2.0;
shieldDamageScale[$DamageType::Plasma] = 2.0;
shieldDamageScale[$DamageType::BomberBombs] = 2.5;
shieldDamageScale[$DamageType::TankChaingun] = 3.0;
shieldDamageScale[$DamageType::TankMortar] = 2.0;
shieldDamageScale[$DamageType::MissileTurret] = 4.0;
shieldDamageScale[$DamageType::MortarTurret] = 2.0;
shieldDamageScale[$DamageType::PlasmaTurret] = 2.0;
shieldDamageScale[$DamageType::SatchelCharge] = 3.0;
shieldDamageScale[$DamageType::Default] = 1.0;
shieldDamageScale[$DamageType::Impact] = 1.25;
shieldDamageScale[$DamageType::Ground] = 1.0;
shieldDamageScale[$DamageType::Explosion] = 2.0;
shieldDamageScale[$DamageType::Lightning] = 5.0;
damageScale[$DamageType::Blaster] = 1.5;
damageScale[$DamageType::Bullet] = 1.2;
damageScale[$DamageType::ELF] = 0.0;
damageScale[$DamageType::ShockLance] = 0.50;
damageScale[$DamageType::Laser] = 2.0;
damageScale[$DamageType::ShrikeBlaster] = 4.0;
damageScale[$DamageType::BellyTurret] = 1.5;
damageScale[$DamageType::AATurret] = 1.0;
damageScale[$DamageType::IndoorDepTurret] = 1.0;
damageScale[$DamageType::OutdoorDepTurret] = 1.0;
damageScale[$DamageType::Disc] = 1.25;
damageScale[$DamageType::Grenade] = 1.0;
damageScale[$DamageType::Mine] = 4.0;
damageScale[$DamageType::Missile] = 1.2;
damageScale[$DamageType::Mortar] = 1.0;
damageScale[$DamageType::Plasma] = 1.5;
damageScale[$DamageType::BomberBombs] = 2.0;
damageScale[$DamageType::TankChaingun] = 2.0;
damageScale[$DamageType::TankMortar] = 1.0;
damageScale[$DamageType::MissileTurret] = 1.2;
damageScale[$DamageType::MortarTurret] = 1.0;
damageScale[$DamageType::PlasmaTurret] = 1.0;
damageScale[$DamageType::SatchelCharge] = 2.2;
damageScale[$DamageType::Default] = 1.0;
damageScale[$DamageType::Impact] = 1.25;
damageScale[$DamageType::Ground] = 1.0;
damageScale[$DamageType::Explosion] = 1.0;
damageScale[$DamageType::Lightning] = 5.0;
};
//**** BEOWULF TANK ****
datablock SimDataBlock(TankDamageProfile)
{
shieldDamageScale[$DamageType::Blaster] = 0.6;
shieldDamageScale[$DamageType::Bullet] = 0.75;
shieldDamageScale[$DamageType::ELF] = 1.0;
shieldDamageScale[$DamageType::ShockLance] = 0.5;
shieldDamageScale[$DamageType::Laser] = 1.0;
shieldDamageScale[$DamageType::ShrikeBlaster] = 1.75;
shieldDamageScale[$DamageType::BellyTurret] = 1.25;
shieldDamageScale[$DamageType::AATurret] = 0.8;
shieldDamageScale[$DamageType::IndoorDepTurret] = 1.0;
shieldDamageScale[$DamageType::OutdoorDepTurret] = 1.0;
shieldDamageScale[$DamageType::Disc] = 0.8;
shieldDamageScale[$DamageType::Grenade] = 0.8;
shieldDamageScale[$DamageType::Mine] = 3.25;
shieldDamageScale[$DamageType::Missile] = 2.0;
shieldDamageScale[$DamageType::Mortar] = 1.7;
shieldDamageScale[$DamageType::Plasma] = 1.0;
shieldDamageScale[$DamageType::BomberBombs] = 1.5;
shieldDamageScale[$DamageType::TankChaingun] = 1.5;
shieldDamageScale[$DamageType::TankMortar] = 1.8;
shieldDamageScale[$DamageType::MissileTurret] = 1.25;
shieldDamageScale[$DamageType::MortarTurret] = 1.0;
shieldDamageScale[$DamageType::PlasmaTurret] = 1.25;
shieldDamageScale[$DamageType::SatchelCharge] = 2.0;
shieldDamageScale[$DamageType::Default] = 1.0;
shieldDamageScale[$DamageType::Impact] = 0.75;
shieldDamageScale[$DamageType::Ground] = 0.75;
shieldDamageScale[$DamageType::Explosion] = 2.0;
shieldDamageScale[$DamageType::Lightning] = 10.0;
damageScale[$DamageType::Blaster] = 0.75;
damageScale[$DamageType::Bullet] = 0.75;
damageScale[$DamageType::ELF] = 0.0;
damageScale[$DamageType::ShockLance] = 0.50;
damageScale[$DamageType::Laser] = 1.0;
damageScale[$DamageType::ShrikeBlaster] = 2.0;
damageScale[$DamageType::BellyTurret] = 1.0;
damageScale[$DamageType::AATurret] = 1.0;
damageScale[$DamageType::IndoorDepTurret] = 1.0;
damageScale[$DamageType::OutdoorDepTurret] = 1.0;
damageScale[$DamageType::Disc] = 1.0;
damageScale[$DamageType::Grenade] = 1.0;
damageScale[$DamageType::Mine] = 2.25;
damageScale[$DamageType::Missile] = 1.25;
damageScale[$DamageType::Mortar] = 1.4;
damageScale[$DamageType::Plasma] = 0.5;
damageScale[$DamageType::BomberBombs] = 1.0;
damageScale[$DamageType::TankChaingun] = 0.75;
damageScale[$DamageType::TankMortar] = 1.6;
damageScale[$DamageType::MissileTurret] = 1.25;
damageScale[$DamageType::MortarTurret] = 1.0;
damageScale[$DamageType::PlasmaTurret] = 1.0;
damageScale[$DamageType::SatchelCharge] = 2.0;
damageScale[$DamageType::Default] = 1.0;
damageScale[$DamageType::Impact] = 0.75;
damageScale[$DamageType::Ground] = 0.75;
damageScale[$DamageType::Explosion] = 1.0;
damageScale[$DamageType::Lightning] = 10.0;
};
//**** JERICHO MPB ****
datablock SimDataBlock(MPBDamageProfile)
{
shieldDamageScale[$DamageType::Blaster] = 0.6;
shieldDamageScale[$DamageType::Bullet] = 0.75;
shieldDamageScale[$DamageType::ELF] = 1.0;
shieldDamageScale[$DamageType::ShockLance] = 0.5;
shieldDamageScale[$DamageType::Laser] = 1.0;
shieldDamageScale[$DamageType::ShrikeBlaster] = 1.75;
shieldDamageScale[$DamageType::BellyTurret] = 1.25;
shieldDamageScale[$DamageType::AATurret] = 0.8;
shieldDamageScale[$DamageType::IndoorDepTurret] = 1.0;
shieldDamageScale[$DamageType::OutdoorDepTurret] = 1.0;
shieldDamageScale[$DamageType::Disc] = 0.8;
shieldDamageScale[$DamageType::Grenade] = 0.8;
shieldDamageScale[$DamageType::Mine] = 3.25;
shieldDamageScale[$DamageType::Missile] = 2.0;
shieldDamageScale[$DamageType::Mortar] = 0.8;
shieldDamageScale[$DamageType::Plasma] = 1.0;
shieldDamageScale[$DamageType::BomberBombs] = 1.5;
shieldDamageScale[$DamageType::TankChaingun] = 1.5;
shieldDamageScale[$DamageType::TankMortar] = 1.4;
shieldDamageScale[$DamageType::MissileTurret] = 1.25;
shieldDamageScale[$DamageType::MortarTurret] = 1.0;
shieldDamageScale[$DamageType::PlasmaTurret] = 1.25;
shieldDamageScale[$DamageType::SatchelCharge] = 2.0;
shieldDamageScale[$DamageType::Default] = 1.0;
shieldDamageScale[$DamageType::Impact] = 0.5;
shieldDamageScale[$DamageType::Ground] = 0.5;
shieldDamageScale[$DamageType::Explosion] = 2.0;
shieldDamageScale[$DamageType::Lightning] = 10.0;
damageScale[$DamageType::Blaster] = 0.75;
damageScale[$DamageType::Bullet] = 0.75;
damageScale[$DamageType::ELF] = 0.0;
damageScale[$DamageType::ShockLance] = 0.50;
damageScale[$DamageType::Laser] = 1.0;
damageScale[$DamageType::ShrikeBlaster] = 2.0;
damageScale[$DamageType::BellyTurret] = 1.0;
damageScale[$DamageType::AATurret] = 1.0;
damageScale[$DamageType::IndoorDepTurret] = 1.0;
damageScale[$DamageType::OutdoorDepTurret] = 1.0;
damageScale[$DamageType::Disc] = 1.0;
damageScale[$DamageType::Grenade] = 1.0;
damageScale[$DamageType::Mine] = 2.25;
damageScale[$DamageType::Missile] = 1.25;
damageScale[$DamageType::Mortar] = 1.0;
damageScale[$DamageType::Plasma] = 0.5;
damageScale[$DamageType::BomberBombs] = 1.0;
damageScale[$DamageType::TankChaingun] = 0.75;
damageScale[$DamageType::TankMortar] = 1.0;
damageScale[$DamageType::MissileTurret] = 1.25;
damageScale[$DamageType::MortarTurret] = 1.0;
damageScale[$DamageType::PlasmaTurret] = 1.0;
damageScale[$DamageType::SatchelCharge] = 2.0;
damageScale[$DamageType::Default] = 1.0;
damageScale[$DamageType::Impact] = 0.5;
damageScale[$DamageType::Ground] = 0.5;
damageScale[$DamageType::Explosion] = 1.0;
damageScale[$DamageType::Lightning] = 10.0;
};
//----------------------------------------------------------------------------
// TURRET DAMAGE PROFILES
//----------------------------------------------------------------------------
datablock SimDataBlock(TurretDamageProfile)
{
shieldDamageScale[$DamageType::Blaster] = 0.8;
shieldDamageScale[$DamageType::Bullet] = 0.8;
shieldDamageScale[$DamageType::ELF] = 1.0;
shieldDamageScale[$DamageType::ShockLance] = 0.5;
shieldDamageScale[$DamageType::Laser] = 1.0;
shieldDamageScale[$DamageType::ShrikeBlaster] = 3.0;
shieldDamageScale[$DamageType::BellyTurret] = 2.0;
shieldDamageScale[$DamageType::AATurret] = 1.0;
shieldDamageScale[$DamageType::IndoorDepTurret] = 1.0;
shieldDamageScale[$DamageType::OutdoorDepTurret] = 1.0;
shieldDamageScale[$DamageType::SentryTurret] = 1.0;
shieldDamageScale[$DamageType::Disc] = 1.0;
shieldDamageScale[$DamageType::Grenade] = 1.5;
shieldDamageScale[$DamageType::Mine] = 3.0;
shieldDamageScale[$DamageType::Missile] = 3.0;
shieldDamageScale[$DamageType::Mortar] = 3.0;
shieldDamageScale[$DamageType::Plasma] = 1.0;
shieldDamageScale[$DamageType::BomberBombs] = 2.0;
shieldDamageScale[$DamageType::TankChaingun] = 1.5;
shieldDamageScale[$DamageType::TankMortar] = 3.0;
shieldDamageScale[$DamageType::MissileTurret] = 3.0;
shieldDamageScale[$DamageType::MortarTurret] = 3.0;
shieldDamageScale[$DamageType::PlasmaTurret] = 2.0;
shieldDamageScale[$DamageType::SatchelCharge] = 4.5;
shieldDamageScale[$DamageType::Default] = 1.0;
shieldDamageScale[$DamageType::Impact] = 1.0;
shieldDamageScale[$DamageType::Ground] = 1.0;
shieldDamageScale[$DamageType::Explosion] = 2.0;
shieldDamageScale[$DamageType::Lightning] = 5.0;
damageScale[$DamageType::Blaster] = 0.8;
damageScale[$DamageType::Bullet] = 0.9;
damageScale[$DamageType::ELF] = 0.0;
damageScale[$DamageType::ShockLance] = 0.50;
damageScale[$DamageType::Laser] = 1.0;
damageScale[$DamageType::ShrikeBlaster] = 1.0;
damageScale[$DamageType::BellyTurret] = 0.6;
damageScale[$DamageType::AATurret] = 1.0;
damageScale[$DamageType::IndoorDepTurret] = 1.0;
damageScale[$DamageType::OutdoorDepTurret] = 1.0;
damageScale[$DamageType::SentryTurret] = 1.0;
damageScale[$DamageType::Disc] = 1.1;
damageScale[$DamageType::Grenade] = 1.0;
damageScale[$DamageType::Mine] = 1.5;
damageScale[$DamageType::Missile] = 1.25;
damageScale[$DamageType::Mortar] = 1.25;
damageScale[$DamageType::Plasma] = 0.75;
damageScale[$DamageType::BomberBombs] = 1.0;
damageScale[$DamageType::TankChaingun] = 1.25;
damageScale[$DamageType::TankMortar] = 1.25;
damageScale[$DamageType::MissileTurret] = 1.25;
damageScale[$DamageType::MortarTurret] = 1.25;
damageScale[$DamageType::PlasmaTurret] = 1.25;
damageScale[$DamageType::SatchelCharge] = 1.5;
damageScale[$DamageType::Default] = 1.0;
damageScale[$DamageType::Impact] = 1.0;
damageScale[$DamageType::Ground] = 1.0;
damageScale[$DamageType::Explosion] = 1.0;
damageScale[$DamageType::Lightning] = 5.0;
};
//----------------------------------------------------------------------------
// STATIC SHAPE DAMAGE PROFILES
//----------------------------------------------------------------------------
datablock SimDataBlock(StaticShapeDamageProfile)
{
shieldDamageScale[$DamageType::Blaster] = 0.8;
shieldDamageScale[$DamageType::Bullet] = 1.0;
shieldDamageScale[$DamageType::ELF] = 1.0;
shieldDamageScale[$DamageType::ShockLance] = 1.0;
shieldDamageScale[$DamageType::Laser] = 1.0;
shieldDamageScale[$DamageType::ShrikeBlaster] = 2.0;
shieldDamageScale[$DamageType::BellyTurret] = 1.5;
shieldDamageScale[$DamageType::AATurret] = 1.0;
shieldDamageScale[$DamageType::IndoorDepTurret] = 1.0;
shieldDamageScale[$DamageType::OutdoorDepTurret] = 1.0;
shieldDamageScale[$DamageType::Turret] = 1.0;
shieldDamageScale[$DamageType::SentryTurret] = 1.0;
shieldDamageScale[$DamageType::Disc] = 1.0;
shieldDamageScale[$DamageType::Grenade] = 1.2;
shieldDamageScale[$DamageType::Mine] = 2.0;
shieldDamageScale[$DamageType::Missile] = 3.0;
shieldDamageScale[$DamageType::Mortar] = 3.0;
shieldDamageScale[$DamageType::Plasma] = 1.5;
shieldDamageScale[$DamageType::BomberBombs] = 2.0;
shieldDamageScale[$DamageType::TankChaingun] = 1.5;
shieldDamageScale[$DamageType::TankMortar] = 3.0;
shieldDamageScale[$DamageType::MissileTurret] = 3.0;
shieldDamageScale[$DamageType::MortarTurret] = 3.0;
shieldDamageScale[$DamageType::PlasmaTurret] = 2.0;
shieldDamageScale[$DamageType::SatchelCharge] = 6.0;
shieldDamageScale[$DamageType::Default] = 1.0;
shieldDamageScale[$DamageType::Impact] = 1.25;
shieldDamageScale[$DamageType::Ground] = 1.0;
shieldDamageScale[$DamageType::Explosion] = 2.0;
shieldDamageScale[$DamageType::Lightning] = 5.0;
damageScale[$DamageType::Blaster] = 1.0;
damageScale[$DamageType::Bullet] = 1.0;
damageScale[$DamageType::ELF] = 0.0;
damageScale[$DamageType::ShockLance] = 1.0;
damageScale[$DamageType::Laser] = 1.0;
damageScale[$DamageType::ShrikeBlaster] = 2.0;
damageScale[$DamageType::BellyTurret] = 1.2;
damageScale[$DamageType::AATurret] = 1.0;
damageScale[$DamageType::IndoorDepTurret] = 1.0;
damageScale[$DamageType::OutdoorDepTurret] = 1.0;
damageScale[$DamageType::SentryTurret] = 1.0;
damageScale[$DamageType::Disc] = 1.15;
damageScale[$DamageType::Grenade] = 1.2;
damageScale[$DamageType::Mine] = 2.0;
damageScale[$DamageType::Missile] = 2.0;
damageScale[$DamageType::Mortar] = 2.0;
damageScale[$DamageType::Plasma] = 1.25;
damageScale[$DamageType::BomberBombs] = 1.0;
damageScale[$DamageType::TankChaingun] = 1.0;
damageScale[$DamageType::TankMortar] = 2.0;
damageScale[$DamageType::MissileTurret] = 2.0;
damageScale[$DamageType::MortarTurret] = 2.0;
damageScale[$DamageType::PlasmaTurret] = 2.0;
damageScale[$DamageType::SatchelCharge] = 4.0;
damageScale[$DamageType::Default] = 1.0;
damageScale[$DamageType::Impact] = 1.25;
damageScale[$DamageType::Ground] = 1.0;
damageScale[$DamageType::Explosion] = 1.0;
damageScale[$DamageType::Lightning] = 5.0;
};
//----------------------------------------------------------------------------
// PLAYER DAMAGE PROFILES
//----------------------------------------------------------------------------
datablock SimDataBlock(LightPlayerDamageProfile)
{
damageScale[$DamageType::Blaster] = 1.3;
damageScale[$DamageType::Bullet] = 1.2;
damageScale[$DamageType::ELF] = 0.75;
damageScale[$DamageType::ShockLance] = 1.0;
damageScale[$DamageType::Laser] = 1.12;
damageScale[$DamageType::ShrikeBlaster] = 1.10;
damageScale[$DamageType::BellyTurret] = 1.0;
damageScale[$DamageType::AATurret] = 0.7;
damageScale[$DamageType::IndoorDepTurret] = 1.3;
damageScale[$DamageType::OutdoorDepTurret] = 1.3;
damageScale[$DamageType::SentryTurret] = 1.0;
damageScale[$DamageType::Disc] = 1.0;
damageScale[$DamageType::Grenade] = 1.2;
damageScale[$DamageType::Mine] = 1.0;
damageScale[$DamageType::Missile] = 1.0;
damageScale[$DamageType::Mortar] = 1.3;
damageScale[$DamageType::Plasma] = 1.0;
damageScale[$DamageType::BomberBombs] = 3.0;
damageScale[$DamageType::TankChaingun] = 1.7;
damageScale[$DamageType::TankMortar] = 1.0;
damageScale[$DamageType::MissileTurret] = 1.0;
damageScale[$DamageType::MortarTurret] = 1.3;
damageScale[$DamageType::PlasmaTurret] = 1.0;
damageScale[$DamageType::SatchelCharge] = 3.0;
damageScale[$DamageType::Default] = 1.0;
damageScale[$DamageType::Impact] = 1.2;
damageScale[$DamageType::Ground] = 1.0;
damageScale[$DamageType::Explosion] = 1.0;
damageScale[$DamageType::Lightning] = 1.0;
};
datablock SimDataBlock(MediumPlayerDamageProfile)
{
damageScale[$DamageType::Blaster] = 1.0;
damageScale[$DamageType::Bullet] = 1.0;
damageScale[$DamageType::ELF] = 0.75;
damageScale[$DamageType::ShockLance] = 1.0;
damageScale[$DamageType::Laser] = 1.1;
damageScale[$DamageType::ShrikeBlaster] = 1.0;
damageScale[$DamageType::BellyTurret] = 1.0;
damageScale[$DamageType::AATurret] = 0.7;
damageScale[$DamageType::IndoorDepTurret] = 1.0;
damageScale[$DamageType::OutdoorDepTurret] = 1.0;
damageScale[$DamageType::SentryTurret] = 1.0;
damageScale[$DamageType::Disc] = 0.8;
damageScale[$DamageType::Grenade] = 1.0;
damageScale[$DamageType::Mine] = 0.9;
damageScale[$DamageType::Missile] = 0.8;
damageScale[$DamageType::Mortar] = 1.0;
damageScale[$DamageType::Plasma] = 0.65;
damageScale[$DamageType::BomberBombs] = 3.0;
damageScale[$DamageType::TankChaingun] = 1.5;
damageScale[$DamageType::TankMortar] = 0.85;
damageScale[$DamageType::MissileTurret] = 0.8;
damageScale[$DamageType::MortarTurret] = 1.0;
damageScale[$DamageType::PlasmaTurret] = 0.65;
damageScale[$DamageType::SatchelCharge] = 3.0;
damageScale[$DamageType::Default] = 1.0;
damageScale[$DamageType::Impact] = 1.0;
damageScale[$DamageType::Ground] = 1.0;
damageScale[$DamageType::Explosion] = 0.8;
damageScale[$DamageType::Lightning] = 1.2;
};
datablock SimDataBlock(HeavyPlayerDamageProfile)
{
damageScale[$DamageType::Blaster] = 0.7;
damageScale[$DamageType::Bullet] = 0.6;
damageScale[$DamageType::ELF] = 0.75;
damageScale[$DamageType::ShockLance] = 1.0;
damageScale[$DamageType::Laser] = 0.67;
damageScale[$DamageType::ShrikeBlaster] = 0.8;
damageScale[$DamageType::BellyTurret] = 0.8;
damageScale[$DamageType::AATurret] = 0.6;
damageScale[$DamageType::IndoorDepTurret] = 0.7;
damageScale[$DamageType::OutdoorDepTurret] = 0.7;
damageScale[$DamageType::SentryTurret] = 1.0;
damageScale[$DamageType::Disc] = 0.6;
damageScale[$DamageType::Grenade] = 0.8;
damageScale[$DamageType::Mine] = 0.8;
damageScale[$DamageType::Missile] = 0.6;
damageScale[$DamageType::Mortar] = 0.7;
damageScale[$DamageType::Plasma] = 0.4;
damageScale[$DamageType::BomberBombs] = 3.0;
damageScale[$DamageType::TankChaingun] = 1.3;
damageScale[$DamageType::TankMortar] = 0.7;
damageScale[$DamageType::MissileTurret] = 0.6;
damageScale[$DamageType::MortarTurret] = 0.6;
damageScale[$DamageType::PlasmaTurret] = 0.4;
damageScale[$DamageType::SatchelCharge] = 3.0;
damageScale[$DamageType::Default] = 1.0;
damageScale[$DamageType::Impact] = 0.8;
damageScale[$DamageType::Ground] = 1.0;
damageScale[$DamageType::Explosion] = 0.6;
damageScale[$DamageType::Lightning] = 1.4;
};

384
scripts/deathMessages.cs Normal file
View file

@ -0,0 +1,384 @@
/////////////////////////////////////////////////////////////////////////////////////////////////
// %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) //
/////////////////////////////////////////////////////////////////////////////////////////////////
$DeathMessageCampingCount = 1;
$DeathMessageCamping[0] = '\c0%1 was killed for camping near the Nexus.';
//Out of Bounds deaths
$DeathMessageOOBCount = 1;
$DeathMessageOOB[0] = '\c0%1 was killed for loitering outside the mission area.';
$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.';
//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!';
//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::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.';
//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.';

538
scripts/debuggerGui.cs Normal file
View file

@ -0,0 +1,538 @@
// debugger is just a simple TCP object
if (!isObject(TCPDebugger))
new TCPObject(TCPDebugger);
//--------------------------------------------------------------
// TCP function defs
//--------------------------------------------------------------
function DebuggerConsoleView::print(%this, %line)
{
%row = %this.addRow(0, %line);
%this.scrollVisible(%row);
}
function TCPDebugger::onLine(%this, %line)
{
echo("Got line=>" @ %line);
%cmd = firstWord(%line);
%rest = restWords(%line);
if(%cmd $= "PASS")
%this.handlePass(%rest);
else if(%cmd $= "COUT")
%this.handleLineOut(%rest);
else if(%cmd $= "FILELISTOUT")
%this.handleFileList(%rest);
else if(%cmd $= "BREAKLISTOUT")
%this.handleBreakList(%rest);
else if(%cmd $= "BREAK")
%this.handleBreak(%rest);
else if(%cmd $= "RUNNING")
%this.handleRunning();
else if(%cmd $= "EVALOUT")
%this.handleEvalOut(%rest);
else if(%cmd $= "OBJTAGLISTOUT")
%this.handleObjTagList(%rest);
else
%this.handleError(%line);
}
//--------------------------------------------------------------
// handlers for messages from the server
//--------------------------------------------------------------
function TCPDebugger::handlePass(%this, %message)
{
if(%message $= "WrongPass")
{
DebuggerConsoleView.print("Disconnected - wrong password.");
%this.disconnect();
}
else if(%message $= "Connected.")
{
DebuggerConsoleView.print("Connected.");
DebuggerStatus.setValue("CONNECTED");
%this.send("FILELIST\r\n");
}
}
function TCPDebugger::handleLineOut(%this, %line)
{
DebuggerConsoleView.print(%line);
}
function TCPDebugger::handleFileList(%this, %line)
{
DebuggerFilePopup.clear();
%word = 0;
while((%file = getWord(%line, %word)) !$= "")
{
%word++;
DebuggerFilePopup.add(%file, %word);
}
}
function TCPDebugger::handleBreakList(%this, %line)
{
%file = getWord(%line, 0);
if(%file != $DebuggerFile)
return;
%pairs = getWord(%line, 1);
%curLine = 1;
DebuggerFileView.clearBreakPositions();
//set the possible break positions
for(%i = 0; %i < %pairs; %i++)
{
%skip = getWord(%line, %i * 2 + 2);
%breaks = getWord(%line, %i * 2 + 3);
%curLine += %skip;
for(%j = 0; %j < %breaks; %j++)
{
DebuggerFileView.setBreakPosition(%curLine);
%curLine++;
}
}
//now set the actual break points...
for (%i = 0; %i < DebuggerBreakPoints.rowCount(); %i++)
{
%breakText = DebuggerBreakPoints.getRowText(%i);
%breakLine = getField(%breakText, 0);
%breakFile = getField(%breakText, 1);
if (%breakFile == $DebuggerFile)
DebuggerFileView.setBreak(%breakLine);
}
}
function TCPDebugger::handleBreak(%this, %line)
{
DebuggerStatus.setValue("BREAK");
// query all the watches
for(%i = 0; %i < DebuggerWatchView.rowCount(); %i++)
{
%id = DebuggerWatchView.getRowId(%i);
%row = DebuggerWatchView.getRowTextById(%id);
%expr = getField(%row, 0);
%this.send("EVAL " @ %id @ " 0 " @ %expr @ "\r\n");
}
// update the call stack window
DebuggerCallStack.clear();
%file = getWord(%line, 0);
%lineNumber = getWord(%line, 1);
%funcName = getWord(%line, 2);
DbgOpenFile(%file, %lineNumber, true);
%nextWord = 3;
%rowId = 0;
%id = 0;
while(1)
{
DebuggerCallStack.setRowById(%id, %file @ "\t" @ %lineNumber @ "\t" @ %funcName);
%id++;
%file = getWord(%line, %nextWord);
%lineNumber = getWord(%line, %nextWord + 1);
%funcName = getWord(%line, %nextWord + 2);
%nextWord += 3;
if(%file $= "")
break;
}
}
function TCPDebugger::handleRunning(%this)
{
DebuggerFileView.setCurrentLine(-1, true);
DebuggerCallStack.clear();
DebuggerStatus.setValue("RUNNING...");
}
function TCPDebugger::handleEvalOut(%this, %line)
{
%id = firstWord(%line);
%value = restWords(%line);
//see if it's the cursor watch, or from the watch window
if (%id < 0)
DebuggerCursorWatch.setText(DebuggerCursorWatch.expr SPC "=" SPC %value);
else
{
%row = DebuggerWatchView.getRowTextById(%id);
if(%row $= "")
return;
%expr = getField(%row, 0);
DebuggerWatchView.setRowById(%id, %expr @ "\t" @ %value);
}
}
function TCPDebugger::handleObjTagList(%this, %line)
{
}
function TCPDebugger::handleError(%this, %line)
{
DebuggerConsoleView.print("ERROR - bogus message: " @ %line);
}
//--------------------------------------------------------------
// handlers for connection related functions
//--------------------------------------------------------------
function TCPDebugger::onDNSResolve(%this)
{
}
function TCPDebugger::onConnecting(%this)
{
}
function TCPDebugger::onConnected(%this)
{
// send the password on connect.
// %this.send(%this.password @ "\r\n");
// tinman - this function never get's called - instead
// send the password immediately...
}
function TCPDebugger::onConnectFailed(%this)
{
}
function TCPDebugger::onDisconnect(%this)
{
}
function DebuggerFilePopup::onSelect(%this, %id, %text)
{
DbgOpenFile(%text, 0, false);
}
//--------------------------------------------------------------
// Gui glue functions
//--------------------------------------------------------------
$DbgWatchSeq = 1;
function DbgWatchDialogAdd()
{
%expr = WatchDialogExpression.getValue();
if (%expr !$= "")
{
DebuggerWatchView.setRowById($DbgWatchSeq, %expr @"\t(unknown)");
TCPDebugger.send("EVAL " @ $DbgWatchSeq @ " 0 " @ %expr @ "\r\n");
$DbgWatchSeq++;
}
//don't forget to close the dialog
Canvas.popDialog(DebuggerWatchDlg);
}
function DbgWatchDialogEdit()
{
%newValue = EditWatchDialogValue.getValue();
%id = DebuggerWatchView.getSelectedId();
if (%id >= 0)
{
%row = DebuggerWatchView.getRowTextById(%id);
%expr = getField(%row, 0);
if (%newValue $= "")
%assignment = %expr @ " = \"\"";
else
%assignment = %expr @ " = " @ %newValue;
TCPDebugger.send("EVAL " @ %id @ " 0 " @ %assignment @ "\r\n");
}
//don't forget to close the dialog
Canvas.popDialog(DebuggerEditWatchDlg);
}
function DbgSetCursorWatch(%expr)
{
DebuggerCursorWatch.expr = %expr;
if (DebuggerCursorWatch.expr $= "")
DebuggerCursorWatch.setText("");
else
TCPDebugger.send("EVAL -1 0 " @ DebuggerCursorWatch.expr @ "\r\n");
}
function DebuggerCallStack::onAction(%this)
{
%id = %this.getSelectedId();
if(%id == -1)
return;
%text = %this.getRowTextById(%id);
%file = getField(%text, 0);
%line = getField(%text, 1);
DbgOpenFile(%file, %line, %id == 0);
}
function DbgConnect()
{
%address = DebuggerConnectAddress.getValue();
%port = DebuggerConnectPort.getValue();
%password = DebuggerConnectPassword.getValue();
if ((%address !$= "" ) && (%port !$= "" ) && (%password !$= "" ))
{
TCPDebugger.connect(%address @ ":" @ %port);
TCPDebugger.schedule(5000, send, %password @ "\r\n");
TCPDebugger.password = %password;
}
//don't forget to close the dialog
Canvas.popDialog(DebuggerConnectDlg);
}
function DbgBreakConditionSet()
{
%condition = BreakCondition.getValue();
%passct = BreakPassCount.getValue();
%clear = BreakClear.getValue();
if (%condition $= "")
%condition = "true";
if (%passct $= "")
%passct = "0";
if (%clear $= "")
%clear = "false";
//set the condition
%id = DebuggerBreakPoints.getSelectedId();
if(%id != -1)
{
%bkp = DebuggerBreakPoints.getRowTextById(%id);
DbgSetBreakPoint(getField(%bkp, 1), getField(%bkp, 0), %clear, %passct, %condition);
}
//don't forget to close the dialog
Canvas.popDialog(DebuggerBreakConditionDlg);
}
function DbgOpenFile(%file, %line, %selectLine)
{
if (%file !$= "")
{
//open the file in the file view
if (DebuggerFileView.open(%file))
{
DebuggerFileView.setCurrentLine(%line, %selectLine);
if (%file !$= $DebuggerFile)
{
TCPDebugger.send("BREAKLIST " @ %file @ "\r\n");
$DebuggerFile = %file;
}
}
}
}
function DbgFileViewFind()
{
%searchString = DebuggerFindStringText.getValue();
%result = DebuggerFileView.findString(%searchString);
//don't forget to close the dialog
Canvas.popDialog(DebuggerFindDlg);
}
function DbgFileBreakPoints(%file, %points)
{
DebuggerFileView.breakPoints(%file, %points);
}
// BRKSET:file line clear passct expr - set a breakpoint on the file,line
function DbgSetBreakPoint(%file, %line, %clear, %passct, %expr)
{
if(!%clear)
{
if(%file == $DebuggerFile)
DebuggerFileView.setBreak(%line);
}
DebuggerBreakPoints.addBreak(%file, %line, %clear, %passct, %expr);
TCPDebugger.send("BRKSET " @ %file @ " " @ %line @ " " @ %clear @ " " @ %passct @ " " @ %expr @ "\r\n");
}
function DbgRemoveBreakPoint(%file, %line)
{
if(%file == $DebuggerFile)
DebuggerFileView.removeBreak(%line);
TCPDebugger.send("BRKCLR " @ %file @ " " @ %line @ "\r\n");
DebuggerBreakPoints.removeBreak(%file, %line);
}
$DbgBreakId = 0;
function DebuggerBreakPoints::addBreak(%this, %file, %line, %clear, %passct, %expr)
{
// columns 0 = line, 1 = file, 2 = expr
%textLine = %line @ "\t" @ %file @ "\t" @ %expr @ "\t" @ %passct @ "\t" @ %clear;
%selId = %this.getSelectedId();
%selText = %this.getRowTextById(%selId);
if(getField(%selText, 0) $= %line && getField(%selText, 1) $= %file)
{
%this.setRowById(%selId, %textLine);
}
else
{
%this.addRow($DbgBreakId, %textLine);
$DbgBreakId++;
}
}
function DebuggerBreakPoints::removeBreak(%this, %file, %line)
{
for(%i = 0; %i < %this.rowCount(); %i++)
{
%id = %this.getRowId(%i);
%text = %this.getRowTextById(%id);
if(getField(%text, 0) $= %line && getField(%text, 1) $= %file)
{
%this.removeRowById(%id);
return;
}
}
}
function DbgDeleteSelectedBreak()
{
%selectedBreak = DebuggerBreakPoints.getSelectedId();
%rowNum = DebuggerBreakPoints.getRowNumById(%selectedWatch);
if (%rowNum >= 0)
{
%breakText = DebuggerBreakPoints.getRowText(%rowNum);
%breakLine = getField(%breakText, 0);
%breakFile = getField(%breakText, 1);
DbgRemoveBreakPoint(%breakFile, %breakLine);
}
}
function DebuggerBreakPoints::clearBreaks(%this)
{
while(%this.rowCount())
{
%id = %this.getRowId(0);
%text = %this.getRowTextById(%id);
%file = getField(%text, 1);
%line = getField(%text, 0);
DbgRemoveBreakPoint(%file, %line);
}
}
function DebuggerBreakPoints::onAction(%this)
{
%id = %this.getSelectedId();
if(%id == -1)
return;
%text = %this.getRowTextById(%id);
%line = getField(%text, 0);
%file = getField(%text, 1);
DbgOpenFile(%file, %line, 0);
}
function DebuggerFileView::onRemoveBreakPoint(%this, %line)
{
%file = $DebuggerFile;
DbgRemoveBreakPoint(%file, %line);
}
function DebuggerFileView::onSetBreakPoint(%this, %line)
{
%file = $DebuggerFile;
DbgSetBreakPoint(%file, %line, 0, 0, true);
}
function DbgConsoleEntryReturn()
{
%msg = DbgConsoleEntry.getValue();
if (%msg !$= "")
{
DebuggerConsoleView.print("%" @ %msg);
if (DebuggerStatus.getValue() $= "NOT CONNECTED")
DebuggerConsoleView.print("*** Not connected.");
else if (DebuggerStatus.getValue() $= "BREAK")
DebuggerConsoleView.print("*** Target is in BREAK mode.");
else
TCPDebugger.send("CEVAL " @ %msg @ "\r\n");
}
DbgConsoleEntry.setValue("");
}
function DbgConsolePrint(%status)
{
DebuggerConsoleView.print(%status);
}
function DbgStackAddFrame(%file, %line, %funcName)
{
if ((%file !$= "") && (%line !$= "") && (%funcName !$= ""))
DebuggerCallStack.add(%file, %line, %funcName);
}
function DbgStackGetFrame()
{
return DebuggerCallStack.getFrame();
}
function DbgStackClear()
{
DebuggerCallStack.clear();
}
function DbgSetWatch(%expr)
{
if (%expr !$= "")
DebuggerWatchView.set(%expr);
}
function DbgDeleteSelectedWatch()
{
%selectedWatch = DebuggerWatchView.getSelectedId();
%rowNum = DebuggerWatchView.getRowNumById(%selectedWatch);
DebuggerWatchView.removeRow(%rowNum);
}
function DbgRefreshWatches()
{
// query all the watches
for(%i = 0; %i < DebuggerWatchView.rowCount(); %i++)
{
%id = DebuggerWatchView.getRowId(%i);
%row = DebuggerWatchView.getRowTextById(%id);
%expr = getField(%row, 0);
TCPDebugger.send("EVAL " @ %id @ " 0 " @ %expr @ "\r\n");
}
}
function DbgClearWatches()
{
DebuggerWatchView.clear();
}
function dbgStepIn()
{
TCPDebugger.send("STEPIN\r\n");
}
function dbgStepOut()
{
TCPDebugger.send("STEPOUT\r\n");
}
function dbgStepOver()
{
TCPDebugger.send("STEPOVER\r\n");
}
function dbgContinue()
{
TCPDebugger.send("CONTINUE\r\n");
}
DebuggerConsoleView.setActive(false);

3378
scripts/defaultGame.cs Normal file

File diff suppressed because it is too large Load diff

1391
scripts/deployables.cs Normal file

File diff suppressed because it is too large Load diff

64
scripts/depthSort.cs Normal file
View file

@ -0,0 +1,64 @@
moveMap.bindCmd(keyboard,o,"","toggleDepthTest();");
moveMap.bindCmd(keyboard,j,"","toggleDepthSort();");
moveMap.bindCmd(keyboard,k,"","toggleRenderDepth();");
moveMap.bindCmd(keyboard,l,"","toggleHoldDepthTest();");
function toggleDepthTest()
{
if ($Collision::testDepthSortList)
{
$Collision::testDepthSortList = false;
echo("Turning OFF testing of DepthSortList");
}
else
{
$Collision::testDepthSortList = true;
echo("Turning ON testing of DepthSortList");
}
}
function toggleDepthSort()
{
if ($Collision::depthSort)
{
$Collision::depthSort = false;
echo("Turning OFF depth sort on depthSortList");
}
else
{
$Collision::depthSort = true;
echo("Turning ON depth sort on depthSortList");
}
}
function toggleRenderDepth()
{
if ($Collision::depthRender)
{
$Collision::depthRender = false;
echo("Turning OFF depth rendering on DepthSortList");
}
else
{
$Collision::depthRender = true;
echo("Turning ON depth rendering on DepthSortList");
}
}
function toggleHoldDepthTest()
{
if ($Collision::renderAlways)
{
$Collision::renderAlways = false;
$Collision::testDepthSortList = true;
}
else
{
$Collision::renderAlways = true;
$Collision::testDepthSortList = false;
}
}
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- //

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