mirror of
https://github.com/UberGames/rpgxEF.git
synced 2025-03-17 16:12:13 +00:00
More work on selfdestruct
Added a new command selfdestructcountdown duration [safezone] [target] It'll do exactly the same as selfdestruct start with the exception that it'll force the entity to think every 0.1 secs. to not do this accidently It got it's own command. It uses the cp-command for display and disables admin_centerprint autoamtically. On a more general selfdestruct note I got rid of those long warning sentences in favour of ^1Self Destruct in %.0f:%2.0f Signed-off-by: Harry Young <hendrik.gerritzen@googlemail.com>
This commit is contained in:
parent
7f4b5e2fac
commit
7d39fcad2d
3 changed files with 212 additions and 144 deletions
|
@ -913,6 +913,7 @@ void CG_InitConsoleCommands( void ) {
|
|||
|
||||
trap_AddCommand("safezonelist");
|
||||
trap_AddCommand("selfdestruct");
|
||||
trap_AddCommand("selfdestructcountdown");
|
||||
trap_AddCommand("shipdamage");
|
||||
trap_AddCommand("shiphealth");
|
||||
}
|
||||
|
|
|
@ -6412,57 +6412,10 @@ static void Cmd_selfdestruct_f(gentity_t *ent) {
|
|||
|
||||
//we need the remaining time in minutes and seconds from that entity. Just ask them off and have the command do the math.
|
||||
ETAsec = floor(modf((( floor(destructEnt->damage / 1000) - floor(level.time / 1000) ) / 60), &ETAmin)*60); //break it apart, put off the minutes and return the floored secs
|
||||
if (!Q_stricmp(arg2, "global")){ //a relevant OP has requestet a global announcement so let's give it
|
||||
if (ETAmin > 1) { // stating minutes
|
||||
if (ETAsec > 1) // stating seconds
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minutes and %.0f seconds.\"", ETAmin, ETAsec ));
|
||||
if (ETAsec == 1) // stating second
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minutes and %.0f second.\"", ETAmin, ETAsec ));
|
||||
if (ETAsec == 0) // stating minutes only
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minutes.\"", ETAmin ));
|
||||
}
|
||||
if (ETAmin == 1) { // stating minute
|
||||
if (ETAsec > 1) // stating seconds
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minute and %.0f seconds.\"", ETAmin, ETAsec ));
|
||||
if (ETAsec == 1) // stating second
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minute and %.0f second.\"", ETAmin, ETAsec ));
|
||||
if (ETAsec == 0) // stating minutes only
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minute.\"", ETAmin ));
|
||||
}
|
||||
if (ETAmin == 0) { // seconds only
|
||||
if (ETAsec > 1) // stating seconds
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f seconds.\"", ETAsec ));
|
||||
if (ETAsec == 1) // stating second
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f second.\"", ETAsec ));
|
||||
if (ETAsec == 0) // savety measure only
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct executing.\""));
|
||||
}
|
||||
} else {
|
||||
if (ETAmin > 1) { // stating minutes
|
||||
if (ETAsec > 1) // stating seconds
|
||||
trap_SendServerCommand( ent-g_entities, va("servermsg \"Self Destruct in %.0f minutes and %.0f seconds.\"", ETAmin, ETAsec ));
|
||||
if (ETAsec == 1) // stating second
|
||||
trap_SendServerCommand( ent-g_entities, va("servermsg \"Self Destruct in %.0f minutes and %.0f second.\"", ETAmin, ETAsec ));
|
||||
if (ETAsec == 0) // stating minutes only
|
||||
trap_SendServerCommand( ent-g_entities, va("servermsg \"Self Destruct in %.0f minutes.\"", ETAmin ));
|
||||
}
|
||||
if (ETAmin == 1) { // stating minute
|
||||
if (ETAsec > 1) // stating seconds
|
||||
trap_SendServerCommand( ent-g_entities, va("servermsg \"Self Destruct in %.0f minute and %.0f seconds.\"", ETAmin, ETAsec ));
|
||||
if (ETAsec == 1) // stating second
|
||||
trap_SendServerCommand( ent-g_entities, va("servermsg \"Self Destruct in %.0f minute and %.0f second.\"", ETAmin, ETAsec ));
|
||||
if (ETAsec == 0) // stating minutes only
|
||||
trap_SendServerCommand( ent-g_entities, va("servermsg \"Self Destruct in %.0f minute.\"", ETAmin ));
|
||||
}
|
||||
if (ETAmin == 0) { // seconds only
|
||||
if (ETAsec > 1) // stating seconds
|
||||
trap_SendServerCommand( ent-g_entities, va("servermsg \"Self Destruct in %.0f seconds.\"", ETAsec ));
|
||||
if (ETAsec == 1) // stating second
|
||||
trap_SendServerCommand( ent-g_entities, va("servermsg \"Self Destruct in %.0f second.\"", ETAsec ));
|
||||
if (ETAsec == 0) // savety measure only
|
||||
trap_SendServerCommand( ent-g_entities, va("servermsg \"Self Destruct executing.\""));
|
||||
}
|
||||
}
|
||||
if (!Q_stricmp(arg2, "global")) //a relevant OP has requestet a global announcement so let's give it
|
||||
trap_SendServerCommand( -1, va("servermsg \"^1Self Destruct in %.0f:%2.0f\"", ETAmin, ETAsec ));
|
||||
else
|
||||
trap_SendServerCommand( ent-g_entities, va("servermsg \"^1Self Destruct in %.0f:%2.0f\"", ETAmin, ETAsec ));
|
||||
} else if (!Q_stricmp(arg, "abort")) {
|
||||
//Is there sth running alrerady?
|
||||
destructEnt = G_Find(NULL, FOFS(classname), "target_selfdestruct");
|
||||
|
@ -6483,6 +6436,7 @@ static void Cmd_selfdestruct_f(gentity_t *ent) {
|
|||
G_PrintfClient(ent, "target: Optional Argument for Effects to fire once the countdown hist 0. The entity will automatically shake everyones screen and kill all clienst outside an active target_safezone.");
|
||||
G_PrintfClient(ent, "^2Hint: Make sure your duration and intervalls are synced up. There is a failsave for the countdown to hit it's mark however there is nothing to make sure that you don't get your warnings at unexpected times...");
|
||||
G_PrintfClient(ent, "^2Try this for example: selfdestruct start 131 10 10 1 1");
|
||||
G_PrintfClient(ent, "\nFor a fluid countdown (each sec displayed) try extremeselfdestruct");
|
||||
G_PrintfClient(ent, "\n^3Usage: selfdestruct remaining");
|
||||
G_PrintfClient(ent, "This will give out the remaining countdown-time to you only even if the count is muted. It is free to use for any client.");
|
||||
G_PrintfClient(ent, "\n^3Usage: selfdestruct remaining global");
|
||||
|
@ -6493,6 +6447,85 @@ static void Cmd_selfdestruct_f(gentity_t *ent) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Cmd_selfdestructcountdown_f
|
||||
Harry Young | 06/11/2012
|
||||
like selfdestruct but forced to think every .1 sec
|
||||
does output via quiet cp
|
||||
don't ask me what I was thinking ^^
|
||||
=================
|
||||
*/
|
||||
static void Cmd_selfdestructcountdown_f(gentity_t *ent) {
|
||||
gentity_t *destructEnt, *safezone=NULL;
|
||||
char arg[16], arg2[16], arg3[16];
|
||||
if(!ent || !ent->client)
|
||||
return;
|
||||
|
||||
//Trapping all potential args here.
|
||||
trap_Argv(1, arg, sizeof(arg));
|
||||
trap_Argv(2, arg2, sizeof(arg2));
|
||||
trap_Argv(3, arg3, sizeof(arg3));
|
||||
|
||||
#ifndef SQL
|
||||
if ( !IsAdmin( ent ) ) {
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"ERROR: You are not logged in as an admin.\n\" ") );
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if ( !IsAdmin( ent ) || !G_Sql_UserDB_CheckRight(ent->client->uid, SQLF_SMS ) ) {
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"ERROR: You are not logged in as a user with the appropiate rights.\n\" ") );
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(trap_Argc() < 1) {
|
||||
G_PrintfClient(ent, "^3Usage: selfdestructcountdown duration [safezone] [target]");
|
||||
G_PrintfClient(ent, "^1WARNING: This makes the entity think every 0.1 seconds and forces a lot off traffic. You may want to use selfdestruct start.");
|
||||
G_PrintfClient(ent, "duration: total countdown-duration in seconds. Must not be 0.");
|
||||
G_PrintfClient(ent, "safezone: safezone to toggle unsafe at T-50ms. Only for maps with multiple ships (like rpg_runabout). Set NULL to skip.");
|
||||
G_PrintfClient(ent, "target: Optional Argument for Effects to fire once the countdown hist 0. The entity will automatically shake everyones screen and kill all clienst outside an active target_safezone.");
|
||||
G_PrintfClient(ent, "To abort call selfdestruct abort");
|
||||
return;
|
||||
}
|
||||
|
||||
// Setup command-Execution
|
||||
|
||||
//Is there sth running alrerady?
|
||||
destructEnt = G_Find(NULL, FOFS(classname), "target_selfdestruct");
|
||||
if(destructEnt) {
|
||||
G_PrintfClient(ent, "^1ERROR: There's already a self destruct in progress, aborting setup.");
|
||||
return;
|
||||
}
|
||||
|
||||
//There is not so let's set this up.
|
||||
destructEnt = G_Spawn();
|
||||
destructEnt->classname = "target_selfdestruct";
|
||||
destructEnt->wait = atoi(arg);
|
||||
destructEnt->bluename = G_NewString(arg2);
|
||||
destructEnt->target = G_NewString(arg3);
|
||||
|
||||
destructEnt->spawnflags = 3; //tells ent to free once aborted and think extreme.
|
||||
|
||||
//we need to check a few things here to make sure the entity works properly. Else we free it.
|
||||
if ( destructEnt->wait > 0 || destructEnt->count > 0 || destructEnt->n00bCount > 0 || destructEnt->health > 0 ){
|
||||
G_CallSpawn(destructEnt); //Spawn-Function will also manage init, so we need to call that.
|
||||
} else { //sth's wrong so lets tell them what is.
|
||||
G_PrintfClient(ent, "^1ERROR: The following arguments are missing:");
|
||||
if ( destructEnt->wait == 0 )
|
||||
G_PrintfClient(ent, "^1-duration must not be 0.");
|
||||
while((safezone = G_Find(safezone, FOFS(classname), "target_safezone")) != NULL){
|
||||
if(!destructEnt->bluename && safezone->spawnflags & 2){
|
||||
G_PrintfClient(ent, "^1-safezone must be given for maps consisting of multiple ships/stations (like rpg_runabout). For a list of safezonesuse the safezonelist command.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
G_PrintfClient(ent, "^1Removing entity.");
|
||||
G_FreeEntity(destructEnt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Cmd_shipdamage_f
|
||||
|
@ -6641,6 +6674,7 @@ GSIO01 | 12/05/2009
|
|||
*/
|
||||
static void Cmd_admin_centerprint_f(gentity_t *ent) {
|
||||
char *arg;
|
||||
gentity_t *destructEnt;
|
||||
|
||||
if ( trap_Argc () < 1 ) {
|
||||
return;
|
||||
|
@ -6663,6 +6697,12 @@ static void Cmd_admin_centerprint_f(gentity_t *ent) {
|
|||
if ( !ent || !ent->client ) {
|
||||
return; // not fully in game yet
|
||||
}
|
||||
|
||||
destructEnt = G_Find(NULL, FOFS(classname), "target_selfdestruct");
|
||||
if( destructEnt || destructEnt->spawnflags & 2){ //if we have a selfdestruct that occupies the Center disallow
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"ERROR: You can not centerprint while a selfdestruct occupies that slot.\n\" ") );
|
||||
return;
|
||||
}
|
||||
|
||||
arg = ConcatArgs( 1 );
|
||||
|
||||
|
@ -8232,6 +8272,8 @@ void ClientCommand( int clientNum )
|
|||
Cmd_safezonelist_f(ent);
|
||||
else if (Q_stricmp(cmd, "selfdestruct") == 0)
|
||||
Cmd_selfdestruct_f(ent);
|
||||
else if (Q_stricmp(cmd, "selfdestructcountdown") == 0)
|
||||
Cmd_selfdestructcountdown_f(ent);
|
||||
else if (Q_stricmp(cmd, "shipdamage") == 0)
|
||||
Cmd_shipdamage_f(ent);
|
||||
else if (Q_stricmp(cmd, "shiphealth") == 0)
|
||||
|
|
|
@ -2578,7 +2578,7 @@ void SP_target_shaderremap(gentity_t *ent) {
|
|||
//RPG-X | Harry Young | 15/10/2011 | MOD END
|
||||
|
||||
//RPG-X | Harry Young | 25/07/2012 | MOD START
|
||||
/*QUAKED target_selfdestruct (1 0 0) (-8 -8 -8) (8 8 8)
|
||||
/*QUAKED target_selfdestruct (1 0 0) (-8 -8 -8) (8 8 8) FREE COUNTDOWN
|
||||
This entity manages the self destruct.
|
||||
For now this should only be used via the selfdestruct console command, however it might be usable from within the radiant at a later date.
|
||||
Should this thing hit 0 the killing part for everyone outside a target_safezone will be done automatically.
|
||||
|
@ -2643,13 +2643,18 @@ static int target_selfdestruct_get_unsafe_players(gentity_t *ents[MAX_GENTITIES]
|
|||
}
|
||||
|
||||
void target_selfdestruct_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
|
||||
if(ent->wait > 50){//if we listed the safezones we're committed
|
||||
//with the use-function we're going to init aborts in a fairly simple manner: Fire warning notes...
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct sequence aborted.\""));
|
||||
G_AddEvent(ent, EV_GLOBAL_SOUND, G_SoundIndex("sound/voice/selfdestruct/abort.mp3"));
|
||||
//set wait to -1...
|
||||
ent->wait = -1;
|
||||
//and arrange for a think in a sec
|
||||
ent->nextthink = level.time + 1000;
|
||||
if(ent->spawnflags & 2)
|
||||
trap_SendServerCommand( -1, va("cp \"Self Destruct sequence aborted.\""));
|
||||
else
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct sequence aborted.\""));
|
||||
G_AddEvent(ent, EV_GLOBAL_SOUND, G_SoundIndex("sound/voice/selfdestruct/abort.mp3"));
|
||||
//set wait to -1...
|
||||
ent->wait = -1;
|
||||
//and arrange for a think in a sec
|
||||
ent->nextthink = level.time + 1000;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2692,32 +2697,8 @@ void target_selfdestruct_think(gentity_t *ent) {
|
|||
//The first is the intervall-warning-loop
|
||||
//We're doing this to give a new warning, so let's do that. I'll need to do a language switch here sometime...
|
||||
ETAsec = floor(modf((ent->wait / 60000), &ETAmin)*60);
|
||||
if (ent->flags == 1) {
|
||||
if (ETAmin > 1) { // stating minutes
|
||||
if (ETAsec > 1) // stating seconds
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minutes and %.0f seconds.\"", ETAmin, ETAsec ));
|
||||
if (ETAsec == 1) // stating second
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minutes and %.0f second.\"", ETAmin, ETAsec ));
|
||||
if (ETAsec == 0) // stating minutes only
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minutes.\"", ETAmin ));
|
||||
}
|
||||
if (ETAmin == 1) { // stating minutes
|
||||
if (ETAsec > 1) // stating seconds
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minute and %.0f seconds.\"", ETAmin, ETAsec ));
|
||||
if (ETAsec == 1) // stating second
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minute and %.0f second.\"", ETAmin, ETAsec ));
|
||||
if (ETAsec == 0) // stating minutes only
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minute.\"", ETAmin ));
|
||||
}
|
||||
if (ETAmin == 0) { // stating minutes
|
||||
if (ETAsec > 1) // stating seconds
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f seconds.\"", ETAsec ));
|
||||
if (ETAsec == 1) // stating second
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f second.\"", ETAsec ));
|
||||
if (ETAsec == 0) // savety measure only
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct executing.\""));
|
||||
}
|
||||
}
|
||||
if (ent->flags == 1)
|
||||
trap_SendServerCommand( -1, va("servermsg \"^1Self Destruct in %.0f:%2.0f\"", ETAmin, ETAsec ));
|
||||
|
||||
// with that out of the way let's set the next think
|
||||
if (ent->wait > 60000 ) {
|
||||
|
@ -2744,8 +2725,8 @@ void target_selfdestruct_think(gentity_t *ent) {
|
|||
} else if (ent->wait == 0) { //bang time ^^
|
||||
//I've reconsidered. Selfdestruct will fire it's death mode no matter what. Targets are for FX-Stuff.
|
||||
healthEnt = G_Find(NULL, FOFS(classname), "target_shiphealth");
|
||||
if(healthEnt){
|
||||
healthEnt->damage = healthEnt->health + healthEnt->splashRadius; //let's use the healthent killfunc if we have one. makes a lot of stuff easier.
|
||||
if(healthEnt && G_Find(healthEnt, FOFS(classname), "target_shiphealth") == NULL ){
|
||||
healthEnt->damage = healthEnt->health + healthEnt->splashRadius; //let's use the healthent killfunc if we have just one. makes a lot of stuff easier.
|
||||
healthEnt->use(healthEnt, NULL, NULL);
|
||||
}else{
|
||||
int num;
|
||||
|
@ -2785,6 +2766,86 @@ void target_selfdestruct_think(gentity_t *ent) {
|
|||
}
|
||||
}
|
||||
|
||||
void target_selfdestructcountdown_think(gentity_t *ent) {
|
||||
gentity_t* client;
|
||||
gentity_t *healthEnt, *safezone=NULL;
|
||||
double ETAmin, ETAsec, temp = 0.0f;
|
||||
int i = 0;
|
||||
|
||||
//this is for calling the safezones to list. It needs to stand here to not screw up the remainder of the think.
|
||||
if (ent->wait == 50) {
|
||||
while ((safezone = G_Find( safezone, FOFS( classname ), "target_safezone" )) != NULL ){
|
||||
if(!Q_stricmp(safezone->targetname, ent->bluename))//free shipwide safezone if it exists
|
||||
G_FreeEntity(safezone);
|
||||
else
|
||||
safezone->use(safezone, ent, ent);
|
||||
}
|
||||
ent->wait = 0;
|
||||
ent->nextthink = level.time + 50;
|
||||
return;
|
||||
}
|
||||
|
||||
temp = ent->wait - 100;
|
||||
ent->wait = temp;
|
||||
|
||||
if (ent->wait > 0){
|
||||
ETAsec = modf((ent->wait / 60000), &ETAmin)*60;
|
||||
trap_SendServerCommand( -1, va("cp \"^1Self Destruct in %1.0f:%2.1f\"", ETAmin, ETAsec ));
|
||||
ent->nextthink = level.time + 100;
|
||||
|
||||
if (ent->nextthink == ent->damage){
|
||||
//we need to get the safezones operational and it is highly unlikely that it'll happen in the last .05 secs of the count
|
||||
ent->nextthink = ent->nextthink - 50;
|
||||
ent->wait = 50;
|
||||
}
|
||||
|
||||
} else if (ent->wait == 0) { //bang time ^^
|
||||
//I've reconsidered. Selfdestruct will fire it's death mode no matter what. Targets are for FX-Stuff.
|
||||
healthEnt = G_Find(NULL, FOFS(classname), "target_shiphealth");
|
||||
if(healthEnt && G_Find(healthEnt, FOFS(classname), "target_shiphealth") == NULL ){
|
||||
healthEnt->damage = healthEnt->health + healthEnt->splashRadius; //let's use the healthent killfunc if we have just one. makes a lot of stuff easier.
|
||||
healthEnt->use(healthEnt, NULL, NULL);
|
||||
}else{
|
||||
int num;
|
||||
gentity_t *ents[MAX_GENTITIES];
|
||||
|
||||
|
||||
num = target_selfdestruct_get_unsafe_players(ents);
|
||||
|
||||
//Loop trough all clients on the server.
|
||||
for(i = 0; i < num; i++) {
|
||||
client = ents[i];
|
||||
G_Damage (client, ent, ent, 0, 0, 999999, 0, MOD_TRIGGER_HURT); //maybe a new message ala "[Charname] did not abandon ship."
|
||||
}
|
||||
//let's hear it
|
||||
G_AddEvent(ent, EV_GLOBAL_SOUND, G_SoundIndex("sound/weapons/explosions/explode2.wav"));
|
||||
//let's be shakey for a sec... I hope lol ^^
|
||||
trap_SetConfigstring( CS_CAMERA_SHAKE, va( "%i %i", 9999, ( 1000 + ( level.time - level.startTime ) ) ) );
|
||||
//let's clear the lower right corner or the center... depends
|
||||
if(ent->spawnflags & 2)
|
||||
trap_SendServerCommand( -1, va("cp \" \""));
|
||||
else
|
||||
trap_SendServerCommand( -1, va("servermsg \" \""));
|
||||
}
|
||||
if(ent->target)
|
||||
G_UseTargets(ent, ent);
|
||||
//we're done here so let's finish up in a sec.
|
||||
ent->wait = -1;
|
||||
ent->nextthink = level.time + 1000;
|
||||
return;
|
||||
} else if (ent->wait < 0) {
|
||||
|
||||
//we have aborted and the note should be out or ended and everyone should be dead so let's reset
|
||||
ent->nextthink = -1;
|
||||
ent->wait = ent->splashDamage;
|
||||
//free ent if it was command-spawned
|
||||
if (ent->spawnflags & 1)
|
||||
G_FreeEntity(ent);
|
||||
|
||||
return; //And we're done.
|
||||
}
|
||||
}
|
||||
|
||||
void SP_target_selfdestruct(gentity_t *ent) {
|
||||
double ETAmin, ETAsec;
|
||||
float temp;
|
||||
|
@ -2812,59 +2873,16 @@ void SP_target_selfdestruct(gentity_t *ent) {
|
|||
ent->damage = ent->wait + level.time;
|
||||
|
||||
//time's set so let's let everyone know that we're counting. I'll need to do a language switch here sometime...
|
||||
ETAsec = floor(modf((ent->wait / 60000), &ETAmin)*60);
|
||||
if (ent->flags == 1) {
|
||||
if (ETAmin > 1) { // stating minutes
|
||||
if (ETAsec > 1) // stating seconds
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minutes and %.0f seconds.\"", ETAmin, ETAsec ));
|
||||
if (ETAsec == 1) // stating second
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minutes and %.0f second.\"", ETAmin, ETAsec ));
|
||||
if (ETAsec == 0) // stating minutes only
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minutes.\"", ETAmin ));
|
||||
}
|
||||
if (ETAmin == 1) { // stating minutes
|
||||
if (ETAsec > 1) // stating seconds
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minute and %.0f seconds.\"", ETAmin, ETAsec ));
|
||||
if (ETAsec == 1) // stating second
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minute and %.0f second.\"", ETAmin, ETAsec ));
|
||||
if (ETAsec == 0) // stating minutes only
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minute.\"", ETAmin ));
|
||||
}
|
||||
if (ETAmin == 0) { // stating minutes
|
||||
if (ETAsec > 1) // stating seconds
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f seconds.\"", ETAsec ));
|
||||
if (ETAsec == 1) // stating second
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f second.\"", ETAsec ));
|
||||
if (ETAsec == 0) // savety measure only
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct executing.\""));
|
||||
}
|
||||
if(ent->spawnflags & 2){ // we're extreme
|
||||
ETAsec = modf((ent->wait / 60000), &ETAmin)*60;
|
||||
trap_SendServerCommand( -1, va("cp \"^1Self Destruct in %1.0f:%2.1f\"", ETAmin, ETAsec ));
|
||||
} else {
|
||||
if (ETAmin > 1) { // stating minutes
|
||||
if (ETAsec > 1) // stating seconds
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minutes and %.0f seconds. There will be no further audio warnings.\"", ETAmin, ETAsec ));
|
||||
if (ETAsec == 1) // stating second
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minutes and %.0f second. There will be no further audio warnings.\"", ETAmin, ETAsec ));
|
||||
if (ETAsec == 0) // stating minutes only
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minutes. There will be no further audio warnings.\"", ETAmin ));
|
||||
}
|
||||
if (ETAmin == 1) { // stating minutes
|
||||
if (ETAsec > 1) // stating seconds
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minute and %.0f seconds. There will be no further audio warnings.\"", ETAmin, ETAsec ));
|
||||
if (ETAsec == 1) // stating second
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minute and %.0f second. There will be no further audio warnings.\"", ETAmin, ETAsec ));
|
||||
if (ETAsec == 0) // stating minutes only
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f minute. There will be no further audio warnings.\"", ETAmin ));
|
||||
}
|
||||
if (ETAmin == 0) { // stating minutes
|
||||
if (ETAsec > 1) // stating seconds
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f seconds. There will be no further audio warnings.\"", ETAsec ));
|
||||
if (ETAsec == 1) // stating second
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct in %.0f second. There will be no further audio warnings.\"", ETAsec ));
|
||||
if (ETAsec == 0) // savety measure only
|
||||
trap_SendServerCommand( -1, va("servermsg \"Self Destruct executing.\""));
|
||||
}
|
||||
}
|
||||
|
||||
ETAsec = floor(modf((ent->wait / 60000), &ETAmin)*60);
|
||||
if (ent->flags == 1)
|
||||
trap_SendServerCommand( -1, va("servermsg \"^1Self Destruct in %.0f:%2.0f\"", ETAmin, ETAsec ));
|
||||
else
|
||||
trap_SendServerCommand( -1, va("servermsg \"^1Self Destruct in %.0f:%2.0f; There will be no further audio warnings.\"", ETAmin, ETAsec ));
|
||||
}
|
||||
ent->r.svFlags |= SVF_BROADCAST;
|
||||
trap_LinkEntity(ent);
|
||||
|
||||
|
@ -2893,16 +2911,23 @@ void SP_target_selfdestruct(gentity_t *ent) {
|
|||
// Now all that's left is to plan the next think.
|
||||
|
||||
ent->use = target_selfdestruct_use;
|
||||
ent->think = target_selfdestruct_think;
|
||||
if(ent->spawnflags & 2)
|
||||
ent->think = target_selfdestructcountdown_think;
|
||||
else
|
||||
ent->think = target_selfdestruct_think;
|
||||
|
||||
// we have 3 different intervalls so we need to do some if's based on the to-be-updated duration...
|
||||
if (ent->wait > 60000 ) {
|
||||
ent->nextthink = level.time + ent->count;
|
||||
if(ent->spawnflags & 2){
|
||||
ent->nextthink = level.time + 100;
|
||||
} else {
|
||||
if (ent->wait > 10000 ) {
|
||||
ent->nextthink = level.time + ent->n00bCount;
|
||||
if (ent->wait > 60000 ) {
|
||||
ent->nextthink = level.time + ent->count;
|
||||
} else {
|
||||
ent->nextthink = level.time + ent->health;
|
||||
if (ent->wait > 10000 ) {
|
||||
ent->nextthink = level.time + ent->n00bCount;
|
||||
} else {
|
||||
ent->nextthink = level.time + ent->health;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue