public static float EnterCooldownHoursLeft(this MapParent worldObject)
        {
            EnterCooldownComp component = worldObject.GetComponent <EnterCooldownComp>();

            if (component == null)
            {
                return(0f);
            }
            return(component.DaysLeft * 24f);
        }
 public static FloatMenuAcceptanceReport CanVisit(Caravan caravan, MapParent escapeShip)
 {
     if (escapeShip == null || !escapeShip.Spawned || escapeShip.GetComponent <EscapeShipComp>() == null)
     {
         return(false);
     }
     if (escapeShip.EnterCooldownBlocksEntering())
     {
         return(FloatMenuAcceptanceReport.WithFailMessage("MessageEnterCooldownBlocksEntering".Translate(escapeShip.EnterCooldownTicksLeft().ToStringTicksToPeriod())));
     }
     return(true);
 }
        public static FloatMenuAcceptanceReport CanVisit(Caravan caravan, MapParent escapeShip)
        {
            FloatMenuAcceptanceReport result;

            if (escapeShip == null || !escapeShip.Spawned || escapeShip.GetComponent <EscapeShipComp>() == null)
            {
                result = false;
            }
            else if (escapeShip.EnterCooldownBlocksEntering())
            {
                result = FloatMenuAcceptanceReport.WithFailMessage("MessageEnterCooldownBlocksEntering".Translate(new object[]
                {
                    escapeShip.EnterCooldownDaysLeft().ToString("0.#")
                }));
            }
            else
            {
                result = true;
            }
            return(result);
        }
 public static IEnumerable <FloatMenuOption> GetFloatMenuOptions(Caravan caravan, MapParent escapeShip)
 {
     return(CaravanArrivalActionUtility.GetFloatMenuOptions <CaravanArrivalAction_VisitEscapeShip>(() => CaravanArrivalAction_VisitEscapeShip.CanVisit(caravan, escapeShip), () => new CaravanArrivalAction_VisitEscapeShip(escapeShip.GetComponent <EscapeShipComp>()), "VisitEscapeShip".Translate(new object[]
     {
         escapeShip.Label
     }), caravan, escapeShip.Tile, escapeShip));
 }
Beispiel #5
0
        public static bool EnterCooldownBlocksEntering(this MapParent worldObject)
        {
            EnterCooldownComp component = worldObject.GetComponent <EnterCooldownComp>();

            return(component != null && component.BlocksEntering);
        }
Beispiel #6
0
        public static float EnterCooldownDaysLeft(this MapParent worldObject)
        {
            EnterCooldownComp component = worldObject.GetComponent <EnterCooldownComp>();

            return((component == null) ? 0f : component.DaysLeft);
        }
 public static bool EnterCooldownBlocksEntering(this MapParent worldObject)
 {
     return(worldObject.GetComponent <EnterCooldownComp>()?.BlocksEntering ?? false);
 }
        public static int EnterCooldownTicksLeft(this MapParent worldObject)
        {
            EnterCooldownComp component = worldObject.GetComponent <EnterCooldownComp>();

            return(Mathf.CeilToInt((component != null) ? (component.DaysLeft * 60000f) : 0f));
        }
 public static float EnterCooldownDaysLeft(this MapParent worldObject)
 {
     return(worldObject.GetComponent <EnterCooldownComp>()?.DaysLeft ?? 0f);
 }