Skip to content

Commit

Permalink
Merge branch 'general-devel' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
hakusaro authored Jan 25, 2025
2 parents 1948ad3 + 7e9b97b commit 8f5a810
Show file tree
Hide file tree
Showing 26 changed files with 1,679 additions and 902 deletions.
33 changes: 19 additions & 14 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
# ignore every file
*
# Ignore all Git metadata and build output (in all directories).
**/.git*
**/bin/
**/obj/

# except for the ones required for building
!i18n/
!prebuilts/
!TerrariaServerAPI/
!TShockAPI/
!TShockLauncher/
!TShockLauncher.Tests/
!TShock.sln

# but exclude build artifacts
*/bin/
*/obj/
# Ignore other specific files that aren't needed for the build itself.
/.all-contributorsrc
/.dockerignore
/.editorconfig
/.vscode
/appveyor.yml
/COPYING
/crowdin.yml
/Dockerfile
/docs
/README.md
/README_cn.md
/renovate.json
/scripts
/SECURITY.md
4 changes: 3 additions & 1 deletion .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
> By participating in the TShock for Terraria community, all members will adhere to maintaining decorum with respect to all humans, in and out of the community. Members will not engage in discussion that inappropriately disparages or marginalizes any group of people or any individual. Members will not attempt to further or advance an agenda to the point of being overbearing or close minded (such as through spreading FUD). Members will not abuse services provided to them and will follow the guidance of community leaders on a situational basis about what abuse consists of. Members will adhere to United States and international law. If members notice a violation of this code of conduct, they will not engage but will instead contact the leadership team on either the forums or Discord.
> Do not attempt to circumvent or bypass the code of conduct by using clever logic or reasoning (e.g., insulting Facepunch members, because they weren't directly mentioned here).
> Do not attempt to circumvent or bypass the code of conduct by using clever logic or reasoning (e.g., insulting Facepunch members, because they weren't directly mentioned here).
> Do not abuse GitHub services by generating useless emails to all people who watch the repo. This includes unnecessary PR approvals and off-topic discussion, issue, and PR comments that serve no purpose. Due to the high visibility nature of actions that create emails, you may be blocked temporarily as your first warning.
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]
60 changes: 60 additions & 0 deletions .github/workflows/ci-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CI (Docker image)

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
permissions:
attestations: write
id-token: write
packages: write
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: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate version information
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag,enable=${{ !startsWith(github.ref, 'refs/tags/v') }}
type=ref,event=pr
type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
type=semver,pattern={{major}}.{{minor}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
type=semver,pattern={{major}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
flavor: |
latest=${{ startsWith(github.ref, 'refs/tags/v') }}
- name: Build image
id: build
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7,windows/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
pull: true
cache-from: type=gha, scope=${{ github.workflow }}
cache-to: type=gha, scope=${{ github.workflow }}
- name: Generate build provenance attestation
if: ${{ github.event_name != 'pull_request' }}
uses: actions/attest-build-provenance@v2
with:
subject-name: ghcr.io/${{ github.repository }}
subject-digest: ${{ steps.build.outputs.digest }}
push-to-registry: true
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
7 changes: 5 additions & 2 deletions TShockAPI/Bouncer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2659,9 +2659,12 @@ internal void OnPlayerDamage(object sender, GetDataHandlers.PlayerDamageEventArg
* If the player was not specified, that is, the player index is -1, then it is definitely a custom cause, as you can only deal damage with a projectile or another player.
* This is how everything else works. If an NPC is specified, its value is not -1, which is a custom cause.
*
* An exception to this is damage dealt by the Inferno potion to other players -- it is only identified by the other index value of 16,
* even lacking a source player index.
*
* Checking whether this damage came from the player is necessary, because the damage from the player can come even when it is hit by a NPC
*/
if (TShock.Config.Settings.DisableCustomDeathMessages && id != args.Player.Index &&
if (TShock.Config.Settings.DisableCustomDeathMessages && id != args.Player.Index && reason._sourceOtherIndex != 16 &&
(reason._sourcePlayerIndex == -1 || reason._sourceNPCIndex != -1 || reason._sourceOtherIndex != -1 || reason._sourceCustomReason != null))
{
TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerDamage rejected custom death message from {0}", args.Player.Name));
Expand Down Expand Up @@ -2851,7 +2854,7 @@ internal static int GetMaxPlaceStyle(int tileID)
{ BuffID.Poisoned, 3600 }, // BuffID: 20
{ BuffID.OnFire, 1200 }, // BuffID: 24
{ BuffID.Confused, short.MaxValue }, // BuffID: 31 Brain of Confusion Internal Item ID: 3223
{ BuffID.CursedInferno, 420 }, // BuffID: 39
{ BuffID.CursedInferno, 600 }, // BuffID: 39
{ BuffID.Frostburn, 900 }, // BuffID: 44
{ BuffID.Ichor, 1200 }, // BuffID: 69
{ BuffID.Venom, 1800 }, // BuffID: 70
Expand Down
6 changes: 1 addition & 5 deletions TShockAPI/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6462,7 +6462,7 @@ private static void GBuff(CommandArgs args)
if (target == user)
user.SendSuccessMessage(GetString($"You buffed yourself with {TShock.Utils.GetBuffName(id)} ({TShock.Utils.GetBuffDescription(id)}) for {time} seconds."));
else
target.SendSuccessMessage(GetString($"You have buffed {user.Name} with {TShock.Utils.GetBuffName(id)} ({TShock.Utils.GetBuffDescription(id)}) for {time} seconds!"));
user.SendSuccessMessage(GetString($"You have buffed {target.Name} with {TShock.Utils.GetBuffName(id)} ({TShock.Utils.GetBuffDescription(id)}) for {time} seconds!"));
if (!args.Silent && target != user)
target.SendSuccessMessage(GetString($"{user.Name} has buffed you with {TShock.Utils.GetBuffName(id)} ({TShock.Utils.GetBuffDescription(id)}) for {time} seconds!"));
}
Expand Down Expand Up @@ -6740,10 +6740,6 @@ private static void ToggleGodMode(CommandArgs args)

playerToGod.GodMode = !playerToGod.GodMode;

var godPower = CreativePowerManager.Instance.GetPower<CreativePowers.GodmodePower>();

godPower.SetEnabledState(playerToGod.Index, playerToGod.GodMode);

if (playerToGod != args.Player)
{
args.Player.SendSuccessMessage(playerToGod.GodMode
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
3 changes: 3 additions & 0 deletions TShockAPI/DB/CharacterManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ public bool InsertPlayerData(TSPlayer player, bool fromCommand = false)
if (!player.IsLoggedIn)
return false;

if (player.State < 10)
return false;

if (player.HasPermission(Permissions.bypassssc) && !fromCommand)
{
TShock.Log.ConsoleInfo(GetParticularString("{0} is a player name", $"Skipping SSC save (due to tshock.ignore.ssc) for {player.Account.Name}"));
Expand Down
Loading

0 comments on commit 8f5a810

Please sign in to comment.