Example #1
0
 public BaseProvider(Actor self, BaseProviderInfo info)
 {
     Info      = info;
     this.self = self;
     devMode   = self.Owner.PlayerActor.Trait <DeveloperMode>();
     progress  = total = info.InitialDelay;
 }
Example #2
0
        public PowerManager(Actor self, PowerManagerInfo info)
        {
            this.self = self;
            this.info = info;

            devMode        = self.Trait <DeveloperMode>();
            wasHackEnabled = devMode.UnlimitedPower;
        }
Example #3
0
 public BaseProvider(Actor self, BaseProviderInfo info)
 {
     Info             = info;
     this.self        = self;
     devMode          = self.Owner.PlayerActor.Trait <DeveloperMode>();
     progress         = total = info.InitialDelay;
     allyBuildEnabled = self.World.WorldActor.Trait <MapBuildRadius>().AllyBuildRadiusEnabled;
 }
Example #4
0
        public CombatDebugOverlay(Actor self)
        {
            healthInfo = self.Info.TraitInfoOrDefault <HealthInfo>();
            coords     = Exts.Lazy(self.Trait <BodyOrientation>);

            var localPlayer = self.World.LocalPlayer;

            devMode = localPlayer != null?localPlayer.PlayerActor.Trait <DeveloperMode>() : null;
        }
Example #5
0
        public SupportPowerManager(ActorInitializer init)
        {
            Self       = init.Self;
            DevMode    = Self.Trait <DeveloperMode>();
            TechTree   = Self.Trait <TechTree>();
            RadarPings = Exts.Lazy(() => init.World.WorldActor.TraitOrDefault <RadarPings>());

            init.World.ActorAdded   += ActorAdded;
            init.World.ActorRemoved += ActorRemoved;
        }
Example #6
0
        public CombatDebugOverlay(Actor self)
        {
            attack = Exts.Lazy(() => self.TraitOrDefault <AttackBase>());
            coords = Exts.Lazy(() => self.Trait <IBodyOrientation>());
            health = Exts.Lazy(() => self.TraitOrDefault <Health>());

            var localPlayer = self.World.LocalPlayer;

            devMode = localPlayer != null?localPlayer.PlayerActor.Trait <DeveloperMode>() : null;
        }
Example #7
0
        void INotifyCreated.Created(Actor self)
        {
            playerPower     = self.Owner.PlayerActor.TraitOrDefault <PowerManager>();
            playerResources = self.Owner.PlayerActor.Trait <PlayerResources>();
            developerMode   = self.Owner.PlayerActor.Trait <DeveloperMode>();
            techTree        = self.Owner.PlayerActor.Trait <TechTree>();

            productionTraits = self.TraitsImplementing <Production>().Where(p => p.Info.Produces.Contains(Info.Type)).ToArray();
            CacheProducibles(self.Owner.PlayerActor);
        }
Example #8
0
        public CombatDebugOverlay(Actor self)
        {
            healthInfo = self.Info.TraitInfoOrDefault <HealthInfo>();
            blockInfo  = self.Info.TraitInfoOrDefault <BlocksProjectilesInfo>();
            attack     = Exts.Lazy(() => self.TraitOrDefault <AttackBase>());
            coords     = Exts.Lazy(() => self.Trait <BodyOrientation>());

            var localPlayer = self.World.LocalPlayer;

            devMode = localPlayer != null?localPlayer.PlayerActor.Trait <DeveloperMode>() : null;
        }
Example #9
0
        public BaseProvider(Actor self, BaseProviderInfo info)
            : base(info)
        {
            this.self = self;
            devMode   = self.Owner.PlayerActor.Trait <DeveloperMode>();
            progress  = total = info.InitialDelay;
            var mapBuildRadius = self.World.WorldActor.TraitOrDefault <MapBuildRadius>();

            allyBuildEnabled   = mapBuildRadius != null && mapBuildRadius.AllyBuildRadiusEnabled;
            buildRadiusEnabled = mapBuildRadius != null && mapBuildRadius.BuildRadiusEnabled;
        }
Example #10
0
        public ProductionQueue(ActorInitializer init, Actor playerActor, ProductionQueueInfo info)
        {
            self            = init.Self;
            Info            = info;
            playerResources = playerActor.Trait <PlayerResources>();
            playerPower     = playerActor.Trait <PowerManager>();
            developerMode   = playerActor.Trait <DeveloperMode>();

            Race    = init.Contains <RaceInit>() ? init.Get <RaceInit, string>() : self.Owner.Faction.InternalName;
            Enabled = !info.Race.Any() || info.Race.Contains(Race);

            CacheProduceables(playerActor);
        }
