From d9d40f1354f7707197842fc173f0fbc4637d61f8 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Fri, 16 Jun 2023 06:53:25 +1000 Subject: [PATCH] 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. --- qcsrc/common/mutators/mutator/powerups/sv_powerups.qc | 2 -- qcsrc/server/items/items.qc | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) 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 -- 2.39.2