X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Ft_items.qc;h=8573e4af0f9ba26f37e19ed7d84fb81f552ce3eb;hp=9edea4fb698cc3aaece7449bbb2d47e9c96f25f9;hb=8d9b7f923d981be7330d7f70f1c52ee2de000bf7;hpb=0956bbb0845e58e200a91814175f9021eb76e983 diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 9edea4fb6..8573e4af0 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -743,17 +743,16 @@ bool Item_GiveAmmoTo(entity item, entity player, int res_type, float ammomax) if (item.spawnshieldtime) { if ((player_amount >= ammomax) && (item.pickup_anyway <= 0)) - { return false; - } - GiveOrTakeResourceWithLimit(player, res_type, amount, ammomax); - return true; } - if (g_weapon_stay != 2) - { + else if (g_weapon_stay == 2) + ammomax = min(amount, ammomax); + else return false; - } - GiveOrTakeResourceWithLimit(player, res_type, amount, min(amount, ammomax)); + if (amount < 0) + TakeResourceWithLimit(player, res_type, -amount, ammomax); + else + GiveResourceWithLimit(player, res_type, amount, ammomax); return true; } @@ -781,14 +780,14 @@ bool Item_GiveTo(entity item, entity player) } } bool pickedup = false; - pickedup = pickedup || Item_GiveAmmoTo(item, player, RES_HEALTH, item.max_health); - pickedup = pickedup || Item_GiveAmmoTo(item, player, RES_ARMOR, item.max_armorvalue); - pickedup = pickedup || Item_GiveAmmoTo(item, player, RES_SHELLS, g_pickup_shells_max); - pickedup = pickedup || Item_GiveAmmoTo(item, player, RES_BULLETS, g_pickup_nails_max); - pickedup = pickedup || Item_GiveAmmoTo(item, player, RES_ROCKETS, g_pickup_rockets_max); - pickedup = pickedup || Item_GiveAmmoTo(item, player, RES_CELLS, g_pickup_cells_max); - pickedup = pickedup || Item_GiveAmmoTo(item, player, RES_PLASMA, g_pickup_plasma_max); - pickedup = pickedup || Item_GiveAmmoTo(item, player, RES_FUEL, g_pickup_fuel_max); + pickedup = (pickedup || Item_GiveAmmoTo(item, player, RES_HEALTH, item.max_health)); + pickedup = (pickedup || Item_GiveAmmoTo(item, player, RES_ARMOR, item.max_armorvalue)); + pickedup = (pickedup || Item_GiveAmmoTo(item, player, RES_SHELLS, g_pickup_shells_max)); + pickedup = (pickedup || Item_GiveAmmoTo(item, player, RES_BULLETS, g_pickup_nails_max)); + pickedup = (pickedup || Item_GiveAmmoTo(item, player, RES_ROCKETS, g_pickup_rockets_max)); + pickedup = (pickedup || Item_GiveAmmoTo(item, player, RES_CELLS, g_pickup_cells_max)); + pickedup = (pickedup || Item_GiveAmmoTo(item, player, RES_PLASMA, g_pickup_plasma_max)); + pickedup = (pickedup || Item_GiveAmmoTo(item, player, RES_FUEL, g_pickup_fuel_max)); if (item.itemdef.instanceOfWeaponPickup) { WepSet w; @@ -1216,6 +1215,9 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default return; } + precache_model(this.model); + precache_sound(this.item_pickupsound); + if (Item_IsLoot(this)) { this.reset = SUB_Remove; @@ -1247,6 +1249,8 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default { if(!have_pickup_item(this)) { + if(g_weaponarena == 2 && weaponid) + weaponsInMap |= WepSet_FromWeapon(Weapons_from(weaponid)); startitem_failed = true; delete(this); return; @@ -1307,9 +1311,6 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default weaponsInMap |= WepSet_FromWeapon(Weapons_from(weaponid)); - precache_model(this.model); - precache_sound(this.item_pickupsound); - if ( def.instanceOfPowerup || def.instanceOfWeaponPickup || (def.instanceOfHealth && def != ITEM_HealthSmall) @@ -1341,12 +1342,13 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default this.ItemStatus |= ITS_ANIMATE2; } + if(Item_IsLoot(this)) + this.gravity = 1; + if(def.instanceOfWeaponPickup) { if (!Item_IsLoot(this)) // if dropped, colormap is already set up nicely this.colormap = 1024; // color shirt=0 pants=0 grey - else - this.gravity = 1; if (!(this.spawnflags & 1024)) this.ItemStatus |= ITS_ANIMATE1; this.SendFlags |= ISF_COLORMAP; @@ -1858,7 +1860,7 @@ float GiveItems(entity e, float beginarg, float endarg) POSTGIVE_RES_ROT(e, RES_HEALTH, 1, pauserothealth_finished, autocvar_g_balance_pause_health_rot, pauseregen_finished, autocvar_g_balance_pause_health_regen, SND_MEGAHEALTH, SND_Null); if(e.superweapons_finished <= 0) - if(STAT(WEAPONS, e) & WEPSET_SUPERWEAPONS) + if(!g_weaponarena && (STAT(WEAPONS, e) & WEPSET_SUPERWEAPONS)) e.superweapons_finished = autocvar_g_balance_superweapons_time; if(e.strength_finished <= 0)