SSFT: added flag cannon functionality, flag collide with stand 'return'

This commit is contained in:
loop 2025-10-24 01:43:24 +01:00
parent bb8b6bd6c8
commit 9ffd8008d4
3 changed files with 109 additions and 65 deletions

View file

@ -13,11 +13,11 @@
//--- OBJECT WRITE BEGIN ---
new SimGroup(MissionGroup) {
Team_Hunters_timeLimit = "25";
musicTrack = "ice";
cdTrack = "5";
powerCount = "0";
Hunters_timeLimit = "25";
Team_Hunters_timeLimit = "25";
new MissionArea(MissionArea) {
area = "-1008 -1032 2144 2080";
@ -53,8 +53,8 @@ new SimGroup(MissionGroup) {
terrainFile = "Scarabrae_nef.ter";
squareSize = "8";
hazeDistance = "250";
position = "-1024 -1024 0";
hazeDistance = "250";
visibleDistance = "1200";
locked = "true";
};
@ -64,13 +64,13 @@ new SimGroup(MissionGroup) {
customArea = "0 0 0 0";
position = "0 0 0 1";
YDimOverSize = "0";
conjoinBowlDev = "20";
GraphFile = "Scarabrae_nef.nav";
rotation = "0 0 0 0";
coverage = "0";
scale = "1 1 1";
XDimOverSize = "0";
YDimOverSize = "0";
GraphFile = "Scarabrae_nef.nav";
locked = "true";
};
new Sky(Sky) {
@ -244,8 +244,8 @@ new SimGroup(MissionGroup) {
lockCount = "0";
homingCount = "0";
Target = "33";
team = "0";
Target = "33";
locked = "false";
};
new InteriorInstance() {
@ -266,9 +266,9 @@ new SimGroup(MissionGroup) {
lockCount = "0";
homingCount = "0";
Target = "34";
team = "0";
Trigger = "20162";
Trigger = "34762";
Target = "34";
locked = "false";
};
new StaticShape() {
@ -279,9 +279,9 @@ new SimGroup(MissionGroup) {
lockCount = "0";
homingCount = "0";
Target = "35";
team = "0";
Trigger = "20164";
Trigger = "34764";
Target = "35";
locked = "false";
};
new InteriorInstance() {
@ -302,9 +302,9 @@ new SimGroup(MissionGroup) {
lockCount = "0";
homingCount = "0";
Target = "36";
team = "0";
Trigger = "20167";
Trigger = "34767";
Target = "36";
locked = "false";
};
};
@ -400,10 +400,10 @@ new SimGroup(MissionGroup) {
lockCount = "0";
homingCount = "0";
notReady = "1";
Trigger = "34778";
inUse = "Down";
Target = "39";
Trigger = "20178";
notReady = "1";
};
new Marker(BankSpawn) {
position = "-155.307 126.636 243.233";
@ -424,10 +424,10 @@ new SimGroup(MissionGroup) {
lockCount = "0";
homingCount = "0";
Target = "40";
wrangle = "Aim Trainer teleports";
Desc = "Dynamic Aim Trainer\nShoot moving targets while in the air to score points!\nMove faster to score more points and have fun!";
wrangle = "Aim Trainer teleports";
destination = "ATMSpawn";
Target = "40";
};
new StaticShape(ATHT) {
position = "-170.634 150.644 233.142";
@ -437,9 +437,9 @@ new SimGroup(MissionGroup) {
lockCount = "0";
homingCount = "0";
Target = "41";
Desc = "Aim Trainer\nShoot fast moving targets while in the air to score points!\nMove faster to score more points and have fun!";
destination = "ATHSpawn";
Target = "41";
};
new StaticShape(ATLT) {
position = "-176.634 144.844 233.142";
@ -449,9 +449,9 @@ new SimGroup(MissionGroup) {
lockCount = "0";
homingCount = "0";
Target = "42";
Desc = "Static Aim Trainer\nShoot static targets while in the air to score points!\nMove faster to score more points and have fun!";
destination = "ATLSpawn";
Target = "42";
};
new StaticShape(DuelZone) {
position = "-140.434 150.844 233.142";
@ -461,10 +461,10 @@ new SimGroup(MissionGroup) {
lockCount = "0";
homingCount = "0";
Target = "43";
wrangle = "Duel zone teleports";
Desc = "it\'s time to d-d-d-d-d-d-d-duel";
wrangle = "Duel zone teleports";
destination = "undefined";
Target = "43";
};
new StaticShape(FTT) {
position = "-176.634 117.644 233.142";
@ -474,10 +474,10 @@ new SimGroup(MissionGroup) {
lockCount = "0";
homingCount = "0";
Target = "44";
wrangle = "Flag Trainer teleport";
Desc = "Flag Training Zone\nCatch flags! Throw flags!\nWe love flags!";
wrangle = "Flag Trainer teleport";
destination = "FTSpawn";
Target = "44";
};
};
new ForceFieldBare(TractorBeamFront) {
@ -489,10 +489,10 @@ new SimGroup(MissionGroup) {
homingCount = "0";
gravityMod = "-2.75";
originalscale = "10 40 140";
Target = "-1";
appliedForce = "0 0 0";
pz = "20187";
originalscale = "10 40 140";
pz = "34787";
Target = "-1";
velocityMod = "1.0";
};
new Trigger(BankWaypointZone) {
@ -577,9 +577,9 @@ new SimGroup(MissionGroup) {
lockCount = "0";
homingCount = "0";
Target = "45";
Desc = "\nWelcome back to the Bank!";
destination = "BankSpawn";
Target = "45";
};
new Marker(ATLSpawn) {
position = "-546.054 112.086 223.904";
@ -608,9 +608,9 @@ new SimGroup(MissionGroup) {
lockCount = "0";
homingCount = "0";
Target = "46";
Desc = "\nWelcome back to the Bank!";
destination = "BankSpawn";
Target = "46";
};
new TSStatic(LeftPlaceholder) {
position = "-419.363 775.104 251.039";
@ -669,9 +669,9 @@ new SimGroup(MissionGroup) {
lockCount = "0";
homingCount = "0";
Target = "47";
Desc = "\nWelcome back to the Bank!";
destination = "BankSpawn";
Target = "47";
};
new StaticShape() {
position = "264.386 -581.653 232.142";
@ -703,6 +703,40 @@ new SimGroup(MissionGroup) {
Target = "-1";
};
new StaticShape() {
position = "164.875 -615.487 223.553";
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "ExteriorFlagStand";
lockCount = "0";
homingCount = "0";
Target = "-1";
};
new StaticShape() {
position = "264.341 -564.157 241.442";
rotation = "-1 0 0 40";
scale = "1 1 1";
dataBlock = "ExteriorFlagStand";
lockCount = "0";
homingCount = "0";
flagvel = "0 -25 40";
cannon = "1";
Target = "-1";
};
new StaticShape() {
position = "310.537 -493.475 229.386";
rotation = "0.67341 0 0.739269 100";
scale = "1 1 1";
dataBlock = "ExteriorFlagStand";
lockCount = "0";
homingCount = "0";
flagvel = "15 30 40";
cannon = "1";
Target = "-1";
};
};
};
//--- OBJECT WRITE END ---

View file

@ -1,10 +1,9 @@
// TODO: flag cannon
// TODO: flag collide with stand, return to stand
// TODO: flag goals
// Time in seconds
$FlagTrainerTossReset = 45;
$FlagTrainerGrabReset = 90;
$FlagTrainerCannonInterval = 25;
function Flag::objectiveInit(%data, %flag) {
%flag.originalPosition = %flag.getTransform();
@ -14,6 +13,12 @@ function Flag::objectiveInit(%data, %flag) {
%flag.grabber = 0;
}
function SkillSectorGame::flagStandCollision(%game, %dataBlock, %obj, %colObj) {
if (%colObj.getDatablock().getName() $= "FLAG" && !%colObj.isHome) {
returnFlag(%colObj, 'StandCollide');
}
}
function initFlagStand(%stand) {
// Give the stand a flag
echo("Found a stand");
@ -30,6 +35,23 @@ function initFlagStand(%stand) {
if(%flag.stand) {
%flag.stand.getDataBlock().onFlagReturn(%flag.stand);
}
if (%stand.cannon) {
// Stand is a flag cannon! Fire the missiles!
$Cannons[$CannonCount] = %stand;
$CannonCount++;
flagCannon(%stand);
}
}
function flagCannon(%stand) {
// Fire flag and schedule another flag fire
%flag = %stand.flag;
if (isObject(%flag)) {
%flag.setVelocity(%stand.flagvel);
cancel(%stand.cannonSched); // don't allow accidental re-queue
%stand.cannonSched = schedule($FlagTrainerCannonInterval*1000, 0, flagCannon, %stand);
returnFlagAfter(%flag, $FlagTrainerCannonInterval-2, 'CannonReset');
}
}
function scanGroupForFlagStands(%group) {
@ -46,62 +68,45 @@ function scanGroupForFlagStands(%group) {
function SkillSectorGame::InitFlagTrainer() {
if ($DEVMODE) {
// echo("Not putting a flags on stands");
// return;
return;
}
$CannonCount = 0;
// Find all the flag stands and give them a flag
scanGroupForFlagStands(FlagTrain);
}
function SkillSectorGame::ShutdownFlagTrainer() {
for (%i = 0; %i < $CannonCount; %i++) {
cancel($Cannons[%i].cannonSched);
}
}
function SkillSectorGame::playerTouchFlag(%game, %player, %flag) {
if (isObject(%player.holdingFlag)) {
echo("Already holding a flag");
messageClient(%player.client, 'MsgFlagAlready', '\c0You\'re already holding a flag - don\'t be greedy!');
return;
}
if (isObject(%flag.carrier)) {
echo("Can't pick up a flag that's being carried")
echo("Can't pick up a flag that's being carried");
return;
}
%game.playerTouchEnemyFlag(%player, %flag);
// %client = %player.client;
// if ((%flag.carrier $= "") && (%player.getState() !$= "Dead"))
// {
// // z0dd - ZOD, 5/07/04. Cancel the lava return.
// if(isEventPending(%obj.lavaEnterThread))
// cancel(%obj.lavaEnterThread);
// //flag isn't held and has been touched by a live player
// if (%client.team == %flag.team)
// %game.playerTouchOwnFlag(%player, %flag);
// else
// %game.playerTouchEnemyFlag(%player, %flag);
// }
// // toggle visibility of the flag
// setTargetRenderMask(%flag.waypoint.getTarget(), %flag.isHome ? 0 : 1);
}
function SkillSectorGame::playerTouchEnemyFlag(%game, %player, %flag) {
%client = %player.client;
%player.holdingFlag = %flag; //%player has this flag
%flag.carrier = %player; //this %flag is carried by %player
%player.holdingFlag = %flag;
%flag.carrier = %player;
%player.mountImage(FlagImage, $FlagSlot, true, 'dsword');
%flag.hide(true);
%flag.startFade(0, 0, false);
if(%flag.stand)
%flag.stand.getDataBlock().onFlagTaken(%flag.stand);//animate, if exterior stand
if(%flag.stand) %flag.stand.getDataBlock().onFlagTaken(%flag.stand);
returnFlagAfter(%flag, $FlagTrainerGrabReset, 'GrabReset');
}
function SkillSectorGame::dropFlag(%game, %player)
{
function SkillSectorGame::dropFlag(%game, %player) {
%player.throwObject(%player.holdingFlag);
// if(%player.holdingFlag > 0)
// {
// if (!%player.client.outOfBounds)
// %player.throwObject(%player.holdingFlag);
// else
// %game.boundaryLoseFlag(%player);
// }
}
function returnFlag(%flag, %reason) {
@ -110,16 +115,19 @@ function returnFlag(%flag, %reason) {
%flag.hide(false);
%flag.carrier.holdingFlag = 0; // tell the player they've lost the flag
}
%flag.stand.getDataBlock().onFlagReturn(%flag.stand);
if(%flag.stand) %flag.stand.getDataBlock().onFlagReturn(%flag.stand);
%flag.setVelocity("0 0 0");
%flag.setTransform(%flag.stand.getTransform());
//messageClient(%flag.carrier.client, 'MsgFlagReturned', '\c0Flag returned (%1)', %reason);
%flag.isHome = true;
//messageClient(%flag.carrier.client, 'MsgFlagReturned', '\c0Flag returned (%1)', %reason); // Kinda annoying, players will figure this out eventually
%flag.carrier = 0;
}
function returnFlagAfter(%flag, %after, %reason) {
%flag.isHome = false; // happens whenever player tosses or picks up flag. also happens when cannon fires
cancel(%flag.returnSched);
%flag.returnSched = schedule(%after*1000, 0, returnFlag, %flag, %reason);
//messageClient(%flag.carrier.client, 'MsgFlagReturnCountdown', '\c0Flag will be returned to stand in %1 seconds (%2)', %after, %reason);
//messageClient(%flag.carrier.client, 'MsgFlagReturnCountdown', '\c0Flag will be returned to stand in %1 seconds (%2)', %after, %reason); // Kinda annoying, players will figure this out eventually
}
function SkillSectorGame::playerDroppedFlag(%game, %player) {

View file

@ -57,6 +57,8 @@ function SkillSectorGame::gameOver(%game) {
DefaultGame::gameOver(%game);
WaypointWranglerShutdown();
%game.ShutdownFlagTrainer();
// deactivatePackage(SkillSectorGame);
}
if ($DEVMODE) {