Improve mob floating #3883

Merged
ancientmarinerdev merged 4 commits from Codiac/MineClone2:mob_float_fix into master 2023-08-28 01:30:18 +02:00
Contributor

This changes mob floating so they stay inside the top water node instead of standing on it. The head of the mob should still be above water.

Changes drowning so that mobs will not drown in one block of water. They will drown in 2 or more blocks of water.

Does not appear to affect them getting out of deep water :( But they do seem to die somewhat faster when they stay in deep water.

Testing

Grab some eggs in creative mode and spawn mobs in various depths of water.

This changes mob floating so they stay inside the top water node instead of standing on it. The head of the mob should still be above water. Changes drowning so that mobs will not drown in one block of water. They will drown in 2 or more blocks of water. Does not appear to affect them getting out of deep water :( But they do seem to die somewhat faster when they stay in deep water. ### Testing Grab some eggs in creative mode and spawn mobs in various depths of water.
Codiac added 1 commit 2023-08-12 06:04:54 +02:00
6ae597c97f This changes mob floating so they stay inside the top water node instead of
standing on it. The head of the mod should still be above water.

Changes drowning so that mobs will not drown in one block of water. They will
drown in 2 or more blocks of water.

Does not appear to affect them getting out of deep water :( But they do seem to
die somewhat faster when they stay in deep water.
Codiac added 1 commit 2023-08-13 04:13:24 +02:00
898a183ccd Prevent floating mobs from drowning all the time
Less dieing for mobs in deep water.
Codiac added 1 commit 2023-08-13 04:15:21 +02:00
Author
Contributor

FYI the stuff up in the Minclonea patch merge is all mine :(

FYI the stuff up in the Minclonea patch merge is all mine :(
ancientmarinerdev requested changes 2023-08-13 15:31:31 +02:00
@ -675,6 +675,9 @@ function mob_class:do_env_damage()
self.standing_in = node_ok(pos, "air").name
self.standing_on = node_ok(pos2, "air").name
local pos3 = {x=pos.x, y=pos.y+1, z=pos.z}

We should use vector.offset for this. The vector functions have assertions in there. This could be invalid and fail further down the line.

We should use vector.offset for this. The vector functions have assertions in there. This could be invalid and fail further down the line.
Author
Contributor

I just copied how pos2 is done. Should we just change pos3, change pos2 and pos3, or do a separate PR that changes to vectors in a bunch of places?

I just copied how pos2 is done. Should we just change pos3, change pos2 and pos3, or do a separate PR that changes to vectors in a bunch of places?
Author
Contributor

I just did pos3.

I just did pos3.

Thanks. As long as we don't add more to the tech debt bonfire. Ideally we fix surrounding cases as we go, but I won't be that harsh, just yet. You're learning the project, and I don't want the learning curve to be offputting.

Long term, improving code around where we work will help to chip through that tech debt and eventually we'll have a good code base :).

Thanks. As long as we don't add more to the tech debt bonfire. Ideally we fix surrounding cases as we go, but I won't be that harsh, just yet. You're learning the project, and I don't want the learning curve to be offputting. Long term, improving code around where we work will help to chip through that tech debt and eventually we'll have a good code base :).
Codiac marked this conversation as resolved
@ -940,3 +944,3 @@
-- in water then float up
if registered_node.groups.water then
if acc and self.floats == 1 then
if acc and self.floats == 1 minetest.registered_nodes[node_ok(vector.offset(pos,0,self.collisionbox[5] -0.25,0)).name].groups.water then

is this missing an and after == 1 ?

is this missing an and after == 1 ?
Author
Contributor

Yes, I really did murder that merge. I'll update the PR.

Yes, I really did murder that merge. I'll update the PR.
Codiac marked this conversation as resolved
Codiac added 1 commit 2023-08-14 02:48:48 +02:00
ancientmarinerdev added this to the 0.85.0 - Fire and Stone milestone 2023-08-28 01:29:01 +02:00
ancientmarinerdev added the
mobs
label 2023-08-28 01:29:12 +02:00
ancientmarinerdev approved these changes 2023-08-28 01:30:01 +02:00
ancientmarinerdev left a comment
Owner

There was something real satisfying about testing this. It wasn't perfect, but it was so wonderful, and a little funny. Thanks for fixing this :).

There was something real satisfying about testing this. It wasn't perfect, but it was so wonderful, and a little funny. Thanks for fixing this :).
ancientmarinerdev merged commit 5f0944062c into master 2023-08-28 01:30:18 +02:00
Codiac deleted branch mob_float_fix 2023-08-29 09:07:51 +02:00
Sign in to join this conversation.
No reviewers
No project
No Assignees
2 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#3883
No description provided.