public Reservation(int year, int d, Construction constructionName) { startingYear = year; duration = d; construction = constructionName; upgradeYear = 0; isUpgraded = false; isPopulationUpgraded = false; isDestroyed = false; buildingProperties = new BuildingsBaseProperties(); constructionStatus = ConstructionStatus.None; }
public override Job GetJob(Pawn meeseeks, CompMeeseeksMemory memory, SavedJob savedJob, SavedTargetInfo jobTarget, ref JobAvailability jobAvailabilty) { Job job = null; ConstructionStatus status = jobTarget.TargetConstructionStatus(meeseeks.MapHeld); Logger.MessageFormat(this, "Checking for blocker, construction status: {0}", status); if (status == ConstructionStatus.None) { BuildableDef buildableDef = jobTarget.BuildableDef; if (buildableDef != null && GenConstruct.PlaceBlueprintForBuild(buildableDef, jobTarget.Cell, meeseeks.MapHeld, jobTarget.blueprintRotation, meeseeks.Faction, jobTarget.blueprintStuff) != null) { status = ConstructionStatus.InProgress; } } if (status == ConstructionStatus.Blocked) { job = GetDeconstructingJob(meeseeks, jobTarget, meeseeks.MapHeld); if (job == null) { jobAvailabilty = JobAvailability.Delayed; } else { jobAvailabilty = JobAvailability.Available; } } else if (status == ConstructionStatus.InProgress) { job = ScanForJob(meeseeks, memory, savedJob, jobTarget, ref jobAvailabilty, true); if (job == null) { jobAvailabilty = JobAvailability.Delayed; } else { jobAvailabilty = JobAvailability.Available; } } else if (status == ConstructionStatus.Complete) { jobAvailabilty = JobAvailability.Complete; } return(job); }
public Reservation(int year, int d, Construction constructionName) { startingYear = year; duration = d; construction = constructionName; upgradeYear = 0; isUpgraded = false; isPopulationUpgraded = false; isDestroyed = false; buildingProperties = new BuildingsBaseProperties(); constructionStatus = ConstructionStatus.None; }
void InitialState() { constructionYear = 0; constructionLifetime = 0; if (isPopulationConstruction) { degradationPeriod = 0; //population constructions do not degradate upgraded = true; //set to upgrade automatically to historical period 2, when entering it if (isPopulationConstruction_UpgradedLevel) { constructingPeriod = 1;//takes 1 year to complete the construction stage } //(because the constructing starts directly from stage 2) else { constructingPeriod = 2; //takes two years to complete the construction stage } upgradeYear = (int)HistoricalPeriod.HP2_FirstYear; //initially } else { degradationPeriod = 1;//(initially) takes one year for the construction to disappear upgradeYear = 0; upgraded = false; constructingPeriod = 2;//takes two years to complete the construction stage } repairCost = 0; upgradeCost = 0; isSelected = false; constructionType = ConstructionType.None; constructionStatus = ConstructionStatus.None; historicalPeriod_1_Availability = 0; historicalPeriod_2_Availability = 0; HP1_Aspect_AnimationSpeed = 0; HP1_Aspect_ExtraAnimationSpeed = 0; HP2_Aspect_AnimationSpeed = 0; HP2_Aspect_ExtraAnimationSpeed = 0; HP1_AspectExtraAnimationSprite = null; HP2_AspectExtraAnimationSprite = null; }
/// <summary> /// Adapts the graphics for the current construction to the construction stage and historical period /// Both stage and historical period are previosly determined based on the current year /// </summary> /// <param name="stage">Stage 0..4; 0 means nothing is displayed, 4 means degradation state</param> /// <param name="period">Historical period 1,2</param> protected void ConstructionStage(int stage, int period) { Hide(); switch (stage) { case 0: constructionStatus = ConstructionStatus.None; break; case 1://first construction stage if (period == 1 && HistoricalPeriod_1_Availability) { HP1_ConstructionSprite.Visible = true; HP1_ConstructionSprite.FrameNumber = 0; HP1_ConstructionSprite.Highlight = isSelected; this.Enabled = true; } if (period == 2 && HistoricalPeriod_2_Availability) { HP2_ConstructionSprite.Visible = true; HP2_ConstructionSprite.FrameNumber = 0; HP2_ConstructionSprite.Highlight = isSelected; this.Enabled = true; } constructionStatus = ConstructionStatus.InConstruction; break; case 2://second construction stage if (period == 1 && HistoricalPeriod_1_Availability) { HP1_ConstructionSprite.Visible = true; HP1_ConstructionSprite.FrameNumber = 1; HP1_ConstructionSprite.Highlight = isSelected; this.Enabled = true; } if (period == 2 && HistoricalPeriod_2_Availability) { HP2_ConstructionSprite.Visible = true; HP2_ConstructionSprite.FrameNumber = 1; HP2_ConstructionSprite.Highlight = isSelected; this.Enabled = true; } constructionStatus = ConstructionStatus.InConstruction; break; case 3://third stage construction == aspect sprite; construction finished if (period == 1 && HistoricalPeriod_1_Availability) { HP1_AspectSprite.Visible = true; HP1_AspectSprite.FrameNumber = 0; HP1_AspectSprite.Highlight = isSelected; HP1_AspectSprite.AnimationSpeed = HP1_Aspect_AnimationSpeed; if (HP1_AspectExtraAnimationSprite != null) { HP1_AspectExtraAnimationSprite.Visible = true; HP1_AspectExtraAnimationSprite.FrameNumber = 0; HP1_AspectExtraAnimationSprite.Highlight = isSelected; HP1_AspectExtraAnimationSprite.AnimationSpeed = HP1_Aspect_ExtraAnimationSpeed; } this.Enabled = true; } if (period == 2 && HistoricalPeriod_2_Availability) { HP2_AspectSprite.Visible = true; HP2_AspectSprite.FrameNumber = 0; HP2_AspectSprite.Highlight = isSelected; HP2_AspectSprite.AnimationSpeed = HP2_Aspect_AnimationSpeed; if (HP2_AspectExtraAnimationSprite != null) { HP2_AspectExtraAnimationSprite.Visible = true; HP2_AspectExtraAnimationSprite.FrameNumber = 0; HP2_AspectExtraAnimationSprite.Highlight = isSelected; HP2_AspectExtraAnimationSprite.AnimationSpeed = HP2_Aspect_ExtraAnimationSpeed; } this.Enabled = true; } constructionStatus = ConstructionStatus.InProduction; break; case 4://forth stage construction == degradation period if (period == 1 && HistoricalPeriod_1_Availability) { if (HP1_DegradationSprite != null) { HP1_DegradationSprite.Visible = true; HP1_DegradationSprite.Highlight = isSelected; } this.Enabled = true; } if (period == 2 && HistoricalPeriod_2_Availability) { if (HP2_DegradationSprite != null) { HP2_DegradationSprite.Visible = true; HP2_DegradationSprite.Highlight = isSelected; } this.Enabled = true; } constructionStatus = ConstructionStatus.InDegradation; break; default: break; } }
void InitialState() { constructionYear = 0; constructionLifetime = 0; if (isPopulationConstruction) { degradationPeriod = 0; //population constructions do not degradate upgraded = true;//set to upgrade automatically to historical period 2, when entering it if (isPopulationConstruction_UpgradedLevel) constructingPeriod = 1;//takes 1 year to complete the construction stage //(because the constructing starts directly from stage 2) else constructingPeriod = 2;//takes two years to complete the construction stage upgradeYear = (int)HistoricalPeriod.HP2_FirstYear; //initially } else { degradationPeriod = 1;//(initially) takes one year for the construction to disappear upgradeYear = 0; upgraded = false; constructingPeriod = 2;//takes two years to complete the construction stage } repairCost = 0; upgradeCost = 0; isSelected = false; constructionType = ConstructionType.None; constructionStatus = ConstructionStatus.None; historicalPeriod_1_Availability = 0; historicalPeriod_2_Availability = 0; HP1_Aspect_AnimationSpeed = 0; HP1_Aspect_ExtraAnimationSpeed = 0; HP2_Aspect_AnimationSpeed = 0; HP2_Aspect_ExtraAnimationSpeed = 0; HP1_AspectExtraAnimationSprite = null; HP2_AspectExtraAnimationSprite = null; }
/// <summary> /// Adapts the graphics for the current construction to the construction stage and historical period /// Both stage and historical period are previosly determined based on the current year /// </summary> /// <param name="stage">Stage 0..4; 0 means nothing is displayed, 4 means degradation state</param> /// <param name="period">Historical period 1,2</param> protected void ConstructionStage(int stage, int period) { Hide(); switch (stage) { case 0: constructionStatus = ConstructionStatus.None; break; case 1: //first construction stage if (period == 1 && HistoricalPeriod_1_Availability) { HP1_ConstructionSprite.Visible = true; HP1_ConstructionSprite.FrameNumber = 0; HP1_ConstructionSprite.Highlight = isSelected; this.Enabled = true; } if (period == 2 && HistoricalPeriod_2_Availability) { HP2_ConstructionSprite.Visible = true; HP2_ConstructionSprite.FrameNumber = 0; HP2_ConstructionSprite.Highlight = isSelected; this.Enabled = true; } constructionStatus = ConstructionStatus.InConstruction; break; case 2: //second construction stage if (period == 1 && HistoricalPeriod_1_Availability) { HP1_ConstructionSprite.Visible = true; HP1_ConstructionSprite.FrameNumber = 1; HP1_ConstructionSprite.Highlight = isSelected; this.Enabled = true; } if (period == 2 && HistoricalPeriod_2_Availability) { HP2_ConstructionSprite.Visible = true; HP2_ConstructionSprite.FrameNumber = 1; HP2_ConstructionSprite.Highlight = isSelected; this.Enabled = true; } constructionStatus = ConstructionStatus.InConstruction; break; case 3: //third stage construction == aspect sprite; construction finished if (period == 1 && HistoricalPeriod_1_Availability) { HP1_AspectSprite.Visible = true; HP1_AspectSprite.FrameNumber = 0; HP1_AspectSprite.Highlight = isSelected; HP1_AspectSprite.AnimationSpeed = HP1_Aspect_AnimationSpeed; if (HP1_AspectExtraAnimationSprite != null) { HP1_AspectExtraAnimationSprite.Visible = true; HP1_AspectExtraAnimationSprite.FrameNumber = 0; HP1_AspectExtraAnimationSprite.Highlight = isSelected; HP1_AspectExtraAnimationSprite.AnimationSpeed = HP1_Aspect_ExtraAnimationSpeed; } this.Enabled = true; } if (period == 2 && HistoricalPeriod_2_Availability) { HP2_AspectSprite.Visible = true; HP2_AspectSprite.FrameNumber = 0; HP2_AspectSprite.Highlight = isSelected; HP2_AspectSprite.AnimationSpeed = HP2_Aspect_AnimationSpeed; if (HP2_AspectExtraAnimationSprite != null) { HP2_AspectExtraAnimationSprite.Visible = true; HP2_AspectExtraAnimationSprite.FrameNumber = 0; HP2_AspectExtraAnimationSprite.Highlight = isSelected; HP2_AspectExtraAnimationSprite.AnimationSpeed = HP2_Aspect_ExtraAnimationSpeed; } this.Enabled = true; } constructionStatus = ConstructionStatus.InProduction; break; case 4: //forth stage construction == degradation period if (period == 1 && HistoricalPeriod_1_Availability) { if (HP1_DegradationSprite != null) { HP1_DegradationSprite.Visible = true; HP1_DegradationSprite.Highlight = isSelected; } this.Enabled = true; } if (period == 2 && HistoricalPeriod_2_Availability) { if (HP2_DegradationSprite != null) { HP2_DegradationSprite.Visible = true; HP2_DegradationSprite.Highlight = isSelected; } this.Enabled = true; } constructionStatus = ConstructionStatus.InDegradation; break; default: break; } }