Files
institution/Wiki/contraband/Improvised-Weapons.md
T
flan 3530100ed5 Aggregate the whole suite wiki onto the Institution page
Wiki/Home.md is the suite's front door; every layer's wiki now mirrors here
under Wiki/<layer>/ (core, contraband, justice, gangs, ward), so the whole
suite reads in one place with the index linking to the local pages. The
layer repos stay canonical -- Tools/sync-wiki.sh refreshes the aggregated
copy on demand. The README's main page points to it.
2026-07-15 20:30:38 +00:00

9.5 KiB
Raw Blame History

Improvised Weapons

The acquisition route you cannot deny — because you are obliged to furnish the cell, and the furniture is the raw material.

You have to give a prisoner a bed. RimWorld will nag you until you do. That bed is a frame of wood, or steel, or — if you built a nice prison — plasteel. Give a disposed prisoner a season of unsupervised time with it and they will file a blade off it. The prison's own furnishings are the arsenal, and better furniture is worse.

The shiv

CB_Shiv is a crude stabbing weapon: "A blade filed off a bed frame and wrapped in cloth for a grip. Barely a weapon — but a barely-a-weapon in a cell you thought was empty is a dead guard."

Stat Value
Tech level Neolithic
Mass 0.4 kg
concealability 0.75 (hides very well — it rides on the body)
hideIn OnBody | InCell
Point (Stab) power 7, cooldown 1.5 s
Handle (Blunt) power 5, cooldown 1.6 s
acquireWorker AcquireWorker_Improvise
useWorker none — an armed prisoner is the payload

It is stuffable (stuffCategories: Metallic, Woody, Stony), which is the entire point of the harvest mechanic: a shiv's stats come from its material for free. A wood shiv is feeble; a plasteel one is vicious. You never furnished a cell thinking of it as an armoury, but that is what it is.

Who whittles: the disposition gate

AcquireWorker_Improvise.CanAcquire is not "any prisoner." Three things must all be true:

  1. Held. The pawn is a prisoner, slave, or ward patient (IsHeld). Free colonists do not whittle shivs in the commons — yet (the concealment layer already tracks them; only the authority to act on them is missing).

  2. Disposed. A seeded propensity roll:

    Propensity.Would(pawn, 0.10, SaltImprovise)
    

    Base chance 0.10, scaled by Core's nature × nurture. It is seeded per pawn, so it is a fixed fact about them — the mistreated, high-propensity lifer chews his bed apart; the frightened cook never does, and never would have, no matter how many times you reload.

  3. Material in reach. There is a workable source (see below).

The base is deliberately low. Most prisoners are not making weapons. When one is, that is a fact about who they are and how you keep them, and the tell it leaves is meant to point you at exactly that pawn.

The source: what counts as raw material

FindSource looks for the nearest reachable, damageable, usefully-stuffed piece of furniture:

  • Their own assigned bed first — it is right there in the cell.
  • Otherwise the closest artificial building within 12 tiles that qualifies.

IsWorkableSource requires all of:

Requirement Why
Made of Stuff you cannot whittle a blade out of nothing
useHitPoints it has to be damageable
Stuff category is Metallic, Woody, or Stony cloth and leather cannot be filed into a blade
Reachable at Touch through Danger.Deadly they have to get to it

This is also the counter-play. A cell furnished only in cloth and hydroponics offers nothing to file. A steel bed offers a steel shiv. What you build the cell out of decides whether it can become a weapon, and how nasty that weapon is.

Harvest by damage: the tell is the mechanic

Each poll the pawn makes progress, OnHarvestTick chips at the source:

damage = max(1, round(source.MaxHitPoints × 0.012))   // Blunt, ~1.2% of max HP per worked poll

The damage is not a side effect — it is the point. A gnawed bed is probable cause. The same poll that advances the shiv damages the furniture, and that visible wear is what Warden Search reads to send a guard to the right prisoner first: a badly damaged bed shoots a prisoner to the top of the search priority list. Whittling a shiv is loud, in the only sense that matters — it leaves a mark you can act on.

Because the source takes real damage, a determined prisoner can reduce a piece of furniture to wreckage and move on to the next: if the source is destroyed before the shiv is finished, FindSource looks for another, and if there is none, the route stalls (progress is kept, not lost). A materially poor cell is a real defence — the prisoner cannot make progress with nothing to file.

How long, and the material it becomes

Progress uses the default rate — roughly 1.5 unsupervised days of active work — jittered ±25% each poll so no two shivs finish on the same schedule:

progressPerPoll = 250 / (1.5 × 60000)  ×  Rand.Range(0.75, 1.25)

