Merge branch 'general-devel' into pr3005

This commit is contained in:
Lucas Nicodemus 2025-01-25 22:40:03 +09:00 committed by GitHub
commit b9d984863d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 72 additions and 33 deletions

2
.github/FUNDING.yml vendored
View file

@ -1,2 +1,2 @@
# These are supported funding model platforms # These are supported funding model platforms
github: [SignatureBeef, hakusaro, Stealownz, QuiCM] github: [SignatureBeef, QuiCM]

25
.github/workflows/ci-docker.yml vendored Normal file
View file

@ -0,0 +1,25 @@
name: CI (Docker image)
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up buildx
uses: docker/setup-buildx-action@v3
- name: Build image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7,windows/amd64
push: false
pull: true
cache-from: type=gha, scope=${{ github.workflow }}
cache-to: type=gha, scope=${{ github.workflow }}

View file

@ -1,10 +1,8 @@
ARG TARGETPLATFORM=linux/amd64 # TARGETPLATFORM and BUILDPLATFORM are automatically filled in by Docker buildx.
ARG BUILDPLATFORM=${TARGETPLATFORM} # They should not be set in the global scope manually.
FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:6.0 AS builder FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:6.0 AS builder
ARG TARGETPLATFORM
# Copy build context # Copy build context
WORKDIR /TShock WORKDIR /TShock
COPY . ./ COPY . ./
@ -12,6 +10,10 @@ COPY . ./
# Build and package release based on target architecture # Build and package release based on target architecture
RUN dotnet build -v m RUN dotnet build -v m
WORKDIR /TShock/TShockLauncher WORKDIR /TShock/TShockLauncher
# Make TARGETPLATFORM available to the container.
ARG TARGETPLATFORM
RUN \ RUN \
case "${TARGETPLATFORM}" in \ case "${TARGETPLATFORM}" in \
"linux/amd64") export ARCH="linux-x64" \ "linux/amd64") export ARCH="linux-x64" \

View file

@ -1,5 +1,5 @@
<p align="center"> <p align="center">
<img src="https://tshock.co/newlogo.png" alt="TShock for Terraria"><br /> <img src="https://tshock.s3.us-west-001.backblazeb2.com/newlogo.png" alt="TShock for Terraria"><br />
<a href="https://ci.appveyor.com/project/hakusaro/tshock"> <a href="https://ci.appveyor.com/project/hakusaro/tshock">
<img src="https://ci.appveyor.com/api/projects/status/chhe61q227lqdlg1?svg=true" alt="AppVeyor Build Status"> <img src="https://ci.appveyor.com/api/projects/status/chhe61q227lqdlg1?svg=true" alt="AppVeyor Build Status">
</a> </a>

View file

@ -1,5 +1,5 @@
<p align="center"> <p align="center">
<img src="https://tshock.co/newlogo.png" alt="TShock for Terraria"><br /> <img src="https://tshock.s3.us-west-001.backblazeb2.com/newlogo.png" alt="TShock for Terraria"><br />
<a href="https://ci.appveyor.com/project/hakusaro/tshock"> <a href="https://ci.appveyor.com/project/hakusaro/tshock">
<img src="https://ci.appveyor.com/api/projects/status/chhe61q227lqdlg1?svg=true" alt="AppVeyor Build Status"> <img src="https://ci.appveyor.com/api/projects/status/chhe61q227lqdlg1?svg=true" alt="AppVeyor Build Status">
</a> </a>

View file

@ -320,8 +320,8 @@ namespace TShockAPI.Configuration
[Description("The reason given if banning a mediumcore player on death.")] [Description("The reason given if banning a mediumcore player on death.")]
public string MediumcoreBanReason = GetString("Death results in a ban"); public string MediumcoreBanReason = GetString("Death results in a ban");
/// <summary>Disbales IP bans by default, if no arguments are passed to the ban command.</summary> /// <summary>Disables IP bans by default, if no arguments are passed to the ban command.</summary>
[Description("Disbales IP bans by default, if no arguments are passed to the ban command.")] [Description("Disables IP bans by default, if no arguments are passed to the ban command.")]
public bool DisableDefaultIPBan; public bool DisableDefaultIPBan;
/// <summary>Enable or disable the whitelist based on IP addresses in the whitelist.txt file.</summary> /// <summary>Enable or disable the whitelist based on IP addresses in the whitelist.txt file.</summary>

View file

