public static Lord MakeNewLord(Faction faction, LordJob lordJob, Map map, IEnumerable <Pawn> startingPawns = null) { if (map == null) { Log.Warning("Tried to create a lord with null map."); return(null); } Lord lord = new Lord(); lord.loadID = Find.UniqueIDsManager.GetNextLordID(); lord.faction = faction; map.lordManager.AddLord(lord); lord.SetJob(lordJob); lord.GotoToil(lord.Graph.StartingToil); if (startingPawns != null) { foreach (Pawn startingPawn in startingPawns) { lord.AddPawn(startingPawn); } return(lord); } return(lord); }
public void LogLords() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("======= Lords ======="); stringBuilder.AppendLine("Count: " + lords.Count); for (int i = 0; i < lords.Count; i++) { Lord lord = lords[i]; stringBuilder.AppendLine(); stringBuilder.Append("#" + (i + 1) + ": "); if (lord.LordJob == null) { stringBuilder.AppendLine("no-job"); } else { stringBuilder.AppendLine(lord.LordJob.GetType().Name); } stringBuilder.Append("Current toil: "); if (lord.CurLordToil == null) { stringBuilder.AppendLine("null"); } else { stringBuilder.AppendLine(lord.CurLordToil.GetType().Name); } stringBuilder.AppendLine("Members (count: " + lord.ownedPawns.Count + "):"); for (int j = 0; j < lord.ownedPawns.Count; j++) { stringBuilder.AppendLine(" " + lord.ownedPawns[j].LabelShort + " (" + lord.ownedPawns[j].Faction + ")"); } } Log.Message(stringBuilder.ToString()); }
public override bool ActivateOn(Lord lord, TriggerSignal signal) { if (signal.type == TriggerSignalType.Tick && Find.TickManager.TicksGame % 197 == 0) { for (int i = 0; i < lord.ownedPawns.Count; i++) { Pawn pawn = lord.ownedPawns[i]; if (pawn.Spawned && !pawn.Dead && !pawn.Downed) { Hediff firstHediffOfDef = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.Heatstroke, false); if (firstHediffOfDef != null && firstHediffOfDef.Severity > this.temperatureHediffThreshold) { return(true); } Hediff firstHediffOfDef2 = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.Hypothermia, false); if (firstHediffOfDef2 != null && firstHediffOfDef2.Severity > this.temperatureHediffThreshold) { return(true); } } } } return(false); }
public void RemoveLord(Lord oldLord) { this.lords.Remove(oldLord); oldLord.Cleanup(); }
public void AddLord(Lord newLord) { this.lords.Add(newLord); newLord.lordManager = this; }
public override bool ActivateOn(Lord lord, TriggerSignal signal) { return(signal.type == TriggerSignalType.Memo && signal.memo == this.memo); }
public override bool ActivateOn(Lord lord, TriggerSignal signal) { return(signal.type == TriggerSignalType.PawnLost && (signal.condition == PawnLostCondition.MadePrisoner || signal.condition == PawnLostCondition.IncappedOrKilled)); }
public override bool ActivateOn(Lord lord, TriggerSignal signal) { return(signal.type == TriggerSignalType.FactionRelationsChanged && (signal.previousRelationKind == FactionRelationKind.Hostile && lord.faction != null) && !lord.faction.HostileTo(Faction.OfPlayer)); }
public override bool ActivateOn(Lord lord, TriggerSignal signal) { return(signal.type == TriggerSignalType.PawnLost); }
public override bool ActivateOn(Lord lord, TriggerSignal signal) { return(Trigger_PawnHarmed.SignalIsHarm(signal) && (!this.requireInstigatorWithFaction || (signal.dinfo.Instigator != null && signal.dinfo.Instigator.Faction != null)) && Rand.Value < this.chance); }
public override bool ActivateOn(Lord lord, TriggerSignal signal) { return(signal.type == TriggerSignalType.PawnLost && (float)lord.numPawnsLostViolently >= (float)lord.numPawnsEverGained * this.fraction); }
public void RemoveLord(Lord oldLord) { lords.Remove(oldLord); Find.SignalManager.DeregisterReceiver(oldLord); oldLord.Cleanup(); }
public void AddLord(Lord newLord) { lords.Add(newLord); newLord.lordManager = this; Find.SignalManager.RegisterReceiver(newLord); }
public override bool ActivateOn(Lord lord, TriggerSignal signal) { return(signal.type == TriggerSignalType.Tick && Find.TickManager.TicksGame % this.interval == 0 && Rand.Value < this.chancePerInterval); }
public override bool ActivateOn(Lord lord, TriggerSignal signal) { return(signal.type == TriggerSignalType.BuildingDamaged && signal.dinfo.Def.externalViolence && signal.thing.def.category == ThingCategory.Building && signal.dinfo.Instigator != null && signal.dinfo.Instigator.Faction == Faction.OfPlayer && signal.thing.Faction != Faction.OfPlayer && Rand.Value < this.chance); }
public abstract bool ActivateOn(Lord lord, TriggerSignal signal);
public override bool ActivateOn(Lord lord, TriggerSignal signal) { return(signal.type == TriggerSignalType.FactionRelationsChanged && (lord.faction == null || !lord.faction.HostileTo(Faction.OfPlayer))); }
public abstract bool AllowActivation(Lord lord, TriggerSignal signal);
public override bool ActivateOn(Lord lord, TriggerSignal signal) { return(signal.type == TriggerSignalType.Tick && (this.thing.DestroyedOrNull() || (float)this.thing.HitPoints < (1f - this.damageFraction) * (float)this.thing.MaxHitPoints)); }
public override bool ActivateOn(Lord lord, TriggerSignal signal) { return(signal.type == this.signalType && Rand.Value < this.chance); }
public override bool ActivateOn(Lord lord, TriggerSignal signal) { return(signal.type == TriggerSignalType.PawnLost && signal.condition == PawnLostCondition.IncappedOrKilled && signal.Pawn.Dead); }
public override bool ActivateOn(Lord lord, TriggerSignal signal) { return(condition(signal)); }
public override bool ActivateOn(Lord lord, TriggerSignal signal) { return signal.type == TriggerSignalType.PawnLost && lord.numPawnsLostViolently >= this.count; }
public override bool ActivateOn(Lord lord, TriggerSignal signal) { return(signal.type == TriggerSignalType.Tick && Find.TickManager.TicksGame % this.checkEveryTicks == 0 && this.condition()); }
public override bool ActivateOn(Lord lord, TriggerSignal signal) { return(base.ActivateOn(lord, signal) && Find.TickManager.TicksGame - lord.lastPawnHarmTick >= 300); }