]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make particle count and intensity of impact sound depend on the impact speed
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 27 Oct 2011 10:48:31 +0000 (13:48 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 27 Oct 2011 10:48:31 +0000 (13:48 +0300)
defaultXonotic.cfg
effectinfo.txt
qcsrc/server/autocvars.qh
qcsrc/server/mutators/sandbox.qc

index 76be8f9cb19166425641e96de44d7cff1e8299c1..d0de6f89b0a964892d576a29832fef1b4cb05fa3 100644 (file)
@@ -547,7 +547,8 @@ set g_sandbox_editor_distance_spawn 200 "distance at which objects spawn in fron
 set g_sandbox_editor_distance_edit 350 "distance at which players can edit or remove objects they are looking at"
 set g_sandbox_object_scale_min 0.1 "minimum scale that objects can be set to"
 set g_sandbox_object_scale_max 2 "maximum scale that objects can be set to"
-set g_sandbox_object_matvel 200 "velocity objects must have while colliding for material effects to be applied"
+set g_sandbox_object_material_velocity_min 200 "velocity objects must have while colliding for material effects to be applied"
+set g_sandbox_object_material_velocity_factor 0.002 "velocity range which decides the intensity of material effects"
 
 seta menu_sandbox_spawn_model "" // used to store the model in the input field
 seta menu_sandbox_edit_skin 0
index 06e097331291dcd555043ab1f37399f4534ae36d..610ae1a23979d0df5498156e83de76f8acd964c8 100644 (file)
@@ -6411,7 +6411,7 @@ rotate -180 180 -20 20
 // metal impact effect
 // used in qcsrc/server/mutators/sandbox.qc:   pointparticles(particleeffectnum("impact_metal"), self.origin, '0 0 0', 1);
 effect impact_metal
-countabsolute 5
+countabsolute 1
 type alphastatic
 tex 0 8
 size 3 6
@@ -6422,7 +6422,7 @@ color 0x000000 0x886666
 originjitter 20 20 5
 // sparks
 effect impact_metal
-count 10
+count 2
 type spark
 tex 41 41
 color 0xFFCC22 0xFF4422
@@ -6438,7 +6438,7 @@ gravity 1
 // stone impact effect
 // used in qcsrc/server/mutators/sandbox.qc:   pointparticles(particleeffectnum("impact_stone"), self.origin, '0 0 0', 1);
 effect impact_stone
-countabsolute 5
+countabsolute 1
 type alphastatic
 tex 0 8
 size 3 6
@@ -6450,7 +6450,7 @@ originjitter 20 20 5
 // debris
 effect impact_stone
 notunderwater
-count 5
+count 2
 type alphastatic
 tex 66 68
 color 0x000000 0x886644
@@ -6465,7 +6465,7 @@ rotate -180 180 -1000 1000
 // wood impact effect
 // used in qcsrc/server/mutators/sandbox.qc:   pointparticles(particleeffectnum("impact_wood"), self.origin, '0 0 0', 1);
 effect impact_wood
-countabsolute 5
+countabsolute 1
 type alphastatic
 tex 0 8
 size 3 6
@@ -6476,7 +6476,7 @@ color 0x000000 0xcc9966
 originjitter 20 20 5
 // sparks
 effect impact_wood
-count 10
+count 2
 type spark
 tex 41 41
 color 0x221100 0x221100
@@ -6491,7 +6491,7 @@ gravity 1
 // flesh impact effect
 // used in qcsrc/server/mutators/sandbox.qc:   pointparticles(particleeffectnum("impact_flesh"), self.origin, '0 0 0', 1);
 effect impact_flesh
-countabsolute 1
+countabsolute 0.5
 type alphastatic
 tex 0 8
 size 8 12
@@ -6500,7 +6500,7 @@ color 0x000000 0x420000
 originjitter 11 11 11
 // blood splash
 effect impact_flesh
-count 3
+count 0.3
 type blood
 tex 24 32
 size 2 6
index 6a503d38c054eea2842a783b64207fa15df6d384..f764502b493c25f00e40aeafc11ce46f929d1f44 100644 (file)
@@ -1204,4 +1204,5 @@ float autocvar_g_sandbox_editor_distance_spawn;
 float autocvar_g_sandbox_editor_distance_edit;
 float autocvar_g_sandbox_object_scale_min;
 float autocvar_g_sandbox_object_scale_max;
-float autocvar_g_sandbox_object_matvel;
+float autocvar_g_sandbox_object_material_velocity_min;
+float autocvar_g_sandbox_object_material_velocity_factor;
index 971b0ab3b1b48c34e93698e9cd3b7e2318e789ae..1dab4fb2b89896731967f44568339161cedc5c11 100644 (file)
@@ -15,26 +15,30 @@ void sandbox_Object_Touch()
        if(self.touch_timer > time)
                return; // don't execute each frame
        self.touch_timer = time + 0.1;
-       if not(vlen(self.velocity) >= autocvar_g_sandbox_object_matvel || vlen(other.velocity) >= autocvar_g_sandbox_object_matvel)
+       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
 
+       float intensity;
+       intensity = (vlen(self.velocity) + vlen(other.velocity)) / 2;
+       intensity = bound(0, intensity * autocvar_g_sandbox_object_material_velocity_factor, 1);
+
        switch(self.material)
        {
                case MATERIAL_METAL:
-                       sound(self, CH_TRIGGER, strcat("object/impact_metal_", ftos(ceil(random() * 5)) , ".ogg"), VOL_BASE, ATTN_NORM);
-                       pointparticles(particleeffectnum("impact_metal"), self.origin, '0 0 0', 1);
+                       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
                        break;
                case MATERIAL_STONE:
-                       sound(self, CH_TRIGGER, strcat("object/impact_stone_", ftos(ceil(random() * 5)) , ".ogg"), VOL_BASE, ATTN_NORM);
-                       pointparticles(particleeffectnum("impact_stone"), self.origin, '0 0 0', 1);
+                       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
                        break;
                case MATERIAL_WOOD:
-                       sound(self, CH_TRIGGER, strcat("object/impact_wood_", ftos(ceil(random() * 5)) , ".ogg"), VOL_BASE, ATTN_NORM);
-                       pointparticles(particleeffectnum("impact_wood"), self.origin, '0 0 0', 1);
+                       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
                        break;
                case MATERIAL_FLESH:
-                       sound(self, CH_TRIGGER, strcat("object/impact_flesh_", ftos(ceil(random() * 5)) , ".ogg"), VOL_BASE, ATTN_NORM);
-                       pointparticles(particleeffectnum("impact_flesh"), self.origin, '0 0 0', 1);
+                       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
                        break;
                default:
                        break;