Add magma block damage #1952

Closed
GuyLiner wants to merge 11 commits from GuyLiner/MineClone2:magma into master
Contributor

This PR fixes #630

In minecraft mobs are damaged when they step on magma blocks, as you probably already know. This adds that functionality, however this is nowhere near being finished.

My main point in putting in this PR is to see if I'm on the right track or if this implementation is not sound. I also added some comments along the way as I was learning my way around the code.

I created a new timer called damage_timer and another function called node_hurt. When a mob steps on the block, it gets hurt. In minecraft when mobs are on magma blocks they don't try to move, so nothing AI wise has to be coded there.

Certain mobs are also not affected by this damage, which wouldn't be too hard to add either.

If I get the go ahead, I'd like to add cacti, and enderman water damage as well.

This PR fixes #630 In minecraft mobs are damaged when they step on magma blocks, as you probably already know. This adds that functionality, however this is nowhere near being finished. My main point in putting in this PR is to see if I'm on the right track or if this implementation is not sound. I also added some comments along the way as I was learning my way around the code. I created a new timer called <code>damage_timer</code> and another function called <code>node_hurt</code>. When a mob steps on the block, it gets hurt. In minecraft when mobs are on magma blocks they don't try to move, so nothing AI wise has to be coded there. Certain mobs are also not affected by this damage, which wouldn't be too hard to add either. If I get the go ahead, I'd like to add cacti, and enderman water damage as well.
GuyLiner added 6 commits 2022-01-04 17:22:30 +01:00
Contributor

Looks good, welcome merging it into MCL5, as MCL2 Mob API is under refactoring by Fleckenstein... let's do all mob-related stuff in MCL5 right now, then, after MCL2 0.72 release let's just backport it. Am I right, @EliasFleckenstein03 ?

Looks good, welcome merging it into MCL5, as MCL2 Mob API is under refactoring by Fleckenstein... let's do all mob-related stuff in MCL5 right now, then, after MCL2 0.72 release let's just backport it. Am I right, @EliasFleckenstein03 ?
GuyLiner added 1 commit 2022-01-07 04:17:51 +01:00
NO11 reviewed 2022-01-08 19:22:48 +01:00
@ -785,0 +790,4 @@
self.damage_timer = self.damage_timer - dtime
--This gets the coords of the node below the mob
cur_pos['y'] = cur_pos['y'] - 1
Member

You can use cur_pos.y instead of cur_pos['y'] here.

You can use `cur_pos.y` instead of `cur_pos['y']` here.
NO11 marked this conversation as resolved
GuyLiner added 1 commit 2022-01-11 16:51:59 +01:00
AFCMS added the
mobs
label 2022-02-27 14:33:36 +01:00
Contributor

Closed for inactivity, can be reopened if the contributor wants to resume work on this.

Closed for inactivity, can be reopened if the contributor wants to resume work on this.
FossFanatic closed this pull request 2022-12-19 22:20:24 +01:00
Author
Contributor

Forgot the original PR was closed, is there something else I need to do with this or was the original code just trash?

Forgot the original PR was closed, is there something else I need to do with this or was the original code just trash?
Contributor

Forgot the original PR was closed, is there something else I need to do with this or was the original code just trash?

No idea about the code. Feel free to reopen this if you want to request this be merged.

>Forgot the original PR was closed, is there something else I need to do with this or was the original code just trash? No idea about the code. Feel free to reopen this if you want to request this be merged.
Author
Contributor

Alright thanks

Alright thanks
GuyLiner reopened this pull request 2023-02-05 00:54:09 +01:00
Author
Contributor

This looks like it might have to be re-done, I don't think the files are in the same place they used to be.

This looks like it might have to be re-done, I don't think the files are in the same place they used to be.
GuyLiner added 1 commit 2023-02-05 05:25:12 +01:00
034b4cb710 Added conditional based on existing fire damage conditional that will apply fire damage to a
mob standing on top of a magma node that belongs to the "fire" group. The magma node
has also been added to the fire group, making it so that standing on the node will
do damage to the mob.

In official Minecraft, magma blocks just do fire damage without the fire animation.
Source: https://minecraft.fandom.com/wiki/Magma_Block
GuyLiner changed title from WIP: #630, Initial support for magma block damage to WIP: Add magma block damage 2023-02-05 05:26:16 +01:00
GuyLiner changed title from WIP: Add magma block damage to Add magma block damage 2023-02-05 05:26:43 +01:00
Author
Contributor

I think that should do it, unless I'm about to to get roasted for naming a variable nodef2 lol

I think that should do it, unless I'm about to to get roasted for naming a variable nodef2 lol
Member

I think that should do it, unless I'm about to to get roasted for naming a variable nodef2 lol

Why would you be roasted? That is not how we approach things here now.

> I think that should do it, unless I'm about to to get roasted for naming a variable nodef2 lol Why would you be roasted? That is not how we approach things here now.
Author
Contributor

Lol I was just worried I fucked up a convention or something, but you guys are nice so I'm not really worried.

Lol I was just worried I fucked up a convention or something, but you guys are nice so I'm not really worried.
Member

Well, hopefully in code, it is obvious what it refers too. I mean, I've seen worse variable names... if it's not, I would at least comment what it refers to. But, that's me.

Well, hopefully in code, it is obvious what it refers too. I mean, I've seen worse variable names... if it's not, I would at least comment what it refers to. But, that's me.

Initial glances look good, but I will rebase on to a fresh branch and test, as there is stuff from a year ago that isn't needed.

Ok, I have recreated the branch here with just the final commit:

MineClone2/MineClone2#3405

Initial glances look good, but I will rebase on to a fresh branch and test, as there is stuff from a year ago that isn't needed. Ok, I have recreated the branch here with just the final commit: https://git.minetest.land/MineClone2/MineClone2/pulls/3405

@GuyLiner MineClone2/MineClone2#3405 (comment)

Approval comment in this branch. Thanks for picking it up. Welcome back! :)

@GuyLiner https://git.minetest.land/MineClone2/MineClone2/pulls/3405#issuecomment-62306 Approval comment in this branch. Thanks for picking it up. Welcome back! :)

Pull request closed

Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
6 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: VoxeLibre/VoxeLibre#1952
No description provided.