#include "common.qh"
-#include <server/defs.qh>
-#include <server/miscfunctions.qh>
-
#include <common/command/_mod.qh>
-#include "common.qh"
-
-#include "../scores.qh"
-
+#include <common/deathtypes/all.qh>
#include <common/monsters/_mod.qh>
#include <common/notifications/all.qh>
+#include <common/stats.qh>
+#include <common/vehicles/all.qh>
+#include <common/weapons/_all.qh>
#include <lib/warpzone/common.qh>
+#include <server/campaign.qh>
+#include <server/chat.qh>
+#include <server/client.qh>
+#include <server/command/common.qh>
+#include <server/mutators/_mod.qh>
+#include <server/scores.qh>
+#include <server/world.qh>
// ====================================================
// if client return player nickname, or if server return admin nickname
string GetCallerName(entity caller)
{
- if (caller) return playername(caller, false);
+ if (caller) return playername(caller.netname, caller.team, false);
else return ((autocvar_sv_adminnick != "") ? autocvar_sv_adminnick : "SERVER ADMIN"); // autocvar_hostname
}
else return true;
}
-entity GetIndexedEntity(float argc, float start_index)
+entity GetIndexedEntity(int argc, float start_index)
{
entity selection;
float tmp_number, index;
if (timeout_time == autocvar_sv_timeout_resumetime) // play a warning sound when only <sv_timeout_resumetime> seconds are left
Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, ANNCE_PREPARE);
- this.nextthink = time + TIMEOUT_SLOWMO_VALUE; // think again in one second
+ //this.nextthink = time + TIMEOUT_SLOWMO_VALUE; // think again in one second
+ this.nextthink = time + 1;
timeout_time -= 1; // decrease the time counter
}
+ else if (timeout_time == -1) // infinite timer
+ {
+ Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_TIMEOUT_ONGOING);
+ this.nextthink = time + TIMEOUT_SLOWMO_VALUE;
+ }
else // time to end the timeout
{
Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_TIMEIN);
timeout_status = TIMEOUT_INACTIVE;
+ float total_time = time - timeout_last;
// reset the slowmo value back to normal
- cvar_set("slowmo", ftos(orig_slowmo));
+ // z411 TODO
+ //cvar_set("slowmo", ftos(orig_slowmo));
+
+ // Disable timeout and fix times
+ game_timeout = false;
+ timeout_total_time += total_time;
+ game_starttime += total_time;
+ if(round_handler && round_handler_GetEndTime() > 0)
+ round_handler.round_endtime += total_time;
+
+ LOG_INFOF("Timeout lasted %d secs", total_time);
// unlock the view for players so they can move around again
FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
timeout_status = TIMEOUT_ACTIVE;
// set the slowmo value to the timeout default slowmo value
- cvar_set("slowmo", ftos(TIMEOUT_SLOWMO_VALUE));
+ //cvar_set("slowmo", ftos(TIMEOUT_SLOWMO_VALUE));
+ game_timeout = true;
+ timeout_last = time;
+
+ // play timeout sound
+ sound(NULL, CH_INFO, SND_TIMEOUT, VOL_BASE, ATTN_NONE);
// reset all the flood variables
FOREACH_CLIENT(true, {
// Common commands used in both sv_cmd.qc and cmd.qc
// ===================================================
-void CommonCommand_cvar_changes(float request, entity caller)
+void CommonCommand_cvar_changes(int request, entity caller)
{
switch (request)
{
}
}
-void CommonCommand_cvar_purechanges(float request, entity caller)
+void CommonCommand_cvar_purechanges(int request, entity caller)
{
switch (request)
{
totalspawned += 1;
WarpZone_TraceBox(CENTER_OR_VIEWOFS(caller), caller.mins, caller.maxs, CENTER_OR_VIEWOFS(caller) + v_forward * 150, true, caller);
- mon = spawnmonster(spawn(), arg_lower, 0, caller, caller, trace_endpos, false, false, moveflag);
+ mon = spawnmonster(spawn(), arg_lower, MON_Null, caller, caller, trace_endpos, false, false, moveflag);
print_to(caller, strcat("Spawned ", mon.monster_name));
return;
}
if (mon.realowner != caller && autocvar_g_monsters_edit < 2) { print_to(caller, "This monster does not belong to you"); return; }
if (!is_visible) { print_to(caller, "You must look at your monster to edit it"); return; }
- Damage(mon, NULL, NULL, mon.health + mon.max_health + 200, DEATH_KILL.m_id, DMG_NOWEP, mon.origin, '0 0 0');
+ Damage(mon, NULL, NULL, GetResource(mon, RES_HEALTH) + mon.max_health + 200, DEATH_KILL.m_id, DMG_NOWEP, mon.origin, '0 0 0');
print_to(caller, strcat("Your pet '", mon.monster_name, "' has been brutally mutilated"));
return;
}
if (!autocvar_g_monsters_edit) { print_to(caller, "Monster editing is disabled"); return; }
if (!is_visible) { print_to(caller, "You must look at your monster to edit it"); return; }
if (mon.realowner != caller && autocvar_g_monsters_edit < 2) { print_to(caller, "This monster does not belong to you"); return; }
- if (mon.monsterid == MON_MAGE.monsterid) { print_to(caller, "Mage skins can't be changed"); return; } // TODO
+ if (mon.monsterdef == MON_MAGE) { print_to(caller, "Mage skins can't be changed"); return; } // TODO
mon.skin = stof(argument);
print_to(caller, strcat("Monster skin successfully changed to ", ftos(mon.skin)));
case "butcher":
{
if (caller) { print_to(caller, "This command is not available to players"); return; }
- if (MUTATOR_CALLHOOK(AllowMobButcher)) { LOG_INFOF("%s", M_ARGV(0, string)); return; }
+ if (MUTATOR_CALLHOOK(AllowMobButcher)) { LOG_INFO(M_ARGV(0, string)); return; }
int tmp_remcount = 0;
}
}
-void CommonCommand_info(float request, entity caller, float argc)
+void CommonCommand_info(int request, entity caller, int argc)
{
switch (request)
{
case CMD_REQUEST_COMMAND:
{
- string command = builtin_cvar_string(strcat("sv_info_", argv(1)));
+ string command = cvar_string(strcat("sv_info_", argv(1)));
if (command) wordwrap_sprint(caller, command, 1000);
else print_to(caller, "ERROR: unsupported info command");
}
}
-void CommonCommand_ladder(float request, entity caller)
+void CommonCommand_ladder(int request, entity caller)
{
switch (request)
{
}
}
-void CommonCommand_lsmaps(float request, entity caller)
+void CommonCommand_lsmaps(int request, entity caller)
{
switch (request)
{
}
}
-void CommonCommand_printmaplist(float request, entity caller)
+void CommonCommand_printmaplist(int request, entity caller)
{
switch (request)
{
}
}
-void CommonCommand_rankings(float request, entity caller)
+void CommonCommand_rankings(int request, entity caller)
{
switch (request)
{
}
}
-void CommonCommand_records(float request, entity caller)
+void CommonCommand_records(int request, entity caller)
{
switch (request)
{
}
}
-void CommonCommand_teamstatus(float request, entity caller)
+void CommonCommand_teamstatus(int request, entity caller)
{
switch (request)
{
}
}
-void CommonCommand_time(float request, entity caller)
+void CommonCommand_time(int request, entity caller)
{
switch (request)
{
print_to(caller, strcat("realtime = ", ftos(gettime(GETTIME_REALTIME))));
print_to(caller, strcat("hires = ", ftos(gettime(GETTIME_HIRES))));
print_to(caller, strcat("uptime = ", ftos(gettime(GETTIME_UPTIME))));
- print_to(caller, strcat("localtime = ", strftime(true, "%a %b %e %H:%M:%S %Z %Y")));
- print_to(caller, strcat("gmtime = ", strftime(false, "%a %b %e %H:%M:%S %Z %Y")));
+ print_to(caller, strcat("localtime = ", strftime(true, "%a %b %d %H:%M:%S %Z %Y")));
+ print_to(caller, strcat("gmtime = ", strftime(false, "%a %b %d %H:%M:%S %Z %Y")));
return;
}
}
}
-void CommonCommand_timein(float request, entity caller)
+void CommonCommand_timein(int request, entity caller)
{
switch (request)
{
{
timeout_time = autocvar_sv_timeout_resumetime;
timeout_handler.nextthink = time; // timeout_handler has to take care of it immediately
- bprint(strcat("^1Attention: ^7", GetCallerName(caller), " resumed the game! Prepare for battle!\n"));
+ bprint(strcat("\{1}^1Attention: ^7", GetCallerName(caller), " resumed the game! Prepare for battle!\n"));
return;
}
}
}
-void CommonCommand_timeout(float request, entity caller) // DEAR GOD THIS COMMAND IS TERRIBLE.
+void CommonCommand_timeout(int request, entity caller) // DEAR GOD THIS COMMAND IS TERRIBLE.
{
switch (request)
{
{
print_to(caller, "^7Error: You can not call a timeout while a vote is active.");
}
- else if (warmup_stage && !g_warmup_allow_timeout)
+ else if (warmup_stage && !autocvar_g_warmup_allow_timeout)
{
print_to(caller, "^7Error: You can not call a timeout in warmup-stage.");
}
{
if (caller) CS(caller).allowed_timeouts -= 1;
// write a bprint who started the timeout (and how many they have left)
- bprint(GetCallerName(caller), " ^7called a timeout", (caller ? strcat(" (", ftos(CS(caller).allowed_timeouts), " timeout(s) left)") : ""), "!\n");
+ bprint("\{1}", GetCallerName(caller), " ^7called a timeout", (caller ? strcat(" (", ftos(CS(caller).allowed_timeouts), " timeout(s) left)") : ""), "!\n");
timeout_status = TIMEOUT_LEADTIME;
timeout_caller = caller;
timeout_time = autocvar_sv_timeout_length;
timeout_leadtime = autocvar_sv_timeout_leadtime;
- timeout_handler = spawn();
+ timeout_handler = new(timeout_handler);
setthink(timeout_handler, timeout_handler_think);
timeout_handler.nextthink = time; // always let the entity think asap
-
+
Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, ANNCE_TIMEOUT);
}
}
}
}
-void CommonCommand_who(float request, entity caller, float argc)
+void CommonCommand_who(int request, entity caller, int argc)
{
switch (request)
{
/* use this when creating a new command, making sure to place it in alphabetical order... also,
** ADD ALL NEW COMMANDS TO commands.cfg WITH PROPER ALIASES IN THE SAME FASHION!
-void CommonCommand_(float request, entity caller)
+void CommonCommand_(int request, entity caller)
{
switch(request)
{