示例#1
0
 static void Postfix(PassingShip vis)
 {
     if (Multiplayer.game == null)
     {
         return;
     }
     ScribeUtil.sharedCrossRefs.Unregister(vis);
 }
 internal static void _Depart(this PassingShip obj)
 {
     if (Find.ListerBuildings.allBuildingsColonist.Any(b => (
                                                           (b.def.thingClass == typeof(Building_CommsConsole)) ||
                                                           (b.def.thingClass.IsSubclassOf(typeof(Building_CommsConsole)))
                                                           ))
         )
     {
         string   key       = "MessageShipHasLeftCommsRange";
         string   fullTitle = obj.FullTitle;
         object[] objArray  = { (object)fullTitle };
         Messages.Message(Translator.Translate(key, objArray), MessageSound.Silent);
     }
     Find.PassingShipManager.RemoveShip(obj);
 }
            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);
            }