Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fixed] Sandbox: Non-Builder classes won't receive Wood and Stone after respawning #2021

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Rules/CTF/Scripts/CTF_PickSpawn.as
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void onTick(CRules@ this)
//hook after the change has been decided
void onPlayerChangedTeam(CRules@ this, CPlayer@ player, u8 oldteam, u8 newteam)
{
if (player !is null && player.isMyPlayer() && this.isMatchRunning())
if (player !is null && player.isMyPlayer() && this.isMatchRunning() && this.gamemode_name != "Sandbox")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it not be better to just remove CTF_PickSpawn from sandbox.cfg?

{
SHOW_MENU = true;
RESPAWNS_COUNT = -1;
Expand Down
17 changes: 13 additions & 4 deletions Rules/Sandbox/Scripts/Sandbox_Rules.as
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,12 @@ shared class SandboxSpawns : RespawnSystem
blob.server_Die();
}

if (p_info.blob_name == "") // if user is new
// for newly joined player, hard-set blob to builder
if (p_info.blob_name == "")
{
p_info.blob_name = "builder"; //hard-set the respawn blob
p_info.blob_name = "builder";
}

CBlob@ playerBlob = SpawnPlayerIntoWorld(getSpawnLocation(p_info), p_info);

if (playerBlob !is null)
Expand All @@ -175,8 +177,15 @@ shared class SandboxSpawns : RespawnSystem
RemovePlayerFromSpawn(player);

// spawn resources
SetMaterials(playerBlob, "mat_wood", 500);
SetMaterials(playerBlob, "mat_stone", 250);
if (p_info.blob_name == "builder")
{
SetMaterials(playerBlob, "mat_wood", 500);
SetMaterials(playerBlob, "mat_stone", 250);
}
else if (p_info.blob_name == "archer")
{
SetMaterials(playerBlob, "mat_arrows", 30);
}
}
}
}
Expand Down