From: Rudolf Polzer Date: Sat, 21 Feb 2015 15:03:44 +0000 (+0100) Subject: Initialize func_breakable sound on connect. X-Git-Tag: xonotic-v0.8.1~113 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=033a393eb4a6f79405ad98cbf92cca7012d9e3eb;p=xonotic%2Fxonotic-data.pk3dir.git Initialize func_breakable sound on connect. --- diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 405d55850..3bc5cc762 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -1249,6 +1249,13 @@ void ClientConnect (void) if(IS_REAL_CLIENT(self)) sv_notice_join(); + for (entity e = world; (e = findfloat(e, init_for_player_needed, 1)); ) { + entity oldself = self; + self = e; + e.init_for_player(oldself); + self = oldself; + } + MUTATOR_CALLHOOK(ClientConnect); } /* diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 175179b50..822c5163c 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -623,4 +623,8 @@ const int MIF_GUIDED_TAG = 128; .string playernick; .float elos; .float ranks; + +.float init_for_player_needed; +.void(entity) init_for_player; + #endif diff --git a/qcsrc/server/func_breakable.qc b/qcsrc/server/func_breakable.qc index a8cca1e86..127f62241 100644 --- a/qcsrc/server/func_breakable.qc +++ b/qcsrc/server/func_breakable.qc @@ -142,6 +142,15 @@ void func_breakable_behave_restore() sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); } +void func_breakable_init_for_player(entity player) +{ + if (self.state == 0) + { + msg_entity = player; + soundto (MSG_ONE, self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); + } +} + void func_breakable_destroyed() { func_breakable_look_destroyed(); @@ -283,6 +292,9 @@ void spawnfunc_func_breakable() { self.reset = func_breakable_reset; func_breakable_reset(); + self.init_for_player_needed = 1; + self.init_for_player = func_breakable_init_for_player; + CSQCMODEL_AUTOINIT(); }