Map Init & Map Loading improvements. (#801)

* MapInit v1, so people can criticize my code.

* Map init v1.

* Improve LocalPlayer to fix aghosting.

* Fix map saving.

* Map command improvements:

Implement loadbp
Made certain commands aware of uninitialized maps.

* Adds IMapManager.GetAllGrids()

* Add lsgrid and lsmap commands.

* MetaData component serialization fixes.

Serialize name and description default as null.
Don't serialize prototype.

* Explicit UID indices in map files.

* Update map format doc again.
This commit is contained in:
Pieter-Jan Briers
2019-04-29 12:50:28 +02:00
committed by GitHub
parent 1b3cc8aba6
commit f4b0b69cbb
13 changed files with 344 additions and 38 deletions

View File

@@ -19,6 +19,9 @@ Fields:
* `format`: Version identifier. **The current version is `2`.** Can be used to bail out early for unsupported map files.
* `name`: A name. Simple huh. Can be left out.
* `author`: Authorship info. Also simple. Can be left out.
* `postmapinit`: Whether this map is "post map init". This means that presets such as procedural generation have applied.
In general, maps touched only via map editing mode will have this false. Maps saved mid game will not.
Default value is true if left out.
### The `tilemap` section
@@ -42,7 +45,8 @@ Contains data for all the grids. The section is an ordered sequence. Each sequen
Contains data for all entities on the map. Just like grids these are stored in an indexed list, and an entity declaration is pretty much just like a prototype.
Each entity has a `type` field which specifies which prototype it is, and the components list works as overrides in the same way as entity parenting.
Each entity has a `type` field which specifies which prototype it is, and the components list works as overrides in the same way as prototype parenting.
Each entity also has a numerical `uid` field, which is used to give this entity an unique identifier when referenced by other entities.
#### Chunk Data
@@ -84,7 +88,7 @@ Direct hard `IEntity` references are stored as entity UID, it is simply decoded
In-game `EntityUid` instances are either:
* Serialized as YAML `null` if the entity referenced to is not included in the map saving. If it's on a different grid, for example.
* An integer representing the index in the `entities` section corresponding to the serialized entity.
* An integer representing the `uid` of the serialized entity.
### Grid IDs