-
Notifications
You must be signed in to change notification settings - Fork 187
Set spawn command #2374
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
Set spawn command #2374
Conversation
| desiredPos: Vec3d = .{0, 0, 1.7 - standingBoundingBoxExtent[2]}, | ||
| }; | ||
| pub var super: main.server.Entity = .{}; | ||
| pub var playerSpawnPos: Vec3d = .{0, 0, 0}; |
There was a problem hiding this comment.
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
| } | ||
| } | ||
|
|
||
| fn setSpawn(newSpawnPoint: Vec3d) void { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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}, |
There was a problem hiding this comment.
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?
|
oh boy thanks for your review |
|
welp no clue how to do that ima stop working on this |
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]>
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