From: Mario Date: Sun, 30 Aug 2015 13:49:02 +0000 (+1000) Subject: Add a hook for custom gameplay tips X-Git-Tag: xonotic-v0.8.2~1945 X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=ab75a0c81ec24ce18e013db2dd03fc1bb96f431e;p=xonotic%2Fxonotic-data.pk3dir.git Add a hook for custom gameplay tips --- diff --git a/qcsrc/common/mutators/events.qh b/qcsrc/common/mutators/events.qh index eb46486b6..8a5c153ad 100644 --- a/qcsrc/common/mutators/events.qh +++ b/qcsrc/common/mutators/events.qh @@ -39,4 +39,11 @@ MUTATOR_HOOKABLE(BuildMutatorsString, EV_BuildMutatorsString); /**/ MUTATOR_HOOKABLE(BuildMutatorsPrettyString, EV_BuildMutatorsPrettyString); +/** appends mutator string for displaying extra gameplay tips */ +#define EV_BuildGameplayTipsString(i, o) \ + /**/ i(string, ret_string) \ + /**/ o(string, ret_string) \ + /**/ +MUTATOR_HOOKABLE(BuildGameplayTipsString, EV_BuildGameplayTipsString); + #endif diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 3621f7214..b41ebaca9 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -344,6 +344,12 @@ string getwelcomemessage(void) s = strcat(s, "\n\n^8special gameplay tips: ^7", cache_mutatormsg); } + string mutator_msg = ""; + MUTATOR_CALLHOOK(BuildGameplayTipsString, mutator_msg); + mutator_msg = ret_string; + + s = strcat(s, mutator_msg); // trust that the mutator will do proper formatting + motd = autocvar_sv_motd; if (motd != "") { s = strcat(s, "\n\n^8MOTD: ^7", strreplace("\\n", "\n", motd));