]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Particle count should always be a whole number. Also add a code comment
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 27 Oct 2011 10:54:57 +0000 (13:54 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 27 Oct 2011 10:54:57 +0000 (13:54 +0300)
qcsrc/server/mutators/sandbox.qc

index 1dab4fb2b89896731967f44568339161cedc5c11..9afe34ffb3c09ccd3a8270c744d30b9f44398e68 100644 (file)
@@ -18,6 +18,7 @@ void sandbox_Object_Touch()
        if not(vlen(self.velocity) > autocvar_g_sandbox_object_material_velocity_min || vlen(other.velocity) > autocvar_g_sandbox_object_material_velocity_min)
                return; // impact not strong enough
 
+       // make particle count and sound intensity depend on impact speed
        float intensity;
        intensity = (vlen(self.velocity) + vlen(other.velocity)) / 2;
        intensity = bound(0, intensity * autocvar_g_sandbox_object_material_velocity_factor, 1);
@@ -26,19 +27,19 @@ void sandbox_Object_Touch()
        {
                case MATERIAL_METAL:
                        sound(self, CH_TRIGGER, strcat("object/impact_metal_", ftos(ceil(random() * 5)) , ".ogg"), VOL_BASE * intensity, ATTN_NORM);
-                       pointparticles(particleeffectnum("impact_metal"), self.origin, '0 0 0', intensity * 10); // allow a count from 1 to 10
+                       pointparticles(particleeffectnum("impact_metal"), self.origin, '0 0 0', ceil(intensity * 10)); // allow a count from 1 to 10
                        break;
                case MATERIAL_STONE:
                        sound(self, CH_TRIGGER, strcat("object/impact_stone_", ftos(ceil(random() * 5)) , ".ogg"), VOL_BASE * intensity, ATTN_NORM);
-                       pointparticles(particleeffectnum("impact_stone"), self.origin, '0 0 0', intensity * 10); // allow a count from 1 to 10
+                       pointparticles(particleeffectnum("impact_stone"), self.origin, '0 0 0', ceil(intensity * 10)); // allow a count from 1 to 10
                        break;
                case MATERIAL_WOOD:
                        sound(self, CH_TRIGGER, strcat("object/impact_wood_", ftos(ceil(random() * 5)) , ".ogg"), VOL_BASE * intensity, ATTN_NORM);
-                       pointparticles(particleeffectnum("impact_wood"), self.origin, '0 0 0', intensity * 10); // allow a count from 1 to 10
+                       pointparticles(particleeffectnum("impact_wood"), self.origin, '0 0 0', ceil(intensity * 10)); // allow a count from 1 to 10
                        break;
                case MATERIAL_FLESH:
                        sound(self, CH_TRIGGER, strcat("object/impact_flesh_", ftos(ceil(random() * 5)) , ".ogg"), VOL_BASE * intensity, ATTN_NORM);
-                       pointparticles(particleeffectnum("impact_flesh"), self.origin, '0 0 0', intensity * 10); // allow a count from 1 to 10
+                       pointparticles(particleeffectnum("impact_flesh"), self.origin, '0 0 0', ceil(intensity * 10)); // allow a count from 1 to 10
                        break;
                default:
                        break;