+#include "common.qh"
#include <common/command/command.qh>
#include "common.qh"
#include "../scores.qh"
#include <common/monsters/all.qh>
-#include <common/notifications.qh>
+#include <common/notifications/all.qh>
#include <lib/warpzone/common.qh>
// ==========================================
// used by CommonCommand_timeout() and CommonCommand_timein() to handle game pausing and messaging and such.
-void timeout_handler_reset()
+void timeout_handler_reset(entity this)
{
- SELFPARAM();
- timeout_caller = world;
+ timeout_caller = NULL;
timeout_time = 0;
timeout_leadtime = 0;
- remove(self);
+ remove(this);
}
-void timeout_handler_think()
+void timeout_handler_think(entity this)
{
- SELFPARAM();
switch (timeout_status)
{
case TIMEOUT_ACTIVE:
if (timeout_time == autocvar_sv_timeout_resumetime) // play a warning sound when only <sv_timeout_resumetime> seconds are left
Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_PREPARE);
- self.nextthink = time + TIMEOUT_SLOWMO_VALUE; // think again in one second
+ this.nextthink = time + TIMEOUT_SLOWMO_VALUE; // think again in one second
timeout_time -= 1; // decrease the time counter
}
else // time to end the timeout
it.fixangle = false;
));
- timeout_handler_reset();
+ timeout_handler_reset(this);
}
return;
{
Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_TIMEOUT_BEGINNING, timeout_leadtime);
- self.nextthink = time + 1; // think again in one second
+ this.nextthink = time + 1; // think again in one second
timeout_leadtime -= 1; // decrease the time counter
}
else // time to begin the timeout
it.lastV_angle = it.v_angle;
));
- self.nextthink = time; // think again next frame to handle it under TIMEOUT_ACTIVE code
+ this.nextthink = time; // think again next frame to handle it under TIMEOUT_ACTIVE code
}
return;
case TIMEOUT_INACTIVE:
default:
{
- timeout_handler_reset();
+ timeout_handler_reset(this);
return;
}
}
void CommonCommand_editmob(int request, entity caller, int argc)
{
- SELFPARAM();
switch (request)
{
case CMD_REQUEST_COMMAND:
int moveflag, tmp_moncount = 0;
string arg_lower = strtolower(argument);
moveflag = (argv(3)) ? stof(argv(3)) : 1; // follow owner if not defined
- ret_string = "Monster spawning is currently disabled by a mutator";
if (arg_lower == "list") { print_to(caller, monsterlist_reply); return; }
if (!autocvar_g_monsters) { print_to(caller, "Monsters are disabled"); return; }
if (autocvar_g_monsters_max <= 0 || autocvar_g_monsters_max_perplayer <= 0) { print_to(caller, "Monster spawning is disabled"); return; }
if (!IS_PLAYER(caller)) { print_to(caller, "You must be playing to spawn a monster"); return; }
- if (MUTATOR_CALLHOOK(AllowMobSpawning)) { print_to(caller, ret_string); return; }
+ if (MUTATOR_CALLHOOK(AllowMobSpawning, caller)) { print_to(caller, M_ARGV(1, string)); return; }
if (caller.vehicle) { print_to(caller, "You can't spawn monsters while driving a vehicle"); return; }
if (STAT(FROZEN, caller)) { print_to(caller, "You can't spawn monsters while frozen"); return; }
if (IS_DEAD(caller)) { print_to(caller, "You can't spawn monsters while dead"); return; }
case "butcher":
{
if (caller) { print_to(caller, "This command is not available to players"); return; }
- if (MUTATOR_CALLHOOK(AllowMobButcher)) { LOG_INFO(ret_string, "\n"); return; }
+ if (MUTATOR_CALLHOOK(AllowMobButcher)) { LOG_INFO(M_ARGV(0, string), "\n"); return; }
int tmp_remcount = 0;
{
string command = builtin_cvar_string(strcat("sv_info_", argv(1)));
- if (command) wordwrap_sprint(command, 1000);
+ if (command) wordwrap_sprint(caller, command, 1000);
else print_to(caller, "ERROR: unsupported info command");
return; // never fall through to usage
timeout_leadtime = autocvar_sv_timeout_leadtime;
timeout_handler = spawn();
- timeout_handler.think = timeout_handler_think;
+ setthink(timeout_handler, timeout_handler_think);
timeout_handler.nextthink = time; // always let the entity think asap
Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_TIMEOUT);