Commit 12930d4
authored
Room instances (#363)
# Description
The goal of this PR is to split Room data files into two save forms:
1. The "Template", saved in `_datafiles/world/{worldname}/rooms/` which is just the normal, empty state room definition. This is how the room should be loaded into the memory the first time it is ever encountered. Items shouldn't be on the floor (unless it is desired to start with an item on the floor), gold, containers, etc. are all in their initial state.
2. The "Instance", saved in `_datafiles/world/{worldname}/rooms.instances/` which is everything (or most things) that have changed about the room and are worth saving in case the room gets unloaded from memory.
## Changes
- Updated room "Template" data files to remove random objects that were saved and committed into rooms in the past.
- Instance loading/saving and Template loading/saving are distinct operations with different purposes, and code functions etc. have been created to handle them.
- Developers should generally not have to interface with these, they are for precise modification to specific data when needed, such as in admin commands. The `rooms.LoadRoom()` function remains the primary way to load room data.
- Fixed some inefficiencies with room filenames, should have been caching but wasn't.
- Added a makefile target to delete all instance data for purposes of testing.
- Added an event and handler to rebuild mapper data.
- Fixed a lot of messy/poorly named functions and variables to try and make clearer
- Added lots of code comments for whatever poor soul must revisit this process.
- Moved room save/load functions to own file in package folder.
- Updated admin `build` command to modify template data.
- Updated admin `room` command to modify template data.1 parent 539d2e6 commit 12930d4
File tree
27 files changed
+782
-394
lines changed- _datafiles/world/default/rooms
- catacombs
- dark_forest
- endless_trashheap
- frost_lake
- frostfang_slums
- frostfang
- internal
- events
- hooks
- mapper
- mutators
- plugins
- rooms
- usercommands
27 files changed
+782
-394
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
66 | 71 | | |
67 | 72 | | |
68 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | 17 | | |
21 | 18 | | |
22 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | 21 | | |
25 | 22 | | |
26 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | 19 | | |
27 | 20 | | |
28 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | 19 | | |
22 | 20 | | |
23 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | 16 | | |
19 | 17 | | |
20 | 18 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | 21 | | |
24 | 22 | | |
25 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | 16 | | |
19 | 17 | | |
20 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | 18 | | |
21 | 19 | | |
22 | 20 | | |
0 commit comments