Skip to content

Conversation

@Vinywar123
Copy link
Contributor

@Vinywar123 Vinywar123 commented Nov 14, 2025

This request will add a command that allows players to set their spawnpoint when they die.
This spawnpoint is saved in the players folder allong with the other player data.

If hooked up properly it can also later be used to make blocks that allow players to set their spawnpoint.

it updates the server, game, network, world, and Inventory.zig
also the commands folder for the set spawn command.

This is mostly for under the hood improvements to add blocks that can Set Spawn

  • The Spawnpoitns are saved in the player files in the world along with the other playerdata
  • Spawnpoint is saved, changed, and set even across different worlds and sessions

Go to (link) Instead this is depreciated

y = std.math.clamp(y.?, -1e9, 1e9);
z = std.math.clamp(z.?, -1e9, 1e9);

main.items.Inventory.Sync.setSpawn(source, .{x.?, y.?, z.?});
Copy link
Contributor

Choose a reason for hiding this comment

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

You shouldn't send spawn points through the inventory system. A simple call to main.network.Protocols.genericUpdate.sendSpawnPoint should be good enough. The Inventory.Sync system should only be used for things that need to be synchronized.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh ok i was copy and pasting a lot of code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

well since it changes the players spawn point on the cleint side and user it does need to be synced
clientside so when the player dies its in the correct spot
and serverside so when the client disconnects their spawnpoint is saved

Copy link
Contributor

Choose a reason for hiding this comment

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

Check how the tp command is done, it deosn't go through the Inventory system but instead through network.zig

Copy link
Contributor Author

@Vinywar123 Vinywar123 Dec 5, 2025

Choose a reason for hiding this comment

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

it functions more similar to the gamemode command since it has to save data when the player leaves the game
therefore it does need to be run through inventory

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok i will check it but i have moved it into a generic update

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will check to make sure it still functions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope it does not either save properly anymore or load properly anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think loading is broken now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah whatever i willl just revert it

@Vinywar123
Copy link
Contributor Author

did not have a chance to test it with multiplayer yet either though

@Vinywar123 Vinywar123 marked this pull request as draft November 14, 2025 02:56
updates the inventory, network, and game
this will now sync and load from the world where its players are
@Vinywar123 Vinywar123 marked this pull request as ready for review November 16, 2025 18:12
@Vinywar123 Vinywar123 marked this pull request as draft November 16, 2025 18:30
@Vinywar123 Vinywar123 marked this pull request as ready for review November 16, 2025 19:07
@Vinywar123
Copy link
Contributor Author

it should be finished now

@Vinywar123
Copy link
Contributor Author

Updated to the main branch rechecked and it still works

@Vinywar123 Vinywar123 marked this pull request as draft December 5, 2025 06:31
@Vinywar123
Copy link
Contributor Author

eh damnit i ruined it

@Vinywar123 Vinywar123 closed this Dec 5, 2025
@Vinywar123
Copy link
Contributor Author

ill open a new one i saved a copy of the right version

@Vinywar123 Vinywar123 deleted the SetSpawnCommand branch December 5, 2025 06:34
@Vinywar123 Vinywar123 restored the SetSpawnCommand branch December 5, 2025 06:34
@Vinywar123 Vinywar123 deleted the SetSpawnCommand branch December 5, 2025 06:34
@Vinywar123 Vinywar123 mentioned this pull request Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants