-
Notifications
You must be signed in to change notification settings - Fork 187
Eating is actually doable (no raymarching) #2381
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
base: master
Are you sure you want to change the base?
Conversation
|
Request for label |
IntegratedQuantum
left a comment
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.
As I said in #1939 (comment):
There should be no passive healing, instead healing should require an accessory. So please remove the temporary healing implementation and reimplement it with accessories once we have them.
That PR isnt mine. I dont read review of other peoples PR. |
When implementing a feature it's always a good idea to check if someone else already made a PR, to prevent repeating the same mistakes. |
The PR was also not named after food/eating or something similar |
|
A shame that the regeneration has to be removed, for anyone who wants to add it yourself locally: pub fn regenerateHealth(self: *User) void {
const healthRegenTime = main.timestamp();
if(self.lastHealthRegenTime.durationTo(healthRegenTime).toSeconds() > 5 and self.player.energy > 0 and self.player.health < self.player.maxHealth) {
// give 1 Health every 5 seconds
main.items.Inventory.Sync.addHealth(1, .heal, .server, self.id);
// but take only 1/4 food for it.
main.items.Inventory.Sync.addEnergy(-0.25, .server, self.id);
self.lastHealthRegenTime = healthRegenTime;
}
} |
|
Request for Review |
Request for patience, you are already in my email queue, writing this doesn't make it go any faster. |
|
Ah ok, just thought you might have forgotten that this exist |
| _ = tooltip.swapRemove(tooltip.items.len - 1); | ||
| } | ||
| self.tooltip = tooltip.toOwnedSlice(); | ||
| self.onUse = blk: { |
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.
Callbacks should be registered after everything else, to allow it to reference other items or blocks.
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.
turns out to be more complex then for blocks, since blocks have an array of zon elements, but Item don't.
I only see ugly ways to implement this, like storing the zon in the BaseItem until everything is finished and then parsing the callbacks
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.
did it the ugly way with a finalize() function and storing .zon object
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 like this hack. We shouldn't mix runtime and loadtime data in one struct.
Can you please use the same method as for blocks by aggregating all the item zons in a hashmap?
You can make that assumption if you don't hear from me for a week and I did review newer PRs in that time and it isn't the week before the release. |
|
skipping id 12 and using id 13 instead in sync, because i saw your new PR using 12 now #2415 |
| Sync.ServerSide.executeCommand(.{.addHealth = .{.target = userId, .health = health, .cause = cause}}, null); | ||
| } | ||
| } | ||
| pub fn useItem(source: Command.InventoryAndSlot, side: Side) 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.
Since this function is only used on the client, it should only exist in ClientSide.
| if(stack.amount < 1) | ||
| return .ignored; | ||
|
|
||
| const previous = if(side == .server) user.?.player.energy else main.game.Player.super.energy; |
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 check that user is not null, because in fact in this PR you added code that passes null for this (see comment above)
| } | ||
| } | ||
|
|
||
| pub fn useItem(_: main.Window.Key.Modifiers) bool { |
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 avoid boolean return values or parameters (unless it's immediately obvious from the name what they mean which is not the case here). I'd suggest to just use the callback result.
|
also please rebase after the recent merge of sweet stuff #2417 |
Now you can regenerate Health! 🥳
This follows #965 :
Things I also implemented:
Sped up gif:
