atagen

jelq

public

an http based roguelike rpg about jelqing

Star0
Watch0
a6caa2f9978665374ee51870e78151e4324328d0
1
ssh://brewery@pls.lobotomise.me:33/atagen/jelq.git

Blame: src/game/floors.rs

782069860236atagen2026-10-10 12:44 UTC1
use axum::http::{StatusCode, header};
782069860236atagen2026-10-10 12:44 UTC2
use serde_json::{Value, json};
782069860236atagen2026-10-10 12:44 UTC3
782069860236atagen2026-10-10 12:44 UTC4
use super::{
782069860236atagen2026-10-10 12:44 UTC5
    Cause, Elder, Floor, FloorState, Item, Outcome, Run,
0d604ee39751atagen2026-10-10 14:15 UTC6
    balance::{
a6caa2f99786atagen2026-10-12 10:38 UTC7
        DRAWER_JAMS, EQ_BAND, FLOOR_ALLOWANCE, FLOOR_TURNS, FRICTION_FLOOR, GREGS_LOCKER,
a6caa2f99786atagen2026-10-12 10:38 UTC8
        KEY_IN_DRAWER, RULER_IN_DRAWER, STARTING_EQ, SUSPICION_LIMIT, ZIP,
0d604ee39751atagen2026-10-10 14:15 UTC9
    },
782069860236atagen2026-10-10 12:44 UTC10
    round2,
782069860236atagen2026-10-10 12:44 UTC11
};
782069860236atagen2026-10-10 12:44 UTC12
use crate::problem::Problem;
782069860236atagen2026-10-10 12:44 UTC13
782069860236atagen2026-10-10 12:44 UTC14
impl Run {
782069860236atagen2026-10-10 12:44 UTC15
    pub(super) fn next_floor(&mut self, paid: bool) {
782069860236atagen2026-10-10 12:44 UTC16
        let Some(next) = self.floor.next() else {
782069860236atagen2026-10-10 12:44 UTC17
            return;
782069860236atagen2026-10-10 12:44 UTC18
        };
4347977b8192atagen2026-10-11 04:56 UTC19
        let warm = EQ_BAND.contains(&self.eq);
782069860236atagen2026-10-10 12:44 UTC20
        self.floor = next;
4347977b8192atagen2026-10-11 04:56 UTC21
        self.here = FloorState {
4347977b8192atagen2026-10-11 04:56 UTC22
            warm_arrival: warm,
4347977b8192atagen2026-10-11 04:56 UTC23
            ..FloorState::default()
4347977b8192atagen2026-10-11 04:56 UTC24
        };
782069860236atagen2026-10-10 12:44 UTC25
        self.warmed_up = false;
14de3e1e8dc2atagen2026-10-11 06:19 UTC26
        self.reset_eq(STARTING_EQ);
782069860236atagen2026-10-10 12:44 UTC27
        self.suspicion = 0;
5dfebcc0ac43atagen2026-10-11 05:28 UTC28
        self.shed(FRICTION_FLOOR);
9683736a2c5eatagen2026-10-10 13:15 UTC29
        self.mum = None;
782069860236atagen2026-10-10 12:44 UTC30
        if paid {
782069860236atagen2026-10-10 12:44 UTC31
            self.cash += FLOOR_ALLOWANCE;
782069860236atagen2026-10-10 12:44 UTC32
        }
782069860236atagen2026-10-10 12:44 UTC33
        self.touch();
782069860236atagen2026-10-10 12:44 UTC34
    }
782069860236atagen2026-10-10 12:44 UTC35
782069860236atagen2026-10-10 12:44 UTC36
    pub fn advance(&mut self) -> Result<Outcome, Problem> {
782069860236atagen2026-10-10 12:44 UTC37
        match self.floor {
782069860236atagen2026-10-10 12:44 UTC38
            Floor::Clinic => {
782069860236atagen2026-10-10 12:44 UTC39
                return Err(Problem::new(
782069860236atagen2026-10-10 12:44 UTC40
                    StatusCode::CONFLICT,
782069860236atagen2026-10-10 12:44 UTC41
                    "no-further-floor",
782069860236atagen2026-10-10 12:44 UTC42
                    "There is no further floor. There is only the diagnosis.",
782069860236atagen2026-10-10 12:44 UTC43
                ));
782069860236atagen2026-10-10 12:44 UTC44
            }
782069860236atagen2026-10-10 12:44 UTC45
            Floor::Forum if self.elder != Elder::Beaten => {
782069860236atagen2026-10-10 12:44 UTC46
                return Err(Problem::new(
782069860236atagen2026-10-10 12:44 UTC47
                    StatusCode::CONFLICT,
782069860236atagen2026-10-10 12:44 UTC48
                    "elder-unaddressed",
782069860236atagen2026-10-10 12:44 UTC49
                    "The Elder has not been addressed.",
782069860236atagen2026-10-10 12:44 UTC50
                )
782069860236atagen2026-10-10 12:44 UTC51
                .with("elder", self.path("/elder")));
782069860236atagen2026-10-10 12:44 UTC52
            }
782069860236atagen2026-10-10 12:44 UTC53
            floor if floor.timed() && self.here.turns < FLOOR_TURNS => {
782069860236atagen2026-10-10 12:44 UTC54
                return Err(Problem::new(
782069860236atagen2026-10-10 12:44 UTC55
                    StatusCode::TOO_EARLY,
782069860236atagen2026-10-10 12:44 UTC56
                    "floor-not-over",
782069860236atagen2026-10-10 12:44 UTC57
                    format!(
782069860236atagen2026-10-10 12:44 UTC58
                        "The floor is not over. {} turns remain.",
782069860236atagen2026-10-10 12:44 UTC59
                        FLOOR_TURNS - self.here.turns
782069860236atagen2026-10-10 12:44 UTC60
                    ),
782069860236atagen2026-10-10 12:44 UTC61
                ));
782069860236atagen2026-10-10 12:44 UTC62
            }
782069860236atagen2026-10-10 12:44 UTC63
            _ => {}
782069860236atagen2026-10-10 12:44 UTC64
        }
3f9091557ec3atagen2026-10-11 11:43 UTC65
        if self.chance(
3f9091557ec3atagen2026-10-11 11:43 UTC66
            self.decision(
3f9091557ec3atagen2026-10-11 11:43 UTC67
                "zip",
3f9091557ec3atagen2026-10-11 11:43 UTC68
                "As the floor ends and you put yourself away, does the zip catch?",
3f9091557ec3atagen2026-10-11 11:43 UTC69
            ),
3f9091557ec3atagen2026-10-11 11:43 UTC70
            ZIP,
3f9091557ec3atagen2026-10-11 11:43 UTC71
        ) {
9683736a2c5eatagen2026-10-10 13:15 UTC72
            return Err(self.end(Cause::Zip));
782069860236atagen2026-10-10 12:44 UTC73
        }
7d3fb63208bfatagen2026-10-11 04:38 UTC74
        let left = self.floor.name();
782069860236atagen2026-10-10 12:44 UTC75
        let reverted = self.here.temp_length;
782069860236atagen2026-10-10 12:44 UTC76
        self.next_floor(true);
4347977b8192atagen2026-10-11 04:56 UTC77
        let warm = if self.here.warm_arrival {
4347977b8192atagen2026-10-11 04:56 UTC78
            ", and the warmth came with you"
4347977b8192atagen2026-10-11 04:56 UTC79
        } else {
4347977b8192atagen2026-10-11 04:56 UTC80
            ""
4347977b8192atagen2026-10-11 04:56 UTC81
        };
782069860236atagen2026-10-10 12:44 UTC82
        let mut body = json!({
4347977b8192atagen2026-10-11 04:56 UTC83
            "detail": format!("You leave {left}. You have arrived at {}{warm}.", self.floor.name()),
782069860236atagen2026-10-10 12:44 UTC84
            "note": self.floor.note(),
782069860236atagen2026-10-10 12:44 UTC85
        });
782069860236atagen2026-10-10 12:44 UTC86
        if reverted > 0.0 {
782069860236atagen2026-10-10 12:44 UTC87
            body["reverted"] = json!(round2(reverted));
782069860236atagen2026-10-10 12:44 UTC88
        }
782069860236atagen2026-10-10 12:44 UTC89
        Ok(
782069860236atagen2026-10-10 12:44 UTC90
            Outcome::json(StatusCode::SEE_OTHER, body)
782069860236atagen2026-10-10 12:44 UTC91
                .header(header::LOCATION, self.path("/floor")),
782069860236atagen2026-10-10 12:44 UTC92
        )
782069860236atagen2026-10-10 12:44 UTC93
    }
782069860236atagen2026-10-10 12:44 UTC94
782069860236atagen2026-10-10 12:44 UTC95
    pub fn floor_view(&self) -> Value {
782069860236atagen2026-10-10 12:44 UTC96
        let mut view = json!({
782069860236atagen2026-10-10 12:44 UTC97
            "name": self.floor.name(),
782069860236atagen2026-10-10 12:44 UTC98
            "note": self.floor.note(),
782069860236atagen2026-10-10 12:44 UTC99
            "turns": self.here.turns,
782069860236atagen2026-10-10 12:44 UTC100
            "turns_required": self.floor.timed().then_some(FLOOR_TURNS),
782069860236atagen2026-10-10 12:44 UTC101
            "exit": { "href": self.path("/floor"), "method": "POST" },
782069860236atagen2026-10-10 12:44 UTC102
        });
782069860236atagen2026-10-10 12:44 UTC103
        match self.floor {
9683736a2c5eatagen2026-10-10 13:15 UTC104
            Floor::ChangingRoom => {
782069860236atagen2026-10-10 12:44 UTC105
                view["others"] = json!([
782069860236atagen2026-10-10 12:44 UTC106
                    { "name": "Greg", "self_reported_length": 9.5 },
782069860236atagen2026-10-10 12:44 UTC107
                    { "name": "Dmitri", "self_reported_length": 8.75 },
782069860236atagen2026-10-10 12:44 UTC108
                    { "name": "a man in a towel", "self_reported_length": 11.0 },
782069860236atagen2026-10-10 12:44 UTC109
                ]);
782069860236atagen2026-10-10 12:44 UTC110
            }
782069860236atagen2026-10-10 12:44 UTC111
            Floor::Hotel => view["portal"] = json!(self.path("/portal")),
782069860236atagen2026-10-10 12:44 UTC112
            Floor::Forum => {
782069860236atagen2026-10-10 12:44 UTC113
                view["thread"] = json!(super::FORUM_THREAD);
782069860236atagen2026-10-10 12:44 UTC114
                view["elder"] = json!(self.path("/elder"));
782069860236atagen2026-10-10 12:44 UTC115
            }
782069860236atagen2026-10-10 12:44 UTC116
            Floor::Clinic => view["diagnosis"] = json!(self.path("/diagnosis")),
782069860236atagen2026-10-10 12:44 UTC117
            _ => {}
782069860236atagen2026-10-10 12:44 UTC118
        }
782069860236atagen2026-10-10 12:44 UTC119
        if self.floor.shop_open() {
782069860236atagen2026-10-10 12:44 UTC120
            view["shop"] = json!(self.path("/shop"));
782069860236atagen2026-10-10 12:44 UTC121
        }
782069860236atagen2026-10-10 12:44 UTC122
        view
782069860236atagen2026-10-10 12:44 UTC123
    }
782069860236atagen2026-10-10 12:44 UTC124
782069860236atagen2026-10-10 12:44 UTC125
    fn found(&self, item: Item, detail: &str) -> Outcome {
782069860236atagen2026-10-10 12:44 UTC126
        Outcome::json(StatusCode::FOUND, json!({ "detail": detail })).header(
782069860236atagen2026-10-10 12:44 UTC127
            header::LOCATION,
782069860236atagen2026-10-10 12:44 UTC128
            self.path(&format!("/inventory/{}", item.slug())),
782069860236atagen2026-10-10 12:44 UTC129
        )
782069860236atagen2026-10-10 12:44 UTC130
    }
782069860236atagen2026-10-10 12:44 UTC131
782069860236atagen2026-10-10 12:44 UTC132
    pub fn search_drawer(&mut self) -> Result<Outcome, Problem> {
782069860236atagen2026-10-10 12:44 UTC133
        self.touch();
e807266c323batagen2026-10-12 09:46 UTC134
        self.end_kitchen_visit();
0d604ee39751atagen2026-10-10 14:15 UTC135
        if self.items.cage {
0d604ee39751atagen2026-10-10 14:15 UTC136
            return Ok(self.rummage_for_key());
0d604ee39751atagen2026-10-10 14:15 UTC137
        }
e807266c323batagen2026-10-12 09:46 UTC138
        let first = !self.here.drawer_searched;
e807266c323batagen2026-10-12 09:46 UTC139
        self.here.drawer_searched = true;
3f9091557ec3atagen2026-10-11 11:43 UTC140
        let ruler_here = self.floor == Floor::Bedroom
3f9091557ec3atagen2026-10-11 11:43 UTC141
            && self.chance(
3f9091557ec3atagen2026-10-11 11:43 UTC142
                self.decision("ruler", "Is there a ruler hiding in the drawer?"),
3f9091557ec3atagen2026-10-11 11:43 UTC143
                RULER_IN_DRAWER,
3f9091557ec3atagen2026-10-11 11:43 UTC144
            );
a6caa2f99786atagen2026-10-12 10:38 UTC145
        let vaseline_here = self.floor == Floor::Bathroom
a6caa2f99786atagen2026-10-12 10:38 UTC146
            && first
a6caa2f99786atagen2026-10-12 10:38 UTC147
            && self.chance(
a6caa2f99786atagen2026-10-12 10:38 UTC148
                self.decision(
a6caa2f99786atagen2026-10-12 10:38 UTC149
                    "bathroom-vaseline",
a6caa2f99786atagen2026-10-12 10:38 UTC150
                    "Is it the vaseline behind the door lock, rather than the lotion?",
a6caa2f99786atagen2026-10-12 10:38 UTC151
                ),
a6caa2f99786atagen2026-10-12 10:38 UTC152
                2,
a6caa2f99786atagen2026-10-12 10:38 UTC153
            );
e807266c323batagen2026-10-12 09:46 UTC154
        let locker_open = self.floor == Floor::ChangingRoom
e807266c323batagen2026-10-12 09:46 UTC155
            && first
e807266c323batagen2026-10-12 09:46 UTC156
            && self.chance(
e807266c323batagen2026-10-12 09:46 UTC157
                self.decision("gregs-locker", "Has Greg left his locker open?"),
e807266c323batagen2026-10-12 09:46 UTC158
                GREGS_LOCKER,
e807266c323batagen2026-10-12 09:46 UTC159
            );
782069860236atagen2026-10-10 12:44 UTC160
        match self.floor {
ad00e0e051a1atagen2026-10-10 14:00 UTC161
            Floor::Bedroom if first && !self.items.ruler && ruler_here => {
782069860236atagen2026-10-10 12:44 UTC162
                self.items.grant(Item::Ruler);
782069860236atagen2026-10-10 12:44 UTC163
                self.shame += 10;
782069860236atagen2026-10-10 12:44 UTC164
                Ok(self.found(
782069860236atagen2026-10-10 12:44 UTC165
                    Item::Ruler,
782069860236atagen2026-10-10 12:44 UTC166
                    "You now know. This is the first honest measurement of the run.",
782069860236atagen2026-10-10 12:44 UTC167
                ))
782069860236atagen2026-10-10 12:44 UTC168
            }
782069860236atagen2026-10-10 12:44 UTC169
            Floor::Bathroom if first => {
782069860236atagen2026-10-10 12:44 UTC170
                self.items.grant(Item::DoorLock);
a6caa2f99786atagen2026-10-12 10:38 UTC171
                let detail = if vaseline_here {
a6caa2f99786atagen2026-10-12 10:38 UTC172
                    self.items.grant(Item::Vaseline);
a6caa2f99786atagen2026-10-12 10:38 UTC173
                    "A door lock, which works once, and a tub of vaseline behind it."
a6caa2f99786atagen2026-10-12 10:38 UTC174
                } else {
a6caa2f99786atagen2026-10-12 10:38 UTC175
                    self.items.grant(Item::Lotion);
a6caa2f99786atagen2026-10-12 10:38 UTC176
                    "A door lock, which works once, and a bottle of lotion behind it."
a6caa2f99786atagen2026-10-12 10:38 UTC177
                };
a6caa2f99786atagen2026-10-12 10:38 UTC178
                Ok(self.found(Item::DoorLock, detail))
e807266c323batagen2026-10-12 09:46 UTC179
            }
e807266c323batagen2026-10-12 09:46 UTC180
            Floor::ChangingRoom if locker_open => {
e807266c323batagen2026-10-12 09:46 UTC181
                self.items.grant(Item::BabyOil);
e807266c323batagen2026-10-12 09:46 UTC182
                Ok(self.found(
e807266c323batagen2026-10-12 09:46 UTC183
                    Item::BabyOil,
e807266c323batagen2026-10-12 09:46 UTC184
                    "Greg has left his locker open. The baby oil is yours now, legally speaking.",
e807266c323batagen2026-10-12 09:46 UTC185
                ))
782069860236atagen2026-10-10 12:44 UTC186
            }
9683736a2c5eatagen2026-10-10 13:15 UTC187
            Floor::ChangingRoom => {
782069860236atagen2026-10-10 12:44 UTC188
                self.shame += 3;
782069860236atagen2026-10-10 12:44 UTC189
                Err(Problem::new(
782069860236atagen2026-10-10 12:44 UTC190
                    StatusCode::UNAVAILABLE_FOR_LEGAL_REASONS,
782069860236atagen2026-10-10 12:44 UTC191
                    "not-your-locker",
782069860236atagen2026-10-10 12:44 UTC192
                    "That locker belongs to Greg. The server cannot serve this request for legal reasons.",
782069860236atagen2026-10-10 12:44 UTC193
                ))
782069860236atagen2026-10-10 12:44 UTC194
            }
9683736a2c5eatagen2026-10-10 13:15 UTC195
            Floor::Nans if first => {
782069860236atagen2026-10-10 12:44 UTC196
                self.items.grant(Item::Cage);
782069860236atagen2026-10-10 12:44 UTC197
                self.shame += 5;
782069860236atagen2026-10-10 12:44 UTC198
                Ok(self.found(
782069860236atagen2026-10-10 12:44 UTC199
                    Item::Cage,
782069860236atagen2026-10-10 12:44 UTC200
                    "A small box. Inside was a cage. It is now on. The key is not in the box.",
782069860236atagen2026-10-10 12:44 UTC201
                ))
782069860236atagen2026-10-10 12:44 UTC202
            }
782069860236atagen2026-10-10 12:44 UTC203
            Floor::Hotel if first => {
782069860236atagen2026-10-10 12:44 UTC204
                self.items.grant(Item::DndSign);
782069860236atagen2026-10-10 12:44 UTC205
                self.items.grant(Item::IcePack);
782069860236atagen2026-10-10 12:44 UTC206
                self.items.grant(Item::IcePack);
a6caa2f99786atagen2026-10-12 10:38 UTC207
                self.items.grant(Item::Lotion);
782069860236atagen2026-10-10 12:44 UTC208
                Ok(self.found(
782069860236atagen2026-10-10 12:44 UTC209
                    Item::DndSign,
a6caa2f99786atagen2026-10-12 10:38 UTC210
                    "A Do Not Disturb sign, two ice packs from the machine down the hall, and a complimentary lotion.",
782069860236atagen2026-10-10 12:44 UTC211
                ))
782069860236atagen2026-10-10 12:44 UTC212
            }
782069860236atagen2026-10-10 12:44 UTC213
            Floor::Forum if first => {
782069860236atagen2026-10-10 12:44 UTC214
                self.items.grant(Item::Spreadsheet);
782069860236atagen2026-10-10 12:44 UTC215
                Ok(self.found(
782069860236atagen2026-10-10 12:44 UTC216
                    Item::Spreadsheet,
782069860236atagen2026-10-10 12:44 UTC217
                    "Your own spreadsheet. Every line is flat.",
782069860236atagen2026-10-10 12:44 UTC218
                ))
782069860236atagen2026-10-10 12:44 UTC219
            }
782069860236atagen2026-10-10 12:44 UTC220
            Floor::Clinic => Err(Problem::new(
782069860236atagen2026-10-10 12:44 UTC221
                StatusCode::FORBIDDEN,
782069860236atagen2026-10-10 12:44 UTC222
                "doctors-drawer",
782069860236atagen2026-10-10 12:44 UTC223
                "That is the doctor's drawer.",
782069860236atagen2026-10-10 12:44 UTC224
            )),
782069860236atagen2026-10-10 12:44 UTC225
            _ => Ok(Outcome::empty(StatusCode::NO_CONTENT)),
782069860236atagen2026-10-10 12:44 UTC226
        }
782069860236atagen2026-10-10 12:44 UTC227
    }
782069860236atagen2026-10-10 12:44 UTC228
782069860236atagen2026-10-10 12:44 UTC229
    pub fn accept_terms(&mut self) -> Result<Outcome, Problem> {
782069860236atagen2026-10-10 12:44 UTC230
        if self.floor != Floor::Hotel {
782069860236atagen2026-10-10 12:44 UTC231
            return Err(Problem::new(
782069860236atagen2026-10-10 12:44 UTC232
                StatusCode::NOT_FOUND,
782069860236atagen2026-10-10 12:44 UTC233
                "no-portal",
782069860236atagen2026-10-10 12:44 UTC234
                "There is no captive portal here. There is only the regular kind of captivity.",
782069860236atagen2026-10-10 12:44 UTC235
            ));
782069860236atagen2026-10-10 12:44 UTC236
        }
782069860236atagen2026-10-10 12:44 UTC237
        self.here.wifi_accepted = true;
782069860236atagen2026-10-10 12:44 UTC238
        self.touch();
782069860236atagen2026-10-10 12:44 UTC239
        Ok(Outcome::json(
782069860236atagen2026-10-10 12:44 UTC240
            StatusCode::SEE_OTHER,
782069860236atagen2026-10-10 12:44 UTC241
            json!({ "detail": "Connected. The hotel does not want to know." }),
782069860236atagen2026-10-10 12:44 UTC242
        )
782069860236atagen2026-10-10 12:44 UTC243
        .header(header::LOCATION, self.path("")))
782069860236atagen2026-10-10 12:44 UTC244
    }
d604371299fbatagen2026-10-10 13:54 UTC245
a6caa2f99786atagen2026-10-12 10:38 UTC246
    /// Searching while caged is noisy, costs the floor turn, and the key only turns up some of
a6caa2f99786atagen2026-10-12 10:38 UTC247
    /// the time. A jammed drawer takes a whole turn to work loose.
0d604ee39751atagen2026-10-10 14:15 UTC248
    fn rummage_for_key(&mut self) -> Outcome {
a6caa2f99786atagen2026-10-12 10:38 UTC249
        self.turn += 1;
a6caa2f99786atagen2026-10-12 10:38 UTC250
        self.here.turns += 1;
a6caa2f99786atagen2026-10-12 10:38 UTC251
        self.realise();
0d604ee39751atagen2026-10-10 14:15 UTC252
        let was_below = self.suspicion < SUSPICION_LIMIT;
0d604ee39751atagen2026-10-10 14:15 UTC253
        self.suspicion = (self.suspicion + 1).min(SUSPICION_LIMIT);
0d604ee39751atagen2026-10-10 14:15 UTC254
        self.maybe_summon_mum(was_below);
a6caa2f99786atagen2026-10-12 10:38 UTC255
        if self.here.drawer_jammed {
a6caa2f99786atagen2026-10-12 10:38 UTC256
            self.here.drawer_jammed = false;
a6caa2f99786atagen2026-10-12 10:38 UTC257
            self.notices
a6caa2f99786atagen2026-10-12 10:38 UTC258
                .push("The drawer comes loose. That took a while.");
a6caa2f99786atagen2026-10-12 10:38 UTC259
            return Outcome::empty(StatusCode::NO_CONTENT);
a6caa2f99786atagen2026-10-12 10:38 UTC260
        }
3f9091557ec3atagen2026-10-11 11:43 UTC261
        if !self.chance(
3f9091557ec3atagen2026-10-11 11:43 UTC262
            self.decision("key", "Does the drawer finally give up the cage key?"),
3f9091557ec3atagen2026-10-11 11:43 UTC263
            KEY_IN_DRAWER,
3f9091557ec3atagen2026-10-11 11:43 UTC264
        ) {
a6caa2f99786atagen2026-10-12 10:38 UTC265
            if self.chance(
a6caa2f99786atagen2026-10-12 10:38 UTC266
                self.decision("drawer-jams", "Has the drawer jammed on its runners?"),
a6caa2f99786atagen2026-10-12 10:38 UTC267
                DRAWER_JAMS,
a6caa2f99786atagen2026-10-12 10:38 UTC268
            ) {
a6caa2f99786atagen2026-10-12 10:38 UTC269
                self.here.drawer_jammed = true;
a6caa2f99786atagen2026-10-12 10:38 UTC270
                self.notices.push("The drawer has jammed.");
a6caa2f99786atagen2026-10-12 10:38 UTC271
            }
0d604ee39751atagen2026-10-10 14:15 UTC272
            return Outcome::empty(StatusCode::NO_CONTENT);
0d604ee39751atagen2026-10-10 14:15 UTC273
        }
0d604ee39751atagen2026-10-10 14:15 UTC274
        self.items.grant(Item::CageKey);
0d604ee39751atagen2026-10-10 14:15 UTC275
        Outcome::json(
0d604ee39751atagen2026-10-10 14:15 UTC276
            StatusCode::OK,
0d604ee39751atagen2026-10-10 14:15 UTC277
            json!({ "detail": "The key was in the drawer. The cage is off." }),
0d604ee39751atagen2026-10-10 14:15 UTC278
        )
0d604ee39751atagen2026-10-10 14:15 UTC279
    }
0d604ee39751atagen2026-10-10 14:15 UTC280
d604371299fbatagen2026-10-10 13:54 UTC281
    /// Whether searching the drawer on this floor would turn anything up.
d604371299fbatagen2026-10-10 13:54 UTC282
    pub fn drawer_worth_searching(&self) -> bool {
e807266c323batagen2026-10-12 09:46 UTC283
        !self.here.drawer_searched || self.items.cage
d604371299fbatagen2026-10-10 13:54 UTC284
    }
782069860236atagen2026-10-10 12:44 UTC285
}