]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Initialize func_breakable sound on connect.
authorRudolf Polzer <divverent@xonotic.org>
Sat, 21 Feb 2015 15:03:44 +0000 (16:03 +0100)
committerRudolf Polzer <divverent@xonotic.org>
Sat, 21 Feb 2015 15:03:44 +0000 (16:03 +0100)
qcsrc/server/cl_client.qc
qcsrc/server/defs.qh
qcsrc/server/func_breakable.qc

index 405d558504a7399ae9b8d598049918cdb8a89a20..3bc5cc762f231b2e92f8df7dfdfe4b05e9d55bb1 100644 (file)
@@ -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);
 }
 /*
index 175179b50797d5a5ede5cffd8352f19eb602cfc3..822c5163c384c1476656d825ab0a009f549ac406 100644 (file)
@@ -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
index a8cca1e86a4f6d34cc922019d3e9e3d41bb7bbaa..127f6224106f159964cf0b1c92373575a829b1ed 100644 (file)
@@ -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();
 }