ENTITIES/mcl_mobs: Give mobs sunburn at correct light level #175

Merged
cora merged 1 commits from fix-mobs-burning-in-sunlight into master 2021-11-19 21:27:56 +01:00
Owner
Problem

TRACKING ISSUE: #173

Before this patch, the light level that makes mobs that burn in sunlight
catch fire had been mistakenly specified as minetest.LIGHT_MAX or more.

The correct light level for sunlight is LIGHT_SUN, which is one higher
than minetest.LIGHT_MAX. Since minetest.LIGHT_MAX is the maximum light
value that a node can have and torches emit light at that light level,
mobs that burn in sunlight caught fire inside torch nodes.

Solution

The mob API has been adjusted to use LIGHT_SUN (15) instead of LIGHT_MAX (14).

Details

Before this patch:

  1. In Minetest in the file src/light.h, LIGHT_MAX is defied as 14. LIGHT_SUN is defined as 15.

  2. In Mineclonia in the file mods/ENTITIES/mcl_mobs/api.lua, line 1060, the code checks for >= minetest.LIGHT_MAX.

  3. In Mineclonia in the file mods/ITEMS/mcl_torches/init.lua, line 2, LIGHT_TORCH is set to minetest.LIGHT_MAX.

With this patch, the code in the file mods/ENTITIES/mcl_mobs/api.lua checks for == LIGHT_SUN, which is defined as minetest.LIGHT_MAX + 1.

Testing Steps
Verify Bug
  1. Enter a world in creative mode with Mineclonia commit fc47f0a87e.
  2. Spawn a zombie in direct sunlight using the zombie egg. Verify that it catches fire.
  3. Put a torch in a cave where there is no sunlight.
  4. Spawn a zombie in the cave. Verify that it catches fire.
Verify Patch
  1. Enter a world in creative mode with Mineclonia commit 66dd87af25.
  2. Spawn a zombie in direct sunlight using the zombie egg. Verify that it catches fire.
  3. Put one or more torches in a cave where there is no sunlight.
  4. Spawn a zombie in the cave and manage to get it in a torch node. Verify that it does not catch fire.
To do
  • Fill out PR template
  • Write test plan
  • Tests
##### Problem TRACKING ISSUE: https://git.minetest.land/Mineclonia/Mineclonia/issues/173 Before this patch, the light level that makes mobs that burn in sunlight catch fire had been mistakenly specified as minetest.LIGHT_MAX or more. The correct light level for sunlight is LIGHT_SUN, which is one higher than minetest.LIGHT_MAX. Since minetest.LIGHT_MAX is the maximum light value that a node can have and torches emit light at that light level, mobs that burn in sunlight caught fire inside torch nodes. ##### Solution The mob API has been adjusted to use `LIGHT_SUN` (15) instead of `LIGHT_MAX` (14). ##### Details Before this patch: 1. In Minetest in the file `src/light.h`, `LIGHT_MAX` is defied as 14. `LIGHT_SUN` is defined as 15. 2. In Mineclonia in the file `mods/ENTITIES/mcl_mobs/api.lua`, line 1060, the code checks for `>= minetest.LIGHT_MAX`. 3. In Mineclonia in the file `mods/ITEMS/mcl_torches/init.lua`, line 2, LIGHT_TORCH is set to `minetest.LIGHT_MAX`. With this patch, the code in the file `mods/ENTITIES/mcl_mobs/api.lua` checks for `== LIGHT_SUN`, which is defined as `minetest.LIGHT_MAX + 1`. ##### Testing Steps ###### Verify Bug 1. Enter a world in creative mode with Mineclonia commit fc47f0a87e3f118f901147fd253aeef01789508c. 2. Spawn a zombie in direct sunlight using the zombie egg. Verify that it catches fire. 3. Put a torch in a cave where there is no sunlight. 4. Spawn a zombie in the cave. Verify that it catches fire. ###### Verify Patch 1. Enter a world in creative mode with Mineclonia commit 66dd87af250460665b953581943005a880aeba89. 2. Spawn a zombie in direct sunlight using the zombie egg. Verify that it catches fire. 3. Put one or more torches in a cave where there is no sunlight. 4. Spawn a zombie in the cave and manage to get it in a torch node. Verify that it does not catch fire. ##### To do - [x] Fill out PR template - [x] Write test plan - [x] Tests
erlehmann force-pushed fix-mobs-burning-in-sunlight from 8855e2568b to 66dd87af25 2021-11-19 03:18:41 +01:00 Compare
erlehmann changed title from WIP: ENTITIES/mcl_mobs: Adjust light level for mobs that burn in sunlight to WIP: ENTITIES/mcl_mobs: Give mobs sunburn at correct light level 2021-11-19 03:18:54 +01:00
erlehmann changed title from WIP: ENTITIES/mcl_mobs: Give mobs sunburn at correct light level to ENTITIES/mcl_mobs: Give mobs sunburn at correct light level 2021-11-19 03:23:24 +01:00
cora approved these changes 2021-11-19 21:27:45 +01:00
cora left a comment
Member
Testing Steps
Verify Bug
  • 1. Enter a world in creative mode with Mineclonia commit fc47f0a87e.
  • 2. Spawn a zombie in direct sunlight using the zombie egg. Verify that it catches fire.
  • 3. Put a torch in a cave where there is no sunlight.
  • 4. Spawn a zombie in the cave. Verify that it catches fire.
    • note that this only happens when the zombie walks on the node.
Verify Patch
  • 1. Enter a world in creative mode with Mineclonia commit 66dd87af25.
  • 2. Spawn a zombie in direct sunlight using the zombie egg. Verify that it catches fire.
  • 3. Put one or more torches in a cave where there is no sunlight.
  • 4. Spawn a zombie in the cave and manage to get it in a torch node. Verify that it does not catch fire.

good fixing <3

##### Testing Steps ###### Verify Bug - [x] 1. Enter a world in creative mode with Mineclonia commit fc47f0a87e3f118f901147fd253aeef01789508c. - [x] 2. Spawn a zombie in direct sunlight using the zombie egg. Verify that it catches fire. - [x] 3. Put a torch in a cave where there is no sunlight. - [x] 4. Spawn a zombie in the cave. Verify that it catches fire. - note that this only happens when the zombie walks *on* the node. ###### Verify Patch - [x] 1. Enter a world in creative mode with Mineclonia commit 66dd87af250460665b953581943005a880aeba89. - [x] 2. Spawn a zombie in direct sunlight using the zombie egg. Verify that it catches fire. - [x] 3. Put one or more torches in a cave where there is no sunlight. - [x] 4. Spawn a zombie in the cave and manage to get it in a torch node. Verify that it does not catch fire. good fixing <3
cora merged commit 71befcff10 into master 2021-11-19 21:27:56 +01:00
cora deleted branch fix-mobs-burning-in-sunlight 2021-11-19 21:27:57 +01:00
This repo is archived. You cannot comment on pull requests.
No description provided.