Skip to content

Commit

Permalink
Merge branch 'general-devel' into pr3005
Browse files Browse the repository at this point in the history
  • Loading branch information
hakusaro authored Jan 25, 2025
2 parents dbca317 + b4968ad commit b9d9848
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# These are supported funding model platforms
github: [SignatureBeef, hakusaro, Stealownz, QuiCM]
github: [SignatureBeef, QuiCM]
25 changes: 25 additions & 0 deletions .github/workflows/ci-docker.yml
Original file line number Diff line number Diff line change
@@ -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 }}
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
ARG TARGETPLATFORM=linux/amd64
ARG BUILDPLATFORM=${TARGETPLATFORM}
# TARGETPLATFORM and BUILDPLATFORM are automatically filled in by Docker buildx.
# They should not be set in the global scope manually.

FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:6.0 AS builder

ARG TARGETPLATFORM

# Copy build context
WORKDIR /TShock
COPY . ./

# Build and package release based on target architecture
RUN dotnet build -v m
WORKDIR /TShock/TShockLauncher

# Make TARGETPLATFORM available to the container.
ARG TARGETPLATFORM

RUN \
case "${TARGETPLATFORM}" in \
"linux/amd64") export ARCH="linux-x64" \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<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">
<img src="https://ci.appveyor.com/api/projects/status/chhe61q227lqdlg1?svg=true" alt="AppVeyor Build Status">
</a>
Expand Down
2 changes: 1 addition & 1 deletion README_cn.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<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">
<img src="https://ci.appveyor.com/api/projects/status/chhe61q227lqdlg1?svg=true" alt="AppVeyor Build Status">
</a>
Expand Down
4 changes: 2 additions & 2 deletions TShockAPI/Configuration/TShockConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@ public class TShockSettings
[Description("The reason given if banning a mediumcore player on death.")]
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>
[Description("Disbales IP bans by default, if no arguments are passed to the ban command.")]
/// <summary>Disables IP bans by default, if no arguments are passed to the ban command.</summary>
[Description("Disables IP bans by default, if no arguments are passed to the ban command.")]
public bool DisableDefaultIPBan;

/// <summary>Enable or disable the whitelist based on IP addresses in the whitelist.txt file.</summary>
Expand Down
15 changes: 3 additions & 12 deletions TShockAPI/Permissions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -529,18 +529,9 @@ public static void DumpDescriptions()
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 commands = GetCommands(name);
foreach (var c in commands)
{
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)) : ""));
var strs = GetCommands(name).Select(c => c.Names.Count > 1
? $"/{c.Name} (/{string.Join(" /", c.Names.Skip(1))})"
: $"/{c.Name}");

sb.AppendLine($"## {name}");
sb.AppendLine($"{desc}");
Expand Down
8 changes: 8 additions & 0 deletions TShockAPI/TShock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,8 @@ public override void Initialize()
Hooks.AccountHooks.AccountDelete += OnAccountDelete;
Hooks.AccountHooks.AccountCreate += OnAccountCreate;

On.Terraria.RemoteClient.Reset += RemoteClient_Reset;

GetDataHandlers.InitGetDataHandler();
Commands.InitCommands();

Expand Down Expand Up @@ -496,6 +498,12 @@ void SafeError(string message)
}
}

private static void RemoteClient_Reset(On.Terraria.RemoteClient.orig_Reset orig, RemoteClient client)
{
client.ClientUUID = null;
orig(client);
}

private static void OnAchievementInitializerLoad(ILContext il)
{
// Modify AchievementInitializer.Load to remove the Main.netMode == 2 check (occupies the first 4 IL instructions)
Expand Down
2 changes: 1 addition & 1 deletion TShockAPI/TShockAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
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)
-->
<Version>5.2.0</Version>
<Version>5.2.1</Version>
<AssemblyTitle>TShock for Terraria</AssemblyTitle>
<Company>Pryaxis &amp; TShock Contributors</Company>
<Product>TShockAPI</Product>
Expand Down
14 changes: 11 additions & 3 deletions TShockAPI/TextLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ namespace TShockAPI
/// </summary>
public class TextLog : ILog, IDisposable
{
private readonly StreamWriter _logWriter;
private readonly bool ClearFile;
private StreamWriter _logWriter;

/// <summary>
/// File name of the Text log
Expand All @@ -44,7 +45,7 @@ public class TextLog : ILog, IDisposable
public TextLog(string filename, bool clear)
{
FileName = filename;
_logWriter = new StreamWriter(filename, !clear);
ClearFile = clear;
}

public bool MayWriteType(TraceLevel type)
Expand Down Expand Up @@ -247,6 +248,10 @@ public void Write(string message, TraceLevel level)
{
if (!MayWriteType(level))
return;
if (_logWriter is null)
{
_logWriter = new StreamWriter(FileName, !ClearFile);
}

var caller = "TShock";

Expand Down Expand Up @@ -278,7 +283,10 @@ public void Write(string message, TraceLevel level)

public void Dispose()
{
_logWriter.Dispose();
if (_logWriter != null)
{
_logWriter.Dispose();
}
}
}
}
2 changes: 1 addition & 1 deletion TShockInstaller/TShockInstaller.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SharpZipLib" Version="1.4.1" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions TShockPluginManager/TShockPluginManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NuGet.Packaging" Version="6.3.1" />
<PackageReference Include="NuGet.Protocol" Version="6.3.1" />
<PackageReference Include="NuGet.Packaging" Version="6.3.4" />
<PackageReference Include="NuGet.Protocol" Version="6.3.3" />
<PackageReference Include="NuGet.Resolver" Version="6.3.1" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="System.Reflection.MetadataLoadContext" Version="6.0.0" />
Expand Down
7 changes: 6 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. -->

## 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)
* 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)
Expand All @@ -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.GiveItem`, which has `TShockAPI.NetItem` structure in its arguments. (@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)
* 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
* An additional option `pvpwithnoteam` is added at `PvPMode` to enable PVP with no team. (@CelestialAnarchy, #2617, @ATFGK)
Expand Down
8 changes: 4 additions & 4 deletions docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ Open ports can also be passed through using `-p <host_port>:<container_port>`.

For Example:
```bash
# Building the image
docker build -t tshock:linux-amd64 --build-arg TARGETPLATFORM=linux/amd64 .
# Building the image using buildx and loading it into docker
docker buildx build -t tshock:latest --load .

# Running the image
docker run -p 7777:7777 -p 7878:7878 \
-v /home/cider/tshock/:/tshock \
-v /home/cider/.local/share/Terraria/Worlds:/worlds \
-v /home/cider/tshock/plugins:/plugins \
--rm -it tshock:linux-amd64 \
--rm -it tshock:latest \
-world /worlds/backflip.wld -motd "OMFG DOCKER"
```

Expand All @@ -33,7 +33,7 @@ Using `docker buildx`, you could build [multi-platform images](https://docs.dock
For Example:
```bash
# 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
docker run -p 7777:7777 -p 7878:7878 \
Expand Down

0 comments on commit b9d9848

Please sign in to comment.