Esempio n. 1
0
        public override void PostSpawnSetup(bool respawningAfterLoad)
        {
            base.PostSpawnSetup(respawningAfterLoad);

            setupDone = true;

            calculated   = false;
            lastPosition = iv3Invalid;
            lastRotation = r4Invalid;

            isPawn    = parent.def.category == ThingCategory.Pawn;
            size      = parent.def.size;
            isOneCell = size.z == 1 && size.x == 1;

            isSaveable       = parent.def.isSaveable;
            saveCompressible = parent.def.saveCompressible;

            compHiddenable = mainComponent.compHiddenable;

            updateVisibility(false);
        }
        public override void PostSpawnSetup(bool respawningAfterLoad)
        {
            base.PostSpawnSetup(respawningAfterLoad);

            setupDone = true;

            calculated     = false;
            lastPosition   = iv3Invalid;
            lastSightRange = -9999;
            lastIsPeeking  = false;

            viewMap1 = null;
            viewMap2 = null;

            viewRect = new CellRect(-1, -1, 0, 0);

            viewPositions = new IntVec3[5];

            compHiddenable    = mainComponent.compHiddenable;
            compGlower        = parent.GetComp <CompGlower>();
            compPowerTrader   = parent.GetComp <CompPowerTrader>();
            compRefuelable    = parent.GetComp <CompRefuelable>();
            compFlickable     = parent.GetComp <CompFlickable>();
            compMannable      = parent.GetComp <CompMannable>();
            compProvideVision = parent.GetComp <CompProvideVision>();

            pawn     = parent as Pawn;
            building = parent as Building;
            turret   = parent as Building_TurretGun;

            if (pawn != null)
            {
                raceProps  = pawn.RaceProps;
                hediffs    = pawn.health.hediffSet.hediffs;
                capacities = pawn.health.capacities;
            }

            initMap();

            def = parent.def;
            if (def.race != null)
            {
                isMechanoid = def.race.IsMechanoid;
            }
            else
            {
                isMechanoid = false;
            }

            if (!isMechanoid)
            {
                baseViewRange = NON_MECH_DEFAULT_RANGE;
            }
            else
            {
                baseViewRange = MECH_DEFAULT_RANGE;
            }

            disabled = false;

            lastMovementTick       = Find.TickManager.TicksGame;
            lastPositionUpdateTick = lastMovementTick;
            updateFoV();
        }
Esempio n. 3
0
        public override void PostSpawnSetup(bool respawningAfterLoad)
        {
            setupDone = true;

            calculated     = false;
            lastPosition   = iv3Invalid;
            lastSightRange = 0;
            lastIsPeeking  = false;

            viewMap1 = null;
            viewMap2 = null;

            viewRect = new CellRect(-1, -1, 0, 0);

            viewPositions = new IntVec3[5];

            compHiddenable    = mainComponent.compHiddenable;
            compGlower        = parent.GetComp <CompGlower>();
            compPowerTrader   = parent.GetComp <CompPowerTrader>();
            compRefuelable    = parent.GetComp <CompRefuelable>();
            compFlickable     = parent.GetComp <CompFlickable>();
            compMannable      = parent.GetComp <CompMannable>();
            compProvideVision = parent.GetComp <CompProvideVision>();

            pawn     = parent as Pawn;
            building = parent as Building;
            turret   = parent as Building_TurretGun;

            if (pawn != null)
            {
                raceProps  = pawn.RaceProps;
                hediffs    = pawn.health.hediffSet.hediffs;
                capacities = pawn.health.capacities;
                pawnPather = pawn.pather;
            }

            def = parent.def;
            if (def.race != null)
            {
                isMechanoid = def.race.IsMechanoid;
            }
            else
            {
                isMechanoid = false;
            }

            if (!isMechanoid)
            {
                baseViewRange = NON_MECH_DEFAULT_RANGE;
            }
            else
            {
                baseViewRange = MECH_DEFAULT_RANGE;
            }

            if ((pawn == null) && !(turret != null && compMannable == null) && (compProvideVision == null) && (building == null))
            {
                // Disable the component and remove from the main one (this thing doesn't need the FoV calculation).
                Log.Message("Removing unneeded FoV watcher from " + parent.ThingID);
                disabled = true;
                mainComponent.compFieldOfViewWatcher = null;
            }
            else
            {
                disabled = false;
            }

            initMap();

            lastMovementTick       = Find.TickManager.TicksGame;
            lastPositionUpdateTick = lastMovementTick;
            updateFoV();
        }