public override void OnUpdate() { if (Owner.Get() == null || lifetime <= 0) { Decorative.Remove(this); return; } if (rof-- > 0 && --lifetime > 0) { return; } rof = 5; int damage = lifetime > 0 ? 10 : 100; TechnoExt target = Decorative as TechnoExt; Pointer <WeaponTypeClass> pWeapon = Weapon; Pointer <WarheadTypeClass> pWarhead = Warhead; Func <int, Pointer <BulletClass> > CreateBullet = (int damage) => { Pointer <BulletClass> pBullet = pWeapon.Ref.Projectile.Ref. CreateBullet(target.OwnerObject.Convert <AbstractClass>(), Owner.Get().OwnerObject, damage, pWarhead, pWeapon.Ref.Speed, pWeapon.Ref.Bright); return(pBullet); }; CoordStruct curLocation = target.OwnerObject.Ref.Base.Base.GetCoords(); if (Cluster) { CellStruct cur = MapClass.Coord2Cell(curLocation); CellSpreadEnumerator enumerator = new CellSpreadEnumerator(2); foreach (CellStruct offset in enumerator) { Pointer <BulletClass> pBullet = CreateBullet(damage); CoordStruct where = MapClass.Cell2Coord(cur + offset, 2000); if (MapClass.Instance.TryGetCellAt(where, out Pointer <CellClass> pCell)) { BulletVelocity velocity = new BulletVelocity(0, 0, 0); pBullet.Ref.MoveTo(where, velocity); pBullet.Ref.SetTarget(pCell.Convert <AbstractClass>()); } } } else { Pointer <BulletClass> pBullet = CreateBullet(damage); const int radius = 600; CoordStruct where = curLocation + new CoordStruct(random.Next(-radius, radius), random.Next(-radius, radius), 2000); BulletVelocity velocity = new BulletVelocity(0, 0, 0); pBullet.Ref.MoveTo(where, velocity); } }