home *** CD-ROM | disk | FTP | other *** search
- /*
- ===========
- CheckFall
-
- called when a player jumps (higher than normal - heh)
- ============
- */
- void() CheckFall =
- {
- local float hgt;
- local float BASE_DMG;
- local string s;
-
- // this is how much damage is taken for each 10 feet fallen
-
- BASE_DMG = 5;
-
- // the following few lines inform the player how far s/he fell - I found
- // that 11 units approximately equals 1 foot
-
- hgt = (self.jump_flag + 300) / -11; // jump_flag is negative, thus -11
- sprint(self, "You fell ");
- s= ftos(hgt);
- sprint(self, s);
- sprint(self, " FT\n");
-
- /* the player can be hurt by falling into water, whether or not there is a
- hard surface beneath - try doing a belly flop from 40 feet up and you
- won't exactly be breathing easy for the next few seconds - heh heh */
-
- if (self.watertype == CONTENT_WATER)
- {
- sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
- if (hgt < 40)
- {
- T_Damage (self, world, world, BASE_DMG);
- sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
- self.deathtype = "falling";
- }
- else if (hgt < 50)
- {
- T_Damage (self, world, world, 2*BASE_DMG);
- sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
- self.deathtype = "falling";
- }
- else if (hgt < 60)
- {
- T_Damage (self, world, world, 4*BASE_DMG);
- sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
- self.deathtype = "falling";
- }
- else if (hgt < 70)
- {
- T_Damage (self, world, world, 8*BASE_DMG);
- sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
- self.deathtype = "falling";
- }
- else
- {
- T_Damage (self, world, world, 16*BASE_DMG);
- sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
- self.deathtype = "falling";
- }
- }
-
- /* the following code damages the player varying degrees depending on the
- height of their fall in feet (hgt) - I tried to be realistic, but I'm no
- physics major - I figured damage would be at least geometric instead of
- linear since your velocity when falling increases exponentially (?)...or
- something - heh heh */
-
- else
- {
- if (hgt < 10)
- {
- sound (self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM);
- }
- else if (hgt < 20)
- {
- T_Damage (self, world, world, BASE_DMG);
- sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
- self.deathtype = "falling";
- }
- else if (hgt < 30)
- {
- T_Damage (self, world, world, 2*BASE_DMG);
- sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
- self.deathtype = "falling";
- }
- else if (hgt < 40)
- {
- T_Damage (self, world, world, 4*BASE_DMG);
- sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
- self.deathtype = "falling";
- }
- else if (hgt < 50)
- {
- T_Damage (self, world, world, 8*BASE_DMG);
- sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
- self.deathtype = "falling";
- }
- else if (hgt < 60)
- {
- T_Damage (self, world, world, 16*BASE_DMG);
- sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
- self.deathtype = "falling";
- }
- else if (hgt < 70)
- {
- T_Damage (self, world, world, 32*BASE_DMG);
- sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
- self.deathtype = "falling";
- }
- else
- {
- T_Damage (self, world, world, 64*BASE_DMG);
- sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
- self.deathtype = "falling";
- }
- }
- };
-