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) if (self.ghost == 1)
{ {
ke = find (world, classname, "player"); ke = find (world, classname, "player");
de = find (world, classname, "player"); de = ke;
total = CONTENT_EMPTY; total = -1;
player = MULTICAST_ALL; player = 0;
playercnt = MULTICAST_ALL; playercnt = 0;
while (ke) 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"); ke = find (ke, classname, "player");
} }
while (de) 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); makevectors (de.angles);
self.view2 = de; self.view2 = de;
self.ghostcnt = (self.ghostcnt + 1); self.ghostcnt = self.ghostcnt + 1;
self.cnt = 0; self.cnt = 0;
sprint(self, 2, "now following "); sprint(self, 2, "now following ");
sprint(self, 2, de.netname); sprint(self, 2, de.netname);
sprint(self, 2, ".\n"); sprint(self, 2, ".\n");
if ((self.ghostcnt > total)) if (self.ghostcnt > total)
self.ghostcnt = 0; self.ghostcnt = 0;
return; return;
} }
player = (player + 1); player = player + 1;
if ((self.ghostcnt > total)) if (self.ghostcnt > total)
{ {
self.ghostcnt = 0; self.ghostcnt = 0;
} }
@ -848,6 +848,8 @@ void () LocateSpectatorTarget =
{ {
self.view2 = world; self.view2 = world;
centerprint (self, "No players found...\n"); centerprint (self, "No players found...\n");
if (!deathmatch)
localcmd("restart\n");
return; 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.health = self.health + 3;
self.regen = self.regen - 1; self.regen = self.regen - 1;

View file

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

View file

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

View file

@ -451,6 +451,7 @@ float MULTICAST_PHS_R = 4; // within hearing, reliable
float MULTICAST_PVS_R = 5; // within sight, 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.deadflag = DEAD_NO;
saved.takedamage = DAMAGE_AIM; saved.takedamage = DAMAGE_AIM;
saved.movetype = MOVETYPE_WALK; saved.movetype = MOVETYPE_WALK;
saved.solid = SOLID_SLIDEBOX;
self.materialize = 200; self.materialize = 200;
saved.ghost = 0; saved.ghost = 0;
saved.health = 2; saved.health = 2;
@ -2505,12 +2506,17 @@ void (entity healer, entity saved) RevivePlayer =
player_run(); player_run();
self = oself; self = oself;
stuffcmd(saved, "impulse 1\n"); stuffcmd(saved, "impulse 1\n");
if (healer.classname == "player")
{
sprint (healer, PRINT_HIGH, "you revive "); sprint (healer, PRINT_HIGH, "you revive ");
sprint (healer, PRINT_HIGH, trace_ent.netname); sprint (healer, PRINT_HIGH, trace_ent.netname);
sprint (healer, PRINT_HIGH, ".\n "); sprint (healer, PRINT_HIGH, ".\n ");
}
sprint (saved, PRINT_HIGH, healer.netname); sprint (saved, PRINT_HIGH, healer.netname);
sprint (saved, PRINT_HIGH, " saves you from death.\n"); sprint (saved, PRINT_HIGH, " saves you from death.\n");
saved.view2 = world; saved.view2 = world;
saved.flags (-) FL_FINDABLE_NONSOLID;
}; };
float(float iid) UseBoostingChem = float(float iid) UseBoostingChem =
@ -2560,8 +2566,6 @@ float(float iid) UseBoostingChem =
trace_ent.ragetime = duration; trace_ent.ragetime = duration;
return true; 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); sound (self, CHAN_BODY, "player/berserk.wav", 1, ATTN_NORM);
@ -2569,7 +2573,6 @@ float(float iid) UseBoostingChem =
self.ragetime = duration; self.ragetime = duration;
return true; return true;
} }
}
return false; return false;
}; };
@ -2604,13 +2607,13 @@ float(float iid) UseHealingChem =
makevectors (self.v_angle); makevectors (self.v_angle);
source = self.origin + '0 0 0'; 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.classname == "player" && trace_ent.team == self.team)
{ {
if (trace_ent.health <= 0 && coop == 1) if (trace_ent.health <= 0 && coop == 1)
{ {
RevivePlayer(self, trace_ent); RevivePlayer(self, trace_ent);
return false; return true;
} }
if (trace_ent.health <= 0 && coop == 0) if (trace_ent.health <= 0 && coop == 0)
return false; return false;
@ -2638,8 +2641,6 @@ float(float iid) UseHealingChem =
sound (self, CHAN_BODY, "items/r_item2.wav", 1, ATTN_NORM); sound (self, CHAN_BODY, "items/r_item2.wav", 1, ATTN_NORM);
return true; 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); sound (self, CHAN_BODY, "items/r_item2.wav", 1, ATTN_NORM);
@ -2647,7 +2648,6 @@ float(float iid) UseHealingChem =
self.regen = heal; self.regen = heal;
return true; return true;
} }
}
return false; return false;
}; };
@ -2984,6 +2984,7 @@ void () station_think =
{ {
#define chemcount attack_finished #define chemcount attack_finished
local entity te; local entity te;
local float r;
self.nextthink = time + 2; self.nextthink = time + 2;
self.frame = self.buildtype; self.frame = self.buildtype;
@ -3007,7 +3008,7 @@ void () station_think =
te = findradius (self.origin, 256); te = findradius (self.origin, 256);
while (te) while (te)
{ {
if (te.classname == "player" && te.team == self.team) if (te.classname == "player" && te.team == self.team && !te.deadflag)
{ {
if (self.chemcount <= 0) if (self.chemcount <= 0)
{ {
@ -3030,7 +3031,7 @@ void () station_think =
te = findradius (self.origin, 70); te = findradius (self.origin, 70);
while (te) while (te)
{ {
if (te.classname == "player" && te.team == self.team) if (te.classname == "player" && te.team == self.team && !te.deadflag)
{ {
if (self.chemcount <= 0) if (self.chemcount <= 0)
{ {
@ -3038,15 +3039,33 @@ void () station_think =
sprint (te, 2, "the autodoc is out of medical supplies.\n"); sprint (te, 2, "the autodoc is out of medical supplies.\n");
return; 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); 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; te.health = te.health + 3;
self.chemcount = self.chemcount - 1; self.chemcount = self.chemcount - 1;
if (te.health > te.max_health) if (te.health > te.max_health)
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; te = te.chain;
} }
@ -3057,7 +3076,7 @@ void () station_think =
te = findradius (self.origin, 60); te = findradius (self.origin, 60);
while (te) while (te)
{ {
if (te.classname == "player" && te.team == self.team) if (te.classname == "player" && te.team == self.team && !te.deadflag)
{ {
if (self.chemcount <= 0) if (self.chemcount <= 0)
{ {