]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Limit impact execution time to avoid sounds playing each frame. Impact sounds can...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 26 Oct 2011 16:19:44 +0000 (19:19 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 26 Oct 2011 16:19:44 +0000 (19:19 +0300)
defaultXonotic.cfg
qcsrc/server/mutators/sandbox.qc

index 1415cd8937185c0254ef0a8ddba1cfac70862c43..a5bf4d680ed92ffb7af641d3a8be99cc6bba8ed6 100644 (file)
@@ -547,7 +547,7 @@ 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 50 "velocity objects must have while coliding for material effects to be applied"
+set g_sandbox_object_matvel 200 "velocity objects must have while colliding for material effects to be applied"
 
 seta menu_sandbox_spawn_model "" // used to store the model in the input field
 seta menu_sandbox_edit_skin 0
index af39b1554b416fa88619531aef7d884da11ee68c..8015946618a6e9c9c97fb4cffa31ccf3b5deaf42 100644 (file)
@@ -28,10 +28,16 @@ void sandbox_EditObject_Scale(entity e, float f)
        }
 }
 
+.float touch_timer;
 void sandbox_Object_Touch()
 {
+       // apply material impact effects
+
+       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)
-               return;
+               return; // impact not strong enough
 
        switch(self.material)
        {