Improve info about new changes

This commit is contained in:
NGnius (Graham) 2021-08-30 12:18:49 -04:00
parent d2dff09bc3
commit e501371f38
2 changed files with 83 additions and 34 deletions

View file

@ -15,14 +15,6 @@ namespace CLre.Fixes
public static void Init() public static void Init()
{ {
CultureInfo ci = CultureInfo.CurrentUICulture;
if (ci.TwoLetterISOLanguageName.ToLower() != "en")
{
API.Utility.Logging.LogWarning($"CLre detected non-English language {ci.DisplayName} ({ci.Name}/{ci.TwoLetterISOLanguageName}). " +
"CardLife works best with the Windows language set to English. " +
"If you run into bugs, try launching CardLife with the launch options set to \"%command% --float-fix\", without quotes. " +
"Please also report the issue to NGnius (ngniusness@gmail.com or NGnius#0864 on the CL Discord server), so he can fix the problem properly.");
}
string[] args = Environment.GetCommandLineArgs(); string[] args = Environment.GetCommandLineArgs();
if (args.Contains("-ff", StringComparer.InvariantCultureIgnoreCase) if (args.Contains("-ff", StringComparer.InvariantCultureIgnoreCase)
|| args.Contains("--float-fix", StringComparer.InvariantCultureIgnoreCase) || args.Contains("--float-fix", StringComparer.InvariantCultureIgnoreCase)
@ -31,12 +23,24 @@ namespace CLre.Fixes
{ {
Enabled = true; Enabled = true;
} }
else
{
CultureInfo ci = CultureInfo.CurrentUICulture;
if (ci.TwoLetterISOLanguageName.ToLower() != "en")
{
API.Utility.Logging.LogWarning(
$"CLre detected non-English language {ci.DisplayName} ({ci.Name}/{ci.TwoLetterISOLanguageName}). " +
"CardLife works best with the Windows language set to English. " +
"If you run into bugs, try launching CardLife with the launch options set to \"%command% --float-fix\", without quotes. " +
"Please also report the issue to NGnius (ngniusness@gmail.com or NGnius#0864 on the CL Discord server) or on Trello (https://trello.com/b/EGKEpfBF/cardlife-bugs), so the problem can be fixed properly.");
}
}
} }
} }
[Bugfix(name = "EnchantmentTableFloatParseFix", [Bugfix(name = "AntiStupidFloats",
description = "Make all float parsing culture-invariant", description = "Force language-agnostic float->string behaviour internally, like all programs should (DISABLED BY DEFAULT)",
component = BugfixType.HarmonyPatch, id = 1)] component = BugfixType.HarmonyPatch, id = 10)]
[HarmonyPatch(typeof(float), "ToString", new Type[] { })] [HarmonyPatch(typeof(float), "ToString", new Type[] { })]
class Float_ToString0_Patch class Float_ToString0_Patch
{ {

View file

@ -1,19 +1,21 @@
# CLre # CLre
Always eat your celery, so you'll grow up to be big and strong like me. Always eat your celery, so you'll grow up to be big and strong like me.
Work-in-progress mod for [CardLife](http://cardlifegame.com/). Work-in-progress mod for [Cardlife](http://Cardlifegame.com/).
CardLife has stopped receiving updates, but that doesn't mean it's free from bugs. Cardlife has stopped receiving updates, but that doesn't mean it's free from bugs.
CLre is a mod to rejuvenate CardLife by fixing old bugs and adding some modding sprinkles. CLre is a mod to rejuvenate Cardlife by fixing old bugs and adding some modding sprinkles.
## Setup ## Development
This project requires most of Cardlife's `.dll` files to function correctly. ### Setup
Most, but not all, of these files are stored in Cardlife's `Cardlife_Data\Managed` folder.
This project requires most of Cardlife's `.dll` files to function correctly.
Most, but not all, of these files are stored in Cardlife's `Cardlife_Data\Managed` folder.
The project is pre-configured to look in a folder called cl in the solution's main directory or one level up from that. The project is pre-configured to look in a folder called cl in the solution's main directory or one level up from that.
You can make sure CLre can find all of `.dll` files it needs by copying your Cardlife folder beside this repo's folder and renaming it to `cl`, but that's a bit of a waste of disk space. You can make sure CLre can find all of `.dll` files it needs by copying your Cardlife folder beside this repo's folder and renaming it to `cl`, but that's a bit of a waste of disk space.
You can also create a symbolic link to your Cardlife install folder named `cl` in the same spot to avoid having to re-copy files. You can also create a symbolic link to your Cardlife install folder named `cl` in the same spot to avoid having to re-copy files.
For example, if you cloned the repo into a folder called `CLre_repo`, this is what your folder structure would look like. For example, if you cloned the repo into a folder called `CLre_repo`, this is what your folder structure would look like.
If you decide to change the `cl` folder configuration, do not commit changes to your `CLre.csproj` or `CLre_server.csproj` files otherwise your changes will be rejected. If you decide to change the `cl` folder configuration, do not commit changes to your `CLre.csproj` or `CLre_server.csproj` files otherwise your changes will be rejected.
@ -24,18 +26,18 @@ CLre_repo/ <- CLre git project files
README.md <- This file README.md <- This file
etc. etc.
cl/ <- CardLife files cl/ <- Cardlife files
Cardlife_Data/ Cardlife_Data/
Managed/ <- Cardlife C# Assemblies Managed/ <- Cardlife C# Assemblies
CardlifeGameServer_Data/ CardlifeGameServer_Data/
Managed/ <- Cardlife Server C# Assemblies (optional) Managed/ <- Cardlife Server C# Assemblies (optional)
``` ```
For any game mod to work, you will have to patch your game with the Cardlife adaptation of [CLIPA](https://git.exmods.org/NGnius/CLIPA). For any game mod to work, you will have to patch your game with the Cardlife adaptation of [CLIPA](https://git.exmods.org/NGnius/CLIPA).
FOr a server mod to work, you will have to patch the server (CardlifeGameServer.exe). FOr a server mod to work, you will have to patch the server (CardlifeGameServer.exe).
The installation process is roughly the same as for Gamecraft, except with a different name: [GCIPA Gamecraft install guide](https://git.exmods.org/modtainers/GCIPA/src/branch/master/README.md#how-to-install). The installation process is roughly the same as for Gamecraft, except with a different name: [GCIPA Gamecraft install guide](https://git.exmods.org/modtainers/GCIPA/src/branch/master/README.md#how-to-install).
## Building ### Building
After you've completed the setup, open the solution file `CLre.sln` in your prefered C# .NET/Mono development environment. After you've completed the setup, open the solution file `CLre.sln` in your prefered C# .NET/Mono development environment.
I'd recommend Visual Studio Community Edition or JetBrains Rider. I'd recommend Visual Studio Community Edition or JetBrains Rider.
@ -45,13 +47,13 @@ If it doesn't work and you can't figure out why, ask for help on the [Exmods Dis
## Installation ## Installation
To install the CLre mod, copy the build's `CLre.dll` into the `Plugins` folder where Cardlife is installed. To install the CLre mod, copy the build's `CLre.dll` into the `Plugins` folder where Cardlife is installed.
To install the CLre_server mod, copy the CLre_server build's `CLre_server.dll` into the `Plugins` folder where Cardlife is installed. To install the CLre_server mod, copy the CLre_server build's `CLre_server.dll` into the `Plugins` folder where Cardlife is installed.
## A Note on CLre and CLre_server mods' (lack of) cooperation ## A Note on CLre and CLre_server mods' (lack of) cooperation
CLre is designed for the Cardlife client, and cannot be used to mod the Cardlife server. CLre is designed for the Cardlife client, and cannot be used to mod the Cardlife server.
Similarly, CLre_server is designed for the Cardlife server, and cannot be used to mod the Cardlife client. Similarly, CLre_server is designed for the Cardlife server, and cannot be used to mod the Cardlife client.
DO NOT install CLre and CLre_server in the same `Plugins` folder, because both mods will be loaded -- guaranteeing one will break. DO NOT install CLre and CLre_server in the same `Plugins` folder, because both mods will be loaded -- guaranteeing one will break.
To install CLre and CLre_server on the same computer, create a copy of the game installation and use one copy for CLre and one for CLre_server. To install CLre and CLre_server on the same computer, create a copy of the game installation and use one copy for CLre and one for CLre_server.
@ -59,11 +61,12 @@ To install CLre and CLre_server on the same computer, create a copy of the game
## CLre ## CLre
CLre provides a minimal modding API and useful bugfixes for the Cardlife client. CLre provides a minimal modding API and useful bugfixes for the Cardlife client.
### Fixes ### Fixes
As of v0.0.2, eight (8) bugfixes are implemented. As of v0.0.3, ten (10) bugfixes are implemented.
- InitLogSooner: Start the logger slightly sooner than Cardlife does [TARGET: CustomLoggerThread] [ID: 0] (0M/2P/1I/0W/0A/0D/3T) - InitLogSooner: Start the logger slightly sooner than Cardlife does [TARGET: CustomLoggerThread] [ID: 0] (0M/2P/1I/0W/0A/0D/3T)
- EnchantmentTableFloatParseFix: [MORE: https://trello.com/c/qawBFb7P/1-enchantment-table-fails-to-work] [ID: 1] (0M/2P/0I/0W/0A/0D/2T) - EnchantmentTableFloatParseFix: [MORE: https://trello.com/c/qawBFb7P/1-enchantment-table-fails-to-work] [ID: 1] (0M/2P/0I/0W/0A/0D/2T)
- ExclusionImprovement: [MORE: https://trello.com/c/Ue4yIqWQ/11-placing-material-in-restricted-areas] [ID: 2] (0M/2P/0I/0W/0A/0D/2T) - ExclusionImprovement: [MORE: https://trello.com/c/Ue4yIqWQ/11-placing-material-in-restricted-areas] [ID: 2] (0M/2P/0I/0W/0A/0D/2T)
@ -72,11 +75,14 @@ As of v0.0.2, eight (8) bugfixes are implemented.
- ScrollSpeedImprovement: [MORE: https://trello.com/c/elL8IVdn/4-scroll-menus-are-insensitive] [ID: 5] (0M/1P/0I/0W/0A/0D/1T) - ScrollSpeedImprovement: [MORE: https://trello.com/c/elL8IVdn/4-scroll-menus-are-insensitive] [ID: 5] (0M/1P/0I/0W/0A/0D/1T)
- MiniScreenEmbiggener: [MORE: https://trello.com/c/NAls3XaE/17-game-starts-minimized-and-wont-restore] [ID: 6] (0M/0P/1I/0W/0A/0D/1T) - MiniScreenEmbiggener: [MORE: https://trello.com/c/NAls3XaE/17-game-starts-minimized-and-wont-restore] [ID: 6] (0M/0P/1I/0W/0A/0D/1T)
- UnderStructureCollider: [MORE: https://trello.com/c/nfuaZWQZ/10-passing-through-structures] [ID: 7] (1M/1P/1I/0W/0A/0D/3T) - UnderStructureCollider: [MORE: https://trello.com/c/nfuaZWQZ/10-passing-through-structures] [ID: 7] (1M/1P/1I/0W/0A/0D/3T)
- TerrainModificationFailedHandler: [MORE: https://trello.com/c/Pq5lcB1p/23-moderation-tools] [ID: 8] (0M/2P/1I/1W/0A/2D/6T)
- OfflineSpawnpointSavingFloatFix: [MORE: https://trello.com/c/hpADhDhQ/21-login-goes-to-original-spawn] [ID: 9] (0M/2P/0I/0W/0A/0D/2T)
- AntiStupidFloats: Force language-agnostic float->string behaviour internally (DISABLED BY DEFAULT) [ID: 10] (0M/1P/1I/0W/0A/0D/2T)
### API ### API
Basic engine registration and some events are exposed for modders to use. Basic engine registration and some events are exposed for modders to use.
Documentation WIP... Documentation WIP... (read the code files in the `CLre/API` directory for now)
## CLre_server ## CLre_server
@ -84,23 +90,30 @@ CLre_server provides a minimal modding API, admin HTTP server, and bugfixes for
### Fixes ### Fixes
As of v0.0.2, one (1) bugfix is implemented. As of v0.0.3, one (1) bugfix is implemented.
- InitLogSooner: Start the logger slightly sooner than Cardlife does [TARGET: CustomLoggerThread] [ID: 0] (0M/2P/1I/0W/0A/0D/3T) - InitLogSooner: Start the logger slightly sooner than Cardlife does [TARGET: CustomLoggerThread] [ID: 0] (0M/2P/1I/0W/0A/0D/3T)
### API ### API
Basic engine registration and some events are exposed for modders to use. Basic engine registration and some events are exposed for modders to use.
Documentation WIP... Documentation WIP... (read the code files in the `CLre_server/API` directory for now)
### HTTP Server ### Tweaks
The HTTP server is enabled by the `-web` command line argument. CLre_server also offers a few improvements for the Cardlife server.
These are not bugfixes, but are quality-of-life additions to bring server functionality up to par with other game servers.
Improvements can be enabled and customized by modifying the `CLre_server.json` configuration file in Cardlife's install directory.
#### HTTP Server
The HTTP server is enabled by the `-web` command line argument, or in `CLre_server.json`.
It is disabled by default to reduce resource usage. It is disabled by default to reduce resource usage.
When enabled, the server will listen on http://localhost:5030 and provide basic server status information. When enabled, the server will listen on http://localhost:5030 and provide basic server status information.
This can be accessed through any standard web browser on the same computer. This can be accessed through any standard web browser on the same computer.
If you wish to make this publicly accessible, it is recommended to use Nginx or another web proxy system to proxy traffic to that port securely. If you wish to make this publicly accessible, it is recommended to use Nginx or another web proxy system to proxy traffic to that port securely.
Useful endpoints Useful endpoints
```text ```text
GET / HTML landing page with some basic server info GET / HTML landing page with some basic server info
GET /l/current Server output log, up-to-date as of last webpage refresh GET /l/current Server output log, up-to-date as of last webpage refresh
@ -108,3 +121,35 @@ GET /d/version Cardlife, Unity and CLre version information
GET /status.json Useful status information about players and server state in JSON format GET /status.json Useful status information about players and server state in JSON format
GET /c/game.json Basically GameServerSettings.json for the running Cardlife server GET /c/game.json Basically GameServerSettings.json for the running Cardlife server
``` ```
#### Server Commands
CLre_server can accept chat commands from connected players.
Chat commands can be enabled in `CLre_server.json`.
For this functionality to work, valid user credentials must also be configured.
Commands
```text
/echo <msg> - say <msg>
/help - show a list of commands
/list - display online users
/version - display version information
/ban <user> - permanently remove <user> from this server
/deop <user> - revoke <user> moderator permissions
/kick <user> - disconnect <user> from this server
/op <user> - grant <user> moderator permissions
```
#### Terrain Modification Exclusion Zone
This exclusion zone improvement can be enabled in `CLre_server.json`.
This prevents players from digging under a building that they do not own.
This improves on the existing exclusion zone functionality which already prevents a player from placing materials and building structures too close to another player's building.
#### CLre-only Mode
To prevent vanilla clients from connecting to this server, enable this restriction in `CLre_server.json`.
Enabling this functionality is not recommended.
This functionality should only be used when other code mods are installed which break compatibility with unmodded Cardlife clients.