tModLoader Reset Mode - Cycle worlds one after the other

hamstar

Terrarian


Note: Requires Mod Helpers and Time Limit. Made to also make use of Rewards (optional).


For having met my first patreon goal, here's a mod request I've implemented based on this idea. In a nutshell, once the mode is activated, a timer is set for the current world, causing it to auto-exit and become unplayable thereafter. Once a new world is loaded, all players that join it will be reset (all items, max life, max mana, etc. set to starting amounts). The only recourse for preserving player progress between resets is by way of accrued Progress Points (via. Rewards mod).


Source code now available. API now available (now featuring Mod.Call() bindings).


Installation

Requires tModLoader (+0.11). Copy the above .tmod file to your 'Documents/My Games/Terraria/ModLoader/Mods' folder to play.


ResetMode.png

 
Last edited:
v1.2.1
  • Updated for TML11.5
  • Added ranges for some config settings
v1.2.0
  • Updated to TML11.4 and MH5b
  • Adjusted configs to use non-interface references (improves compatibility?)
  • Replaced uses of ConcurrentDictionary settings in configs with locks
v1.1.4.5
  • Added safety checks against bad local player references
v1.1.4.4
  • Updated for MH v4.2.4.1 fixes
v1.1.4.3
  • Fixed PlayerEjectProtocol
  • Added further debug outputs (e.g. player sync fails)
  • Restructured some ResetModePlayer code
v1.1.4.2
  • Added log alerts for invalid session state
  • Cleaned up some snake case stragglers
  • Changed WorldHelpers.GetUniqueIdWithSeed occurrences to GetUniqueId
  • Improved invalid state debug output
v1.1.4.1
  • Futher tweaked Mod.Call to be less persnickety
v1.1.4
  • Updated to MH v4.2
  • Changed snake case to camel case
  • Refactored away references to the current mod via parameter passing (now uses static instance)
  • Improved error reporting
  • Modified net protocols to use newer standard
  • Updated config to MH v4.2 standard
  • Fixed multiplayer reset stasis fail (sync wasnt completing?!)
  • Added better real-time debug info output

v1.1.3.5
  • Updated for MHv4
v1.1.3.3
  • Set player validation checks to eject player via. signal
  • Added session syncing to client after validation
  • Added update method FPS throttling
  • Added WorldInPlay Promise wrappers to player init stuff
  • Changed player connect code with a convention tweak
  • More fixes for net code issues (knock on wood!)
  • Refactored player sync stuff
v1.1.2
  • Update to Mod Helpers v2.0.2
  • Altered chat commands for readability
  • Added 'WrongWorldForcesHardReset' config option
  • Skimmed non-local player data from session data for syncing
v1.1.1.16
  • Minor internal cleanup
  • Triggered session data to save upon world save
  • Added yet more debug messages
v1.1.1.12
  • Reduced debug message spam output a bit
  • Added slight improvement to debug outputs (e.g. PP spendings)
  • Added periodic debug output
v1.1.1.10
  • Added a very specific failsafe on mod load
  • Corrected exit type (good vs bad) on world expire from a previously-played world vs an unplayed world
  • Synced session data with clients on world expire in MP
  • Added failsafe against saving and loading as a client
  • Added a measure to set Rewards PP refunds between resets to be performed only once
v1.1.1.7
  • Removed redundant inbox messages
  • Set player validations to persist
  • Removed some debug scaffolding
  • Improved error messages
  • Fixed incorrect world exits (plz!)
  • Added debugging aids
v1.1.1.5
  • Set console commands to work as chat commands via the new MH v1.6.6 privileged user
v1.1.1.4
  • Set existing stray reset timers to auto remove
  • Added some safety measures to session logic background Update() code
  • Added more failsafes against invalid global state (e.g. SessionLogic.IsWorldInPlay)
  • Refactored session logic layout internally
v1.1.1.3
  • Fixed an issue causing worlds to re-engage when expired
  • Restructured Mod class internally
v1.1.1.2
  • Restructured game mode loading into SessionLogic
  • Ensured players exit non-active worlds
  • Improved error reporting for world session start
  • Made game state checks more explicit
v1.1.1.1
  • Removed failsafe timer
v1.1.1
  • Deferred player validation on server until at least after world safely loaded
  • Remove net code for rewards purchases; handled with Rewards mod, now
  • Transferred world data to session data, but preserved a wrapper for migration convenience
  • Consolidated ResetModeWorldData wrapper into SessionLogic
  • Assorted refactoring
v1.1.0.6
  • Fixed (hopefully) Wing Slot compatibility
  • Fixed SP redundant timer issue
v1.1.0.5
  • Added timeout failsafe against players who haven't validated their player (failure to sync RM data)
  • Minor internal restructuring
v1.1.0.4
  • Restructured to debug error with Wing Slot mod resets
v1.1.0.3
  • Added Wing Mod compatibility
v1.1.0.2
  • Fixed console commands
  • Updated for Mod Helpers v1.6.3
v1.1.0.1
  • Migrated Hamstar Helpers to Mod Helpers
  • Migrated to C# 6
  • Fixed issue with UI loading
v1.1.0
  • Extensive restructuring and refactoring
  • Set world state to update reactively
  • Set player validation to occur reactively to world and session state
  • Fixed session saving for single player
  • Set world data to be its own discrete data class
  • Added config options for resetting Rewards spendings (refunded) and player kills
  • Fixed autostart (knock on wood)
  • Changed Rewards PP full resets into spendings refunds
  • Fixed world deletions from DeleteAllWorldsBetweenGames setting
v1.0.8.2
  • Fixed (hopefully) Rewards mod API interaction
  • Ensured client awareness of world status on join
v1.0.8
  • Added syncing for clients from server for session data
  • Changed world data file name to newer standard
  • Refactored player loading (hopefully avoids errors)
v1.0.7.2
  • Reimplemented per-session Rewards PP tracking
  • Migrated incorrect per-world PP resetting to per-session system
v1.0.6.1
  • Added reconstitution of player PP on reset (untested)
v1.0.5.1
  • Fixed multiplayer disarming fail (see HH update)
v1.0.5
  • Added OnWorldEngagedCalls to specify a set of Mod.Call() invocations to make when a world is engaged in reset mode. Ex:
    [{"MyModName":["List", "of", "params"]}, {...}]
  • Refactored session save and load to use Mod Specific Data/Reset Mode folder
v1.0.4.2
  • Minor internal refactoring
  • Updated for newer Hamstar's Helpers (v1.4.5)
  • Changed welcome message to inbox message
v1.0.4.1
  • Added config setting 'ResetAllWorldsOnLoad' - Deletes ALL worlds (use with caution!)
  • Refactored some internal code
  • Refactored net protocol layout
v1.0.3.1
  • Added 'AutoStart' config option
v1.0.2.1
  • First public release.
 

Attachments

  • ResetMode v1.0.2.1.zip
    44.3 KB · Views: 196
  • ResetMode v1.0.3.1.zip
    44.7 KB · Views: 190
  • ResetMode v1.0.4.1.zip
    46.3 KB · Views: 230
  • ResetMode v1.0.4.2.zip
    47.1 KB · Views: 199
  • ResetMode v1.0.5.zip
    47.9 KB · Views: 217
  • ResetMode v1.0.5.1.zip
    48 KB · Views: 214
  • ResetMode v1.0.6.1.zip
    50.2 KB · Views: 205
  • ResetMode v1.0.7.2.zip
    51.5 KB · Views: 221
  • ResetMode v1.0.8.zip
    53.1 KB · Views: 226
  • ResetMode v1.0.8.2.zip
    53.7 KB · Views: 211
  • ResetMode v1.1.0.zip
    55.7 KB · Views: 193
  • ResetMode v1.1.0.1.zip
    52.3 KB · Views: 197
  • ResetMode v1.1.0.2.zip
    52.1 KB · Views: 183
  • ResetMode v1.1.0.3.zip
    52.5 KB · Views: 196
  • ResetMode v1.1.0.4.zip
    53.5 KB · Views: 170
  • ResetMode v1.1.0.5.zip
    54.5 KB · Views: 173
  • ResetMode v1.1.0.6.zip
    53.3 KB · Views: 193
  • ResetMode v1.1.1.zip
    50.2 KB · Views: 198
  • ResetMode v1.1.1.1.zip
    49.4 KB · Views: 194
  • ResetMode v1.1.1.2.zip
    50.2 KB · Views: 186
  • ResetMode v1.1.1.3.zip
    50.1 KB · Views: 191
  • ResetMode v1.1.1.4.zip
    50.8 KB · Views: 197
  • ResetMode v1.1.1.5.zip
    51.2 KB · Views: 191
  • ResetMode v1.1.1.6.zip
    52.2 KB · Views: 183
  • ResetMode v1.1.1.7.zip
    52 KB · Views: 186
  • ResetMode v1.1.1.10.zip
    52.4 KB · Views: 194
  • ResetMode v1.1.1.12.zip
    53.1 KB · Views: 236
  • ResetMode v1.1.1.16.zip
    54.4 KB · Views: 176
  • ResetMode v1.1.2.zip
    34.8 KB · Views: 183
  • ResetMode v1.1.3.3.zip
    78.7 KB · Views: 166
  • ResetMode v1.1.3.4.zip
    39.7 KB · Views: 192
  • ResetMode v1.1.3.5.zip
    38.7 KB · Views: 174
  • ResetMode v1.1.4.zip
    34.7 KB · Views: 176
  • ResetMode v1.1.4.1.zip
    35.2 KB · Views: 157
  • ResetMode v1.1.4.2.zip
    36.1 KB · Views: 179
  • ResetMode v1.1.4.3.zip
    38.6 KB · Views: 161
  • ResetMode v1.1.4.4.zip
    36.7 KB · Views: 165
  • ResetMode v1.1.4.5.zip
    38.7 KB · Views: 169
  • ResetMode v1.2.0.zip
    85 KB · Views: 135
  • ResetMode v1.2.0.zip
    85 KB · Views: 146
  • ResetMode v1.2.1.zip
    85.3 KB · Views: 232
Last edited:
I actually have a question... i started a run, which i aborted midways. planned on starting a new one, deleted the old world, created a new character, and created a new world (with start with base mod active, same as the world before). the moment i enter the world, the message "World not valid for Reset Mode. Exiting..." pops up and drops me. i had the option "AutoStartSession" on true for a little bit aswell, but deactivated it and created another world after that.

any solution to fix that?

Edit: apparently it resolved itself after some meddling around and using another character (which didnt work before oddly enough)
 
I actually have a question... i started a run, which i aborted midways. planned on starting a new one, deleted the old world, created a new character, and created a new world (with start with base mod active, same as the world before). the moment i enter the world, the message "World not valid for Reset Mode. Exiting..." pops up and drops me. i had the option "AutoStartSession" on true for a little bit aswell, but deactivated it and created another world after that.

any solution to fix that?

Edit: apparently it resolved itself after some meddling around and using another character (which didnt work before oddly enough)
This mod's determined to be buggy, despite a lot of effort on my part. I think a big part of that is the player id issue I recently found an alternative to, which I'll attempt to implement. Player progress might get lost, though.
 
Last edited:
Back
Top Bottom