Ejemplo n.º 1
0
        public override bool Add(Entity ent, bool makeActive = false)
        {
            var player  = Owner as DeathmatchPlayer;
            var weapon  = ent as BaseDmWeapon;
            var notices = player != null && !player.SupressPickupNotices;

            //
            // We don't want to pick up the same weapon twice
            // But we'll take the ammo from it Winky Face
            //
            if (weapon != null && IsCarryingType(ent.GetType(), out _))
            {
                var ammo     = weapon.AmmoClip;
                var ammoType = weapon.AmmoType;

                if (ammo > 0)
                {
                    player.GiveAmmo(ammoType, ammo);

                    if (notices)
                    {
                        Sound.FromWorld("dm.pickup_ammo", ent.Position);
                        PickupFeed.OnPickup(To.Single(player), $"+{ammo} {ammoType}");
                    }
                }

                ItemRespawn.Taken(ent);

                // Despawn it
                ent.Delete();
                return(false);
            }

            if (weapon != null && notices)
            {
                Sound.FromWorld("dm.pickup_weapon", ent.Position);
                PickupFeed.OnPickup(To.Single(player), $"{ent.ClassInfo.Title}");
            }


            ItemRespawn.Taken(ent);
            return(base.Add(ent, makeActive));
        }
Ejemplo n.º 2
0
        public override void PostLevelLoaded()
        {
            base.PostLevelLoaded();

            ItemRespawn.Init();
        }