]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add some more useful hooks
authorMario <mario@smbclan.net>
Wed, 28 Oct 2015 06:26:04 +0000 (16:26 +1000)
committerMario <mario@smbclan.net>
Wed, 28 Oct 2015 06:26:04 +0000 (16:26 +1000)
qcsrc/client/announcer.qc
qcsrc/client/main.qc
qcsrc/client/mutators/events.qh
qcsrc/common/notifications.qc
qcsrc/server/cl_client.qc
qcsrc/server/mutators/events.qh

index e20557fa741300f05bb7dfd5027a7832f5b70638..2ad1c67c15dbd091785cacff94abed3e9934878b 100644 (file)
@@ -1,10 +1,20 @@
 #include "announcer.qh"
 
+#include "mutators/events.qh"
+
 #include "../common/notifications.qh"
 #include "../common/stats.qh"
 
 bool announcer_1min;
 bool announcer_5min;
+string AnnouncerOption()
+{
+       if(MUTATOR_CALLHOOK(AnnouncerOption, ret_string))
+               return ret_string;
+
+       return autocvar_cl_announcer;
+}
+
 void Announcer_Countdown()
 {
        SELFPARAM();
index 0f84b7fd8258d06c846d2efa772e5eb8dbb4f61d..9d20c406197b3b99fbe874c02bac808248df679b 100644 (file)
@@ -1037,6 +1037,8 @@ void Ent_Init()
        g_trueaim_minrange = ReadCoord();
        g_balance_porto_secondary = ReadByte();
 
+       MUTATOR_CALLHOOK(Ent_Init);
+
        if(!postinit)
                PostInit();
 }
index 678d7ca665edbbae75034e76729cc7f51e7cee20..2fbeaaa7c15299b35ecf853ac4bfb137c8e0fd58 100644 (file)
@@ -129,4 +129,11 @@ MUTATOR_HOOKABLE(PlayerJump, EV_PlayerJump);
        /**/
 MUTATOR_HOOKABLE(WantEventchase, EV_WantEventchase);
 
+#define EV_AnnouncerOption(i, o) \
+       /**/ i(string, ret_string) \
+       /**/ o(string, ret_string) \
+       /**/
+MUTATOR_HOOKABLE(AnnouncerOption, EV_AnnouncerOption);
+
+MUTATOR_HOOKABLE(Ent_Init, EV_NO_ARGS);
 #endif
index 811e7007c63e21b69548a607de73d3918698efa2..9a83eebb5d97b24cd19504db0f586b6c8e3ddd6d 100644 (file)
@@ -595,7 +595,7 @@ void Create_Notification_Entity(
                                {
                                        if(notif.nent_enabled)
                                        {
-                                               precache_sound(sprintf("announcer/%s/%s.wav", autocvar_cl_announcer, snd));
+                                               precache_sound(sprintf("announcer/%s/%s.wav", AnnouncerOption(), snd));
                                                notif.nent_channel = channel;
                                                notif.nent_snd = strzone(snd);
                                                notif.nent_vol = vol;
@@ -1276,7 +1276,7 @@ void Local_Notification_sound(
                        soundchannel,
                        sprintf(
                                "announcer/%s/%s.wav",
-                               autocvar_cl_announcer,
+                               AnnouncerOption(),
                                soundfile
                        ),
                        soundvolume,
@@ -1289,7 +1289,7 @@ void Local_Notification_sound(
                        soundchannel,
                        sprintf(
                                "announcer/%s/%s.wav",
-                               autocvar_cl_announcer,
+                               AnnouncerOption(),
                                soundfile
                        ),
                        soundvolume,
@@ -1311,7 +1311,7 @@ void Local_Notification_sound(
                        soundchannel,
                        sprintf(
                                "announcer/%s/%s.wav",
-                               autocvar_cl_announcer,
+                               AnnouncerOption(),
                                soundfile
                        ),
                        soundvolume,
index d6522285ba23ad4b8be05931c73c7d6042c43d63..cfc058b845cd10360659fd732b31fce16edbd25b 100644 (file)
@@ -650,6 +650,8 @@ bool ClientInit_SendEntity(entity this, entity to, int sf)
        WriteByte(MSG_ENTITY, WEP_CVAR_SEC(hagar, load_max)); // hagar max loadable rockets // WEAPONTODO
        WriteCoord(MSG_ENTITY, autocvar_g_trueaim_minrange);
        WriteByte(MSG_ENTITY, WEP_CVAR(porto, secondary)); // WEAPONTODO
+
+       MUTATOR_CALLHOOK(Ent_Init);
        return true;
 }
 
index 2d9e75b94efc96b392939c5ee57e35d3618566b1..50021ae2d4042b9bae1ae626bc05e37157928e6b 100644 (file)
@@ -811,4 +811,6 @@ MUTATOR_HOOKABLE(TurretValidateTarget, EV_TurretValidateTarget);
     /**/ i(entity, __self) \
     /**/
 MUTATOR_HOOKABLE(TurretThink, EV_TurretThink);
+
+MUTATOR_HOOKABLE(Ent_Init, EV_NO_ARGS);
 #endif