Skip to content

Commit e301b4d

Browse files
author
mirrorcult
authored
Update conventions for hardfork (#128)
1 parent 7b1ed3c commit e301b4d

1 file changed

Lines changed: 16 additions & 25 deletions

File tree

src/coding/code-conventions.md

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
# Code Conventions
22

3-
In addition to the basic [upstream conventions](https://docs.spacestation14.com/en/general-development/codebase-info/conventions.html), Ephemeral Space has a multitude of custom conventions meant to aid in maintainability and reduce merge conflicts.
3+
```admonish warning
4+
These documents have recently changed significantly as a result of our hardfork. Even if this doc looks the same to you, you should reread the conventions to ensure you understand the new conventions going forward.
5+
```
6+
7+
In addition to the basic [upstream conventions](https://docs.spacestation14.com/en/general-development/codebase-info/conventions.html), Ephemeral Space has a multitude of custom conventions meant to aid in maintainability.
8+
9+
**Ephemeral Space is a hardfork of the upstream repository**. This means we have no qualms about editing or deleting upstream files en masse, and things which we have no use for are generally deleted from the repository entirely. We may occasionally cherrypick and backport commits, but we do not regularly merge in upstream, and we handle engine updates ourselves.
410

511
## General Conventions
612

713
### Mirrored Directories
814

9-
When adding new files to the Ephemeral Space project, always include them under an "`_ES`" directory.
15+
When adding *new* files to the Ephemeral Space project, always include them under an "`_ES`" directory.
1016
Each project receives its own corresponding directory (`Content.Client/_ES/`, `Content.Shared/_ES/`, etc.) with the file structure of the `_ES` directory mirroring the folder it is in.
1117

1218
This is similarly done for each folder inside the `Resources` directory (`Resources/Prototypes/_ES`, `Resources/Textures/_ES`, etc.)
@@ -15,30 +21,15 @@ The goal of this is to organize specific Ephemeral Space contributions while mai
1521

1622
### Fork Markers
1723

18-
All modifications to non-_ES files should be enclosed with the `ES START` and `ES END` markers, denoting that the edits were made to the Ephemeral Space project.
19-
20-
When making modifications, prefer to limit their size and place markers around as little code as possible.
21-
Ideally, all the lines within the markers should have been modified.
22-
23-
#### File Markers
24-
25-
When extensive modifications must be made to non-_ES files, prefer to create a header at the beginning of the file to denote the changes.
26-
This helps anyone in the future to see that the entire file has been modified.
27-
28-
### Prefer Creating Over Editing
29-
30-
When faced with the option of editing an existing file or creating a new one, prefer creating new _ES-specific files.
31-
Limiting the amount of modifications made is ideal for development.
24+
All C# files that are modified should have an `ES MODIFIED` marker near the start of the file, along with a comment detailing the edits made. In other files, like YAML, no markers are required.
3225

3326
## C# Conventions
3427

3528
### Class Prefixes
3629

37-
All classes and structs should be prefixed with "ES".
30+
All **data definitions** types (components, prototypes, anything else serializable) should be prefixed with "ES". Any other classes, like systems, do not need to be prefixed.
3831

39-
### Prototype Prefixes
40-
41-
Prototypes, like other classes, should be prefixed with "ES". The name must be explicitly specified in the `PrototypeAttribute` to prevent improper casing.
32+
Prototype names must be explicitly specified in the `PrototypeAttribute` to prevent improper casing.
4233

4334
Bad:
4435
```csharp
@@ -60,14 +51,14 @@ public sealed class ESTestCasePrototype : IPrototype
6051

6152
### ID Prefixes
6253

63-
All prototypes should have their ID's prefixed with "ES".
54+
We previously required ID prefixing in YAML, but **it is not a convention anymore**. YAML IDs for new prototypes should not be prefixed with `ES`. Pre-hardfork prototypes may still be prefixed with `ES`.
6455

6556
## Spriting Conventions
6657

6758
### RSIs
6859

69-
New sprites made for Ephemeral Space should always be placed inside new RSIs in mirrored directories, similar to prototypes.
60+
Entirely new sprites made for Ephemeral Space should always be placed inside new RSIs in mirrored directories, similar to prototypes.
61+
62+
If a sprite is a simple replacement of a pre-existing sprite in the game, the upstream RSI should be edited.
7063

71-
If a sprite replaces a pre-existing sprite in the game, it's fine to simply replace the entire RSI.
72-
However, this should only be done if the new RSI is entirely replaced and is not likely to be modified again in the future.
73-
RSIs that are frequently modified (`computers.rsi`, `module.rsi`, `pda.rsi`) should never be modified in part, as they are likely to cause conflicts that are difficult to resolve.
64+
If editing an upstream RSI requires adding new states or removing states, the entire upstream RSI should be **moved to our folder**, and the changes made there. Note that this doesn't say duplicate--move the folder, duplicating is somewhat costly.

0 commit comments

Comments
 (0)