From: MirceaKitsune Date: Sat, 3 Mar 2012 18:59:18 +0000 (+0200) Subject: Fix and improve the final touches for footstep earthquakes X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=5438fdd847fc2ecf3c0d6894579b39d2444390db;hp=7f8e42d33ae70d5581bb79e3ee1838fe7c5364c2;p=voretournament%2Fvoretournament.git Fix and improve the final touches for footstep earthquakes --- diff --git a/data/qcsrc/server/sv_main.qc b/data/qcsrc/server/sv_main.qc index 3bf49db9..fd754514 100644 --- a/data/qcsrc/server/sv_main.qc +++ b/data/qcsrc/server/sv_main.qc @@ -115,23 +115,29 @@ void CreatureFrame (void) GlobalSound(globalsound_step, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, bound(0, VOL_BASE * (1 - playersize_micro(self)), 1)); sound(self, CHAN_AUTO, "misc/macro_footstep.wav", bound(0, VOL_BASE * playersize_macro(self), 1), ATTN_NORM); - entity head; - for(head = findradius(self.origin, cvar("g_healthsize_quake_step_radius")); head; head = head.chain) + // earthquake effect for nearby players when a macro walks by + if(cvar("g_healthsize_quake_step")) { - if(head.classname != "player") - continue; - - float shake; - shake = vlen(head.origin - self.origin); - if(shake) - shake = 1 - (shake / cvar("g_healthsize_quake_step_radius")); - shake *= cvar("g_healthsize_quake_step"); - - head.punchvector_x += crandom() * shake; - head.punchvector_y += crandom() * shake; - head.punchvector_z += crandom() * shake; - - dprint(strcat(head.netname, " | ", ftos(shake), " --------\n")); + entity head; + for(head = findradius(self.origin, cvar("g_healthsize_quake_step_radius")); head; head = head.chain) + { + if not(head.classname == "player") + continue; + if(head == self) + continue; // not for self + if not(head.flags & FL_ONGROUND) + continue; // we only feel the ground shaking if we are sitting on it + + float shake; + shake = vlen(head.origin - self.origin); + if(shake) + shake = 1 - bound(0, shake / cvar("g_healthsize_quake_step_radius"), 1); + shake *= cvar("g_healthsize_quake_step"); + + head.punchvector_x += crandom() * shake; + head.punchvector_y += crandom() * shake; + head.punchvector_z += crandom() * shake; + } } } else diff --git a/docs/TODO.txt b/docs/TODO.txt index 84daab6d..eb6f5f62 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -134,4 +134,4 @@ - 0.7 BUG: Disabling g_healthsize gives a different field of view, even at 100 heatlh -- 0.7 | 0.8: Add an earthquake effect for the giantess footsteps? \ No newline at end of file +- 0.7 | 0.8: The macro earthquake effect does not work for spectators who are spectating a player, because fl_onground needs to be bhack for the spectated player, not the spectator \ No newline at end of file