using RimWorld; using Verse; namespace BlaxLaws { /// /// Messages for cases (setting "Messages for cases"). Letters are the punishment workers' own, only when /// a colonist is jailed or the player has to act (setting "Letters for jailings"); Laws never sends a /// second letter for a break, since the vanilla break letter already arrives. /// public static class CaseMessages { /// One message when a stage's punishment is dispatched: "Bob broke a law: Wake-up (Did it). Punishment: jail." public static void Filed(LawCase c, Law law, LawStage stage, PunishmentDef punishment) { if (c == null || law == null || !BlaxLawsMod.S.caseMessages) return; string text = "BlaxLaws_CaseFiled".Translate(c.OffenderLabel, law.Label, LawLabels.Stage(stage), punishment?.label ?? law.punishment); Post(c, text); } /// A message about the case, pointing at the offender while it is spawned. Does nothing with messages off. public static void Post(LawCase c, string text, MessageTypeDef type = null) { if (!BlaxLawsMod.S.caseMessages || text.NullOrEmpty()) return; LookTargets target = c?.offender != null && c.offender.Spawned ? new LookTargets(c.offender) : LookTargets.Invalid; Messages.Message(text, target, type ?? MessageTypeDefOf.NeutralEvent, historical: true); } } }