Example #11
0
        public ProductionQueue(ActorInitializer init, Actor playerActor, ProductionQueueInfo info)
        {
            self            = init.Self;
            Info            = info;
            playerResources = playerActor.Trait <PlayerResources>();
            developerMode   = playerActor.Trait <DeveloperMode>();

            Faction        = init.Contains <FactionInit>() ? init.Get <FactionInit, string>() : self.Owner.Faction.InternalName;
            IsValidFaction = !info.Factions.Any() || info.Factions.Contains(Faction);
            Enabled        = IsValidFaction;

            CacheProducibles(playerActor);
            allProducibles       = producible.Where(a => a.Value.Buildable || a.Value.Visible).Select(a => a.Key);
            buildableProducibles = producible.Where(a => a.Value.Buildable).Select(a => a.Key);
        }
Example #12
0
        public SupportPower(Actor self, SupportPowerInfo info)
            : base(info)
        {
            Self      = self;
            this.info = info;

            // Special case handling is required for the Player actor.
            // Created is called before Player.PlayerActor is assigned,
            // so we must query other player traits from self, knowing that
            // it refers to the same actor as self.Owner.PlayerActor
            var playerActor = self.Info.Name == "player" ? self : self.Owner.PlayerActor;

            techTree      = playerActor.Trait <TechTree>();
            developerMode = playerActor.Trait <DeveloperMode>();
        }
Example #13
0
        void INotifyCreated.Created(Actor self)
        {
            // Special case handling is required for the Player actor.
            // Created is called before Player.PlayerActor is assigned,
            // so we must query other player traits from self, knowing that
            // it refers to the same actor as self.Owner.PlayerActor
            var playerActor = self.Info.Name == "player" ? self : self.Owner.PlayerActor;

            playerPower     = playerActor.TraitOrDefault <PowerManager>();
            playerResources = playerActor.Trait <PlayerResources>();
            developerMode   = playerActor.Trait <DeveloperMode>();
            techTree        = playerActor.Trait <TechTree>();

            productionTraits = self.TraitsImplementing <Production>().Where(p => p.Info.Produces.Contains(Info.Type)).ToArray();
            CacheProducibles(playerActor);
        }
Example #14
0
        public RenderDebugState(Actor self, RenderDebugStateInfo info)
        {
            var buildingInfo = self.Info.TraitInfoOrDefault <BuildingInfo>();
            var yOffset      = buildingInfo == null ? 1 : buildingInfo.Dimensions.Y;

            offset = new WVec(0, 512 * yOffset, 0);

            this.self = self;
            color     = GetColor();
            font      = Game.Renderer.Fonts[info.Font];

            var localPlayer = self.World.LocalPlayer;

            devMode = localPlayer != null?localPlayer.PlayerActor.Trait <DeveloperMode>() : null;

            ai = self.Owner.PlayerActor.TraitsImplementing <HackyAI>().FirstOrDefault(x => x.IsEnabled);
        }
Example #15
0
        public void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
        {
            ClearQueue();

            playerPower     = newOwner.PlayerActor.Trait <PowerManager>();
            playerResources = newOwner.PlayerActor.Trait <PlayerResources>();
            developerMode   = newOwner.PlayerActor.Trait <DeveloperMode>();

            if (!Info.Sticky)
            {
                Race    = self.Owner.Faction.InternalName;
                Enabled = !Info.Race.Any() || Info.Race.Contains(Race);
            }

            // Regenerate the produceables and tech tree state
            oldOwner.PlayerActor.Trait <TechTree>().Remove(this);
            CacheProduceables(newOwner.PlayerActor);
            newOwner.PlayerActor.Trait <TechTree>().Update();
        }
Example #16
0
        void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
        {
            ClearQueue();

            playerPower     = newOwner.PlayerActor.Trait <PowerManager>();
            playerResources = newOwner.PlayerActor.Trait <PlayerResources>();
            developerMode   = newOwner.PlayerActor.Trait <DeveloperMode>();

            if (!Info.Sticky)
            {
                Faction        = self.Owner.Faction.InternalName;
                IsValidFaction = !Info.Factions.Any() || Info.Factions.Contains(Faction);
            }

            // Regenerate the producibles and tech tree state
            oldOwner.PlayerActor.Trait <TechTree>().Remove(this);
            CacheProducibles(newOwner.PlayerActor);
            newOwner.PlayerActor.Trait <TechTree>().Update();
        }
Example #17
0
 public void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
 {
     powerManager  = newOwner.PlayerActor.Trait <PowerManager>();
     developerMode = newOwner.PlayerActor.Trait <DeveloperMode>();
 }
Example #18
0
 public PowerTooltip(Actor self)
 {
     this.self     = self;
     powerManager  = self.Owner.PlayerActor.Trait <PowerManager>();
     developerMode = self.Owner.PlayerActor.Trait <DeveloperMode>();
 }
Example #19
0
 void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
 {
     techTree      = newOwner.PlayerActor.Trait <TechTree>();
     developerMode = newOwner.PlayerActor.Trait <DeveloperMode>();
 }