X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Ft_items.qc;h=cacc1e4f511e87ba71f3e91dd83889c0194866af;hp=b506141e8c8e6fb39c4694823f26824746bc5312;hb=14f45231bfeae7747a7bd2b2629164b41985ce71;hpb=8864567ea710555af39cac30456582afcc7ab4af diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index b506141e8c..cacc1e4f51 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -393,7 +393,7 @@ bool have_pickup_item(entity this) if(autocvar_g_pickup_items == 0) return false; if(g_weaponarena) - if(this.weapons || (this.items & IT_AMMO)) // no item or ammo pickups in weaponarena + if(this.weapons || this.itemdef.instanceOfAmmo) // no item or ammo pickups in weaponarena return false; } return true; @@ -924,6 +924,7 @@ float generic_pickupevalfunc(entity player, entity item) {return item.bot_pickup float weapon_pickupevalfunc(entity player, entity item) { float c; + int rating = item.bot_pickupbasevalue; // See if I have it already if(player.weapons & item.weapons) @@ -933,8 +934,10 @@ float weapon_pickupevalfunc(entity player, entity item) c = 0; else if(player.ammo_cells || player.ammo_shells || player.ammo_plasma || player.ammo_nails || player.ammo_rockets) { + if (rating > 0) + rating = BOT_PICKUP_RATING_LOW * 0.5 * (1 + rating / BOT_PICKUP_RATING_HIGH); // Skilled bots will grab more - c = bound(0, skill / 10, 1) * 0.5; + c = 1 + bound(0, skill / 10, 1) * 0.5; } else c = 0; @@ -985,10 +988,10 @@ float weapon_pickupevalfunc(entity player, entity item) } if (missing < 3 && best_ratio) - return (BOT_PICKUP_RATING_HIGH - ( (BOT_PICKUP_RATING_HIGH - BOT_PICKUP_RATING_LOW) * best_ratio )) * c; + c = c - best_ratio * 0.3; } - return item.bot_pickupbasevalue * c; + return rating * c; } float commodity_pickupevalfunc(entity player, entity item) @@ -1055,6 +1058,12 @@ void Item_Damage(entity this, entity inflictor, entity attacker, float damage, i RemoveItem(this); } +void item_use(entity this, entity actor, entity trigger) +{ + // use the touch function to handle collection + gettouch(this)(this, actor); +} + void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter) { string itemname = def.m_name; @@ -1176,6 +1185,9 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default } */ + if(this.targetname != "" && (this.spawnflags & 16)) + this.use = item_use; + if(autocvar_spawn_debug >= 2) { // why not flags & fl_item?