-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathreadme.txt
146 lines (109 loc) · 4.96 KB
/
readme.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
Shroudtopia
Modloader for Enshrouded (Server & Client))
I'm excited to introduce **Shroudtopia**, a modloader that allows easy management and integration of mods for Enshrouded. With Shroudtopia, you can dynamically load, activate, and deactivate mods without restarting, giving you the ultimate flexibility to enhance gameplay.
## Modloader Features
- **Mod Management**: Dynamically load and unload mods from the "mods" folder.
- **Live Configuration**: Modify mod settings at runtime without restarting the server.
- **Dependency Injection**: Each mod is fully integrated into the system via the `ModContext`, enabling shared access to configuration, logging, and other utilities.
## Example Mods
- **Flight Mod:** Enjoy full flight capabilities with the glider. No more losing height!

- **First Person View:** Play Enshrouded from another persepctive. Example for client-only mod.

- **BasicsMod:** Flight Mod is no fun with fall damage. All other legacy Shroudtopia features have been put into this mod. You can selectively activate them in the configuration file.
## Installation
1. **Download:** Get the latest modloader binaries from the [release section](https://github.com/s0t7x/shroudtopia/releases).
2. **Setup:** Extract the files into your Enshrouded game or dedicated server folder.
3. **Mods Folder:** Create a `mods` folder if it doesn’t exist and place your mod DLLs inside.
4. **Launch:** Start the server - a default config is generated if `shroudtopia.json` is absent.
If Shroudtopia is loaded correctly, you should see something like this in the server console:
```
[shroudtopia][INFO] Config loaded.
[shroudtopia][INFO] Wait before injection. Configured boot delay is 3000ms.
```
Upon the first launch, a default configuration file `shroudtopia.json` is created. All mods are deactivated by default, so you must manually activate them by adjusting the configuration.
## Configuration
Each mod can be enabled or customized via the `shroudtopia.json` config file. Here’s an example configuration:
```json
{
"active": true,
"bootDelay": 3000,
"enableLogging": true,
"logLevel": "INFO",
"mods": {
"basics": {
"active": true,
"no_stamina_loss": true,
"no_fall_damage": true,
"no_craft_cost": true,
"inf_item_use": true,
"bypass_altar_limit": true
},
"Flight Mod": {
"active": true
}
},
"updateDelay": 500
}
```
Each mod exposes its configuration options, which can be altered in `shroudtopia.json`. For instance, to enable or disable specific features for the basics mod:
```json
"basics": {
"active": true,
"no_stamina_loss": true,
"no_fall_damage": false,
"no_craft_cost": true,
"inf_item_use": true,
"bypass_altar_limit": true
}
```
# Creating Mods
Mods for Shroudtopia are written as dynamic libraries (DLLs) and need to include `shroudtopia.h` from `./shroudtopia/`.
They must implement the `Mod` interface and provide the factory function `extern "C" __declspec(dllexport) Mod* CreateModInstance()`.
Here’s an example factory function:
```cpp
extern "C" __declspec(dllexport) Mod* CreateModInstance() {
return new BasicsMod();
}
```
## Mod Interface
Every mod must implement the following functions to integrate with the modloader:
```cpp
class Mod {
public:
virtual ~Mod() {}
virtual ModMetaData GetMetaData() = 0;
virtual void Load(ModContext* modContext) = 0;
virtual void Unload(ModContext* modContext) = 0;
virtual void Activate(ModContext* modContext) = 0;
virtual void Deactivate(ModContext* modContext) = 0;
virtual void Update(ModContext* modContext) = 0;
};
```
`ModMetaData` contains essential information about the mod:
```cpp
struct ModMetaData {
std::string name;
std::string description;
std::string version;
std::string author;
std::string targetShroudtopiaVersion;
bool hasClientSupport;
bool hasServerSupport;
};
```
## ModContext
The `ModContext` is passed to each mod and provides access to core functionality, such as configuration, logging, and mod management. For example, the mod can retrieve config values via:
```cpp
bool enabled = modContext->config.GetBool("modName", "feature_name", false);
```
# Contributing
Currently no really game specific functions are implemented in the modContext. This is first try. Anyways, contributions are welcome! Fork the repository, add improvements, and submit pull requests. I would be happy to see more mods for this around.
# License
This project is licensed under the [MIT License](https://github.com/s0t7x/shroudtopia/blob/0.1-stable/LICENSE).
<hr />
Let's make Enshrouded even more exciting with **Shroudtopia**! 🌟
Special thanks to the following folks. Their work gave me a headstart implementing most features:
- cfe
- Turk
- Atamg