]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Minor cleanup for func_plat
authorFreddy <schro.sb@gmail.com>
Wed, 7 Mar 2018 16:55:12 +0000 (17:55 +0100)
committerFreddy <schro.sb@gmail.com>
Wed, 7 Mar 2018 16:55:12 +0000 (17:55 +0100)
qcsrc/common/triggers/func/plat.qc
qcsrc/common/triggers/platforms.qc

index d3f9587b832c79284139bc90eea34f747a2e366d..00d4f78d28b4d1dd55d8987a4fa9d36e91b54dae 100644 (file)
@@ -58,15 +58,19 @@ void plat_link(entity this)
 
 spawnfunc(func_plat)
 {
-       if (this.sounds == 0) this.sounds = 2;
-
        if (this.spawnflags & PLAT_CRUSH)
        {
                this.dmg = 10000;
        }
 
-    if (this.dmg && (this.message == "")) this.message = "was squished";
-    if (this.dmg && (this.message2 == "")) this.message2 = "was squished by";
+    if (this.dmg && (this.message == ""))
+       {
+               this.message = "was squished";
+       }
+    if (this.dmg && (this.message2 == ""))
+       {
+               this.message2 = "was squished by";
+       }
 
        if (this.sounds == 1)
        {
@@ -80,13 +84,20 @@ spawnfunc(func_plat)
                this.noise1 = "plats/medplat2.wav";
        }
 
+       // WARNING: backwards compatibility because people don't use already existing fields :(
        if (this.sound1)
                this.noise = this.sound1;
        if (this.sound2)
                this.noise1 = this.sound2;
 
-       if(this.noise && this.noise != "") { precache_sound(this.noise); }
-       if(this.noise1 && this.noise1 != "") { precache_sound(this.noise1); }
+       if(this.noise && this.noise != "")
+       {
+               precache_sound(this.noise);
+       }
+       if(this.noise1 && this.noise1 != "")
+       {
+               precache_sound(this.noise1);
+       }
 
        this.mangle = this.angles;
        this.angles = '0 0 0';
index 83664cc44fe704d2554d1f5589727008d29a7303..7acdc614e8ff489500e5b31a1e634f145749e8db 100644 (file)
@@ -173,6 +173,8 @@ void plat_use(entity this, entity actor, entity trigger)
        plat_go_down(this);
 }
 
+// WARNING: backwards compatibility because people don't use already existing fields :(
+// TODO: Check if any maps use these fields and remove these fields if it doesn't break maps
 .string sound1, sound2;
 
 void plat_reset(entity this)