commit
6f95b684d4
4 changed files with 42 additions and 16 deletions
|
|
@ -16,6 +16,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
|
||||||
* Fixed server crash from `/v2/players/list` & other parameterised REST endpoints. (@QuiCM, reported by @ATFGK)
|
* Fixed server crash from `/v2/players/list` & other parameterised REST endpoints. (@QuiCM, reported by @ATFGK)
|
||||||
* Added handling to the PlayerChat hook event. (@QuiCM - Thanks for the suggestion @Arthri)
|
* Added handling to the PlayerChat hook event. (@QuiCM - Thanks for the suggestion @Arthri)
|
||||||
* Changed the spawnboss command to support silent command specifiers. (@QuiCM, suggested by @nojomyth-dev)
|
* Changed the spawnboss command to support silent command specifiers. (@QuiCM, suggested by @nojomyth-dev)
|
||||||
|
* Updated /godmode to use Journey Mode's Godmode power instead of healing on damage. (requested by @tlworks, backported by @bartico6, implemented preemptive bugfix for creative powers mentioned by @Stealownz)
|
||||||
|
|
||||||
## TShock 4.5.0.1
|
## TShock 4.5.0.1
|
||||||
* Fixed conversion from old to new ban system for MySQL hosted ban databases. (@DeathCradle, @ATFGK)
|
* Fixed conversion from old to new ban system for MySQL hosted ban databases. (@DeathCradle, @ATFGK)
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ using OTAPI.Tile;
|
||||||
using TShockAPI.Localization;
|
using TShockAPI.Localization;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Terraria.DataStructures;
|
using Terraria.DataStructures;
|
||||||
|
using Terraria.GameContent.Creative;
|
||||||
|
|
||||||
namespace TShockAPI
|
namespace TShockAPI
|
||||||
{
|
{
|
||||||
|
|
@ -544,6 +545,11 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
HelpText = "Toggles godmode on a player."
|
HelpText = "Toggles godmode on a player."
|
||||||
});
|
});
|
||||||
|
add(new Command("", ForceUngod, "ungodme")
|
||||||
|
{
|
||||||
|
HelpText = "Removes godmode from your character.",
|
||||||
|
AllowServer = false
|
||||||
|
});
|
||||||
add(new Command(Permissions.heal, Heal, "heal")
|
add(new Command(Permissions.heal, Heal, "heal")
|
||||||
{
|
{
|
||||||
HelpText = "Heals a player in HP and MP."
|
HelpText = "Heals a player in HP and MP."
|
||||||
|
|
@ -6445,15 +6451,26 @@ namespace TShockAPI
|
||||||
|
|
||||||
playerToGod.GodMode = !playerToGod.GodMode;
|
playerToGod.GodMode = !playerToGod.GodMode;
|
||||||
|
|
||||||
if (playerToGod == args.Player)
|
var godPower = CreativePowerManager.Instance.GetPower<CreativePowers.GodmodePower>();
|
||||||
{
|
|
||||||
args.Player.SendSuccessMessage(string.Format("You are {0} in god mode.", args.Player.GodMode ? "now" : "no longer"));
|
godPower.SetEnabledState(playerToGod.Index, playerToGod.GodMode);
|
||||||
}
|
|
||||||
else
|
if (playerToGod != args.Player)
|
||||||
{
|
{
|
||||||
args.Player.SendSuccessMessage(string.Format("{0} is {1} in god mode.", playerToGod.Name, playerToGod.GodMode ? "now" : "no longer"));
|
args.Player.SendSuccessMessage(string.Format("{0} is {1} in god mode.", playerToGod.Name, playerToGod.GodMode ? "now" : "no longer"));
|
||||||
playerToGod.SendSuccessMessage(string.Format("You are {0} in god mode.", playerToGod.GodMode ? "now" : "no longer"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
playerToGod.SendSuccessMessage(string.Format("You are {0} in god mode.", args.Player.GodMode ? "now" : "no longer"));
|
||||||
|
playerToGod.SendInfoMessage("Please make sure to disable godmode using /ungodme before disconnecting, otherwise your character may remain in godmode indefinitely, including singleplayer.");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ForceUngod(CommandArgs args)
|
||||||
|
{
|
||||||
|
var godPower = CreativePowerManager.Instance.GetPower<CreativePowers.GodmodePower>();
|
||||||
|
|
||||||
|
godPower.SetEnabledState(args.Player.Index, false);
|
||||||
|
|
||||||
|
args.Player.SendSuccessMessage("Journey Godmode has been disabled on your character.");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Cheat Comamnds
|
#endregion Cheat Comamnds
|
||||||
|
|
|
||||||
|
|
@ -2571,10 +2571,6 @@ namespace TShockAPI
|
||||||
args.Player.PlayerData.maxHealth = max;
|
args.Player.PlayerData.maxHealth = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.Player.GodMode && (cur < max))
|
|
||||||
{
|
|
||||||
args.Player.Heal(args.TPlayer.statLifeMax2);
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3733,12 +3729,6 @@ namespace TShockAPI
|
||||||
if (OnPlayerDamage(args.Player, args.Data, id, direction, dmg, pvp, crit, playerDeathReason))
|
if (OnPlayerDamage(args.Player, args.Data, id, direction, dmg, pvp, crit, playerDeathReason))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (TShock.Players[id].GodMode)
|
|
||||||
{
|
|
||||||
TShock.Log.ConsoleDebug("GetDataHandlers / HandlePlayerDamageV2 rejected (god mode on) {0}", args.Player.Name);
|
|
||||||
TShock.Players[id].Heal(args.TPlayer.statLifeMax);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ using TShockAPI.Sockets;
|
||||||
using TShockAPI.CLI;
|
using TShockAPI.CLI;
|
||||||
using TShockAPI.Localization;
|
using TShockAPI.Localization;
|
||||||
using TShockAPI.Configuration;
|
using TShockAPI.Configuration;
|
||||||
|
using Terraria.GameContent.Creative;
|
||||||
|
|
||||||
namespace TShockAPI
|
namespace TShockAPI
|
||||||
{
|
{
|
||||||
|
|
@ -1216,6 +1217,23 @@ namespace TShockAPI
|
||||||
|
|
||||||
Players[args.Who] = null;
|
Players[args.Who] = null;
|
||||||
|
|
||||||
|
//Reset toggle creative powers to default, preventing potential power transfer & desync on another user occupying this slot later.
|
||||||
|
|
||||||
|
foreach(var kv in CreativePowerManager.Instance._powersById)
|
||||||
|
{
|
||||||
|
var power = kv.Value;
|
||||||
|
|
||||||
|
//No need to reset sliders - those are reset manually by the game, most likely an oversight that toggles don't receive this treatment.
|
||||||
|
|
||||||
|
if (power is CreativePowers.APerPlayerTogglePower toggle)
|
||||||
|
{
|
||||||
|
if (toggle._perPlayerIsEnabled[args.Who] == toggle._defaultToggleState)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
toggle.SetEnabledState(args.Who, toggle._defaultToggleState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (tsplr.ReceivedInfo)
|
if (tsplr.ReceivedInfo)
|
||||||
{
|
{
|
||||||
if (!tsplr.SilentKickInProgress && tsplr.State >= 3)
|
if (!tsplr.SilentKickInProgress && tsplr.State >= 3)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue