public FloatMenuOption CommFloatMenuOption(Building_CommsConsole console, Pawn negotiator)
        {
            StringBuilder sb = new StringBuilder("");

            if (CommunicationEstablished)
            {
                sb.Append("CallOnRadio".Translate(this.GetCallLabel()));
            }
            else
            {
                sb.Append("PES_TryToCallOnRadio".Translate(GetCallLabel()));
            }
            return(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(sb.ToString(), delegate()
            {
                console.GiveUseCommsJob(negotiator, this);
            }, MenuOptionPriority.InitiateSocial), negotiator, console));
        }
            static bool Prefix(PassingShip __instance, Building_CommsConsole console, Pawn negotiator, ref FloatMenuOption __result)
            {
                string label = "CallOnRadio".Translate(__instance.GetCallLabel());

                if (!__instance.Map.listerBuildings.allBuildingsColonist.Any(b => b.def.HasComp(typeof(Comp_EnhancedBeacon)) && b.TryGetComp <CompPowerTrader>().PowerOn))
                {
                    return(true);
                }
                else
                {
                    Action action = delegate()
                    {
                        console.GiveUseCommsJob(negotiator, __instance);
                    };
                    __result = FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(label, action, MenuOptionPriority.InitiateSocial, null, null, 0f, null, null), negotiator, console, "ReservedBy");
                    return(false);
                }
            }
            public static bool CommFloatMenuOptionPrefix(Building_CommsConsole console, Pawn negotiator, PassingShip __instance, ref FloatMenuOption __result)
            {
                string label  = "CallOnRadio".Translate(__instance.GetCallLabel());
                Action action = delegate
                {
                    if (!AllPowered(__instance.Map).Any())
                    {
                        Messages.Message("MessageNeedBeaconToTradeWithShip".Translate(), console, MessageTypeDefOf.RejectInput, false);
                    }
                    else
                    {
                        //Log.Message("Trying to use console with PassingShip " + __instance);
                        console.GiveUseCommsJob(negotiator, __instance);
                    }
                };

                __result = FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(label, action, MenuOptionPriority.InitiateSocial, null, null, 0f, null, null), negotiator, console, "ReservedBy");
                return(false);
            }
Exemplo n.º 4
0
 public FloatMenuOption CommFloatMenuOption(Building_CommsConsole console, Pawn negotiator) => FloatMenuUtility.DecoratePrioritizedTask(
     new FloatMenuOption(GetCallLabel(), () => console.GiveUseCommsJob(negotiator, this), MenuOptionPriority.InitiateSocial), negotiator, console);
Exemplo n.º 5
0
 public FloatMenuOption CommFloatMenuOption(Building_CommsConsole console, Pawn negotiator)
 {
     return(new FloatMenuOption(Label, () => console.GiveUseCommsJob(negotiator, this)));
 }