protected void processCommunicable(ICommunicable comm, Pawn myPawn, List <FloatMenuOption> result) { if (comm != null) { string text = "CallOnRadio".Translate(comm.GetCallLabel()); Action action = delegate { ICommunicable localCommTarget = comm; if (!Building_OrbitalTradeBeacon.AllPowered(this.Map).Any <Building_OrbitalTradeBeacon>()) { Messages.Message("MessageNeedBeaconToTradeWithShip".Translate(), this, MessageTypeDefOf.RejectInput); return; } if (comm is ILoadReferenceable) { //if we communicate with an object that can be saved we create a job. Job job = new Job(JobDefOf.UseCommsConsole, this); job.commTarget = localCommTarget; myPawn.jobs.TryTakeOrderedJob(job, JobTag.Misc); } else { //if we cannot save the com target we avoid creating a job and start the communication immediately. localCommTarget.TryOpenComms(myPawn); } PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.OpeningComms, KnowledgeAmount.Total); }; result.Add(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(text, action, MenuOptionPriority.InitiateSocial, null, null, 0f, null, null), myPawn, this)); } }
private void UseAct(Pawn myPawn, ICommunicable commTarget) { var job = new Job(DefDatabase<JobDef>.GetNamed("JecsTools_UseConsole"), this.parent); job.commTarget = commTarget; myPawn.jobs.TryTakeOrderedJob(job); PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.OpeningComms, KnowledgeAmount.Total); }
public void Clear() { def = null; targetA = LocalTargetInfo.Invalid; targetB = LocalTargetInfo.Invalid; targetC = LocalTargetInfo.Invalid; targetQueueA = null; targetQueueB = null; count = -1; countQueue = null; loadID = -1; startTick = -1; expiryInterval = -1; checkOverrideOnExpire = false; playerForced = false; placedThings = null; maxNumMeleeAttacks = int.MaxValue; maxNumStaticAttacks = int.MaxValue; locomotionUrgency = LocomotionUrgency.Jog; haulMode = HaulMode.Undefined; bill = null; commTarget = null; plantDefToSow = null; verbToUse = null; haulOpportunisticDuplicates = false; exitMapOnArrival = false; failIfCantJoinOrCreateCaravan = false; killIncappedTarget = false; ignoreForbidden = false; ignoreDesignations = false; canBash = false; canUseRangedWeapon = true; haulDroppedApparel = false; restUntilHealed = false; ignoreJoyTimeAssignment = false; doUntilGatheringEnded = false; overeat = false; attackDoorIfTargetLost = false; takeExtraIngestibles = 0; expireRequiresEnemiesNearby = false; lord = null; collideWithPawns = false; forceSleep = false; interaction = null; endIfCantShootTargetFromCurPos = false; endIfCantShootInMelee = false; checkEncumbrance = false; followRadius = 0f; endAfterTendedOnce = false; quest = null; mote = null; jobGiverThinkTree = null; jobGiver = null; workGiverDef = null; if (cachedDriver != null) { cachedDriver.job = null; } cachedDriver = null; }
private void UseAct(Pawn myPawn, ICommunicable commTarget) { Job job = new Job(JobDefOf.UseCommsConsole, this); job.commTarget = commTarget; myPawn.jobs.TryTakeOrderedJob(job, JobTag.Misc); PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.OpeningComms, KnowledgeAmount.Total); }
public void GiveUseCommsJob(Pawn negotiator, ICommunicable target) { Job job = new Job(JobDefOf.UseCommsConsole, this); job.commTarget = target; negotiator.jobs.TryTakeOrderedJob(job, JobTag.Misc); PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.OpeningComms, KnowledgeAmount.Total); }
static string CallLabelReplace(ICommunicable comm, string callLabel) { if (comm is Communication) { return(comm.GetCallLabel()); } return(callLabel); }
public SavedJob(Job job) { def = job.def; targetA = job.targetA; targetB = job.targetB; targetC = job.targetC; targetQueueA = job.targetQueueA; targetQueueB = job.targetQueueB; count = job.count; countQueue = job.countQueue; startTick = job.startTick; expiryInterval = job.expiryInterval; checkOverrideOnExpire = job.checkOverrideOnExpire; playerForced = job.playerForced; placedThings = job.placedThings; maxNumMeleeAttacks = job.maxNumMeleeAttacks; maxNumStaticAttacks = job.maxNumStaticAttacks; locomotionUrgency = job.locomotionUrgency; haulMode = job.haulMode; bill = job.bill; commTarget = job.commTarget; plantDefToSow = job.plantDefToSow; verbToUse = job.verbToUse; haulOpportunisticDuplicates = job.haulOpportunisticDuplicates; exitMapOnArrival = job.exitMapOnArrival; failIfCantJoinOrCreateCaravan = job.failIfCantJoinOrCreateCaravan; killIncappedTarget = job.killIncappedTarget; ignoreForbidden = job.ignoreForbidden; ignoreDesignations = job.ignoreDesignations; canBash = job.canBash; canUseRangedWeapon = job.canUseRangedWeapon; haulDroppedApparel = job.haulDroppedApparel; restUntilHealed = job.restUntilHealed; ignoreJoyTimeAssignment = job.ignoreJoyTimeAssignment; doUntilGatheringEnded = job.doUntilGatheringEnded; overeat = job.overeat; attackDoorIfTargetLost = job.attackDoorIfTargetLost; takeExtraIngestibles = job.takeExtraIngestibles; expireRequiresEnemiesNearby = job.expireRequiresEnemiesNearby; lord = job.lord; collideWithPawns = job.collideWithPawns; forceSleep = job.forceSleep; interaction = job.interaction; endIfCantShootTargetFromCurPos = job.endIfCantShootTargetFromCurPos; endIfCantShootInMelee = job.endIfCantShootInMelee; checkEncumbrance = job.checkEncumbrance; followRadius = job.followRadius; endAfterTendedOnce = job.endAfterTendedOnce; quest = job.quest; mote = job.mote; reactingToMeleeThreat = job.reactingToMeleeThreat; wasOnMeditationTimeAssignment = job.wasOnMeditationTimeAssignment; psyfocusTargetLast = job.psyfocusTargetLast; //jobGiverThinkTree = job.jobGiverThinkTree; //jobGiver = job.jobGiver; workGiverDef = job.workGiverDef; ability = job.ability; }
private void UseAct(Pawn myPawn, ICommunicable commTarget) { var job = new Job(DefDatabase <JobDef> .GetNamed("UseSignalFire"), this) { commTarget = commTarget }; myPawn.jobs.TryTakeOrderedJob(job, 0); PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.OpeningComms, (KnowledgeAmount)6); }
public void ExposeData() { ILoadReferenceable refee = (ILoadReferenceable)commTarget; Scribe_References.Look(ref refee, "commTarget"); commTarget = (ICommunicable)refee; Scribe_References.Look(ref verbToUse, "verbToUse"); Scribe_References.Look(ref bill, "bill"); Scribe_References.Look(ref lord, "lord"); Scribe_Defs.Look(ref def, "def"); Scribe_Values.Look(ref loadID, "loadID", 0); Scribe_TargetInfo.Look(ref targetA, "targetA"); Scribe_TargetInfo.Look(ref targetB, "targetB"); Scribe_TargetInfo.Look(ref targetC, "targetC"); Scribe_Collections.Look(ref targetQueueA, "targetQueueA", LookMode.Undefined); Scribe_Collections.Look(ref targetQueueB, "targetQueueB", LookMode.Undefined); Scribe_Values.Look(ref count, "count", -1); Scribe_Collections.Look(ref countQueue, "countQueue", LookMode.Undefined); Scribe_Values.Look(ref startTick, "startTick", -1); Scribe_Values.Look(ref expiryInterval, "expiryInterval", -1); Scribe_Values.Look(ref checkOverrideOnExpire, "checkOverrideOnExpire", defaultValue: false); Scribe_Values.Look(ref playerForced, "playerForced", defaultValue: false); Scribe_Collections.Look(ref placedThings, "placedThings", LookMode.Undefined); Scribe_Values.Look(ref maxNumMeleeAttacks, "maxNumMeleeAttacks", 2147483647); Scribe_Values.Look(ref maxNumStaticAttacks, "maxNumStaticAttacks", 2147483647); Scribe_Values.Look(ref exitMapOnArrival, "exitMapOnArrival", defaultValue: false); Scribe_Values.Look(ref failIfCantJoinOrCreateCaravan, "failIfCantJoinOrCreateCaravan", defaultValue: false); Scribe_Values.Look(ref killIncappedTarget, "killIncappedTarget", defaultValue: false); Scribe_Values.Look(ref haulOpportunisticDuplicates, "haulOpportunisticDuplicates", defaultValue: false); Scribe_Values.Look(ref haulMode, "haulMode", HaulMode.Undefined); Scribe_Defs.Look(ref plantDefToSow, "plantDefToSow"); Scribe_Values.Look(ref locomotionUrgency, "locomotionUrgency", LocomotionUrgency.Jog); Scribe_Values.Look(ref ignoreDesignations, "ignoreDesignations", defaultValue: false); Scribe_Values.Look(ref canBash, "canBash", defaultValue: false); Scribe_Values.Look(ref haulDroppedApparel, "haulDroppedApparel", defaultValue: false); Scribe_Values.Look(ref restUntilHealed, "restUntilHealed", defaultValue: false); Scribe_Values.Look(ref ignoreJoyTimeAssignment, "ignoreJoyTimeAssignment", defaultValue: false); Scribe_Values.Look(ref overeat, "overeat", defaultValue: false); Scribe_Values.Look(ref attackDoorIfTargetLost, "attackDoorIfTargetLost", defaultValue: false); Scribe_Values.Look(ref takeExtraIngestibles, "takeExtraIngestibles", 0); Scribe_Values.Look(ref expireRequiresEnemiesNearby, "expireRequiresEnemiesNearby", defaultValue: false); Scribe_Values.Look(ref collideWithPawns, "collideWithPawns", defaultValue: false); Scribe_Values.Look(ref forceSleep, "forceSleep", defaultValue: false); Scribe_Defs.Look(ref interaction, "interaction"); Scribe_Values.Look(ref endIfCantShootTargetFromCurPos, "endIfCantShootTargetFromCurPos", defaultValue: false); Scribe_Values.Look(ref endIfCantShootInMelee, "endIfCantShootInMelee", defaultValue: false); Scribe_Values.Look(ref checkEncumbrance, "checkEncumbrance", defaultValue: false); Scribe_Values.Look(ref followRadius, "followRadius", 0f); Scribe_Values.Look(ref endAfterTendedOnce, "endAfterTendedOnce", defaultValue: false); if (Scribe.mode == LoadSaveMode.PostLoadInit && verbToUse != null && verbToUse.BuggedAfterLoading) { verbToUse = null; Log.Warning(GetType() + " had a bugged verbToUse after loading."); } }
public void ExposeData() { ILoadReferenceable loadReferenceable = (ILoadReferenceable)this.commTarget; Scribe_References.Look <ILoadReferenceable>(ref loadReferenceable, "commTarget", false); this.commTarget = (ICommunicable)loadReferenceable; Scribe_References.Look <Verb>(ref this.verbToUse, "verbToUse", false); Scribe_References.Look <Bill>(ref this.bill, "bill", false); Scribe_References.Look <Lord>(ref this.lord, "lord", false); Scribe_Defs.Look <JobDef>(ref this.def, "def"); Scribe_Values.Look <int>(ref this.loadID, "loadID", 0, false); Scribe_TargetInfo.Look(ref this.targetA, "targetA"); Scribe_TargetInfo.Look(ref this.targetB, "targetB"); Scribe_TargetInfo.Look(ref this.targetC, "targetC"); Scribe_Collections.Look <LocalTargetInfo>(ref this.targetQueueA, "targetQueueA", LookMode.Undefined, new object[0]); Scribe_Collections.Look <LocalTargetInfo>(ref this.targetQueueB, "targetQueueB", LookMode.Undefined, new object[0]); Scribe_Values.Look <int>(ref this.count, "count", -1, false); Scribe_Collections.Look <int>(ref this.countQueue, "countQueue", LookMode.Undefined, new object[0]); Scribe_Values.Look <int>(ref this.startTick, "startTick", -1, false); Scribe_Values.Look <int>(ref this.expiryInterval, "expiryInterval", -1, false); Scribe_Values.Look <bool>(ref this.checkOverrideOnExpire, "checkOverrideOnExpire", false, false); Scribe_Values.Look <bool>(ref this.playerForced, "playerForced", false, false); Scribe_Collections.Look <ThingCountClass>(ref this.placedThings, "placedThings", LookMode.Undefined, new object[0]); Scribe_Values.Look <int>(ref this.maxNumMeleeAttacks, "maxNumMeleeAttacks", 2147483647, false); Scribe_Values.Look <int>(ref this.maxNumStaticAttacks, "maxNumStaticAttacks", 2147483647, false); Scribe_Values.Look <bool>(ref this.exitMapOnArrival, "exitMapOnArrival", false, false); Scribe_Values.Look <bool>(ref this.failIfCantJoinOrCreateCaravan, "failIfCantJoinOrCreateCaravan", false, false); Scribe_Values.Look <bool>(ref this.killIncappedTarget, "killIncappedTarget", false, false); Scribe_Values.Look <bool>(ref this.haulOpportunisticDuplicates, "haulOpportunisticDuplicates", false, false); Scribe_Values.Look <HaulMode>(ref this.haulMode, "haulMode", HaulMode.Undefined, false); Scribe_Defs.Look <ThingDef>(ref this.plantDefToSow, "plantDefToSow"); Scribe_Values.Look <LocomotionUrgency>(ref this.locomotionUrgency, "locomotionUrgency", LocomotionUrgency.Jog, false); Scribe_Values.Look <bool>(ref this.ignoreDesignations, "ignoreDesignations", false, false); Scribe_Values.Look <bool>(ref this.canBash, "canBash", false, false); Scribe_Values.Look <bool>(ref this.haulDroppedApparel, "haulDroppedApparel", false, false); Scribe_Values.Look <bool>(ref this.restUntilHealed, "restUntilHealed", false, false); Scribe_Values.Look <bool>(ref this.ignoreJoyTimeAssignment, "ignoreJoyTimeAssignment", false, false); Scribe_Values.Look <bool>(ref this.overeat, "overeat", false, false); Scribe_Values.Look <bool>(ref this.attackDoorIfTargetLost, "attackDoorIfTargetLost", false, false); Scribe_Values.Look <int>(ref this.takeExtraIngestibles, "takeExtraIngestibles", 0, false); Scribe_Values.Look <bool>(ref this.expireRequiresEnemiesNearby, "expireRequiresEnemiesNearby", false, false); Scribe_Values.Look <bool>(ref this.collideWithPawns, "collideWithPawns", false, false); Scribe_Values.Look <bool>(ref this.forceSleep, "forceSleep", false, false); Scribe_Defs.Look <InteractionDef>(ref this.interaction, "interaction"); Scribe_Values.Look <bool>(ref this.endIfCantShootTargetFromCurPos, "endIfCantShootTargetFromCurPos", false, false); Scribe_Values.Look <bool>(ref this.endIfCantShootInMelee, "endIfCantShootInMelee", false, false); Scribe_Values.Look <bool>(ref this.checkEncumbrance, "checkEncumbrance", false, false); Scribe_Values.Look <float>(ref this.followRadius, "followRadius", 0f, false); Scribe_Values.Look <bool>(ref this.endAfterTendedOnce, "endAfterTendedOnce", false, false); if (Scribe.mode == LoadSaveMode.PostLoadInit && this.verbToUse != null && this.verbToUse.BuggedAfterLoading) { this.verbToUse = null; Log.Warning(base.GetType() + " had a bugged verbToUse after loading.", false); } }
private void GiveSmokeSignalJob(Pawn myPawn, ICommunicable newCommTarget) { //var job = new Job(MyDefs.ApparelSmokeSignalJobDef, parent) var job = new Job(MyDefs.SmokeSignalJobDef, parent) { commTarget = newCommTarget }; myPawn.jobs.TryTakeOrderedJob(job, 0); PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.OpeningComms, KnowledgeAmount.Total); }
public void ExposeData() { var loadReferenceable = (ILoadReferenceable)commTarget; Scribe_References.Look(ref loadReferenceable, "commTarget", false); commTarget = (ICommunicable)loadReferenceable; Scribe_References.Look(ref verbToUse, "verbToUse", false); Scribe_References.Look(ref bill, "bill", false); Scribe_References.Look(ref lord, "lord", false); Scribe_Defs.Look(ref def, "def"); Scribe_TargetInfo.Look(ref targetA, "targetA"); Scribe_TargetInfo.Look(ref targetB, "targetB"); Scribe_TargetInfo.Look(ref targetC, "targetC"); Scribe_Collections.Look(ref targetQueueA, "targetQueueA", LookMode.Undefined); Scribe_Collections.Look(ref targetQueueB, "targetQueueB", LookMode.Undefined); Scribe_Values.Look(ref count, "count", -1, false); Scribe_Collections.Look(ref countQueue, "countQueue", LookMode.Undefined); Scribe_Values.Look(ref startTick, "startTick", -1, false); Scribe_Values.Look(ref expiryInterval, "expiryInterval", -1, false); Scribe_Values.Look(ref checkOverrideOnExpire, "checkOverrideOnExpire", false, false); Scribe_Values.Look(ref playerForced, "playerForced", false, false); Scribe_Collections.Look(ref placedThings, "placedThings", LookMode.Undefined); Scribe_Values.Look(ref maxNumMeleeAttacks, "maxNumMeleeAttacks", 2147483647, false); Scribe_Values.Look(ref maxNumStaticAttacks, "maxNumStaticAttacks", 2147483647, false); Scribe_Values.Look(ref exitMapOnArrival, "exitMapOnArrival", false, false); Scribe_Values.Look(ref failIfCantJoinOrCreateCaravan, "failIfCantJoinOrCreateCaravan", false, false); Scribe_Values.Look(ref killIncappedTarget, "killIncappedTarget", false, false); Scribe_Values.Look(ref haulOpportunisticDuplicates, "haulOpportunisticDuplicates", false, false); Scribe_Values.Look(ref haulMode, "haulMode", HaulMode.Undefined, false); Scribe_Defs.Look(ref plantDefToSow, "plantDefToSow"); Scribe_Values.Look(ref locomotionUrgency, "locomotionUrgency", LocomotionUrgency.Jog, false); Scribe_Values.Look(ref ignoreDesignations, "ignoreDesignations", false, false); Scribe_Values.Look(ref canBash, "canBash", false, false); Scribe_Values.Look(ref haulDroppedApparel, "haulDroppedApparel", false, false); Scribe_Values.Look(ref restUntilHealed, "restUntilHealed", false, false); Scribe_Values.Look(ref ignoreJoyTimeAssignment, "ignoreJoyTimeAssignment", false, false); Scribe_Values.Look(ref overeat, "overeat", false, false); Scribe_Values.Look(ref attackDoorIfTargetLost, "attackDoorIfTargetLost", false, false); Scribe_Values.Look(ref takeExtraIngestibles, "takeExtraIngestibles", 0, false); Scribe_Values.Look(ref expireRequiresEnemiesNearby, "expireRequiresEnemiesNearby", false, false); Scribe_Values.Look(ref collideWithCaravans, "collideWithCaravans", false, false); }
public void ExposeData() { var loadReferenceable = (ILoadReferenceable)commTarget; Scribe_References.Look(ref loadReferenceable, nameof(commTarget)); commTarget = (ICommunicable)loadReferenceable; Scribe_References.Look(ref verbToUse, nameof(verbToUse)); Scribe_References.Look(ref bill, nameof(bill)); Scribe_References.Look(ref lord, nameof(lord)); Scribe_Defs.Look(ref def, nameof(def)); Scribe_TargetInfo.Look(ref targetA, nameof(targetA)); Scribe_TargetInfo.Look(ref targetB, nameof(targetB)); Scribe_TargetInfo.Look(ref targetC, nameof(targetC)); Scribe_Collections.Look(ref targetQueueA, nameof(targetQueueA), LookMode.GlobalTargetInfo); Scribe_Collections.Look(ref targetQueueB, nameof(targetQueueB), LookMode.GlobalTargetInfo); Scribe_Values.Look(ref count, nameof(count), -1); Scribe_Collections.Look(ref countQueue, nameof(countQueue), LookMode.Value); Scribe_Values.Look(ref startTick, nameof(startTick), -1); Scribe_Values.Look(ref expiryInterval, nameof(expiryInterval), -1); Scribe_Values.Look(ref checkOverrideOnExpire, nameof(checkOverrideOnExpire)); Scribe_Values.Look(ref playerForced, nameof(playerForced)); Scribe_Collections.Look(ref placedThings, nameof(placedThings), LookMode.Deep); Scribe_Values.Look(ref maxNumMeleeAttacks, nameof(maxNumMeleeAttacks), int.MaxValue); Scribe_Values.Look(ref maxNumStaticAttacks, nameof(maxNumStaticAttacks), int.MaxValue); Scribe_Values.Look(ref exitMapOnArrival, nameof(exitMapOnArrival)); Scribe_Values.Look(ref failIfCantJoinOrCreateCaravan, nameof(failIfCantJoinOrCreateCaravan)); Scribe_Values.Look(ref killIncappedTarget, nameof(killIncappedTarget)); Scribe_Values.Look(ref haulOpportunisticDuplicates, nameof(haulOpportunisticDuplicates)); Scribe_Values.Look(ref haulMode, nameof(haulMode)); Scribe_Defs.Look(ref plantDefToSow, nameof(plantDefToSow)); Scribe_Values.Look(ref locomotionUrgency, nameof(locomotionUrgency), LocomotionUrgency.Jog); Scribe_Values.Look(ref ignoreDesignations, nameof(ignoreDesignations)); Scribe_Values.Look(ref canBash, nameof(canBash)); Scribe_Values.Look(ref haulDroppedApparel, nameof(haulDroppedApparel)); Scribe_Values.Look(ref restUntilHealed, nameof(restUntilHealed)); Scribe_Values.Look(ref ignoreJoyTimeAssignment, nameof(ignoreJoyTimeAssignment)); Scribe_Values.Look(ref overeat, nameof(overeat)); Scribe_Values.Look(ref attackDoorIfTargetLost, nameof(attackDoorIfTargetLost)); Scribe_Values.Look(ref takeExtraIngestibles, nameof(takeExtraIngestibles)); Scribe_Values.Look(ref expireRequiresEnemiesNearby, nameof(expireRequiresEnemiesNearby)); Scribe_Values.Look(ref collideWithCaravans, nameof(collideWithCaravans)); }
public void ExposeData() { ILoadReferenceable loadReferenceable = (ILoadReferenceable)this.commTarget; Scribe_References.Look <ILoadReferenceable>(ref loadReferenceable, "commTarget", false); this.commTarget = (ICommunicable)loadReferenceable; Scribe_References.Look <Verb>(ref this.verbToUse, "verbToUse", false); Scribe_References.Look <Bill>(ref this.bill, "bill", false); Scribe_References.Look <Lord>(ref this.lord, "lord", false); Scribe_Defs.Look <CaravanJobDef>(ref this.def, "def"); Scribe_TargetInfo.Look(ref this.targetA, "targetA"); Scribe_TargetInfo.Look(ref this.targetB, "targetB"); Scribe_TargetInfo.Look(ref this.targetC, "targetC"); Scribe_Collections.Look <GlobalTargetInfo>(ref this.targetQueueA, "targetQueueA", LookMode.Undefined, new object[0]); Scribe_Collections.Look <GlobalTargetInfo>(ref this.targetQueueB, "targetQueueB", LookMode.Undefined, new object[0]); Scribe_Values.Look <int>(ref this.count, "count", -1, false); Scribe_Collections.Look <int>(ref this.countQueue, "countQueue", LookMode.Undefined, new object[0]); Scribe_Values.Look <int>(ref this.startTick, "startTick", -1, false); Scribe_Values.Look <int>(ref this.expiryInterval, "expiryInterval", -1, false); Scribe_Values.Look <bool>(ref this.checkOverrideOnExpire, "checkOverrideOnExpire", false, false); Scribe_Values.Look <bool>(ref this.playerForced, "playerForced", false, false); Scribe_Collections.Look <ThingStackPartClass>(ref this.placedThings, "placedThings", LookMode.Undefined, new object[0]); Scribe_Values.Look <int>(ref this.maxNumMeleeAttacks, "maxNumMeleeAttacks", 2147483647, false); Scribe_Values.Look <int>(ref this.maxNumStaticAttacks, "maxNumStaticAttacks", 2147483647, false); Scribe_Values.Look <bool>(ref this.exitMapOnArrival, "exitMapOnArrival", false, false); Scribe_Values.Look <bool>(ref this.failIfCantJoinOrCreateCaravan, "failIfCantJoinOrCreateCaravan", false, false); Scribe_Values.Look <bool>(ref this.killIncappedTarget, "killIncappedTarget", false, false); Scribe_Values.Look <bool>(ref this.haulOpportunisticDuplicates, "haulOpportunisticDuplicates", false, false); Scribe_Values.Look <HaulMode>(ref this.haulMode, "haulMode", HaulMode.Undefined, false); Scribe_Defs.Look <ThingDef>(ref this.plantDefToSow, "plantDefToSow"); Scribe_Values.Look <LocomotionUrgency>(ref this.locomotionUrgency, "locomotionUrgency", LocomotionUrgency.Jog, false); Scribe_Values.Look <bool>(ref this.ignoreDesignations, "ignoreDesignations", false, false); Scribe_Values.Look <bool>(ref this.canBash, "canBash", false, false); Scribe_Values.Look <bool>(ref this.haulDroppedApparel, "haulDroppedApparel", false, false); Scribe_Values.Look <bool>(ref this.restUntilHealed, "restUntilHealed", false, false); Scribe_Values.Look <bool>(ref this.ignoreJoyTimeAssignment, "ignoreJoyTimeAssignment", false, false); Scribe_Values.Look <bool>(ref this.overeat, "overeat", false, false); Scribe_Values.Look <bool>(ref this.attackDoorIfTargetLost, "attackDoorIfTargetLost", false, false); Scribe_Values.Look <int>(ref this.takeExtraIngestibles, "takeExtraIngestibles", 0, false); Scribe_Values.Look <bool>(ref this.expireRequiresEnemiesNearby, "expireRequiresEnemiesNearby", false, false); Scribe_Values.Look <bool>(ref this.collideWithCaravans, "collideWithCaravans", false, false); }
public Dialog_NegotiationIoM(Pawn negotiator, ICommunicable commTarget, DiaNode startNode, bool radioMode) : base(startNode, radioMode, false) { this.negotiator = negotiator; this.commTarget = commTarget; }
public override IEnumerable <FloatMenuOption> GetFloatMenuOptions(Pawn myPawn) { if (!myPawn.CanReach(this, PathEndMode.InteractionCell, Danger.Some, false, TraverseMode.ByPawn)) { FloatMenuOption item = new FloatMenuOption("CannotUseNoPath".Translate(), null, MenuOptionPriority.Default, null, null, 0f, null, null); List <FloatMenuOption> list = new List <FloatMenuOption>(); list.Add(item); return(list); } if (base.Spawned && base.Map.gameConditionManager.ConditionIsActive(GameConditionDefOf.SolarFlare)) { FloatMenuOption item2 = new FloatMenuOption("CannotUseSolarFlare".Translate(), null, MenuOptionPriority.Default, null, null, 0f, null, null); List <FloatMenuOption> list = new List <FloatMenuOption>(); list.Add(item2); return(list); } if (!this.powerComp.PowerOn) { FloatMenuOption item3 = new FloatMenuOption("CannotUseNoPower".Translate(), null, MenuOptionPriority.Default, null, null, 0f, null, null); List <FloatMenuOption> list = new List <FloatMenuOption>(); list.Add(item3); return(list); } if (!myPawn.health.capacities.CapableOf(PawnCapacityDefOf.Talking)) { FloatMenuOption item4 = new FloatMenuOption("CannotUseReason".Translate("IncapableOfCapacity".Translate(PawnCapacityDefOf.Talking.label)), null, MenuOptionPriority.Default, null, null, 0f, null, null); List <FloatMenuOption> list = new List <FloatMenuOption>(); list.Add(item4); return(list); } if (myPawn.skills.GetSkill(SkillDefOf.Social).TotallyDisabled) { FloatMenuOption item5 = new FloatMenuOption("CannotPrioritizeWorkTypeDisabled".Translate(SkillDefOf.Social.LabelCap), null, MenuOptionPriority.Default, null, null, 0f, null, null); List <FloatMenuOption> list = new List <FloatMenuOption>(); list.Add(item5); return(list); } if (!this.CanUseCommsNow) { Log.Error(myPawn + " could not use comm console for unknown reason."); FloatMenuOption item6 = new FloatMenuOption("Cannot use now", null, MenuOptionPriority.Default, null, null, 0f, null, null); List <FloatMenuOption> list = new List <FloatMenuOption>(); list.Add(item6); return(list); } List <FloatMenuOption> list2 = new List <FloatMenuOption>(); IEnumerable <ICommunicable> enumerable = myPawn.Map.passingShipManager.passingShips.Cast <ICommunicable>().Concat(Find.FactionManager.AllFactionsInViewOrder.Cast <ICommunicable>()); foreach (ICommunicable item7 in enumerable) { ICommunicable localCommTarget = item7; string text = "CallOnRadio".Translate(localCommTarget.GetCallLabel()); Faction faction = localCommTarget as Faction; if (faction != null) { if (!faction.IsPlayer) { if (Building_CommsConsole.LeaderIsAvailableToTalk(faction)) { goto IL_0339; } string str = (faction.leader == null) ? "LeaderUnavailableNoLeader".Translate() : "LeaderUnavailable".Translate(faction.leader.LabelShort); list2.Add(new FloatMenuOption(text + " (" + str + ")", null, MenuOptionPriority.Default, null, null, 0f, null, null)); } continue; } goto IL_0339; IL_0339: Action action = delegate { ICommunicable commTarget2 = localCommTarget; if (item7 is TradeShip && !Building_OrbitalTradeBeacon.AllPowered(base.Map).Any()) { Messages.Message("MessageNeedBeaconToTradeWithShip".Translate(), this, MessageTypeDefOf.RejectInput); } else { Job job = new Job(JobDefOf.UseCommsConsole, this); job.commTarget = commTarget2; myPawn.jobs.TryTakeOrderedJob(job, JobTag.Misc); PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.OpeningComms, KnowledgeAmount.Total); } }; list2.Add(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(text, action, MenuOptionPriority.InitiateSocial, null, null, 0f, null, null), myPawn, this, "ReservedBy")); } return(list2); }
public override void DoWindowContents(Rect inRect) { Rect baseRect = inRect; Rect leftRect = new Rect(0f, 15f, 120f, baseRect.height - 25f); Rect centerRect = new Rect(baseRect.width / 2f - 220f, 120f, 440f, baseRect.height - 120f); Rect rightRect = new Rect(baseRect.width - 120f, 15f, 120f, baseRect.height - 25f); GUI.BeginGroup(inRect); Rect titleRect = new Rect(baseRect.x, baseRect.y, baseRect.width, 30f); // GUI.BeginGroup(titleRect); Text.Anchor = TextAnchor.MiddleCenter; Text.Font = GameFont.Medium; string title = "Subsector " + storyTracker.SubsectorName; Widgets.Label(titleRect, title); Text.Font = GameFont.Small; Text.Anchor = TextAnchor.UpperLeft; // GUI.EndGroup(); GUI.BeginGroup(leftRect); float num = leftRect.y; CorruptionStoryTrackerUtilities.ListSeparatorBig(ref num, leftRect.width, "ImperialFrequencies".Translate()); num += 50f; for (int i = 0; i < storyTracker.ImperialFactions.Count; i++) { num += DrawFactionRowCommsIoM(storyTracker.ImperialFactions[i], num, leftRect, negotiator); } // Widgets.DrawRectFast(leftRect, Color.white); GUI.EndGroup(); this.DrawStarGrid(centerRect); // GUI.BeginGroup(centerRect); Rect worldRect = new Rect((centerRect.x + centerRect.width / 2f) - 30f, (centerRect.y + centerRect.height / 2f) - 30f, 60f, 60f); if (Widgets.ButtonImage(worldRect, CorruptionStoryTrackerUtilities.PlanetMedium)) { List <FloatMenuOption> list = new List <FloatMenuOption>(); IEnumerable <ICommunicable> enumerable = negotiator.Map.passingShipManager.passingShips.Cast <ICommunicable>().Concat(Find.FactionManager.AllFactionsInViewOrder.Cast <ICommunicable>()); foreach (ICommunicable commTarget in enumerable) { ICommunicable localCommTarget = commTarget; string text = "CallOnRadio".Translate(new object[] { localCommTarget.GetCallLabel() }); Faction faction = localCommTarget as Faction; if (faction != null) { if (faction.IsPlayer) { continue; } if (!Building_CommsConsole.LeaderIsAvailableToTalk(faction)) { list.Add(new FloatMenuOption(text + " (" + "LeaderUnavailable".Translate(new object[] { faction.leader.LabelShort }) + ")", null, MenuOptionPriority.Default, null, null, 0f, null, null)); continue; } } Action action = delegate { localCommTarget.TryOpenComms(negotiator); }; list.Add(new FloatMenuOption(text, action, MenuOptionPriority.InitiateSocial, null, null, 0f, null, null)); } Find.WindowStack.Add(new FloatMenu(list, null, false)); } TooltipHandler.TipRegion(worldRect, "CurrentWorldInfoRect".Translate(new object[] { Find.World.info.name })); Rect worldLabelrect = worldRect; worldLabelrect.y += 65f; worldLabelrect.width = 80f; GUI.color = Color.red; Widgets.Label(worldLabelrect, Find.World.info.name); GUI.color = Color.white; foreach (StarMapObject current in storyTracker.SubSectorObjects) { // Log.Message(current.objectName + current.objectRect.ToString()); // Widgets.DrawRectFast(current.objectRect, Color.red); if (Widgets.ButtonImage(current.objectRect, current.objectTex)) { } TooltipHandler.TipRegion(current.objectRect, "StarmapObjectInfo".Translate(new object[] { current.objectName, current.diameter, "Unknown" })); } // GUI.EndGroup(); GUI.BeginGroup(rightRect); // Widgets.DrawRectFast(rightRect, Color.red); float num2 = rightRect.y; CorruptionStoryTrackerUtilities.ListSeparatorBig(ref num2, rightRect.width, "UnknownFrequencies".Translate()); num2 += 50f; for (int i = 0; i < storyTracker.XenoFactions.Count; i++) { num2 += DrawFactionRowCommsXeno(storyTracker.XenoFactions[i], num2, rightRect, negotiator); } GUI.EndGroup(); GUI.EndGroup(); if (Widgets.CloseButtonFor(inRect.AtZero())) { this.Close(); } }
public static IEnumerable <FloatMenuOption> GetFloatMenuOptions(this Building_CommsConsole building, Pawn myPawn) { /*if (!myPawn.CanReserve(building, 1)) * { * FloatMenuOption item = new FloatMenuOption("CannotUseReserved".Translate(), null, MenuOptionPriority.Default, null, null, 0f, null); * return new List<FloatMenuOption> * { * item * }; * }*/ if (!myPawn.CanReach(building, PathEndMode.InteractionCell, Danger.Some, false, TraverseMode.ByPawn)) { FloatMenuOption item2 = new FloatMenuOption("CannotUseNoPath".Translate(), null, MenuOptionPriority.Default, null, null, 0f, null); return(new List <FloatMenuOption> { item2 }); } if (building.Map.mapConditionManager.ConditionIsActive(MapConditionDefOf.SolarFlare)) { FloatMenuOption item3 = new FloatMenuOption("CannotUseSolarFlare".Translate(), null, MenuOptionPriority.Default, null, null, 0f, null); return(new List <FloatMenuOption> { item3 }); } if (!building.GetFieldViaReflection <CompPowerTrader>("powerComp").PowerOn) { FloatMenuOption item4 = new FloatMenuOption("CannotUseNoPower".Translate(), null, MenuOptionPriority.Default, null, null, 0f, null); return(new List <FloatMenuOption> { item4 }); } if (!myPawn.health.capacities.CapableOf(PawnCapacityDefOf.Talking)) { FloatMenuOption item5 = new FloatMenuOption("CannotUseReason".Translate(new object[] { "IncapableOfCapacity".Translate(new object[] { PawnCapacityDefOf.Talking.label }) }), null, MenuOptionPriority.Default, null, null, 0f, null); return(new List <FloatMenuOption> { item5 }); } if (!building.CanUseCommsNow) { Log.Error(myPawn + " could not use comm console for unknown reason."); FloatMenuOption item6 = new FloatMenuOption("Cannot use now", null, MenuOptionPriority.Default, null, null, 0f, null); return(new List <FloatMenuOption> { item6 }); } IEnumerable <ICommunicable> enumerable = myPawn.Map.passingShipManager.passingShips.Cast <ICommunicable>().Concat(Find.FactionManager.AllFactionsInViewOrder.Cast <ICommunicable>()); List <FloatMenuOption> list = new List <FloatMenuOption>(); foreach (ICommunicable commTarget in enumerable) { ICommunicable localCommTarget = commTarget; string text = "CallOnRadio".Translate(new object[] { localCommTarget.GetCallLabel() }); Faction faction = localCommTarget as Faction; if (faction != null) { if (faction.IsPlayer) { continue; } if (!Building_CommsConsole.LeaderIsAvailableToTalk(faction)) { list.Add(new FloatMenuOption(text + " (" + "LeaderUnavailable".Translate(new object[] { faction.leader.LabelShort }) + ")", null, MenuOptionPriority.Default, null, null, 0f, null, null)); continue; } } Action action = delegate { if (commTarget is TradeShip && !Building_OrbitalTradeBeacon.AllPowered(building.Map).Any <Building_OrbitalTradeBeacon>()) { Messages.Message("MessageNeedBeaconToTradeWithShip".Translate(), building, MessageSound.RejectInput); return; } Job job = new Job(JobDefOf.UseCommsConsole, building); job.commTarget = localCommTarget; myPawn.jobs.TryTakeOrderedJob(job); PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.OpeningComms, KnowledgeAmount.Total); }; ITWN.PostMenuOption(list, myPawn, building, text, action, priority: MenuOptionPriority.InitiateSocial); } return(list); }
public void ExposeData() { ILoadReferenceable refee = (ILoadReferenceable)commTarget; Scribe_References.Look(ref refee, "commTarget"); commTarget = (ICommunicable)refee; Scribe_References.Look(ref verbToUse, "verbToUse"); Scribe_References.Look(ref bill, "bill"); Scribe_References.Look(ref lord, "lord"); Scribe_References.Look(ref quest, "quest"); Scribe_Defs.Look(ref def, "def"); //Scribe_Values.Look(ref loadID, "loadID", 0); Scribe_TargetInfo.Look(ref targetA, "targetA"); Scribe_TargetInfo.Look(ref targetB, "targetB"); Scribe_TargetInfo.Look(ref targetC, "targetC"); Scribe_TargetInfo.Look(ref globalTarget, "globalTarget"); Scribe_Collections.Look(ref targetQueueA, "targetQueueA", LookMode.Undefined); Scribe_Collections.Look(ref targetQueueB, "targetQueueB", LookMode.Undefined); Scribe_Values.Look(ref count, "count", -1); Scribe_Collections.Look(ref countQueue, "countQueue", LookMode.Undefined); Scribe_Values.Look(ref startTick, "startTick", -1); Scribe_Values.Look(ref expiryInterval, "expiryInterval", -1); Scribe_Values.Look(ref checkOverrideOnExpire, "checkOverrideOnExpire", defaultValue: false); Scribe_Values.Look(ref playerForced, "playerForced", defaultValue: false); Scribe_Collections.Look(ref placedThings, "placedThings", LookMode.Undefined); Scribe_Values.Look(ref maxNumMeleeAttacks, "maxNumMeleeAttacks", int.MaxValue); Scribe_Values.Look(ref maxNumStaticAttacks, "maxNumStaticAttacks", int.MaxValue); Scribe_Values.Look(ref exitMapOnArrival, "exitMapOnArrival", defaultValue: false); Scribe_Values.Look(ref failIfCantJoinOrCreateCaravan, "failIfCantJoinOrCreateCaravan", defaultValue: false); Scribe_Values.Look(ref killIncappedTarget, "killIncappedTarget", defaultValue: false); Scribe_Values.Look(ref haulOpportunisticDuplicates, "haulOpportunisticDuplicates", defaultValue: false); Scribe_Values.Look(ref haulMode, "haulMode", HaulMode.Undefined); Scribe_Defs.Look(ref plantDefToSow, "plantDefToSow"); Scribe_Values.Look(ref locomotionUrgency, "locomotionUrgency", LocomotionUrgency.Jog); Scribe_Values.Look(ref ignoreDesignations, "ignoreDesignations", defaultValue: false); Scribe_Values.Look(ref canBash, "canBash", defaultValue: false); Scribe_Values.Look(ref canUseRangedWeapon, "canUseRangedWeapon", defaultValue: true); Scribe_Values.Look(ref haulDroppedApparel, "haulDroppedApparel", defaultValue: false); Scribe_Values.Look(ref restUntilHealed, "restUntilHealed", defaultValue: false); Scribe_Values.Look(ref ignoreJoyTimeAssignment, "ignoreJoyTimeAssignment", defaultValue: false); Scribe_Values.Look(ref overeat, "overeat", defaultValue: false); Scribe_Values.Look(ref attackDoorIfTargetLost, "attackDoorIfTargetLost", defaultValue: false); Scribe_Values.Look(ref takeExtraIngestibles, "takeExtraIngestibles", 0); Scribe_Values.Look(ref expireRequiresEnemiesNearby, "expireRequiresEnemiesNearby", defaultValue: false); Scribe_Values.Look(ref collideWithPawns, "collideWithPawns", defaultValue: false); Scribe_Values.Look(ref forceSleep, "forceSleep", defaultValue: false); Scribe_Defs.Look(ref interaction, "interaction"); Scribe_Values.Look(ref endIfCantShootTargetFromCurPos, "endIfCantShootTargetFromCurPos", defaultValue: false); Scribe_Values.Look(ref endIfCantShootInMelee, "endIfCantShootInMelee", defaultValue: false); Scribe_Values.Look(ref checkEncumbrance, "checkEncumbrance", defaultValue: false); Scribe_Values.Look(ref followRadius, "followRadius", 0f); Scribe_Values.Look(ref endAfterTendedOnce, "endAfterTendedOnce", defaultValue: false); Scribe_Defs.Look(ref workGiverDef, "workGiverDef"); //Scribe_Defs.Look(ref jobGiverThinkTree, "jobGiverThinkTree"); Scribe_Values.Look(ref doUntilGatheringEnded, "doUntilGatheringEnded", defaultValue: false); Scribe_Values.Look(ref psyfocusTargetLast, "psyfocusTargetLast", 0f); Scribe_Values.Look(ref wasOnMeditationTimeAssignment, "wasOnMeditationTimeAssignment", defaultValue: false); Scribe_Values.Look(ref reactingToMeleeThreat, "reactingToMeleeThreat", defaultValue: false); Scribe_References.Look(ref ability, "ability"); //if (Scribe.mode == LoadSaveMode.Saving) //{ // jobGiverKey = ((jobGiver != null) ? jobGiver.UniqueSaveKey : (-1)); //} //Scribe_Values.Look(ref jobGiverKey, "lastJobGiverKey", -1); //if (Scribe.mode == LoadSaveMode.PostLoadInit && jobGiverKey != -1 && !jobGiverThinkTree.TryGetThinkNodeWithSaveKey(jobGiverKey, out jobGiver)) //{ // Log.Warning("Could not find think node with key " + jobGiverKey); //} if (Scribe.mode == LoadSaveMode.PostLoadInit && verbToUse != null && verbToUse.BuggedAfterLoading) { verbToUse = null; Log.Warning(string.Concat(GetType(), " had a bugged verbToUse after loading.")); } }
public override IEnumerable <FloatMenuOption> GetFloatMenuOptions(Pawn myPawn) { if (!ReachabilityUtility.CanReach(myPawn, this, (PathEndMode)4, (Danger)2, false, 0)) { FloatMenuOption item = new FloatMenuOption(Translator.Translate("CannotUseNoPath"), null, (MenuOptionPriority)4, null, null, 0f, null, null); return(new List <FloatMenuOption> { item }); } if (Spawned && Map.gameConditionManager.ConditionIsActive(GameConditionDefOf.SolarFlare)) { return(new List <FloatMenuOption> { new FloatMenuOption(Translator.Translate("CannotUseSolarFlare"), null, (MenuOptionPriority)4, null, null, 0f, null, null) }); } if (!myPawn.health.capacities.CapableOf(PawnCapacityDefOf.Talking)) { return(new List <FloatMenuOption> { new FloatMenuOption(Translator.Translate("CannotUseReason", new object[] { Translator.Translate("IncapableOfCapacity", new object[] { PawnCapacityDefOf.Talking.label }) }), null, (Verse.MenuOptionPriority) 4, null, null, 0f, null, null) }); } if (!this.CanUseSignalFireNow) { Log.Error(myPawn + " could not use comm console for unknown reason."); return(new List <FloatMenuOption> { new FloatMenuOption("Cannot use now", null, (MenuOptionPriority)4, null, null, 0f, null, null) }); } List <FloatMenuOption> list = new List <FloatMenuOption>(); foreach (ICommunicable commTarget in Find.FactionManager.AllFactionsInViewOrder) { ICommunicable localCommTarget = commTarget; string text = Translator.Translate("CallOnRadio", new object[] { localCommTarget.GetCallLabel() }); if (localCommTarget is Faction faction) { if (faction.IsPlayer) { continue; } if (!LeaderIsAvailableToTalk(faction)) { string str; if (faction.leader != null) { str = Translator.Translate("LeaderUnavailable", new object[] { faction.leader.LabelShort }); } else { str = Translator.Translate("LeaderUnavailableNoLeader"); } list.Add(new FloatMenuOption(text + " (" + str + ")", null, (MenuOptionPriority)4, null, null, 0f, null, null)); continue; } } void action() { if (commTarget is TradeShip && !Building_OrbitalTradeBeacon.AllPowered(Map).Any()) { Messages.Message(Translator.Translate("MessageNeedBeaconToTradeWithShip"), this, MessageTypeDefOf.RejectInput, false); } else { Job job = new Job(DefDatabase <JobDef> .GetNamed("UseSignalFire", true), this) { commTarget = localCommTarget }; myPawn.jobs.TryTakeOrderedJob(job, 0); PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.OpeningComms, (KnowledgeAmount)6); } } list.Add(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(text, action, (MenuOptionPriority)7, null, null, 0f, null, null), myPawn, this, "ReservedBy")); } return(list); }