]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
items: apply 0.5s spawnshield to all loot drops by default
authorbones_was_here <bones_was_here@xonotic.au>
Thu, 15 Jun 2023 20:53:25 +0000 (06:53 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Thu, 15 Jun 2023 20:53:25 +0000 (06:53 +1000)
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
qcsrc/server/items/items.qc

index 7b15d34a09f8a4d4f30533d0f304dcfec6d89099..4fb9882c97ea94e195f21a0d115c80bbc1b6d8ef 100644 (file)
@@ -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);
 
index 7c3fd969b5f7f6929a814bdb52500eccb4cdf2e1..3aef870e00a8b775257803ef20ce1270fc941067 100644 (file)
@@ -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