mirror of
https://github.com/UberGames/RPG-X2.git
synced 2025-02-01 04:40:42 +00:00
Added changes to target_levlchange suggested by Harry Young and
fixed a bug in it I discovered by doing so. Fixed a bug in target_serverchange.
This commit is contained in:
parent
2a5e54ae23
commit
e304aea758
2 changed files with 11 additions and 4 deletions
|
@ -2705,6 +2705,7 @@ Can be toggled by an usable if the usable has NO_ACTIVATOR spawnflag.
|
||||||
void target_serverchange_think(gentity_t *ent) {
|
void target_serverchange_think(gentity_t *ent) {
|
||||||
if(!ent->touched || !ent->touched->client) return;
|
if(!ent->touched || !ent->touched->client) return;
|
||||||
trap_SendServerCommand(ent->touched->client->ps.clientNum, va("cg_connect \"%s\"\n", ent->targetname2));
|
trap_SendServerCommand(ent->touched->client->ps.clientNum, va("cg_connect \"%s\"\n", ent->targetname2));
|
||||||
|
ent->nextthink = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void target_serverchange_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
|
void target_serverchange_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
|
||||||
|
@ -2768,14 +2769,16 @@ void SP_target_serverchange(gentity_t *ent) {
|
||||||
This will change the map if rpg_allowSPLevelChange is set to 1.
|
This will change the map if rpg_allowSPLevelChange is set to 1.
|
||||||
|
|
||||||
"target" map to load (for example: borg2)
|
"target" map to load (for example: borg2)
|
||||||
|
"wait" time to wait before levelchange (whole numbers only, -1 for intermediate levelchange, 0 for default = 5)
|
||||||
*/
|
*/
|
||||||
void target_levelchange_think(gentity_t *ent) {
|
void target_levelchange_think(gentity_t *ent) {
|
||||||
|
if(ent->count > 0) {
|
||||||
ent->count--;
|
ent->count--;
|
||||||
if(ent->count != 0)
|
|
||||||
trap_SendServerCommand(-1, va("servercprint \"Mapchange in %i ...\"", ent->count));
|
trap_SendServerCommand(-1, va("servercprint \"Mapchange in %i ...\"", ent->count));
|
||||||
else {
|
} else {
|
||||||
trap_SendConsoleCommand(EXEC_APPEND, va("devmap \"%s\"", ent->target));
|
trap_SendConsoleCommand(EXEC_APPEND, va("devmap \"%s\"", ent->target));
|
||||||
ent->nextthink = -1;
|
ent->nextthink = -1;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
ent->nextthink = level.time + 1000;
|
ent->nextthink = level.time + 1000;
|
||||||
}
|
}
|
||||||
|
@ -2784,7 +2787,6 @@ void target_levelchange_use(gentity_t *ent, gentity_t *other, gentity_t *activat
|
||||||
if(rpg_allowSPLevelChange.integer) {
|
if(rpg_allowSPLevelChange.integer) {
|
||||||
ent->think = target_levelchange_think;
|
ent->think = target_levelchange_think;
|
||||||
ent->nextthink = level.time + 1000;
|
ent->nextthink = level.time + 1000;
|
||||||
ent->count = 5;
|
|
||||||
trap_SendServerCommand(-1, va("servercprint \"Mapchange in %i ...\"", ent->count));
|
trap_SendServerCommand(-1, va("servercprint \"Mapchange in %i ...\"", ent->count));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2796,6 +2798,11 @@ void SP_target_levelchange(gentity_t *ent) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!ent->wait)
|
||||||
|
ent->count = 5;
|
||||||
|
if(ent->wait < -1)
|
||||||
|
ent->count = -1;
|
||||||
|
|
||||||
ent->use = target_levelchange_use;
|
ent->use = target_levelchange_use;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
stefgame.suo
BIN
stefgame.suo
Binary file not shown.
Loading…
Reference in a new issue