mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 12:47:58 +03:00
cmd/flood: add room_num arg
This commit is contained in:
parent
3bf7761872
commit
4ba1d96282
3 changed files with 18 additions and 10 deletions
|
@ -24,7 +24,9 @@ Currently supported commands:
|
|||
|
||||
- `/flood`
|
||||
`/drain`
|
||||
Floods or drains the current room at will. For when drowning is preferable to puzzles!
|
||||
- `/flood {room_num}`
|
||||
`/drain {room_num}`
|
||||
Floods or drains the chosen room at will. For when drowning is preferable to puzzles!
|
||||
|
||||
- `/give {item_name}`
|
||||
`/give {num} {item_name}`
|
||||
|
|
|
@ -23,7 +23,9 @@ Currently supported commands:
|
|||
|
||||
- `/flood`
|
||||
`/drain`
|
||||
Floods or drains the current room at will. For when drowning is preferable to puzzles!
|
||||
- `/flood {room_num}`
|
||||
`/drain {room_num}`
|
||||
Floods or drains the chosen room at will. For when drowning is preferable to puzzles!
|
||||
|
||||
- `/give {item_name}`
|
||||
`/give {num} {item_name}`
|
||||
|
|
|
@ -7,19 +7,23 @@ static COMMAND_RESULT M_Entrypoint(const COMMAND_CONTEXT *ctx);
|
|||
|
||||
static COMMAND_RESULT M_Entrypoint(const COMMAND_CONTEXT *const ctx)
|
||||
{
|
||||
if (!String_IsEmpty(ctx->args)) {
|
||||
return CR_BAD_INVOCATION;
|
||||
}
|
||||
int32_t room_num;
|
||||
if (!String_ParseInteger(ctx->args, &room_num)) {
|
||||
if (!String_IsEmpty(ctx->args)) {
|
||||
return CR_BAD_INVOCATION;
|
||||
}
|
||||
|
||||
ITEM *const lara_item = Lara_GetItem();
|
||||
if (lara_item == nullptr) {
|
||||
return CR_UNAVAILABLE;
|
||||
ITEM *const lara_item = Lara_GetItem();
|
||||
if (lara_item == nullptr) {
|
||||
return CR_UNAVAILABLE;
|
||||
}
|
||||
room_num = lara_item->room_num;
|
||||
}
|
||||
|
||||
if (String_Equivalent(ctx->prefix, "flood")) {
|
||||
Room_Get(lara_item->room_num)->flags |= RF_UNDERWATER;
|
||||
Room_Get(room_num)->flags |= RF_UNDERWATER;
|
||||
} else if (String_Equivalent(ctx->prefix, "drain")) {
|
||||
Room_Get(lara_item->room_num)->flags &= ~RF_UNDERWATER;
|
||||
Room_Get(room_num)->flags &= ~RF_UNDERWATER;
|
||||
} else {
|
||||
return CR_UNAVAILABLE;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue