ITEMS/mcl_tnt: Add setting for TNT drop rate (default 100%) #291

Merged
erlehmann merged 3 commits from add-tnt-drop-rate-setting into master 2022-04-18 21:36:10 +02:00
Owner
Problem

TRACKING ISSUE: #287

Destroying nodes with TNT drops only some of them (1 / explosion strength) as items.
For a TNT explosion (with strength 4), this means that 25% of the nodes are dropped.

This means that destroying nodes with TNT makes it impossible to pick all of them up.

Solution

This PR introduces a setting for the chance of a node to drop from a TNT explosion.

Details

Since Minecraft 1.14 has a TNT 100% drop rate, the default rate is set to 100% too.

Testing Steps

Note that items entities spawned by explosions may be pushed into walls. Therefore, a good way of figuring out how many nodes were dropped as items is to pick the items up and count the number of items in your inventory.

Verify Bug
  1. Enter a world in Minetest 5.4+ with Mineclonia commit d2c335d8fb (branch master) in survival mode.
  2. Make a 5×5 platform out of nodes unaffected by explosions (e.g. obsidian).
  3. Put nodes dropping from explosions (e.g. dirt) on the outermost nodes.
  4. Put a TNT node on the node in middle of the platform.
  5. Use flint and steel on the TNT node in the middle of the platform.
  6. Wait for the TNT entity to explode.
  7. Verify that the number of items spawned is less than the number of nodes destroyed.
Verify Patch (Test Structure Placement)
  1. Enter a world in Minetest 5.4+ with Mineclonia commit 6e11819b79 (branch add-tnt-drop-rate-setting) in survival mode.
  2. Execute the command /spawnstruct test_structure_tnt.
  3. Verify that no test structure is placed and that you get an error message about not having enough privileges.
  4. Execute the command /grantme debug.
  5. Execute the command /spawnstruct test_structure_tnt.
  6. Verify that a test structure is placed.
Verify Patch (TNT drop rate unset, i.e. should be 100%)
  1. Verify that minetest.conf does not contain a line starting with mcl_tnt_drop_rate.
  2. Enter a world in Minetest 5.4+ with Mineclonia commit 6e11819b79 (branch add-tnt-drop-rate-setting) in survival mode.
  3. Execute the command /grantme debug.
  4. Execute the command /spawnstruct test_structure_tnt.
  5. Use flint and steel on the TNT node in the test structure.
  6. Wait for the TNT entity to explode.
  7. Verify that no item was spawned for each destroyed glass node.
  8. Verify that a wood item was spawned for each destroyed wood node.
  9. Verify that a cobblestone item was spawned for each destroyed stone node.
  10. Verify that a dirt item was spawned for each destroyed dirt with grass node.
Verify Patch (TNT drop rate set to 50%)
  1. Set the setting mcl_tnt_drop_rate (TNT drop rate) to 0.5.
  2. Enter a world in Minetest 5.4+ with Mineclonia commit 6e11819b79 (branch add-tnt-drop-rate-setting) in survival mode.
  3. Execute the command /grantme debug.
  4. Execute the command /spawnstruct test_structure_tnt.
  5. Use flint and steel on the TNT node in the test structure.
  6. Wait for the TNT entity to explode.
  7. Verify that no item was spawned for each destroyed glass node.
  8. Verify that the number of items spawned is less than the number of nodes destroyed.
  9. Exit Minetest.
  10. Verify that minetest.conf does contain a line mcl_tnt_drop_rate = 0.5.
Verify Patch (TNT drop rate set to 0%)
  1. Set the setting mcl_tnt_drop_rate (TNT drop rate) to 0.0.
  2. Enter a world in Minetest 5.4+ with Mineclonia commit 6e11819b79 (branch add-tnt-drop-rate-setting) in survival mode.
  3. Execute the command /grantme debug.
  4. Execute the command /spawnstruct test_structure_tnt.
  5. Use flint and steel on the TNT node in the test structure.
  6. Wait for the TNT entity to explode.
  7. Verify that no items were spawned for any destroyed node.
  8. Exit Minetest.
  9. Verify that minetest.conf does contain a line mcl_tnt_drop_rate = 0.0.
To do
  • Add TNT drop rate setting with existing default (25%)
  • Set TNT drop rate default to 100%
  • Add TNT test structure
  • Write test plan
  • Verify test plan
##### Problem TRACKING ISSUE: https://git.minetest.land/Mineclonia/Mineclonia/issues/287 Destroying nodes with TNT drops only some of them (1 / explosion strength) as items. For a TNT explosion (with strength 4), this means that 25% of the nodes are dropped. This means that destroying nodes with TNT makes it impossible to pick all of them up. ##### Solution This PR introduces a setting for the chance of a node to drop from a TNT explosion. ##### Details Since Minecraft 1.14 has a TNT 100% drop rate, the default rate is set to 100% too. ##### Testing Steps Note that items entities spawned by explosions may be pushed into walls. Therefore, a good way of figuring out how many nodes were dropped as items is to pick the items up and count the number of items in your inventory. ###### Verify Bug 1. Enter a world in Minetest 5.4+ with Mineclonia commit d2c335d8fbcc018ce4ef04d15494afe252f01779 (branch `master`) in survival mode. 2. Make a 5×5 platform out of nodes unaffected by explosions (e.g. obsidian). 3. Put nodes dropping from explosions (e.g. dirt) on the outermost nodes. 4. Put a TNT node on the node in middle of the platform. 5. Use flint and steel on the TNT node in the middle of the platform. 6. Wait for the TNT entity to explode. 7. Verify that the number of items spawned is less than the number of nodes destroyed. ###### Verify Patch (Test Structure Placement) 1. Enter a world in Minetest 5.4+ with Mineclonia commit 6e11819b794c941c0e88b698f706d1d02c6ef302 (branch `add-tnt-drop-rate-setting`) in survival mode. 2. Execute the command `/spawnstruct test_structure_tnt`. 3. Verify that no test structure is placed and that you get an error message about not having enough privileges. 4. Execute the command `/grantme debug`. 5. Execute the command `/spawnstruct test_structure_tnt`. 6. Verify that a test structure is placed. ###### Verify Patch (TNT drop rate unset, i.e. should be 100%) 0. Verify that `minetest.conf` does not contain a line starting with `mcl_tnt_drop_rate`. 1. Enter a world in Minetest 5.4+ with Mineclonia commit 6e11819b794c941c0e88b698f706d1d02c6ef302 (branch `add-tnt-drop-rate-setting`) in survival mode. 2. Execute the command `/grantme debug`. 3. Execute the command `/spawnstruct test_structure_tnt`. 4. Use flint and steel on the TNT node in the test structure. 5. Wait for the TNT entity to explode. 6. Verify that no item was spawned for each destroyed glass node. 7. Verify that a wood item was spawned for each destroyed wood node. 8. Verify that a cobblestone item was spawned for each destroyed stone node. 9. Verify that a dirt item was spawned for each destroyed dirt with grass node. ###### Verify Patch (TNT drop rate set to 50%) 0. Set the setting `mcl_tnt_drop_rate` (TNT drop rate) to `0.5`. 1. Enter a world in Minetest 5.4+ with Mineclonia commit 6e11819b794c941c0e88b698f706d1d02c6ef302 (branch `add-tnt-drop-rate-setting`) in survival mode. 2. Execute the command `/grantme debug`. 3. Execute the command `/spawnstruct test_structure_tnt`. 4. Use flint and steel on the TNT node in the test structure. 5. Wait for the TNT entity to explode. 6. Verify that no item was spawned for each destroyed glass node. 7. Verify that the number of items spawned is less than the number of nodes destroyed. 8. Exit Minetest. 9. Verify that `minetest.conf` does contain a line `mcl_tnt_drop_rate = 0.5`. ###### Verify Patch (TNT drop rate set to 0%) 0. Set the setting `mcl_tnt_drop_rate` (TNT drop rate) to `0.0`. 1. Enter a world in Minetest 5.4+ with Mineclonia commit 6e11819b794c941c0e88b698f706d1d02c6ef302 (branch `add-tnt-drop-rate-setting`) in survival mode. 2. Execute the command `/grantme debug`. 3. Execute the command `/spawnstruct test_structure_tnt`. 4. Use flint and steel on the TNT node in the test structure. 5. Wait for the TNT entity to explode. 6. Verify that no items were spawned for any destroyed node. 7. Exit Minetest. 8. Verify that `minetest.conf` does contain a line `mcl_tnt_drop_rate = 0.0`. ##### To do - [x] Add TNT drop rate setting with existing default (25%) - [x] Set TNT drop rate default to 100% - [x] Add TNT test structure - [x] Write test plan - [x] Verify test plan
erlehmann force-pushed add-tnt-drop-rate-setting from 85700fe246 to 20f760e4a6 2022-04-17 17:25:11 +02:00 Compare
erlehmann force-pushed add-tnt-drop-rate-setting from 20f760e4a6 to 6e11819b79 2022-04-17 18:44:29 +02:00 Compare
erlehmann changed title from WIP: ITEMS/mcl_tnt: Add setting for TNT drop rate (default 100%) to ITEMS/mcl_tnt: Add setting for TNT drop rate (default 100%) 2022-04-17 19:08:16 +02:00
erlehmann requested review from Li0n_2 2022-04-17 19:08:28 +02:00
erlehmann added the
ready for review
label 2022-04-17 19:08:49 +02:00
Li0n_2 approved these changes 2022-04-18 19:58:57 +02:00
Li0n_2 left a comment
Member

No bugs or crashes were found when performing the following testings steps according to the instructions:

  • Verify Bug

  • Verify Patch (Test Structure Placement)

  • Verify Patch (TNT drop rate unset, i.e. should be 100%)

  • Verify Patch (TNT drop rate set to 50%)

  • Verify Patch (TNT drop rate set to 0%)

No bugs or crashes were found when performing the following testings steps according to the instructions: - [x] Verify Bug - [X] Verify Patch (Test Structure Placement) - [X] Verify Patch (TNT drop rate unset, i.e. should be 100%) - [X] Verify Patch (TNT drop rate set to 50%) - [X] Verify Patch (TNT drop rate set to 0%)
erlehmann merged commit 1ce88e7528 into master 2022-04-18 21:36:10 +02:00
erlehmann deleted branch add-tnt-drop-rate-setting 2022-04-18 21:36:23 +02:00
This repo is archived. You cannot comment on pull requests.
No description provided.