steroids work, dead players can restart map - needs fixing so they don't restart the server whilst there's still a dude left alive.

and the stimpacks alias thingie works.
added random messages about the autodoc curing you of various STIs.


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1808 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2006-01-06 17:38:51 +00:00
parent f2aa8780cd
commit 94cca0a89e
5 changed files with 70 additions and 44 deletions

View File

@ -805,39 +805,39 @@ void () LocateSpectatorTarget =
if (self.ghost == 1)
{
ke = find (world, classname, "player");
de = find (world, classname, "player");
total = CONTENT_EMPTY;
player = MULTICAST_ALL;
playercnt = MULTICAST_ALL;
de = ke;
total = -1;
player = 0;
playercnt = 0;
while (ke)
{
if (((ke.classname == "player") && (ke.ghost == MULTICAST_ALL)))
if (ke.classname == "player" && ke.ghost == 0 && ke.health > 0)
{
total = (total + 1);
total = total + 1;
}
ke = find (ke, classname, "player");
}
while (de)
{
if (((de.classname == "player") && (de.ghost == MULTICAST_ALL)))
if (de.classname == "player" && de.ghost == 0 && ke.health > 0)
{
if ((player == self.ghostcnt))
if (player == self.ghostcnt)
{
makevectors (de.angles);
self.view2 = de;
self.ghostcnt = (self.ghostcnt + 1);
self.ghostcnt = self.ghostcnt + 1;
self.cnt = 0;
sprint(self, 2, "now following ");
sprint(self, 2, de.netname);
sprint(self, 2, ".\n");
if ((self.ghostcnt > total))
if (self.ghostcnt > total)
self.ghostcnt = 0;
return;
}
player = (player + 1);
if ((self.ghostcnt > total))
player = player + 1;
if (self.ghostcnt > total)
{
self.ghostcnt = 0;
}
@ -848,6 +848,8 @@ void () LocateSpectatorTarget =
{
self.view2 = world;
centerprint (self, "No players found...\n");
if (!deathmatch)
localcmd("restart\n");
return;
}
}
@ -1304,7 +1306,7 @@ void() PlayerPreThink =
}
}
if (self.regen > 0)
if (self.regen > 0 && !self.deadflag) //don't come back to life.
{
self.health = self.health + 3;
self.regen = self.regen - 1;
@ -1323,7 +1325,7 @@ void() PlayerPreThink =
PlayerDeathThink ();
return;
}
if (self.deadflag == DEAD_DYING)
return; // dying, so do nothing

View File

@ -17,6 +17,10 @@ float(string desc) itemtoslot =
}
else
{
slot = SlotOfItem(self, slot);
if (slot)
return slot;
sprint(self, PRINT_HIGH, "You don't have one of those\n");
return 0;
}

View File

@ -4,9 +4,7 @@ void() info_player_start;
void(entity targ, entity attacker) ClientObituary;
void(entity inflictor, entity attacker, float damage, entity ignore, string dtype) T_RadiusDamage;
/*SERVER
void() monster_death_use;
*/
//============================================================================
@ -88,15 +86,17 @@ void(entity targ, entity attacker) Killed =
ClientObituary(self, attacker);
if (self.classname == "player") //so dead players can spectate
{
self.ghost = 1;
self.flags = self.flags | FL_FINDABLE_NONSOLID; //so tracelines can find them
}
self.takedamage = DAMAGE_NO;
self.touch = SUB_Null;
self.effects = 0;
/*SERVER
monster_death_use();
*/
self.th_die ();
self = oself;

View File

@ -451,6 +451,7 @@ float MULTICAST_PHS_R = 4; // within hearing, reliable
float MULTICAST_PVS_R = 5; // within sight, reliable
#define FL_FINDABLE_NONSOLID 16384 //a cpqwsv feature
//================================================

View File