When progress reaches 1, the shiv is finished, silently — the player is told nothing. Two things happen:

  • Material carry-through. item.stuff = source.Stuff. A wood bed yields a wood shiv, a plasteel bunk a plasteel one. When the shiv is later redeemed into a real Thing, it is made of exactly that material, and its combat stats follow.
  • The record. CriminalRecord.contrabandMade is incremented (Core's record). That number feeds the warden's future suspicion of this pawn and, if you run Institution: Justice, their security classification.

The shiv comes out in a break — and who reaches for it

A hidden shiv is inert until a breakout. When a prisoner enters the PrisonerEscape or PrisonerAssaultColony duty, JobGiver_UseContraband offers to materialise what they are hiding — but a weapon only comes out for someone who would actually use it. That test is Disposition.WouldArmSelf, and it is the same gate JobGiver_ArmSelf uses to decide whether an escapee even bothers to pick a weapon off the floor.

This matters because vanilla escapees never arm themselves at all. JobGiver_PickUpOpportunisticWeapon exists and is simply absent from the escape duty tree, so a base-game prisoner walks out unarmed, always. Arming is genuinely new behaviour, so it is kept rare enough that when it happens you recognise who did it.

WouldArmSelf

First a hard gate: a pawn who WorkTagIsDisabled(Violent) never arms, ever — a pacifist who picks up a rifle is not a rare event, it is a bug. Otherwise:

chance = ArmDisposition(pawn) × ArmCircumstance(pawn)
armed  = WouldSeeded(pawn, min(chance, 0.85), SaltArm)   // seeded — a fixed fact per pawn

Disposition — who they are, fixed, nothing about today changes it:

ArmDisposition = 0.10 (base) × trait × skill
Factor Value
Bloodlust ×2.5 (highest applicable trait only — not a stack)
Psychopath ×2.0
Brawler ×1.8
Wimp ×0.3
Kind ×0.4
skill 0.5 + max(Shooting, Melee)/20 × 1.5 → range 0.5 .. 2.0

Being captured in a raid does not make someone a fighter — plenty of prisoners are cooks and conscripts. A weapon is only worth grabbing if you know what to do with it, hence the skill term.

Circumstance — what is happening right now, live, not seeded:

Condition Effect Reasoning
Health < 50% ×0.4 badly hurt people run or crawl; they don't seek a fight
≥ 2 other prisoners escaping within 12 tiles ×2.0 a crowd emboldens; one man slips out, six men riot
An armed colonist within 20 tiles ×1.8 now a weapon is not bravado, it's the plan

Which weapon they reach for

JobGiver_ArmSelf prefers, in order:

  1. Their own dropped weapon — the gun they carried when you downed them, still lying where it fell within 45 tiles. Vanilla remembers it in Pawn_MindState.droppedWeapon and then never uses the field for prisoners. "A man walking back to the spot where his own rifle fell is a better story than a man rummaging through your stockpile." A prisoner does not care that you marked it forbidden.
  2. Anything to hand within 18 tiles — but only for a pawn over a higher disposition floor (WouldSeeded(pawn, 0.35, …)). Rummaging a stockpile is a further step than grabbing your own gun back.

A concealed shiv slots into this the natural way: a prisoner who has been sitting on a blade and who is the sort to use it does not leave it in his pocket. JobGiver_UseContraband redeems it and moves it straight from inventory into the equipment slot. The pawn who would not arm keeps it hidden and runs — and the shiv survives to be found in a later search, or used in a later break.

Not only shivs: the crude pick

AcquireWorker_Improvise is shared. The crude pick (CB_DiggingTool) is filed off furniture exactly the same way — same disposition gate, same damage tell — but it carries an escapeWorker instead of weapon stats, and its purpose is a tunnel rather than a fight. See Tunnels.

Quick reference

Constant Value Meaning
Improvise base chance 0.10 before nature × nurture; seeded per pawn
Damage per worked poll ~1.2% of source max HP Blunt; the visible tell
Source search radius 12 tiles own bed first, then nearest workable furniture
Time to finish a shiv ~1.5 active days jittered ±25% per poll
Workable stuff Metallic / Woody / Stony cloth and leather cannot be whittled
Shiv concealability 0.75 hard to find on the body
Arm chance cap 0.85 after disposition × circumstance
Own-weapon reach 45 tiles their dropped weapon
Any-weapon reach 18 tiles scavenge floor 0.35 disposition

Part of the Institution suite — Core · Contraband · Justice · Gangs, alongside Foul Play and Ward. Each stands alone; together they interlock. Developed with substantial assistance from Claude (Anthropic).