@ -529,18 +529,9 @@ namespace TShockAPI
field.GetCustomAttributes(false).FirstOrDefault(o => o is DescriptionAttribute) as DescriptionAttribute; field.GetCustomAttributes(false).FirstOrDefault(o => o is DescriptionAttribute) as DescriptionAttribute;
var desc = descattr != null && !string.IsNullOrWhiteSpace(descattr.Description) ? descattr.Description : GetString("No description available."); var desc = descattr != null && !string.IsNullOrWhiteSpace(descattr.Description) ? descattr.Description : GetString("No description available.");
var commands = GetCommands(name); var strs = GetCommands(name).Select(c => c.Names.Count > 1
foreach (var c in commands) ? $"/{c.Name} (/{string.Join(" /", c.Names.Skip(1))})"
{ : $"/{c.Name}");
for (var i = 0; i < c.Names.Count; i++)
{
c.Names[i] = "/" + c.Names[i];
}
}
var strs =
commands.Select(
c =>
c.Name + (c.Names.Count > 1 ? " ({0})".SFormat(string.Join(" ", c.Names.ToArray(), 1, c.Names.Count - 1)) : ""));
sb.AppendLine($"## {name}"); sb.AppendLine($"## {name}");
sb.AppendLine($"{desc}"); sb.AppendLine($"{desc}");

View file

@ -428,6 +428,8 @@ namespace TShockAPI
Hooks.AccountHooks.AccountDelete += OnAccountDelete; Hooks.AccountHooks.AccountDelete += OnAccountDelete;
Hooks.AccountHooks.AccountCreate += OnAccountCreate; Hooks.AccountHooks.AccountCreate += OnAccountCreate;
On.Terraria.RemoteClient.Reset += RemoteClient_Reset;
GetDataHandlers.InitGetDataHandler(); GetDataHandlers.InitGetDataHandler();
Commands.InitCommands(); Commands.InitCommands();
@ -496,6 +498,12 @@ namespace TShockAPI
} }
} }
private static void RemoteClient_Reset(On.Terraria.RemoteClient.orig_Reset orig, RemoteClient client)
{
client.ClientUUID = null;
orig(client);
}
private static void OnAchievementInitializerLoad(ILContext il) private static void OnAchievementInitializerLoad(ILContext il)
{ {
// Modify AchievementInitializer.Load to remove the Main.netMode == 2 check (occupies the first 4 IL instructions) // Modify AchievementInitializer.Load to remove the Main.netMode == 2 check (occupies the first 4 IL instructions)

View file

@ -18,7 +18,7 @@
Also, be sure to release on github with the exact assembly version tag as below Also, be sure to release on github with the exact assembly version tag as below
so that the update manager works correctly (via the Github releases api and mimic) so that the update manager works correctly (via the Github releases api and mimic)
--> -->
<Version>5.2.0</Version> <Version>5.2.1</Version>
<AssemblyTitle>TShock for Terraria</AssemblyTitle> <AssemblyTitle>TShock for Terraria</AssemblyTitle>
<Company>Pryaxis &amp; TShock Contributors</Company> <Company>Pryaxis &amp; TShock Contributors</Company>
<Product>TShockAPI</Product> <Product>TShockAPI</Product>

View file

@ -29,7 +29,8 @@ namespace TShockAPI
/// </summary> /// </summary>
public class TextLog : ILog, IDisposable public class TextLog : ILog, IDisposable
{ {
private readonly StreamWriter _logWriter; private readonly bool ClearFile;
private StreamWriter _logWriter;
/// <summary> /// <summary>
/// File name of the Text log /// File name of the Text log
@ -44,7 +45,7 @@ namespace TShockAPI
public TextLog(string filename, bool clear) public TextLog(string filename, bool clear)
{ {
FileName = filename; FileName = filename;
_logWriter = new StreamWriter(filename, !clear); ClearFile = clear;
} }
public bool MayWriteType(TraceLevel type) public bool MayWriteType(TraceLevel type)
@ -247,6 +248,10 @@ namespace TShockAPI
{ {
if (!MayWriteType(level)) if (!MayWriteType(level))
return; return;
if (_logWriter is null)
{
_logWriter = new StreamWriter(FileName, !ClearFile);
}
var caller = "TShock"; var caller = "TShock";
@ -277,8 +282,11 @@ namespace TShockAPI
} }
public void Dispose() public void Dispose()
{
if (_logWriter != null)
{ {
_logWriter.Dispose(); _logWriter.Dispose();
} }
} }
} }
}

View file

@ -12,6 +12,6 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="SharpZipLib" Version="1.4.1" /> <PackageReference Include="SharpZipLib" Version="1.4.2" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -7,8 +7,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="NuGet.Packaging" Version="6.3.1" /> <PackageReference Include="NuGet.Packaging" Version="6.3.4" />
<PackageReference Include="NuGet.Protocol" Version="6.3.1" /> <PackageReference Include="NuGet.Protocol" Version="6.3.3" />
<PackageReference Include="NuGet.Resolver" Version="6.3.1" /> <PackageReference Include="NuGet.Resolver" Version="6.3.1" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" /> <PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="System.Reflection.MetadataLoadContext" Version="6.0.0" /> <PackageReference Include="System.Reflection.MetadataLoadContext" Version="6.0.0" />

View file

