public SetMachineTargetRotation(
     UsableMachine usableMachine,
     float horizontalRotaiton,
     float verticalRotation)
 {
     this.UsableMachine      = usableMachine;
     this.HorizontalRotation = horizontalRotaiton;
     this.VerticalRotation   = verticalRotation;
 }
 public SetMachineRotation(
     UsableMachine missionObject,
     float horizontalRotation,
     float verticalRotation)
 {
     this.UsableMachine      = missionObject;
     this.HorizontalRotation = horizontalRotation;
     this.VerticalRotation   = verticalRotation;
 }
Exemple #3
0
        public static bool Prefix(this Formation formation, UsableMachine usable, bool isPlayerOrder)         // variable names must match exactly
        {
            if (formation.CountOfUnits < 1)
            {
                return(true);
            }
            if (!Main.IsPIC(formation) | formation.IsAIControlled)
            {
                return(true);
            }
            SiegeWeapon sw = (usable as SiegeWeapon);

            Traverse.Create(formation).Method("JoinDetachment", usable).GetValue();
            Main.Log("Formation starting using: " + sw.GetSiegeEngineType().ToString(), true);
            return(false);
        }
Exemple #4
0
        public static bool Prefix(IEnumerable <Formation> formations, UsableMachine usable)
        {
            // if every formation is not using, have every formation start
            if (formations.All(i => i.IsUsingMachine(usable) == false))
            {
                foreach (Formation f in formations)
                {
                    f.StartUsingMachine(usable, true);
                }
                ;
                return(false);
            }

            // if not every formation is using, have every formation start
            if (formations.Any(i => i.IsUsingMachine(usable) == true) && formations.Any(i => i.IsUsingMachine(usable) == false))
            {
                foreach (Formation f in formations)
                {
                    f.StartUsingMachine(usable, true);
                }
                ;
                return(false);
            }

            if (usable is SiegeTower || usable is BatteringRam)
            {
                // if every formation is following, have every formation stop
                if (formations.All(i => i.MovementOrder.TargetEntity == usable.WaitEntity))
                {
                    foreach (Formation f in formations)
                    {
                        f.StopUsingMachine(usable, true);
                        f.MovementOrder = MovementOrder.MovementOrderMove(f.OrderPosition);
                    }
                    ;
                    return(false);
                }
                // if every formation is using, have every formation follow
                if (formations.All(i => i.IsUsingMachine(usable) == true))
                {
                    foreach (Formation f in formations)
                    {
                        var mo = Traverse.Create <MovementOrder>().Method("MovementOrderFollowEntity", usable.WaitEntity).GetValue <MovementOrder>();
                        Main.Log("Formation following: " + (usable as SiegeWeapon).GetSiegeEngineType(), true);
                        f.MovementOrder = mo;
                    }
                    return(false);
                }
            }
            else
            {
                // if every formation is using, have every formation stop
                if (formations.All(i => i.IsUsingMachine(usable) == true))
                {
                    foreach (Formation f in formations)
                    {
                        f.StopUsingMachine(usable, true);
                    }
                    ;
                    return(false);
                }
            }
            return(false);
        }
 public SetSiegeMachineMovementDistance(UsableMachine usableMachine, float distance)
 {
     this.UsableMachine = usableMachine;
     this.Distance      = distance;
 }