@ -2495,6 +2495,7 @@ void (entity healer, entity saved) RevivePlayer =
saved.deadflag = DEAD_NO;
saved.takedamage = DAMAGE_AIM;
saved.movetype = MOVETYPE_WALK;
saved.solid = SOLID_SLIDEBOX;
self.materialize = 200;
saved.ghost = 0;
saved.health = 2;
@ -2505,12 +2506,17 @@ void (entity healer, entity saved) RevivePlayer =
player_run();
self = oself;
stuffcmd(saved, "impulse 1\n");
sprint (healer, PRINT_HIGH, "you revive ");
sprint (healer, PRINT_HIGH, trace_ent.netname);
sprint (healer, PRINT_HIGH, ".\n ");
if (healer.classname == "player")
{
sprint (healer, PRINT_HIGH, "you revive ");
sprint (healer, PRINT_HIGH, trace_ent.netname);
sprint (healer, PRINT_HIGH, ".\n ");
}
sprint (saved, PRINT_HIGH, healer.netname);
sprint (saved, PRINT_HIGH, " saves you from death.\n");
saved.view2 = world;
saved.flags (-) FL_FINDABLE_NONSOLID;
};
float(float iid) UseBoostingChem =
@ -2560,15 +2566,12 @@ float(float iid) UseBoostingChem =
trace_ent.ragetime = duration;
return true;
}
if (trace_fraction == 1.0)
if (self.health < self.max_health && self.rage == 0)
{
if (self.health < self.max_health && self.rage == 0)
{
sound (self, CHAN_BODY, "player/berserk.wav", 1, ATTN_NORM);
self.rage = iid;
self.ragetime = duration;
return true;
}
sound (self, CHAN_BODY, "player/berserk.wav", 1, ATTN_NORM);
self.rage = iid;
self.ragetime = duration;
return true;
}
return false;
};
@ -2604,13 +2607,13 @@ float(float iid) UseHealingChem =
makevectors (self.v_angle);
source = self.origin + '0 0 0';
traceline (source, source + v_forward*64, FALSE, self);
traceline (source, source + v_forward*64, 32, self);
if (trace_ent.classname == "player" && trace_ent.team == self.team)
{
if (trace_ent.health <= 0 && coop == 1)
{
RevivePlayer(self, trace_ent);
return false;
return true;
}
if (trace_ent.health <= 0 && coop == 0)
return false;
@ -2638,15 +2641,12 @@ float(float iid) UseHealingChem =
sound (self, CHAN_BODY, "items/r_item2.wav", 1, ATTN_NORM);
return true;
}
if (trace_fraction == 1.0)
if (self.health < self.max_health && self.regen == 0)
{
if (self.health < self.max_health && self.regen == 0)
{
sound (self, CHAN_BODY, "items/r_item2.wav", 1, ATTN_NORM);
self.health = self.health + heal;
self.regen = heal;
return true;
}
sound (self, CHAN_BODY, "items/r_item2.wav", 1, ATTN_NORM);
self.health = self.health + heal;
self.regen = heal;
return true;
}
return false;
};
@ -2984,6 +2984,7 @@ void () station_think =
{
#define chemcount attack_finished
local entity te;
local float r;
self.nextthink = time + 2;
self.frame = self.buildtype;
@ -3007,7 +3008,7 @@ void () station_think =
te = findradius (self.origin, 256);
while (te)
{
if (te.classname == "player" && te.team == self.team)
if (te.classname == "player" && te.team == self.team && !te.deadflag)
{
if (self.chemcount <= 0)
{
@ -3030,7 +3031,7 @@ void () station_think =
te = findradius (self.origin, 70);
while (te)
{
if (te.classname == "player" && te.team == self.team)
if (te.classname == "player" && te.team == self.team && !te.deadflag)
{
if (self.chemcount <= 0)
{
@ -3038,15 +3039,33 @@ void () station_think =
sprint (te, 2, "the autodoc is out of medical supplies.\n");
return;
}
if (te.health < te.max_health)
if (te.deadflag)
RevivePlayer(self, te);
else if (te.health < te.max_health)
{
sound (self, CHAN_BODY, "items/r_item2.wav", 1, ATTN_NORM);
sprint (te, 2, "the auto-doc heals you for 3 health.\n");
sprint (te, PRINT_MEDIUM, "the auto-doc heals you for 3 health.\n");
te.health = te.health + 3;
self.chemcount = self.chemcount - 1;
if (te.health > te.max_health)
te.health = te.max_health;
}
if (random() < 0.001)
{
r = random()*6;
if (r < 1)
sprint(te, PRINT_HIGH, "the auto-doc heals you of AIDS\n");
else if (r < 2)
sprint(te, PRINT_HIGH, "the auto-doc heals you of Genital Herpes\n");
else if (r < 3)
sprint(te, PRINT_HIGH, "the auto-doc heals you of Gonorrhea\n");
else if (r < 4)
sprint(te, PRINT_HIGH, "the auto-doc heals you of Syphillis\n");
else if (r < 5)
sprint(te, PRINT_HIGH, "the auto-doc rids you of Crabs\n");
else if (r < 6)
sprint(te, PRINT_HIGH, "the auto-doc heals you of Chlamydia\n");
}
}
te = te.chain;
}
@ -3057,7 +3076,7 @@ void () station_think =
te = findradius (self.origin, 60);
while (te)
{
if (te.classname == "player" && te.team == self.team)
if (te.classname == "player" && te.team == self.team && !te.deadflag)
{
if (self.chemcount <= 0)
{