@ -78,6 +78,11 @@ Use past tense when adding new entries; sign your name off when you add or chang
* If there is no section called "Upcoming changes" below this line, please add one with `## Upcoming changes` as the first line, and then a bulleted item directly after with the first change. --> * If there is no section called "Upcoming changes" below this line, please add one with `## Upcoming changes` as the first line, and then a bulleted item directly after with the first change. -->
## Upcoming changes ## Upcoming changes
* Fixed `/dump-reference-data` mutate the command names. (#2943, @sgkoishi)
* Added `ParryDamageBuff` (Striking Moment with Brand of the Inferno and shield) for player, updated `CursedInferno` buff for NPC (@sgkoishi, #3005)
* Fix typo in config for IP bans. (@redchess64)
## TShock 5.2.1
* Updated `TSPlayer.GodMode`. (@AgaSpace) * Updated `TSPlayer.GodMode`. (@AgaSpace)
* Previously the field was used as some kind of dataset changed by /godmode command, but now it is a property that receives/changes data in journey mode. * Previously the field was used as some kind of dataset changed by /godmode command, but now it is a property that receives/changes data in journey mode.
* Added the `TSPlayer.Client` property. It allows the developer to get the `RemoteClient` player, without an additional call to `Terraria.Netplay.Clients`. (@AgaSpace) * Added the `TSPlayer.Client` property. It allows the developer to get the `RemoteClient` player, without an additional call to `Terraria.Netplay.Clients`. (@AgaSpace)
@ -88,9 +93,9 @@ Use past tense when adding new entries; sign your name off when you add or chang
* Added a method `TSPlayer.UpdateSection` with arguments `rectangle` and `isLoaded`, which will load some area from the server to the player. (@AgaSpace) * Added a method `TSPlayer.UpdateSection` with arguments `rectangle` and `isLoaded`, which will load some area from the server to the player. (@AgaSpace)
* Added a method `TSPlayer.GiveItem`, which has `TShockAPI.NetItem` structure in its arguments. (@AgaSpace) * Added a method `TSPlayer.GiveItem`, which has `TShockAPI.NetItem` structure in its arguments. (@AgaSpace)
* Added a property `TSPlayer.Hostile`, which gets pvp player mode. (@AgaSpace) * Added a property `TSPlayer.Hostile`, which gets pvp player mode. (@AgaSpace)
* Fixed bug where when the `UseSqlLogs` config property is true, an empty log file would still get created. (@ZakFahey)
* Fixed typo in `/gbuff`. (@sgkoishi, #2955) * Fixed typo in `/gbuff`. (@sgkoishi, #2955)
* Rewrote the `.dockerignore` file into a denylist. (@timschumi) * Rewrote the `.dockerignore` file into a denylist. (@timschumi)
* Added `ParryDamageBuff` (Striking Moment with Brand of the Inferno and shield) for player, updated `CursedInferno` buff for NPC (@sgkoishi, #3005)
## TShock 5.2 ## TShock 5.2
* An additional option `pvpwithnoteam` is added at `PvPMode` to enable PVP with no team. (@CelestialAnarchy, #2617, @ATFGK) * An additional option `pvpwithnoteam` is added at `PvPMode` to enable PVP with no team. (@CelestialAnarchy, #2617, @ATFGK)

View file

@ -14,15 +14,15 @@ Open ports can also be passed through using `-p <host_port>:<container_port>`.
For Example: For Example:
```bash ```bash
# Building the image # Building the image using buildx and loading it into docker
docker build -t tshock:linux-amd64 --build-arg TARGETPLATFORM=linux/amd64 . docker buildx build -t tshock:latest --load .
# Running the image # Running the image
docker run -p 7777:7777 -p 7878:7878 \ docker run -p 7777:7777 -p 7878:7878 \
-v /home/cider/tshock/:/tshock \ -v /home/cider/tshock/:/tshock \
-v /home/cider/.local/share/Terraria/Worlds:/worlds \ -v /home/cider/.local/share/Terraria/Worlds:/worlds \
-v /home/cider/tshock/plugins:/plugins \ -v /home/cider/tshock/plugins:/plugins \
--rm -it tshock:linux-amd64 \ --rm -it tshock:latest \
-world /worlds/backflip.wld -motd "OMFG DOCKER" -world /worlds/backflip.wld -motd "OMFG DOCKER"
``` ```
@ -33,7 +33,7 @@ Using `docker buildx`, you could build [multi-platform images](https://docs.dock
For Example: For Example:
```bash ```bash
# Building the image using buildx and loading it into docker # Building the image using buildx and loading it into docker
sudo docker buildx build -t tshock:linux-arm64 --platform linux/arm64 --load . docker buildx build -t tshock:linux-arm64 --platform linux/arm64 --load .
# Running the image # Running the image
docker run -p 7777:7777 -p 7878:7878 \ docker run -p 7777:7777 -p 7878:7878 \