From: bones_was_here Date: Thu, 15 Jun 2023 20:53:25 +0000 (+1000) Subject: items: apply 0.5s spawnshield to all loot drops by default X-Git-Tag: xonotic-v0.8.6~7^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d9d40f1354f7707197842fc173f0fbc4637d61f8;p=xonotic%2Fxonotic-data.pk3dir.git items: apply 0.5s spawnshield to all loot drops by default This prevents immediate pickup of the dropped item. Previously powerups used this mechanism, whereas thrown weapons could be picked up immediately by everyone except the person who threw them. It will be consistent for most/all loot items now, and perhaps nicer because players should see the items in the world before picking them up so it might feel more deliberate and less random. --- diff --git a/qcsrc/common/mutators/mutator/powerups/sv_powerups.qc b/qcsrc/common/mutators/mutator/powerups/sv_powerups.qc index 7b15d34a0..4fb9882c9 100644 --- a/qcsrc/common/mutators/mutator/powerups/sv_powerups.qc +++ b/qcsrc/common/mutators/mutator/powerups/sv_powerups.qc @@ -122,8 +122,6 @@ void powerups_DropItem(entity this, StatusEffects effect, bool freezeTimer) if (!Item_InitializeLoot(e, item.m_canonical_spawnfunc, this.origin, vel, time_to_live)) return; - e.item_spawnshieldtime = time + 0.5; - if(!freezeTimer) Item_SetExpiring(e, true); diff --git a/qcsrc/server/items/items.qc b/qcsrc/server/items/items.qc index 7c3fd969b..3aef870e0 100644 --- a/qcsrc/server/items/items.qc +++ b/qcsrc/server/items/items.qc @@ -205,9 +205,6 @@ void Item_Think(entity this) if (this.itemdef.instanceOfPowerup) powerups_DropItem_Think(this); - // enable pickup by the player who threw it - this.owner = NULL; - // send slow updates even if the item didn't move // recovers prediction desyncs where server thinks item stopped, client thinks it didn't ItemUpdate(this); @@ -1018,6 +1015,9 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default this.nextthink = time + IT_UPDATE_INTERVAL; this.wait = time + autocvar_g_items_dropped_lifetime; + this.owner = NULL; // anyone can pick this up, including the player who threw it + this.item_spawnshieldtime = time + 0.5; // but not straight away + this.takedamage = DAMAGE_YES; this.event_damage = Item_Damage; // enable this to have thrown items burn in lava