Beispiel #1
0
        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 <BulletClass>     pBullet = pWeapon.Ref.Projectile.Ref.
                                                CreateBullet(target.OwnerObject.Convert <AbstractClass>(), Owner.Get().OwnerObject,
                                                             damage, Warhead, pWeapon.Ref.Speed, pWeapon.Ref.Bright);

            const int   radius      = 600;
            CoordStruct curLocation = target.OwnerObject.Ref.Base.Base.GetCoords();

            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);
        }
Beispiel #2
0
        private void KillStart(TechnoExt ext)
        {
            angle  = 0;
            frames = 0;
            radius = 1024;

            Target.Set(ext);
        }
Beispiel #3
0
        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);
            }
        }
Beispiel #4
0
        static public unsafe UInt32 TechnoClass_Remove_Script(REGISTERS *R)
        {
            Pointer <TechnoClass> pTechno = (IntPtr)R->ECX;

            TechnoExt ext = TechnoExt.ExtMap.Find(pTechno);

            ext.Scriptable?.OnRemove();

            return(0);
        }
Beispiel #5
0
 public override void OnFire(Pointer <AbstractClass> pTarget, int weaponIndex)
 {
     if (pTarget.CastToTechno(out Pointer <TechnoClass> pTechno))
     {
         TechnoExt pTargetExt = TechnoExt.ExtMap.Find(pTechno);
         if (pTargetExt.Get(MissileFall.ID) == null)
         {
             pTargetExt.CreateDecorator <MissileFall>(MissileFall.ID, "Missile Fall Decorator", this, weaponIndex != 0);
         }
     }
 }
Beispiel #6
0
        static public unsafe UInt32 TechnoClass_Put_Script(REGISTERS *R)
        {
            Pointer <TechnoClass> pTechno = (IntPtr)R->ECX;
            var pCoord  = R->Stack <Pointer <CoordStruct> >(0x4);
            var faceDir = R->Stack <Direction>(0x8);

            TechnoExt ext = TechnoExt.ExtMap.Find(pTechno);

            ext.Scriptable?.OnPut(pCoord.Data, faceDir);

            return(0);
        }
Beispiel #7
0
        static public unsafe UInt32 TechnoClass_ReceiveDamage_Script(REGISTERS *R)
        {
            Pointer <TechnoClass> pTechno = (IntPtr)R->ECX;
            var pDamage = R->Stack <Pointer <int> >(0x4);
            var distanceFromEpicenter = R->Stack <int>(0x8);
            var pWH                    = R->Stack <Pointer <WarheadTypeClass> >(0xC);
            var pAttacker              = R->Stack <Pointer <ObjectClass> >(0x10);
            var ignoreDefenses         = R->Stack <bool>(0x14);
            var preventPassengerEscape = R->Stack <bool>(0x18);
            var pAttackingHouse        = R->Stack <Pointer <HouseClass> >(0x1C);

            TechnoExt ext = TechnoExt.ExtMap.Find(pTechno);

            ext.Scriptable?.OnReceiveDamage(pDamage, distanceFromEpicenter, pWH, pAttacker, ignoreDefenses, preventPassengerEscape, pAttackingHouse);

            return(0);
        }
Beispiel #8
0
 static public unsafe UInt32 TechnoClass_Save_Suffix(REGISTERS *R)
 {
     return(TechnoExt.TechnoClass_Save_Suffix(R));
 }
Beispiel #9
0
 static public unsafe UInt32 TechnoClass_DTOR(REGISTERS *R)
 {
     return(TechnoExt.TechnoClass_DTOR(R));
 }
Beispiel #10
0
 public GGI(TechnoExt owner) : base(owner)
 {
 }
Beispiel #11
0
 public Disk(TechnoExt owner) : base(owner)
 {
 }
Beispiel #12
0
 public MTNK(TechnoExt owner) : base(owner)
 {
 }