From 95b9e9b2c63ff930d81329b43c2388e04d55bd8b Mon Sep 17 00:00:00 2001 From: lordhavoc Date: Tue, 26 Feb 2008 11:24:13 +0000 Subject: [PATCH] bots now play CTF properly improved waypoint spawning code significantly added waypoints to CTF flags, dom points, and onslaught points git-svn-id: svn://svn.icculus.org/nexuiz/trunk@3433 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/server/bots.qc | 100 +++++++++++------- data/qcsrc/server/ctf.qc | 4 + data/qcsrc/server/defs.qh | 2 + data/qcsrc/server/domination.qc | 2 + data/qcsrc/server/havocbot.qc | 4 +- data/qcsrc/server/havocbot_roles.qc | 65 +++++++----- data/qcsrc/server/mode_onslaught.qc | 2 + data/qcsrc/server/t_items.qc | 157 +++++++++++++--------------- data/qcsrc/server/t_teleporters.qc | 3 - 9 files changed, 186 insertions(+), 153 deletions(-) diff --git a/data/qcsrc/server/bots.qc b/data/qcsrc/server/bots.qc index 0b9188854..58f6d833c 100644 --- a/data/qcsrc/server/bots.qc +++ b/data/qcsrc/server/bots.qc @@ -551,6 +551,12 @@ void(entity wp) waypoint_schedulerelink = m2 = wp.maxs; setmodel(wp, "models/runematch/rune.mdl"); wp.effects = EF_LOWPRECISION; setsize(wp, m1, m2); + if (wp.wpflags & WAYPOINTFLAG_ITEM) + wp.colormod = '1 0 0'; + else if (wp.wpflags & WAYPOINTFLAG_GENERATED) + wp.colormod = '1 1 0'; + else + wp.colormod = '1 1 1'; } else wp.model = ""; @@ -572,75 +578,87 @@ entity(vector m1, vector m2, float f) waypoint_spawn = { local entity w; local vector org; - org = (m1 + m2) * 0.5; - m1 = m1 - org; - m2 = m2 - org; w = find(world, classname, "waypoint"); while (w) { // if a matching waypoint already exists, don't add a duplicate - if (w.origin == org && w.mins == m1 && w.maxs == m2) + if (boxesoverlap(m1, m2, w.absmin, w.absmax)) return w; w = find(w, classname, "waypoint"); } w = spawn(); w.classname = "waypoint"; w.wpflags = f; - setorigin(w, org); - setsize(w, PL_MIN + m1, PL_MAX + m2); + setorigin(w, (m1 + m2) * 0.5); + setsize(w, m1 - w.origin, m2 - w.origin); + if (vlen(w.size) > 0) + w.wpisbox = TRUE; if(!(f & WAYPOINTFLAG_GENERATED)) + if(!w.wpisbox) { - org = w.origin + '0 0 2'; - tracebox(org, w.mins, w.maxs, w.origin, MOVE_WORLDONLY, w); - if(trace_startsolid) + traceline(w.origin + '0 0 1', w.origin + PL_MIN_z * '0 0 1' - '0 0 1', MOVE_NOMONSTERS, w); + if (trace_fraction < 1) + setorigin(w, trace_endpos - PL_MIN_z * '0 0 1'); + + // check if the start position is stuck + tracebox(w.origin, PL_MIN + '-1 -1 -1', PL_MAX + '1 1 1', w.origin, MOVE_NOMONSTERS, w); + if (trace_startsolid) { - org = w.origin + '2 2 2'; - tracebox(org, w.mins, w.maxs, w.origin, MOVE_WORLDONLY, w); + org = w.origin + '0 0 26'; + tracebox(org, PL_MIN, PL_MAX, w.origin, MOVE_WORLDONLY, w); if(trace_startsolid) { - org = w.origin + '-2 -2 2'; - tracebox(org, w.mins, w.maxs, w.origin, MOVE_WORLDONLY, w); + org = w.origin + '2 2 2'; + tracebox(org, PL_MIN, PL_MAX, w.origin, MOVE_WORLDONLY, w); if(trace_startsolid) { - org = w.origin + '-2 2 2'; - tracebox(org, w.mins, w.maxs, w.origin, MOVE_WORLDONLY, w); + org = w.origin + '-2 -2 2'; + tracebox(org, PL_MIN, PL_MAX, w.origin, MOVE_WORLDONLY, w); if(trace_startsolid) { - org = w.origin + '2 -2 2'; - tracebox(org, w.mins, w.maxs, w.origin, MOVE_WORLDONLY, w); + org = w.origin + '-2 2 2'; + tracebox(org, PL_MIN, PL_MAX, w.origin, MOVE_WORLDONLY, w); if(trace_startsolid) { - // this WP is in solid, refuse it - dprint("Killed a waypoint that was stuck in solid at ", vtos(org), "\n"); - remove(w); - return world; + org = w.origin + '2 -2 2'; + tracebox(org, PL_MIN, PL_MAX, w.origin, MOVE_WORLDONLY, w); + if(trace_startsolid) + { + // this WP is in solid, refuse it + dprint("Killed a waypoint that was stuck in solid at ", vtos(org), "\n"); + remove(w); + return world; + } } } } } + setorigin(w, org * 0.05 + trace_endpos * 0.95); // don't trust the trace fully } - org = org * 0.05 + trace_endpos * 0.95; // don't trust the trace fully - tracebox(org, w.mins, w.maxs, org - '0 0 128', MOVE_WORLDONLY, w); - - if(trace_fraction == 1 || trace_startsolid) + tracebox(w.origin, PL_MIN, PL_MAX, w.origin - '0 0 128', MOVE_WORLDONLY, w); + if(trace_startsolid) { - // this WP is in air, refuse it - dprint("Killed a waypoint that was stuck in air/ceiling at ", vtos(w.origin), "\n"); + dprint("Killed a waypoint that was stuck in solid ", vtos(w.origin), "\n"); remove(w); return world; } - trace_endpos_z += 0.1; // don't trust the trace fully - -// dprint("Moved waypoint at ", vtos(w.origin), " by ", ftos(vlen(w.origin - trace_endpos))); -// dprint(" direction: ", vtos((trace_endpos - w.origin)), "\n"); - - setorigin(w, trace_endpos); + if (!trace_inwater) + { + if(trace_fraction == 1) + { + dprint("Killed a waypoint that was stuck in air at ", vtos(w.origin), "\n"); + remove(w); + return world; + } + trace_endpos_z += 0.1; // don't trust the trace fully +// dprint("Moved waypoint at ", vtos(w.origin), " by ", ftos(vlen(w.origin - trace_endpos))); +// dprint(" direction: ", vtos((trace_endpos - w.origin)), "\n"); + setorigin(w, trace_endpos); + } } - setsize(w, m1, m2); - waypoint_clearlinks(w); //waypoint_schedulerelink(w); return w; @@ -830,7 +848,7 @@ void(entity e) waypoint_spawnforitem = w = findchain(classname, "waypoint"); while (w) { - if (vlen(w.size) > 1) + if (w.wpisbox) { if (boxesoverlap(org, org, w.absmin, w.absmax)) { @@ -1205,7 +1223,9 @@ void() navigation_markroutes = }; // updates the best goal according to a weighted calculation of travel cost and item value of a new proposed item -void(entity e, float f) navigation_routerating = +.void() havocbot_role; +void() havocbot_role_ctf_offense; +void(entity e, float f, float rangebias) navigation_routerating = { if (!e) return; @@ -1224,7 +1244,9 @@ void(entity e, float f) navigation_routerating = { //te_wizspike(e.nearestwaypoint.wpnearestpoint); //dprint(e.classname, " ", ftos(f), "*(500/(500+", ftos((e.nearestwaypoint.wpcost + vlen(e.origin - e.nearestwaypoint.wpnearestpoint))), " = "); - f = f * 500 / ((e.nearestwaypoint.wpcost + vlen(e.origin - e.nearestwaypoint.wpnearestpoint)) + 500); + f = f * rangebias / ((e.nearestwaypoint.wpcost + vlen(e.origin - e.nearestwaypoint.wpnearestpoint)) + rangebias); + if (self.havocbot_role == havocbot_role_ctf_offense) + dprint("-- considering ", e.classname, " (with rating ", ftos(f), ")\n"); //dprint(ftos(f)); if (navigation_bestrating < f) { @@ -1299,6 +1321,8 @@ void() navigation_goalrating_start = // ends a goal selection session (updates goal stack to the best goal) void() navigation_goalrating_end = { + if (self.havocbot_role == havocbot_role_ctf_offense) + dprint(navigation_bestgoal.classname, " (with rating ", ftos(navigation_bestrating), ")\n"); navigation_routetogoal(navigation_bestgoal); }; diff --git a/data/qcsrc/server/ctf.qc b/data/qcsrc/server/ctf.qc index e76755e4c..4e529f1f8 100644 --- a/data/qcsrc/server/ctf.qc +++ b/data/qcsrc/server/ctf.qc @@ -506,6 +506,8 @@ void() item_flag_team1 = if(!self.noalign) droptofloor(); + waypoint_spawnforitem(self); + WaypointSprite_SpawnFixed("redbase", self.origin + '0 0 37', self, sprite); }; @@ -569,6 +571,8 @@ void() item_flag_team2 = if(!self.noalign) droptofloor(); + waypoint_spawnforitem(self); + WaypointSprite_SpawnFixed("bluebase", self.origin + '0 0 37', self, sprite); }; diff --git a/data/qcsrc/server/defs.qh b/data/qcsrc/server/defs.qh index 8cc044003..147a03262 100644 --- a/data/qcsrc/server/defs.qh +++ b/data/qcsrc/server/defs.qh @@ -394,3 +394,5 @@ float have_team_spawns; // set when showing a kill countdown .entity killindicator; .float killindicator_teamchange; + +void Damage (entity targ, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force); diff --git a/data/qcsrc/server/domination.qc b/data/qcsrc/server/domination.qc index 76a19c4ae..4eb3fd407 100644 --- a/data/qcsrc/server/domination.qc +++ b/data/qcsrc/server/domination.qc @@ -269,6 +269,8 @@ void() dom_controlpoint_setup = setsize(self, '-32 -32 -32', '32 32 32'); setorigin(self, self.origin + '0 0 20'); droptofloor(); + + waypoint_spawnforitem(self); }; diff --git a/data/qcsrc/server/havocbot.qc b/data/qcsrc/server/havocbot.qc index 8c7dceec7..69601061f 100644 --- a/data/qcsrc/server/havocbot.qc +++ b/data/qcsrc/server/havocbot.qc @@ -229,9 +229,9 @@ void() havocbot_movetogoal = else keyboard_y = 0; - if (keyboard_z >= trigger) + if (keyboard_z > trigger) keyboard_z = 1; - else if (keyboard_z <= trigger1) + else if (keyboard_z < trigger1) keyboard_z = -1; else keyboard_z = 0; diff --git a/data/qcsrc/server/havocbot_roles.qc b/data/qcsrc/server/havocbot_roles.qc index 474d35bd8..1df5bca1a 100644 --- a/data/qcsrc/server/havocbot_roles.qc +++ b/data/qcsrc/server/havocbot_roles.qc @@ -27,7 +27,7 @@ void(float ratingscale, vector org, float sradius) havocbot_goalrating_items = // get the value of the item t = head.bot_pickupevalfunc(self, head); if (t > 0) - navigation_routerating(head, t * ratingscale); + navigation_routerating(head, t * ratingscale, 2000); } head = head.chain; } @@ -42,11 +42,11 @@ void(float ratingscale, vector org, float sradius) havocbot_goalrating_controlpo if (vlen(head.origin - org) < sradius) { if(head.cnt > -1) // this is just being fought for - navigation_routerating(head, ratingscale); + navigation_routerating(head, ratingscale, 5000); else if(head.goalentity.cnt == 0) // unclaimed point - navigation_routerating(head, ratingscale * 0.5); + navigation_routerating(head, ratingscale * 0.5, 5000); else if(head.goalentity.team != self.team) // other team's point - navigation_routerating(head, ratingscale * 0.2); + navigation_routerating(head, ratingscale * 0.2, 5000); } head = head.chain; } @@ -63,7 +63,7 @@ void(float ratingscale, vector org, float sradius) havocbot_goalrating_waypoints while (head) { if (vlen(head.origin - org) < sradius && vlen(head.origin - org) > 100) - navigation_routerating(head, ratingscale); + navigation_routerating(head, ratingscale, 2000); head = head.chain; } }; @@ -89,7 +89,7 @@ void(float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplay if (t > 0) { //dprint("found: "); dprint(head.netname); dprint("\n"); - navigation_routerating(head, t * ratingscale); + navigation_routerating(head, t * ratingscale, 500); } } } @@ -119,7 +119,7 @@ void(float ratingscale, vector org, float sradius) havocbot_goalrating_ctf_carri // get the value of the item t = head.bot_pickupevalfunc(self, head) * 0.0001; if (t > 0) - navigation_routerating(head, t * ratingscale); + navigation_routerating(head, t * ratingscale, 500); } head = head.chain; } @@ -137,7 +137,7 @@ void(float ratingscale) havocbot_goalrating_ctf_ourflag = head = head.enemy; } if (head) - navigation_routerating(head, ratingscale); + navigation_routerating(head, ratingscale, 10000); }; void(float ratingscale) havocbot_goalrating_ctf_enemyflag = @@ -151,7 +151,7 @@ void(float ratingscale) havocbot_goalrating_ctf_enemyflag = head = head.enemy; } if (head) - navigation_routerating(head, ratingscale); + navigation_routerating(head, ratingscale, 10000); }; void(float ratingscale) havocbot_goalrating_ctf_enemybase = @@ -171,7 +171,7 @@ void(float ratingscale) havocbot_goalrating_ctf_ourstolenflag = } if (head) if (head.cnt != FLAG_BASE) - navigation_routerating(head, ratingscale); + navigation_routerating(head, ratingscale, 10000); }; void(float ratingscale) havocbot_goalrating_ctf_droppedflags = @@ -181,7 +181,7 @@ void(float ratingscale) havocbot_goalrating_ctf_droppedflags = while (head) { if (head.cnt != FLAG_BASE) // flag is carried or out in the field - navigation_routerating(head, ratingscale); + navigation_routerating(head, ratingscale, 10000); head = head.enemy; } }; @@ -206,6 +206,7 @@ void() havocbot_role_ctf_rogue = //role flag carrier: //pick up armor and health //go to our flag spot +.float bot_cantfindflag; void() havocbot_role_ctf_carrier = { if (self.flagcarried == world) @@ -219,7 +220,14 @@ void() havocbot_role_ctf_carrier = { self.bot_strategytime = time + cvar("bot_ai_strategyinterval"); navigation_goalrating_start(); - havocbot_goalrating_ctf_ourflag(5000); + havocbot_goalrating_ctf_ourflag(50000); + if (navigation_bestgoal) + self.bot_cantfindflag = time + 10; + else if (time > self.bot_cantfindflag) + { + // can't navigate to our own flag :( + Damage(self, self, self, 100000, DEATH_KILL, self.origin, '0 0 0'); + } havocbot_goalrating_ctf_carrieritems(1000, self.origin, 1000); navigation_goalrating_end(); } @@ -240,6 +248,7 @@ void() havocbot_role_ctf_offense = dprint("changing role to carrier\n"); self.havocbot_role = havocbot_role_ctf_carrier; self.havocbot_role_timeout = 0; + self.bot_cantfindflag = time + 10; return; } // check our flag @@ -260,7 +269,7 @@ void() havocbot_role_ctf_offense = } if (!self.havocbot_role_timeout) self.havocbot_role_timeout = time + random() * 30 + 60; - if (self.ammo_rockets < 15 || time > self.havocbot_role_timeout) + if (time > self.havocbot_role_timeout) { dprint("changing role to middle\n"); self.havocbot_role = havocbot_role_ctf_middle; @@ -271,9 +280,9 @@ void() havocbot_role_ctf_offense = { self.bot_strategytime = time + cvar("bot_ai_strategyinterval"); navigation_goalrating_start(); - havocbot_goalrating_ctf_ourstolenflag(5000); - havocbot_goalrating_ctf_enemyflag(3000); - havocbot_goalrating_ctf_enemybase(2000); + havocbot_goalrating_ctf_ourstolenflag(50000); + havocbot_goalrating_ctf_enemyflag(30000); + havocbot_goalrating_ctf_enemybase(20000); havocbot_goalrating_items(10000, self.origin, 10000); navigation_goalrating_end(); } @@ -293,6 +302,7 @@ void() havocbot_role_ctf_interceptor = dprint("changing role to carrier\n"); self.havocbot_role = havocbot_role_ctf_carrier; self.havocbot_role_timeout = 0; + self.bot_cantfindflag = time + 10; return; } // check our flag @@ -315,8 +325,8 @@ void() havocbot_role_ctf_interceptor = { self.bot_strategytime = time + cvar("bot_ai_strategyinterval"); navigation_goalrating_start(); - havocbot_goalrating_ctf_ourstolenflag(5000); - havocbot_goalrating_ctf_droppedflags(5000); + havocbot_goalrating_ctf_ourstolenflag(50000); + havocbot_goalrating_ctf_droppedflags(50000); havocbot_goalrating_items(10000, self.origin, 10000); navigation_goalrating_end(); } @@ -337,6 +347,7 @@ void() havocbot_role_ctf_middle = dprint("changing role to carrier\n"); self.havocbot_role = havocbot_role_ctf_carrier; self.havocbot_role_timeout = 0; + self.bot_cantfindflag = time + 10; return; } // check our flag @@ -358,7 +369,6 @@ void() havocbot_role_ctf_middle = if (!self.havocbot_role_timeout) self.havocbot_role_timeout = time + random() * 10 + 10; if (time > self.havocbot_role_timeout) - if (self.ammo_rockets >= 25) { if (random() < 0.5) { @@ -378,8 +388,8 @@ void() havocbot_role_ctf_middle = { self.bot_strategytime = time + cvar("bot_ai_strategyinterval"); navigation_goalrating_start(); - havocbot_goalrating_ctf_ourstolenflag(5000); - havocbot_goalrating_ctf_droppedflags(3000); + havocbot_goalrating_ctf_ourstolenflag(50000); + havocbot_goalrating_ctf_droppedflags(30000); //havocbot_goalrating_enemyplayers(1000, self.origin, 1000); havocbot_goalrating_items(10000, self.origin, 10000); navigation_goalrating_end(); @@ -400,6 +410,7 @@ void() havocbot_role_ctf_defense = dprint("changing role to carrier\n"); self.havocbot_role = havocbot_role_ctf_carrier; self.havocbot_role_timeout = 0; + self.bot_cantfindflag = time + 10; return; } // check our flag @@ -420,7 +431,7 @@ void() havocbot_role_ctf_defense = } if (!self.havocbot_role_timeout) self.havocbot_role_timeout = time + random() * 20 + 30; - if (self.ammo_rockets < 15 || time > self.havocbot_role_timeout) + if (time > self.havocbot_role_timeout) { dprint("changing role to middle\n"); self.havocbot_role = havocbot_role_ctf_middle; @@ -431,8 +442,8 @@ void() havocbot_role_ctf_defense = { self.bot_strategytime = time + cvar("bot_ai_strategyinterval"); navigation_goalrating_start(); - havocbot_goalrating_ctf_ourstolenflag(20000); - havocbot_goalrating_ctf_droppedflags(500); + havocbot_goalrating_ctf_ourstolenflag(200000); + havocbot_goalrating_ctf_droppedflags(50000); havocbot_goalrating_items(10000, f.origin, 10000); navigation_goalrating_end(); } @@ -548,11 +559,11 @@ void(float ratingscale_team, float ratingscale_dropped, float ratingscale_enemy) if(!head.owner || head.team == self.team) continue; // skip what I can't see if(!head.owner) - navigation_routerating(head, ratingscale_dropped); + navigation_routerating(head, ratingscale_dropped, 10000); else if(head.team == self.team) - navigation_routerating(head, ratingscale_team); + navigation_routerating(head, ratingscale_team, 10000); else - navigation_routerating(head, ratingscale_enemy); + navigation_routerating(head, ratingscale_enemy, 10000); head = head.enemy; } }; diff --git a/data/qcsrc/server/mode_onslaught.qc b/data/qcsrc/server/mode_onslaught.qc index 4927a5839..dbde61dbc 100644 --- a/data/qcsrc/server/mode_onslaught.qc +++ b/data/qcsrc/server/mode_onslaught.qc @@ -757,6 +757,8 @@ void() onslaught_controlpoint = e.colormap = self.colormap; onslaught_updatelinks(); + waypoint_spawnforitem(self); + WaypointSprite_SpawnFixed(string_null, e.origin + '0 0 1' * e.maxs_z, self, sprite); self.sprite.waypointsprite_for_player = onslaught_controlpoint_waypointsprite_for_player; }; diff --git a/data/qcsrc/server/t_items.qc b/data/qcsrc/server/t_items.qc index a69e06040..b58ca2f1c 100644 --- a/data/qcsrc/server/t_items.qc +++ b/data/qcsrc/server/t_items.qc @@ -272,8 +272,49 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, { startitem_failed = FALSE; - if (self.classname != "droppedweapon") + // is it a dropped weapon? + if (self.classname == "droppedweapon") { + // it's a dropped weapon + self.movetype = MOVETYPE_TOSS; + self.solid = SOLID_TRIGGER; + // Savage: remove thrown items after a certain period of time ("garbage collection") + self.think = RemoveItem; + self.nextthink = time + 60; + // don't drop if in a NODROP zone (such as lava) + traceline(self.origin, self.origin, MOVE_NORMAL, self); + if (trace_dpstartcontents & DPCONTENTS_NODROP) + { + startitem_failed = TRUE; + remove(self); + return; + } + } + else + { + // it's a level item + if(self.spawnflags & 1) + self.noalign = 1; + if (self.noalign) + self.movetype = MOVETYPE_NONE; + else + self.movetype = MOVETYPE_TOSS; + self.solid = SOLID_TRIGGER; + // do item filtering according to game mode and other things + if (!self.noalign) + { + // first nudge it off the floor a little bit to avoid math errors + setorigin(self, self.origin + '0 0 1'); + // set item size before we spawn a waypoint + if((itemflags & FL_POWERUP) || self.health || self.armorvalue) + setsize (self, '-16 -16 0', '16 16 48'); + else + setsize (self, '-16 -16 0', '16 16 32'); + // note droptofloor returns FALSE if stuck/or would fall too far + droptofloor(); + waypoint_spawnforitem(self); + } + if(teams_matter) { if(self.notteam) @@ -303,7 +344,7 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, remove (self); return; } - + /* * can't do it that way, as it would break maps * TODO make a target_give like entity another way, that perhaps has @@ -317,7 +358,7 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, return; } */ - + if(cvar("spawn_debug") >= 2) { entity otheritem; @@ -333,70 +374,41 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, self.is_item = TRUE; } - waypoint_spawnforitem(self); - itemsInMap |= itemid; - } - - if (!(cvar("g_pickup_items") && !g_nixnex) && !g_minstagib && - itemid != IT_STRENGTH && itemid != IT_INVINCIBLE && itemid != IT_HEALTH) - { - startitem_failed = TRUE; - remove (self); - return; - } - if (g_minstagib) - { - // don't remove dropped items and powerups - if (self.classname != "droppedweapon" && - self.classname != "minstagib") + if(g_lms || g_instagib || g_rocketarena) { startitem_failed = TRUE; - remove (self); + remove(self); return; } - } - - if(g_lms && (self.classname != "droppedweapon")) - { - startitem_failed = TRUE; - remove(self); - return; - } - - if(g_instagib || g_rocketarena) - { - startitem_failed = TRUE; - remove(self); - return; - } - - if (self.classname == "droppedweapon") - { - // don't drop if in a NODROP zone (such as lava) - traceline(self.origin, self.origin, MOVE_NORMAL, self); - if (trace_dpstartcontents & DPCONTENTS_NODROP) + else if (g_minstagib) + { + // don't remove dropped items and powerups + if (self.classname != "minstagib") + { + startitem_failed = TRUE; + remove (self); + return; + } + } + else if ((!cvar("g_pickup_items") || g_nixnex) && itemid != IT_STRENGTH && itemid != IT_INVINCIBLE && itemid != IT_HEALTH) { startitem_failed = TRUE; - remove(self); + remove (self); return; } - } - if (self.classname != "droppedweapon") - { precache_model (itemmodel); precache_sound (pickupsound); precache_sound ("misc/itemrespawn.wav"); - } - if(itemid & (IT_STRENGTH | IT_INVINCIBLE | IT_HEALTH | IT_ARMOR | IT_KEY1 | IT_KEY2 | - IT_ROCKET_LAUNCHER | IT_HAGAR | IT_NEX | IT_CRYLINK | IT_ELECTRO | - IT_GRENADE_LAUNCHER | IT_UZI | IT_SHOTGUN | IT_LASER) && self.classname != "droppedweapon") - { - self.target = "###item###"; // for finding the nearest item using find() + if(itemid & (IT_STRENGTH | IT_INVINCIBLE | IT_HEALTH | IT_ARMOR | IT_KEY1 | IT_KEY2 | + IT_ROCKET_LAUNCHER | IT_HAGAR | IT_NEX | IT_CRYLINK | IT_ELECTRO | + IT_GRENADE_LAUNCHER | IT_UZI | IT_SHOTGUN | IT_LASER)) + self.target = "###item###"; // for finding the nearest item using find() } + self.bot_pickup = TRUE; self.bot_pickupevalfunc = pickupevalfunc; self.bot_pickupbasevalue = pickupbasevalue; @@ -409,13 +421,6 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, self.netname = itemname; self.items = itemid; self.flags = FL_ITEM | itemflags; - if(self.spawnflags & 1) - self.noalign = 1; - if (self.noalign) - self.movetype = MOVETYPE_NONE; - else - self.movetype = MOVETYPE_TOSS; - self.solid = SOLID_TRIGGER; self.touch = Item_Touch; setmodel (self, self.mdl); // precision set below self.effects |= EF_LOWPRECISION; @@ -429,20 +434,6 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, self.colormap = 160 * 1024 + 160; } - // Savage: remove thrown items after a certain period of time ("garbage collection") - if (self.classname == "droppedweapon") - { - self.think = RemoveItem; - self.nextthink = time + 60; - } - else if (!self.noalign) - { - // first nudge it off the floor a little bit to avoid math errors - setorigin(self, self.origin + '0 0 1'); - // note droptofloor returns FALSE if stuck/or would fall too far - droptofloor(); - } - if (cvar("g_fullbrightitems")) self.effects = self.effects | EF_FULLBRIGHT; } @@ -538,7 +529,7 @@ void weapon_uzi (void) { if(!self.ammo_nails) self.ammo_nails = cvar("g_pickup_nails"); - StartItem ("models/weapons/g_uzi.md3", "weapons/weaponpickup.wav", 15, W_Name(WEP_UZI), IT_UZI, FL_WEAPON, weapon_pickupevalfunc, 20000); + StartItem ("models/weapons/g_uzi.md3", "weapons/weaponpickup.wav", 15, W_Name(WEP_UZI), IT_UZI, FL_WEAPON, weapon_pickupevalfunc, 5000); if (self.modelindex) // don't precache if self was removed weapon_action(WEP_UZI, WR_PRECACHE); } @@ -556,7 +547,7 @@ void weapon_shotgun (void) { if(!self.ammo_shells) self.ammo_shells = cvar("g_pickup_shells"); - StartItem ("models/weapons/g_shotgun.md3", "weapons/weaponpickup.wav", 15, W_Name(WEP_SHOTGUN), IT_SHOTGUN, FL_WEAPON, weapon_pickupevalfunc, 10000); + StartItem ("models/weapons/g_shotgun.md3", "weapons/weaponpickup.wav", 15, W_Name(WEP_SHOTGUN), IT_SHOTGUN, FL_WEAPON, weapon_pickupevalfunc, 2500); if (self.modelindex) // don't precache if self was removed weapon_action(WEP_SHOTGUN, WR_PRECACHE); } @@ -565,7 +556,7 @@ void weapon_grenadelauncher (void) { if(!self.ammo_rockets) self.ammo_rockets = cvar("g_pickup_rockets"); - StartItem ("models/weapons/g_gl.md3", "weapons/weaponpickup.wav", 15, W_Name(WEP_GRENADE_LAUNCHER), IT_GRENADE_LAUNCHER, FL_WEAPON, weapon_pickupevalfunc, 20000); + StartItem ("models/weapons/g_gl.md3", "weapons/weaponpickup.wav", 15, W_Name(WEP_GRENADE_LAUNCHER), IT_GRENADE_LAUNCHER, FL_WEAPON, weapon_pickupevalfunc, 5000); if (self.modelindex) // don't precache if self was removed weapon_action(WEP_GRENADE_LAUNCHER, WR_PRECACHE); } @@ -574,7 +565,7 @@ void weapon_electro (void) { if(!self.ammo_cells) self.ammo_cells = cvar("g_pickup_cells"); - StartItem ("models/weapons/g_electro.md3", "weapons/weaponpickup.wav", 15, W_Name(WEP_ELECTRO), IT_ELECTRO, FL_WEAPON, weapon_pickupevalfunc, 15000); + StartItem ("models/weapons/g_electro.md3", "weapons/weaponpickup.wav", 15, W_Name(WEP_ELECTRO), IT_ELECTRO, FL_WEAPON, weapon_pickupevalfunc, 5000); if (self.modelindex) // don't precache if self was removed weapon_action(WEP_ELECTRO, WR_PRECACHE); } @@ -583,7 +574,7 @@ void weapon_crylink (void) { if(!self.ammo_cells) self.ammo_cells = cvar("g_pickup_cells"); - StartItem ("models/weapons/g_crylink.md3", "weapons/weaponpickup.wav", 15, W_Name(WEP_CRYLINK), IT_CRYLINK, FL_WEAPON, weapon_pickupevalfunc, 10000); + StartItem ("models/weapons/g_crylink.md3", "weapons/weaponpickup.wav", 15, W_Name(WEP_CRYLINK), IT_CRYLINK, FL_WEAPON, weapon_pickupevalfunc, 2500); if (self.modelindex) // don't precache if self was removed weapon_action(WEP_CRYLINK, WR_PRECACHE); } @@ -605,7 +596,7 @@ void weapon_nex (void) nextime = 15 * nextime; else nextime = 15; - StartItem ("models/weapons/g_nex.md3", "weapons/weaponpickup.wav", nextime, W_Name(WEP_NEX), IT_NEX, FL_WEAPON, weapon_pickupevalfunc, 30000); + StartItem ("models/weapons/g_nex.md3", "weapons/weaponpickup.wav", nextime, W_Name(WEP_NEX), IT_NEX, FL_WEAPON, weapon_pickupevalfunc, 10000); if (self.modelindex) // don't precache if self was removed weapon_action(WEP_NEX, WR_PRECACHE); } @@ -614,7 +605,7 @@ void weapon_hagar (void) { if(!self.ammo_rockets) self.ammo_rockets = cvar("g_pickup_rockets"); - StartItem ("models/weapons/g_hagar.md3", "weapons/weaponpickup.wav", 15, W_Name(WEP_HAGAR), IT_HAGAR, FL_WEAPON, weapon_pickupevalfunc, 10000); + StartItem ("models/weapons/g_hagar.md3", "weapons/weaponpickup.wav", 15, W_Name(WEP_HAGAR), IT_HAGAR, FL_WEAPON, weapon_pickupevalfunc, 5000); if (self.modelindex) // don't precache if self was removed weapon_action(WEP_HAGAR, WR_PRECACHE); } @@ -630,7 +621,7 @@ void weapon_rocketlauncher (void) } if(!self.ammo_rockets) self.ammo_rockets = g_pickup_rockets; - StartItem ("models/weapons/g_rl.md3", "weapons/weaponpickup.wav", 15, W_Name(WEP_ROCKET_LAUNCHER), IT_ROCKET_LAUNCHER, FL_WEAPON, weapon_pickupevalfunc, 30000); + StartItem ("models/weapons/g_rl.md3", "weapons/weaponpickup.wav", 15, W_Name(WEP_ROCKET_LAUNCHER), IT_ROCKET_LAUNCHER, FL_WEAPON, weapon_pickupevalfunc, 10000); if (self.modelindex) // don't precache if self was removed weapon_action(WEP_ROCKET_LAUNCHER, WR_PRECACHE); } @@ -709,7 +700,7 @@ void item_health_small (void) { self.max_health = g_pickup_healthsmall_max; if(!self.health) self.health = g_pickup_healthsmall; - StartItem ("models/items/g_h1.md3", "misc/minihealth.wav", 15, "5 Health", IT_5HP, 0, commodity_pickupevalfunc, 1000); + StartItem ("models/items/g_h1.md3", "misc/minihealth.wav", 15, "5 Health", IT_5HP, 0, commodity_pickupevalfunc, 20000); } void item_health_medium (void) { @@ -717,7 +708,7 @@ void item_health_medium (void) { self.max_health = g_pickup_healthmedium_max; if(!self.health) self.health = g_pickup_healthmedium; - StartItem ("models/items/g_h25.md3", "misc/mediumhealth.wav", 15, "25 Health", IT_25HP, 0, commodity_pickupevalfunc, 5000); + StartItem ("models/items/g_h25.md3", "misc/mediumhealth.wav", 15, "25 Health", IT_25HP, 0, commodity_pickupevalfunc, 20000); } void item_health_large (void) { @@ -725,7 +716,7 @@ void item_health_large (void) { self.max_health = g_pickup_healthlarge_max; if(!self.health) self.health = g_pickup_healthlarge; - StartItem ("models/items/g_h50.md3", "misc/mediumhealth.wav", 15, "50 Health", IT_25HP, 0, commodity_pickupevalfunc, 5000); + StartItem ("models/items/g_h50.md3", "misc/mediumhealth.wav", 15, "50 Health", IT_25HP, 0, commodity_pickupevalfunc, 20000); } void item_health_mega (void) { diff --git a/data/qcsrc/server/t_teleporters.qc b/data/qcsrc/server/t_teleporters.qc index c7263044b..c8fe5416c 100644 --- a/data/qcsrc/server/t_teleporters.qc +++ b/data/qcsrc/server/t_teleporters.qc @@ -1,6 +1,3 @@ -void Damage (entity targ, entity inflictor, entity attacker, float -damage, float deathtype, vector hitloc, vector force); - void() tdeath_touch = { if (other == self.owner) -- 2.39.2