-
Notifications
You must be signed in to change notification settings - Fork 0
Entities #8
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
Entities #8
Conversation
src/entity.zig
Outdated
| } | ||
|
|
||
| pub fn add(self: *ServerEntityManager, entity: main.server.Entity) u32 { | ||
| const id: u32 = @intCast(self.dense.items.len); |
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.
| const id: u32 = @intCast(self.dense.items.len); | |
| const sparseId: u32 = @intCast(self.sparse.items.len); |
src/entity.zig
Outdated
| // The id can only be at most 1 greater then the length of the sparse list. | ||
| if (id == self.sparse.items.len) { | ||
| self.sparse.append(null); | ||
| } | ||
|
|
||
| self.sparse.items[id] = id; |
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.
| // The id can only be at most 1 greater then the length of the sparse list. | |
| if (id == self.sparse.items.len) { | |
| self.sparse.append(null); | |
| } | |
| self.sparse.items[id] = id; | |
| self.sparse.append(null); |
src/entity.zig
Outdated
| self.dense.append(entity); | ||
| self.dense.items[id].id = id; |
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.
| self.dense.append(entity); | |
| self.dense.items[id].id = id; | |
| const denseId = self.dense.items.len | |
| self.sparse.items[id] = denseId; | |
| self.dense.append(entity); | |
| self.dense.items[denseId].id = sparseId; |
src/entity.zig
Outdated
| self.dense.append(entity); | ||
| self.dense.items[id].id = id; | ||
|
|
||
| return id; |
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.
| return id; | |
| return sparseId; |
src/entity.zig
Outdated
|
|
||
| pub const ServerEntityManager = struct { | ||
| dense: main.List(main.server.Entity), | ||
| sparse: main.List(?u32), |
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.
| sparse: main.List(?u32), | |
| sparse: main.List(?u32), | |
| free: main.ListUnmanaged(u32), |
src/entity.zig
Outdated
| pub fn remove(self: *ServerEntityManager, id: u32) void { | ||
| if (!self.contains(id)) return; | ||
|
|
||
| const index = self.sparse.items[id] orelse return; |
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.
| const index = self.sparse.items[id] orelse return; | |
| const denseId = self.sparse.items[id] orelse return; |
src/entity.zig
Outdated
| return id; | ||
| } | ||
|
|
||
| pub fn remove(self: *ServerEntityManager, id: u32) 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.
| pub fn remove(self: *ServerEntityManager, id: u32) void { | |
| pub fn remove(self: *ServerEntityManager, sparseId: u32) void { |
Some funny stuff with entities
Currently Copper beats iron due to its low swing time. This makes iron more elastic, giving it the same swing time as copper. Both a copper-head and an iron-head pickaxe now have a swing time of 0.12s This makes iron strictly better than copper, reducing it from the best metal in the game to a step in the progression, it's still required to mine iron. However the plan is to give it a come-back in the end game due to its high conductivity.
## Description This pull request adds `/replace` command. The main difference from `/set` with `/mask global` is that mask specified for `/replace` is inlined, local and positive, i.e. only blocks matching the mask specified as part of `/replace` command will be affected. `/replace` ignores global masks. ``` /replace <old> <new> ``` `<old>` - expression following mask syntax (PixelGuys#1284), blocks which match will be affected `<new>` - expression following pattern syntax (PixelGuys#1237) used to fill blocks matched by `<old>` ## Examples `/replace cubyz:air cubyz:void` `/replace $leaf|cubyz:air cubyz:stone,cubyz:grass` ## Links Related to: PixelGuys#1214 Depends on: PixelGuys#1337 Depends on: PixelGuys#1284 --------- Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
Resolves: PixelGuys#1457 --------- Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
… client side (PixelGuys#1475) extracted from PixelGuys#1446
No description provided.