Update /godmode to use JourneyMode Godmode power.
- Previous Bouncer checks for GodMode (namely, Hurt) were removed. - The command now uses the GodmodePower from core Terraria - The toggle powers (which this command will now make use of) are now reset on disconnect to prevent accidentally "gifting" godmode to an unsuspecting player.
This commit is contained in:
parent
173d6f71f5
commit
207b43e772
3 changed files with 24 additions and 10 deletions
|
|
@ -44,6 +44,7 @@ using TShockAPI.Sockets;
|
|||
using TShockAPI.CLI;
|
||||
using TShockAPI.Localization;
|
||||
using TShockAPI.Configuration;
|
||||
using Terraria.GameContent.Creative;
|
||||
|
||||
namespace TShockAPI
|
||||
{
|
||||
|
|
@ -1216,6 +1217,23 @@ namespace TShockAPI
|
|||
|
||||
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.SilentKickInProgress && tsplr.State >= 3)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue