X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Ft_items.qc;h=9a8ac71239ba807cfe8019022aae7d7473a9e605;hb=3d1817a9f5354dbfa1cf799ee7f3a206dd0ed033;hp=b502cac3312d051d46c4f044516f78c1d4ff80eb;hpb=44effb3a66f8b44d05106ff361ef5fc126fef03b;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index b502cac33..9a8ac7123 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -1,3 +1,40 @@ +float have_pickup_item(void) +{ + // minstagib: only allow filtered items + if(g_minstagib) + if(self.classname != "minstagib") + return FALSE; + + if(self.items == IT_STRENGTH || self.items == IT_INVINCIBLE) + { + if(autocvar_g_powerups > 0) + return TRUE; + if(autocvar_g_powerups == 0) + return FALSE; + if(g_lms) + return FALSE; + if(g_ca) + return FALSE; + if(g_arena) + return FALSE; + } + else + { + if(autocvar_g_pickup_items > 0) + return TRUE; + if(autocvar_g_pickup_items == 0) + return FALSE; + if(g_lms) + return FALSE; + if(g_ca) + return FALSE; + if(g_weaponarena) + if((self.weapons & WEPBIT_ALL) || (self.items & IT_AMMO)) + return FALSE; + } + return TRUE; +} + #define ITEM_RESPAWN_TICKS 10 #define ITEM_RESPAWNTIME(i) ((i).respawntime + crandom() * (i).respawntimejitter) @@ -390,7 +427,7 @@ float Item_GiveTo(entity item, entity player) } if (item.flags & FL_WEAPON) - if ((it = item.weapons - (item.weapons & player.weapons)) || (g_pickup_weapons_anyway && !(g_weapon_stay == 3 && !e.spawnshieldtime))) + if ((it = item.weapons - (item.weapons & player.weapons)) || (g_pickup_weapons_anyway && g_weapon_stay == 0)) { pickedup = TRUE; for(i = WEP_FIRST; i <= WEP_LAST; ++i) @@ -559,7 +596,7 @@ void RemoveItem(void) // pickup evaluation functions // these functions decide how desirable an item is to the bots -float generic_pickupevalfunc(entity player, entity item) {return item.bot_pickupbasevalue;}; +float generic_pickupevalfunc(entity player, entity item) {return item.bot_pickupbasevalue;} float weapon_pickupevalfunc(entity player, entity item) { @@ -616,7 +653,7 @@ float weapon_pickupevalfunc(entity player, entity item) } return item.bot_pickupbasevalue * c; -}; +} float commodity_pickupevalfunc(entity player, entity item) { @@ -669,7 +706,7 @@ float commodity_pickupevalfunc(entity player, entity item) c = c + max(0, 1 - player.health / item.max_health); return item.bot_pickupbasevalue * c; -}; +} .float is_item; @@ -707,6 +744,13 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, return; } + if(!have_pickup_item()) + { + startitem_failed = TRUE; + remove (self); + return; + } + self.reset = Item_Reset; // it's a level item if(self.spawnflags & 1) @@ -759,35 +803,6 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, self.is_item = TRUE; } - if(g_lms || g_ca) - { - startitem_failed = TRUE; - remove(self); - return; - } - else if (g_weaponarena && ((weaponid & WEPBIT_ALL) || (itemid & IT_AMMO))) - { - startitem_failed = TRUE; - remove(self); - return; - } - else if (g_minstagib) - { - // don't remove dropped items and powerups - if (self.classname != "minstagib") - { - startitem_failed = TRUE; - remove (self); - return; - } - } - else if (!autocvar_g_pickup_items && itemid != IT_STRENGTH && itemid != IT_INVINCIBLE && itemid != IT_HEALTH) - { - startitem_failed = TRUE; - remove (self); - return; - } - weaponsInMap |= weaponid; precache_model (itemmodel); @@ -855,7 +870,7 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, */ void minstagib_items (float itemid) { - local float rnd; + float rnd; self.classname = "minstagib"; // replace rocket launchers and nex guns with ammo cells @@ -1041,7 +1056,7 @@ void weapon_defaultspawnfunc(float wpn) void spawnfunc_weapon_shotgun (void); void spawnfunc_weapon_uzi (void) { - if(q3acompat_machineshotgunswap) + if(autocvar_sv_q3acompat_machineshotgunswap) if(self.classname != "droppedweapon") { weapon_defaultspawnfunc(WEP_SHOTGUN); @@ -1051,7 +1066,7 @@ void spawnfunc_weapon_uzi (void) { } void spawnfunc_weapon_shotgun (void) { - if(q3acompat_machineshotgunswap) + if(autocvar_sv_q3acompat_machineshotgunswap) if(self.classname != "droppedweapon") { weapon_defaultspawnfunc(WEP_UZI); @@ -1107,7 +1122,7 @@ void spawnfunc_item_rockets (void) { void spawnfunc_item_shells (void); void spawnfunc_item_bullets (void) { if(!weaponswapping) - if(q3acompat_machineshotgunswap) + if(autocvar_sv_q3acompat_machineshotgunswap) if(self.classname != "droppedweapon") { weaponswapping = TRUE; @@ -1133,7 +1148,7 @@ void spawnfunc_item_cells (void) { void spawnfunc_item_shells (void) { if(!weaponswapping) - if(q3acompat_machineshotgunswap) + if(autocvar_sv_q3acompat_machineshotgunswap) if(self.classname != "droppedweapon") { weaponswapping = TRUE; @@ -1220,12 +1235,6 @@ void spawnfunc_item_health_large (void) { } void spawnfunc_item_health_mega (void) { - if(!autocvar_g_powerup_superhealth) - return; - - if((g_arena || g_ca) && !autocvar_g_arena_powerups) - return; - if(g_minstagib) { minstagib_items(IT_NAILS); } else { @@ -1247,12 +1256,6 @@ void spawnfunc_item_health25() { spawnfunc_item_health_medium(); } void spawnfunc_item_health100() { spawnfunc_item_health_mega(); } void spawnfunc_item_strength (void) { - if(!autocvar_g_powerup_strength) - return; - - if((g_arena || g_ca) && !autocvar_g_arena_powerups) - return; - if(g_minstagib) { minstagib_items(IT_STRENGTH); } else { @@ -1263,12 +1266,6 @@ void spawnfunc_item_strength (void) { } void spawnfunc_item_invincible (void) { - if(!autocvar_g_powerup_shield) - return; - - if((g_arena || g_ca) && !autocvar_g_arena_powerups) - return; - if(g_minstagib) { minstagib_items(IT_INVINCIBLE); } else {