Skip to content

Commit 33ddd72

Browse files
authored
Room edit "exits" command (#228)
# Changes * Interactive menu to edit exits added * Invoke via `room edit exits`
1 parent c524c27 commit 33ddd72

File tree

5 files changed

+435
-29
lines changed

5 files changed

+435
-29
lines changed

_datafiles/world/default/templates/admincommands/help/command.room.template

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ Set a property of the room. This updates basic properties of the room you are in
3434
Containers:
3535
You can interactively add/remove/edit containers using the command:
3636
<ansi fg="command">room edit containers</ansi>
37+
Exits:
38+
You can interactively add/remove/edit exits using the command:
39+
<ansi fg="command">room edit exits</ansi>
3740

3841
<ansi fg="command">room exit [exit_name] [room_id]</ansi> - e.g. <ansi fg="command">room exit west 159</ansi>
3942
This will create a new exit that links to a specific room_id using the exit_name provided.

_datafiles/world/empty/templates/admincommands/help/command.room.template

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ Set a property of the room. This updates basic properties of the room you are in
3434
Containers:
3535
You can interactively add/remove/edit containers using the command:
3636
<ansi fg="command">room edit containers</ansi>
37+
Exits:
38+
You can interactively add/remove/edit exits using the command:
39+
<ansi fg="command">room edit exits</ansi>
3740

3841
<ansi fg="command">room exit [exit_name] [room_id]</ansi> - e.g. <ansi fg="command">room exit west 159</ansi>
3942
This will create a new exit that links to a specific room_id using the exit_name provided.

internal/items/itemspec.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,20 @@ func FindItem(nameOrId string) int {
264264
return FindItemByName(nameOrId)
265265
}
266266

267+
func FindKeyByLockId(lockId string) int {
268+
269+
for _, item := range items {
270+
if item.Type != Key {
271+
continue
272+
}
273+
if item.KeyLockId == lockId {
274+
return item.ItemId
275+
}
276+
}
277+
278+
return 0
279+
}
280+
267281
func FindItemByName(name string) int {
268282
name = strings.ToLower(name)
269283

internal/rooms/rooms.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ type Room struct {
9090
LastIdleMessage uint8 `yaml:"-"` // index of the last idle message displayed
9191
LongTermDataStore map[string]any `yaml:"longtermdatastore,omitempty"` // Long term data store for the room
9292
Mutators mutators.MutatorList `yaml:"mutators,omitempty"` // mutators this room spawns with.
93-
Pvp bool `yaml:"pvp,omitempty"` // config pvp is set to `limited`, uses this value
93+
Pvp bool `yaml:"pvp,omitempty"` // if config pvp is set to `limited`, uses this value
9494
players []int `yaml:"-"` // list of user IDs currently in the room
9595
mobs []int `yaml:"-"` // list of mob instance IDs currently in the room. Does not get saved.
9696
visitors map[VisitorType]map[int]uint64 `yaml:"-"` // list of user IDs that have visited this room, and the last round they did

0 commit comments

Comments
 (0)