Skip to content

Conversation

@Vinywar123
Copy link
Contributor

Restored From (Link)

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

desiredPos: Vec3d = .{0, 0, 1.7 - standingBoundingBoxExtent[2]},
};
pub var super: main.server.Entity = .{};
pub var playerSpawnPos: Vec3d = .{0, 0, 0};
Copy link
Contributor

Choose a reason for hiding this comment

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

It's better to rename it to spawnPos, player prefix is redundant

@codemob-dev codemob-dev moved this to Low Priority in PRs to review Dec 6, 2025
}
}

fn setSpawn(newSpawnPoint: Vec3d) void {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should synchronize the spawn point with the client. I think the client shouldn't even know the spawn point. Instead I'd prefer if the client gets its respawn point sent by the server together with the kill packet.


pub fn kill() void {
Player.super.pos = world.?.spawn;
Player.super.pos = Player.playerSpawnPos;
Copy link
Member

Choose a reason for hiding this comment

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

Why did you add a second variable to store the spawn point?

Following on my comment above, please remove both of them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

one for the user/server one for the game/client

Copy link
Member

Choose a reason for hiding this comment

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

Is the other one used for anything else?

time = 3,
biome = 4,
particles = 5,
setSpawn = 6,
Copy link
Member

Choose a reason for hiding this comment

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

not needed, see my comment above,

pub const help = @import("help.zig");
pub const invite = @import("invite.zig");
pub const kill = @import("kill.zig");
pub const setSpawn = @import("setSpawn.zig");
Copy link
Member

Choose a reason for hiding this comment

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

Please keep this sorted alphabetically.
Also please call it just spawn it can also serve as a way to query the spawn position.

lastRenderDistance: u16 = 0,
lastPos: Vec3i = @splat(0),
gamemode: std.atomic.Value(main.game.Gamemode) = .init(.creative),
playerSpawnPos: Vec3d = .{0, 0, 0},
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need two separate spawn points?

@IntegratedQuantum IntegratedQuantum moved this from Low Priority to In review in PRs to review Dec 7, 2025
@Vinywar123
Copy link
Contributor Author

oh boy thanks for your review

@Vinywar123
Copy link
Contributor Author

welp no clue how to do that ima stop working on this
if someone else wants to work on this that would be nice

@IntegratedQuantum IntegratedQuantum moved this from In review to WIP/not ready for review in PRs to review Dec 30, 2025
@Argmaster
Copy link
Collaborator

#2447

@Argmaster Argmaster closed this Jan 2, 2026
IntegratedQuantum added a commit that referenced this pull request Jan 12, 2026
Changes to the PR #2374 from @Vinywar123 : 

- renamed setSpawn command to spawn.
- only the server knows the spawn and gives it the player with the kill
sync.
- when the spawn command is run with no parameters the command will
return the spawnpoint.
- renamed the playerSpawnPoint variable to spawnPoint.

---------

Co-authored-by: Vinywar123 <[email protected]>
Co-authored-by: IntegratedQuantum <[email protected]>
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.

4 participants