[fixed] Sandbox: Non-Builder classes won't receive Wood and Stone after respawning #2021
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Status
Description
Fixes #1998
Sandbox mode uses script files
CTF_GiveSpawnItems.as
andSandbox_Rules.as
.The former:
But the latter overwrites that so:
Also, because of
void onPlayerChangedTeam(CRules@ this, CPlayer@ player, u8 oldteam, u8 newteam)
inCTF_PickSpawn.as
, the player could receive twice the amount of materials on their first join, both in online and offline. This is related to an old issue which was fixed by adding checkthis.isMatchRunning()
. So it was fixed for all game modes except Sandbox becausethis.isMatchRunning()
is already true.This PR fixes these issues by adding a check
this.gamemode_name != "Sandbox"
toCTF_PickSpawn.as
.After applying this fix, I'm only receiving the regular 500 wood and 250 stone.
Sandbox_Rules.as
now sets materials to 500 wood and 250 stone only for builder and now also sets 30 arrows for archer (so they receive it always in this game mode even if someday the "out of pity" rule inCTF_GiveSpawnItems.as
were to be removed.Archer and Knight no longer receive unwanted wood and stone materials.
Because I ran into unnecessary misunderstandings, I changed wording
// if user is new
and//hard-set the respawn blob
to// for newly joined player, hard-set blob to builder
and placed it above the lines of code so the programmer can easily see what this code section does.Tested in offline and online.
Steps to Test or Reproduce
Join Sandbox.
Receive 1000 wood and 250 stone
After this PR, you receive the normal amount of 500 wood and 250 stone.
Change class to Knight, then die and respawn.
Receive 500 wood and 250 stone.
Be annoyed that you have to spend time opening your inventory and throwing these unwanted materials away.
After this PR, Knight receives nothing. Archer still always receives 30 arrows each respawn.