items/mcl_bows: Let players shoot themselves with arrows #117

Merged
erlehmann merged 8 commits from fix-arrow-selfshoot-3 into master 2021-07-13 08:55:59 +02:00
Owner
Problem

TRACKING ISSUE: #113

Players can shoot themselves with bows in Minecraft and MineClone2.

Solution
  1. Port the regular arrow code from MineClone2 commit 6b1ce182d3.
  2. Port the potion arrow code from Mineclonia PR #115.
  3. Fix remaining bugs.
Details

This PR right originally existed to figure out what the difference was between the solution that @cora made for players wanting to shooting themselves in PR #115 and the ones that @epCode made in MineClone2 commit 6b1ce182d3. I have cherry-picked both of those and cleaned up the commits to remove unrelated changes and whitespace errors.

I then fixed a bug inherited from MineClone that would cause a stack trace when the “Ding” hit sound was played for potion arrows. I also made it so that for both regular and potion arrows the game plays the hit sound only when hitting another player, and not oneself.

Testing Steps
World Preparation
  1. Create a new world in Mineclonia commit 9f086a9242 with mapgen v7 and seed “arrow”.
  2. Enter the new world in survival mode with damage turned on.
  3. Execute the following commands:
    • /grantme give
    • /giveme mcl_bows:bow
    • /giveme mcl_bows:arrow 5
    • /giveme mcl_potions:harming_arrow 5
    • /giveme mobs_mc:snowman 2
    • /giveme mesecons_button:button_wood_off 2
    • /giveme mesecons_lightstone:lightstone_off 2
    • /giveme mcl_end:crystal 2
    • /giveme mcl_core:obsidian 2
  4. Verify that you have one bow, 5 regular arrows, 5 arrows of harming, 2 snowman eggs, 2 wood buttons, 2 redstone lamps, 2 end crystals, 2 obsidian in your inventory.
Verify Bug (for future reference)
  1. Enter the prepared world in survival mode with damage turned on.
  2. Order your items so that the bow is in hotbar slot 1, the regular arrows are in hotbar slot 2 and the arrows of harming are hotbar slot 3.
  3. Using the bow, Aim straight up. Shoot with minimal power (hold right mousebutton shortly).
  4. Verify that you have 4 arrows in your inventory while the arrow is in flight.
  5. Verify that the arrow flies up.
  6. Verify that the arrow falls down.
  7. Verify that you pick up the arrow.
  8. Verify that you have 5 arrows in your inventory.
  9. Put arrows of harming in hotbar slot 2 and regular arrows in hotbar slot 3.
  10. Using the bow, aim straight up. Shoot with minimal power (hold right mousebutton shortly).
  11. Verify that you have 4 arrows of harming in your inventory while the arrow or harming is in flight.
  12. Verify that the arrow of harming flies up.
  13. Verify that the arrow of harming falls down.
  14. Verify that you pick up the arrow of harming.
  15. Verify that you have 5 arrows of harming in your inventory.
Verify Patch Part 1: Regular Arrows
  1. Enter the prepared world in survival mode with damage turned on.
  2. Order your items so that the bow is in hotbar slot 1, the regular arrows are in hotbar slot 2 and the arrows of harming are hotbar slot 3.
  3. Using the bow, aim straight. Shoot with minimal power (hold right mousebutton shortly).
  4. Verify that you have 4 arrows in your inventory while the arrow is in flight.
  5. Verify that the arrow flies up.
  6. Verify that the arrow falls down.
  7. Verify that you get damaged by the arrow.
  8. Verify that the arrow hitting you does not make a “Ding” hit sound.
  9. Verify that you did not pick up an arrow.
  10. Verify that you have 4 arrows in your inventory.
  11. Spawn a snowman using the snowman egg.
  12. Using the bow, aim at the snowman. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release).
  13. Verify that the snowman dies.
  14. Verify that you have 3 arrows in your inventory.
  15. Verify that the arrow hitting the snowman does not make a “Ding” hit sound.
  16. Using the bow, aim at the ground about 5 nodes in front of you. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release).
  17. Verify that you have 2 arrows in your inventory while the arrow is in flight.
  18. Verify that the arrow gets stuck in the ground about where you aimed.
  19. Verify that you have 2 arrows in your inventory.
  20. Walk over the arrow stuck in the ground.
  21. Verify that you picked up the arrow.
  22. Verify that you have 3 arrows in your inventory.
  23. Place a redstone lamp on the ground.
  24. Place the wood button on the side of the redstone lamp.
  25. Using the bow, aim at the wood button. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release).
  26. Verify that the button gets hit and the redstone lamp lights up.
  27. Verify that you have 2 arrows in your inventory.
  28. Move close to the arrow on the wood button.
  29. Verify that you pick up the arrow on the wood button.
  30. Verify that you have 3 arrows in your inventory.
  31. Place a block of obsidian on the ground.
  32. Place an end crystal on top of the obsidian.
  33. Using the bow, aim at the end crystal. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release).
  34. Verify that the end crystal blows up.
Verify Patch Part 2: Enchanted Arrows
  1. Enter the prepared world in survival mode with damage turned on.
  2. Order your items so that the bow is in hotbar slot 1, the arrows of harming are in hotbar slot 2 and the regular arrows are in hotbar slot 3.
  3. Using the bow, aim straight up. Shoot with minimal power (hold right mousebutton shortly).
  4. Verify that you have 4 arrows of harming in your inventory while the arrow or harming is in flight.
  5. Verify that the arrow of harming flies up.
  6. Verify that the arrow of harming falls down.
  7. Verify that you get damaged by the arrow of harming.
  8. Verify that the arrow of harming hitting you does not make a “Ding” hit sound.
  9. Verify that you did not pick up an arrow of harming
  10. Verify that you have 4 arrows of harming in your inventory.
  11. Spawn a snowman using the snowman egg.
  12. Using the bow, aim at the snowman. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release).
  13. Verify that the snowman dies.
  14. Verify that you have 3 arrows of harming in your inventory.
  15. Verify that the arrow hitting the snowman does not make a “Ding” hit sound.
  16. Using the bow, aim at the ground about 5 nodes in front of you. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release).
  17. Verify that you have 2 arrows of harming in your inventory while the arrow of harming is in flight.
  18. Verify that the arrow of harming gets stuck in the ground about where you aimed.
  19. Verify that you have 2 arrows of harming in your inventory.
  20. Walk over the arrow of harming stuck in the ground.
  21. Verify that you picked up the arrow of harming.
  22. Verify that you have 3 arrows of harming in your inventory.
  23. Place a redstone lamp on the ground.
  24. Place the wood button on the side of the redstone lamp.
  25. Using the bow, aim at the wood button. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release).
  26. Verify that the button gets hit and the redstone lamp lights up.
  27. Verify that you have 2 arrows of harming in your inventory.
  28. Move close to the arrow of harming on the wood button.
  29. Verify that you pick up the arrow of harming on the wood button.
  30. Verify that you have 3 arrows of harming in your inventory.
  31. Place a block of obsidian on the ground.
  32. Place an end crystal on top of the obsidian.
  33. Using the bow, aim at the end crystal. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release).
  34. Verify that the end crystal blows up.
Verify Patch Part 3: Multiplayer
  1. Enter the prepared world in survival mode with damage turned on and “host server” checked.
  2. Order your items so that the bow is in hotbar slot 1, the regular arrows are in hotbar slot 2 and the arrows of harming are hotbar slot 3.
  3. In a second client, connect to 127.0.0.1 port 30000.
  4. Using the bow, aim at the second player. Shoot with enough power to hit the other player (hold right mousebutton, then release).
  5. Verify that hitting the second player with the arrow makes a “Ding” hit sound.
  6. Verify that the second player gets damaged by the arrow.
  7. Verify that you have 1 arrow less than before.
  8. Order your items so that the bow is in hotbar slot 1, the arrows of harming are in hotbar slot 2 and the regular arrows are in hotbar slot 3.
  9. Using the bow, aim at the second player. Shoot with enough power to hit the other player (hold right mousebutton, then release).
  10. Verify that hitting the second player with the arrow of harming makes a “Ding” hit sound.
  11. Verify that the second player gets damaged by the arrow of harming.
  12. Verify that you have 1 arrow of harming less than before.
  • Figure out what is different from PR #115
  • Fill out PR template
  • Figure out testing steps
  • Verify testing steps
##### Problem TRACKING ISSUE: https://git.minetest.land/Mineclonia/Mineclonia/issues/113 Players can shoot themselves with bows in Minecraft and MineClone2. ##### Solution 1. Port the regular arrow code from MineClone2 commit 6b1ce182d3c5fac70e035e14914e29582ec75bd4. 2. Port the potion arrow code from Mineclonia PR #115. 3. Fix remaining bugs. ##### Details This PR right originally existed to figure out what the difference was between the solution that @cora made for players wanting to shooting themselves in PR #115 and the ones that @epCode made in MineClone2 commit 6b1ce182d3c5fac70e035e14914e29582ec75bd4. I have cherry-picked both of those and cleaned up the commits to remove unrelated changes and whitespace errors. I then fixed a bug inherited from MineClone that would cause a stack trace when the “Ding” hit sound was played for potion arrows. I also made it so that for both regular and potion arrows the game plays the hit sound only when hitting another player, and not oneself. ##### Testing Steps ###### World Preparation 1. Create a new world in Mineclonia commit 9f086a9242292be1044ee128ff9d54ce2fad3c07 with mapgen v7 and seed “arrow”. 2. Enter the new world in survival mode with damage turned on. 3. Execute the following commands: - /grantme give - /giveme mcl_bows:bow - /giveme mcl_bows:arrow 5 - /giveme mcl_potions:harming_arrow 5 - /giveme mobs_mc:snowman 2 - /giveme mesecons_button:button_wood_off 2 - /giveme mesecons_lightstone:lightstone_off 2 - /giveme mcl_end:crystal 2 - /giveme mcl_core:obsidian 2 4. Verify that you have one bow, 5 regular arrows, 5 arrows of harming, 2 snowman eggs, 2 wood buttons, 2 redstone lamps, 2 end crystals, 2 obsidian in your inventory. ###### Verify Bug (for future reference) 1. Enter the prepared world in survival mode with damage turned on. 2. Order your items so that the bow is in hotbar slot 1, the regular arrows are in hotbar slot 2 and the arrows of harming are hotbar slot 3. 3. Using the bow, Aim straight up. Shoot with minimal power (hold right mousebutton shortly). 4. Verify that you have 4 arrows in your inventory while the arrow is in flight. 5. Verify that the arrow flies up. 6. Verify that the arrow falls down. 7. Verify that you pick up the arrow. 8. Verify that you have 5 arrows in your inventory. 9. Put arrows of harming in hotbar slot 2 and regular arrows in hotbar slot 3. 10. Using the bow, aim straight up. Shoot with minimal power (hold right mousebutton shortly). 11. Verify that you have 4 arrows of harming in your inventory while the arrow or harming is in flight. 12. Verify that the arrow of harming flies up. 13. Verify that the arrow of harming falls down. 14. Verify that you pick up the arrow of harming. 15. Verify that you have 5 arrows of harming in your inventory. ###### Verify Patch Part 1: Regular Arrows 1. Enter the prepared world in survival mode with damage turned on. 2. Order your items so that the bow is in hotbar slot 1, the regular arrows are in hotbar slot 2 and the arrows of harming are hotbar slot 3. 3. Using the bow, aim straight. Shoot with minimal power (hold right mousebutton shortly). 4. Verify that you have 4 arrows in your inventory while the arrow is in flight. 5. Verify that the arrow flies up. 6. Verify that the arrow falls down. 7. Verify that you get damaged by the arrow. 8. Verify that the arrow hitting you does not make a “Ding” hit sound. 8. Verify that you did not pick up an arrow. 8. Verify that you have 4 arrows in your inventory. 8. Spawn a snowman using the snowman egg. 8. Using the bow, aim at the snowman. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release). 8. Verify that the snowman dies. 8. Verify that you have 3 arrows in your inventory. 8. Verify that the arrow hitting the snowman does not make a “Ding” hit sound. 8. Using the bow, aim at the ground about 5 nodes in front of you. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release). 8. Verify that you have 2 arrows in your inventory while the arrow is in flight. 8. Verify that the arrow gets stuck in the ground about where you aimed. 9. Verify that you have 2 arrows in your inventory. 9. Walk over the arrow stuck in the ground. 9. Verify that you picked up the arrow. 9. Verify that you have 3 arrows in your inventory. 9. Place a redstone lamp on the ground. 9. Place the wood button on the side of the redstone lamp. 10. Using the bow, aim at the wood button. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release). 11. Verify that the button gets hit and the redstone lamp lights up. 11. Verify that you have 2 arrows in your inventory. 11. Move close to the arrow on the wood button. 11. Verify that you pick up the arrow on the wood button. 11. Verify that you have 3 arrows in your inventory. 11. Place a block of obsidian on the ground. 12. Place an end crystal on top of the obsidian. 12. Using the bow, aim at the end crystal. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release). 12. Verify that the end crystal blows up. ###### Verify Patch Part 2: Enchanted Arrows 1. Enter the prepared world in survival mode with damage turned on. 2. Order your items so that the bow is in hotbar slot 1, the arrows of harming are in hotbar slot 2 and the regular arrows are in hotbar slot 3. 10. Using the bow, aim straight up. Shoot with minimal power (hold right mousebutton shortly). 11. Verify that you have 4 arrows of harming in your inventory while the arrow or harming is in flight. 12. Verify that the arrow of harming flies up. 13. Verify that the arrow of harming falls down. 14. Verify that you get damaged by the arrow of harming. 8. Verify that the arrow of harming hitting you does not make a “Ding” hit sound. 15. Verify that you did not pick up an arrow of harming 15. Verify that you have 4 arrows of harming in your inventory. 8. Spawn a snowman using the snowman egg. 8. Using the bow, aim at the snowman. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release). 8. Verify that the snowman dies. 8. Verify that you have 3 arrows of harming in your inventory. 8. Verify that the arrow hitting the snowman does not make a “Ding” hit sound. 8. Using the bow, aim at the ground about 5 nodes in front of you. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release). 8. Verify that you have 2 arrows of harming in your inventory while the arrow of harming is in flight. 8. Verify that the arrow of harming gets stuck in the ground about where you aimed. 9. Verify that you have 2 arrows of harming in your inventory. 9. Walk over the arrow of harming stuck in the ground. 9. Verify that you picked up the arrow of harming. 9. Verify that you have 3 arrows of harming in your inventory. 9. Place a redstone lamp on the ground. 9. Place the wood button on the side of the redstone lamp. 10. Using the bow, aim at the wood button. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release). 11. Verify that the button gets hit and the redstone lamp lights up. 11. Verify that you have 2 arrows of harming in your inventory. 11. Move close to the arrow of harming on the wood button. 11. Verify that you pick up the arrow of harming on the wood button. 11. Verify that you have 3 arrows of harming in your inventory. 11. Place a block of obsidian on the ground. 12. Place an end crystal on top of the obsidian. 12. Using the bow, aim at the end crystal. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release). 12. Verify that the end crystal blows up. ##### Verify Patch Part 3: Multiplayer 1. Enter the prepared world in survival mode with damage turned on and “host server” checked. 2. Order your items so that the bow is in hotbar slot 1, the regular arrows are in hotbar slot 2 and the arrows of harming are hotbar slot 3. 3. In a second client, connect to 127.0.0.1 port 30000. 4. Using the bow, aim at the second player. Shoot with enough power to hit the other player (hold right mousebutton, then release). 5. Verify that hitting the second player with the arrow makes a “Ding” hit sound. 7. Verify that the second player gets damaged by the arrow. 6. Verify that you have 1 arrow less than before. 7. Order your items so that the bow is in hotbar slot 1, the arrows of harming are in hotbar slot 2 and the regular arrows are in hotbar slot 3. 8. Using the bow, aim at the second player. Shoot with enough power to hit the other player (hold right mousebutton, then release). 5. Verify that hitting the second player with the arrow of harming makes a “Ding” hit sound. 7. Verify that the second player gets damaged by the arrow of harming. 6. Verify that you have 1 arrow of harming less than before. - [x] Figure out what is different from PR #115 - [x] Fill out PR template - [x] Figure out testing steps - [x] Verify testing steps
erlehmann force-pushed fix-arrow-selfshoot-3 from cf7a767958 to 251fd414bc 2021-07-12 01:24:29 +02:00 Compare
erlehmann force-pushed fix-arrow-selfshoot-3 from 251fd414bc to 330487fcc9 2021-07-12 01:38:20 +02:00 Compare
Author
Owner
-						if self._shooter and self._shooter:is_player() and self._in_player == false then
+						if self._shooter and self._shooter:is_player() then

I think this code might be wrong in PR #112. After all, self._in_player is never set, so it will always be nil, so I would think PR #112 breaks the sound an arrow makes when it hits a player.

``` - if self._shooter and self._shooter:is_player() and self._in_player == false then + if self._shooter and self._shooter:is_player() then ``` I think this code might be wrong in PR #112. After all, `self._in_player` is never set, so it will always be `nil`, so I would think PR #112 breaks the sound an arrow makes when it hits a player.
erlehmann force-pushed fix-arrow-selfshoot-3 from 330487fcc9 to 6951ecdfc9 2021-07-12 02:14:14 +02:00 Compare
erlehmann added 1 commit 2021-07-12 02:44:36 +02:00
erlehmann added 1 commit 2021-07-12 03:49:17 +02:00
erlehmann changed title from WIP: items/mcl_bows: Let players shoot themselves with regular arrows to WIP: items/mcl_bows: Let players shoot themselves with arrows 2021-07-12 04:41:12 +02:00
erlehmann added 2 commits 2021-07-12 05:07:27 +02:00
Author
Owner

According to https://yewtu.be/watch?v=F09qguaa41Y you do not get a hit sound when you hit yourself.

According to https://yewtu.be/watch?v=F09qguaa41Y you do not get a hit sound when you hit yourself.
Owner

I think this code might be wrong in PR #112. After all, self._in_player is never set, so it will always be nil, so I would think PR #112 breaks the sound an arrow makes when it hits a player.

This is probably related to arrows sticking in player what @cora mentioned in PR #116.

> I think this code might be wrong in PR #112. After all, self._in_player is never set, so it will always be nil, so I would think PR #112 breaks the sound an arrow makes when it hits a player. This is probably related to arrows sticking in player what @cora mentioned in PR #116.
Owner

I maintain that this code should be refactored as follows:

  • Set _time_in_air to 0 in on_activate.
  • Increment _time_in_air using dtime in on_step (so it represents seconds of flight).
  • Compare it to a value like 0.1 or 0.02 on collisions (not 1.02), the value should ideally be as low as possible without causing issues.

There is no reason for a variable representing elapsed time to start at 1.0 which makes code like _time_in_air > 1.02 misleading.

I maintain that this code should be refactored as follows: - Set `_time_in_air to` 0 in `on_activate`. - Increment `_time_in_air` using `dtime` in `on_step` (so it represents seconds of flight). - Compare it to a value like 0.1 or 0.02 on collisions (not 1.02), the value should ideally be as low as possible without causing issues. There is no reason for a variable representing elapsed time to start at 1.0 which makes code like `_time_in_air > 1.02` misleading.
Author
Owner

_time_in_air is not used anywhere else, fortunately:

; ack '_time_in_air'
mods/ITEMS/mcl_potions/tipped_arrow.lua
133:		self._time_in_air = self._time_in_air + .001
223:				if obj == self._shooter and self._time_in_air > 1.02 or obj ~= self._shooter and (is_player or (lua and (lua._cmi_is_mob or lua._hittable_by_projectile))) then
400:		self._time_in_air = 1.0

mods/ITEMS/mcl_bows/arrow.lua
139:	self._time_in_air = self._time_in_air + .001
231:			if obj == self._shooter and self._time_in_air > 1.02 or obj ~= self._shooter and (is_player or (lua and (lua._cmi_is_mob or lua._hittable_by_projectile))) then
416:	self._time_in_air = 1.0
`_time_in_air` is not used anywhere else, fortunately: ``` ; ack '_time_in_air' mods/ITEMS/mcl_potions/tipped_arrow.lua 133: self._time_in_air = self._time_in_air + .001 223: if obj == self._shooter and self._time_in_air > 1.02 or obj ~= self._shooter and (is_player or (lua and (lua._cmi_is_mob or lua._hittable_by_projectile))) then 400: self._time_in_air = 1.0 mods/ITEMS/mcl_bows/arrow.lua 139: self._time_in_air = self._time_in_air + .001 231: if obj == self._shooter and self._time_in_air > 1.02 or obj ~= self._shooter and (is_player or (lua and (lua._cmi_is_mob or lua._hittable_by_projectile))) then 416: self._time_in_air = 1.0 ```
Author
Owner

Assuming the ideal lag-free globalstep is 20 Hz, to get from 1 to 1.02 by adding 0.001 each globalstep takes about a second.

Assuming the ideal lag-free globalstep is 20 Hz, to get from 1 to 1.02 by adding 0.001 each globalstep takes about a second.
erlehmann added 2 commits 2021-07-12 16:08:07 +02:00
Author
Owner

@ryvnf anything more? If not, I'll work on proper testing instructions.

@ryvnf anything more? If not, I'll work on proper testing instructions.
Author
Owner

Set _time_in_air to 0 in on_activate.

That is almost certainly wrong, I think it needs to be dtime_s. Why should it be 0?

> Set _time_in_air to 0 in on_activate. That is almost certainly wrong, I think it needs to be `dtime_s`. Why should it be 0?
Author
Owner

I think one consequence of when on_activate sets _time_in_air to 0 is that an arrow that was unloaded and later loaded would not hurt its shooter for about a second after being loaded.

I think one consequence of when `on_activate` sets `_time_in_air` to 0 is that an arrow that was unloaded and later loaded would not hurt its shooter for about a second after being loaded.
Owner

That is almost certainly wrong, I think it needs to be dtime_s. Why should it be 0?

I think one consequence of when on_activate sets _time_in_air to 0 is that an arrow that was unloaded and later loaded would not hurt its shooter for about a second after being loaded.

Like I wrote in the other PR. I think this can be ignored since it requires a sequence of events which is incredibly unlikely to happen within the time required to hit yourself.

One way would be to serialize the _time_in_air like I suggested here and set that value when the arrow is loaded again. But in practice I think that would be no different than using dtime_s.

I think your solution of using dtime_s is good.

> That is almost certainly wrong, I think it needs to be dtime_s. Why should it be 0? > > I think one consequence of when on_activate sets _time_in_air to 0 is that an arrow that was unloaded and later loaded would not hurt its shooter for about a second after being loaded. Like I wrote in the other PR. I think this can be ignored since it requires a sequence of events which is incredibly unlikely to happen within the time required to hit yourself. One way would be to serialize the `_time_in_air` like I suggested [here](https://git.minetest.land/Mineclonia/Mineclonia/issues/115#issuecomment-25491) and set that value when the arrow is loaded again. But in practice I think that would be no different than using `dtime_s`. I think your solution of using `dtime_s` is good.
Author
Owner

One way would be to serialize the _time_in_air like I suggested here and set that value when the arrow is loaded again. But in practice I think that would be no different than using dtime_s.

I think your solution of using dtime_s is good.

Yeah, it works under the constraint that a map block with an arrow in it is always unloaded for more than a second.

> One way would be to serialize the _time_in_air like I suggested here and set that value when the arrow is loaded again. But in practice I think that would be no different than using dtime_s. > > I think your solution of using dtime_s is good. Yeah, it works under the constraint that a map block with an arrow in it is always unloaded for more than a second.
erlehmann added 1 commit 2021-07-12 22:21:34 +02:00
Author
Owner

This PR now also addresses issue #114 (“Can't blow up end crystals with harming arrows”).

This PR now also addresses issue https://git.minetest.land/Mineclonia/Mineclonia/issues/114 (“Can't blow up end crystals with harming arrows”).
erlehmann changed title from WIP: items/mcl_bows: Let players shoot themselves with arrows to items/mcl_bows: Let players shoot themselves with arrows 2021-07-12 22:44:25 +02:00
Author
Owner

@ryvnf can you please follow the testing steps and report back?

@ryvnf can you please follow the testing steps and report back?
e approved these changes 2021-07-13 08:36:25 +02:00
e left a comment
Member

World Preparation

  • Create a new world in Mineclonia commit 9f086a9242 with mapgen v7 and seed “arrow”.
  • Enter the new world in survival mode with damage turned on.
  • Execute the following commands:
        /grantme give
        /giveme mcl_bows:bow
        /giveme mcl_bows:arrow 5
        /giveme mcl_potions:harming_arrow 5
        /giveme mobs_mc:snowman 2
        /giveme mesecons_button:button_stone_off 2
        /giveme mesecons_lightstone:lightstone_off 2
        /giveme mcl_end:crystal 2
        /giveme mcl_core:obsidian 2
  • Verify that you have one bow, 5 regular arrows, 5 arrows of harming, 2 snowman eggs, 2 wood buttons, 2 redstone lamps, 2 end crystals, 2 obsidian in your inventory.
  • Enter the prepared world in survival mode with damage turned on.
  • Order your items so that the bow is in hotbar slot 1, the regular arrows are in hotbar slot 2 and the arrows of harming are hotbar slot 3.
  • Using the bow, aim straight. Shoot with minimal power (hold right mousebutton shortly).
  • Verify that you have 4 arrows in your inventory while the arrow is in flight.
  • Verify that the arrow flies up.
  • Verify that the arrow falls down.
  • Verify that you get damaged by the arrow.
  • Verify that the arrow hitting you does not make a “Ding” hit sound.
  • Verify that you did not pick up an arrow.
  • Verify that you have 4 arrows in your inventory.
  • Spawn a snowman using the snowman egg.
  • Using the bow, aim at the snowman. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release).
    NB: First arrow went through head without colliding.
  • Verify that the snowman dies.
  • Verify that you have 3 arrows in your inventory.
  • Verify that the arrow hitting the snowman does not make a “Ding” hit sound.
  • Using the bow, aim at the ground about 5 nodes in front of you. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release).
  • Verify that you have 2 arrows in your inventory while the arrow is in flight.
  • Verify that the arrow gets stuck in the ground about where you aimed.
  • Verify that you have 2 arrows in your inventory.
  • Walk over the arrow stuck in the ground.
  • Verify that you picked up the arrow.
  • Verify that you have 3 arrows in your inventory.
  • Place a redstone lamp on the ground.
  • Place the wood button on the side of the redstone lamp.
    NB: Specifications request stone buttons
  • Using the bow, aim at the wood button. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release).
  • Verify that the button gets hit and the redstone lamp lights up.
  • Verify that you have 2 arrows in your inventory.
  • Move close to the arrow on the wood button.
  • Verify that you pick up the arrow on the wood button.
  • Verify that you have 3 arrows in your inventory.
  • Place a block of obsidian on the ground.
  • Place an end crystal on top of the obsidian.
  • Using the bow, aim at the end crystal. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release).
  • Verify that the end crystal blows up.
    NB: My aim sucks.

Verify Patch Part 2: Enchanted Arrows

  • Enter the prepared world in survival mode with damage turned on.
  • Order your items so that the bow is in hotbar slot 1, the arrows of harming are in hotbar slot 2 and the regular arrows are in hotbar slot 3.
  • Using the bow, aim straight up. Shoot with minimal power (hold right mousebutton shortly).
  • Verify that you have 4 arrows of harming in your inventory while the arrow or harming is in flight.
  • Verify that the arrow of harming flies up.
  • Verify that the arrow of harming falls down.
  • Verify that you get damaged by the arrow of harming.
  • Verify that the arrow of harming hitting you does not make a “Ding” hit sound.
  • Verify that you did not pick up an arrow of harming
  • Verify that you have 4 arrows of harming in your inventory.
  • Spawn a snowman using the snowman egg.
  • Using the bow, aim at the snowman. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release).
  • Verify that the snowman dies.
  • Verify that you have 3 arrows of harming in your inventory.
  • Verify that the arrow hitting the snowman does not make a “Ding” hit sound.
  • Using the bow, aim at the ground about 5 nodes in front of you. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release).
  • Verify that you have 2 arrows of harming in your inventory while the arrow of harming is in flight.
  • Verify that the arrow of harming gets stuck in the ground about where you aimed.
  • Verify that you have 2 arrows of harming in your inventory.
  • Walk over the arrow of harming stuck in the ground.
  • Verify that you picked up the arrow of harming.
  • Verify that you have 3 arrows of harming in your inventory.
  • Place a redstone lamp on the ground.
  • Place the wood button on the side of the redstone lamp.
  • Using the bow, aim at the wood button. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release).
  • Verify that the button gets hit and the redstone lamp lights up.
  • Verify that you have 2 arrows of harming in your inventory.
  • Move close to the arrow of harming on the wood button.
  • Verify that you pick up the arrow of harming on the wood button.
  • Verify that you have 3 arrows of harming in your inventory.
  • Place a block of obsidian on the ground.
  • Place an end crystal on top of the obsidian.
  • Using the bow, aim at the end crystal. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release).
  • Verify that the end crystal blows up.
    NB: My aim still sucks.

Verify Patch Part 3: Multiplayer

  • Enter the prepared world in survival mode with damage turned on and “host server” checked.
  • Order your items so that the bow is in hotbar slot 1, the regular arrows are in hotbar slot 2 and the arrows of harming are hotbar slot 3.
  • In a second client, connect to 127.0.0.1 port 30000.
  • Using the bow, aim at the second player. Shoot with enough power to hit the other player (hold right mousebutton, then release).
  • Verify that hitting the second player with the arrow makes a “Ding” hit sound.
  • Verify that the second player gets damaged by the arrow.
  • Verify that you have 1 arrow less than before.
  • Order your items so that the bow is in hotbar slot 1, the arrows of harming are in hotbar slot 2 and the regular arrows are in hotbar slot 3.
  • Using the bow, aim at the second player. Shoot with enough power to hit the other player (hold right mousebutton, then release).
  • Verify that hitting the second player with the arrow of harming makes a “Ding” hit sound.
  • Verify that the second player gets damaged by the arrow of harming.
  • Verify that you have 1 arrow of harming less than before.
World Preparation - [x] Create a new world in Mineclonia commit 9f086a9242 with mapgen v7 and seed “arrow”. - [x] Enter the new world in survival mode with damage turned on. - [x] Execute the following commands: ``` /grantme give /giveme mcl_bows:bow /giveme mcl_bows:arrow 5 /giveme mcl_potions:harming_arrow 5 /giveme mobs_mc:snowman 2 /giveme mesecons_button:button_stone_off 2 /giveme mesecons_lightstone:lightstone_off 2 /giveme mcl_end:crystal 2 /giveme mcl_core:obsidian 2 ``` - [x] Verify that you have one bow, 5 regular arrows, 5 arrows of harming, 2 snowman eggs, 2 wood buttons, 2 redstone lamps, 2 end crystals, 2 obsidian in your inventory. - [x] Enter the prepared world in survival mode with damage turned on. - [x] Order your items so that the bow is in hotbar slot 1, the regular arrows are in hotbar slot 2 and the arrows of harming are hotbar slot 3. - [x] Using the bow, aim straight. Shoot with minimal power (hold right mousebutton shortly). - [x] Verify that you have 4 arrows in your inventory while the arrow is in flight. - [x] Verify that the arrow flies up. - [x] Verify that the arrow falls down. - [x] Verify that you get damaged by the arrow. - [x] Verify that the arrow hitting you does not make a “Ding” hit sound. - [x] Verify that you did not pick up an arrow. - [x] Verify that you have 4 arrows in your inventory. - [x] Spawn a snowman using the snowman egg. - [x] Using the bow, aim at the snowman. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release). **NB: First arrow went through head without colliding.** - [x] Verify that the snowman dies. - [x] Verify that you have 3 arrows in your inventory. - [x] Verify that the arrow hitting the snowman does not make a “Ding” hit sound. - [x] Using the bow, aim at the ground about 5 nodes in front of you. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release). - [x] Verify that you have 2 arrows in your inventory while the arrow is in flight. - [x] Verify that the arrow gets stuck in the ground about where you aimed. - [x] Verify that you have 2 arrows in your inventory. - [x] Walk over the arrow stuck in the ground. - [x] Verify that you picked up the arrow. - [x] Verify that you have 3 arrows in your inventory. - [x] Place a redstone lamp on the ground. - [x] Place the wood button on the side of the redstone lamp. **NB: Specifications request stone buttons** - [x] Using the bow, aim at the wood button. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release). - [x] Verify that the button gets hit and the redstone lamp lights up. - [x] Verify that you have 2 arrows in your inventory. - [x] Move close to the arrow on the wood button. - [x] Verify that you pick up the arrow on the wood button. - [x] Verify that you have 3 arrows in your inventory. - [x] Place a block of obsidian on the ground. - [x] Place an end crystal on top of the obsidian. - [x] Using the bow, aim at the end crystal. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release). - [x] Verify that the end crystal blows up. **NB: My aim sucks.** Verify Patch Part 2: Enchanted Arrows - [x] Enter the prepared world in survival mode with damage turned on. - [x] Order your items so that the bow is in hotbar slot 1, the arrows of harming are in hotbar slot 2 and the regular arrows are in hotbar slot 3. - [x] Using the bow, aim straight up. Shoot with minimal power (hold right mousebutton shortly). - [x] Verify that you have 4 arrows of harming in your inventory while the arrow or harming is in flight. - [x] Verify that the arrow of harming flies up. - [x] Verify that the arrow of harming falls down. - [x] Verify that you get damaged by the arrow of harming. - [x] Verify that the arrow of harming hitting you does not make a “Ding” hit sound. - [x] Verify that you did not pick up an arrow of harming - [x] Verify that you have 4 arrows of harming in your inventory. - [x] Spawn a snowman using the snowman egg. - [x] Using the bow, aim at the snowman. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release). - [x] Verify that the snowman dies. - [x] Verify that you have 3 arrows of harming in your inventory. - [x] Verify that the arrow hitting the snowman does not make a “Ding” hit sound. - [x] Using the bow, aim at the ground about 5 nodes in front of you. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release). - [x] Verify that you have 2 arrows of harming in your inventory while the arrow of harming is in flight. - [x] Verify that the arrow of harming gets stuck in the ground about where you aimed. - [x] Verify that you have 2 arrows of harming in your inventory. - [x] Walk over the arrow of harming stuck in the ground. - [x] Verify that you picked up the arrow of harming. - [x] Verify that you have 3 arrows of harming in your inventory. - [x] Place a redstone lamp on the ground. - [x] Place the wood button on the side of the redstone lamp. - [x] Using the bow, aim at the wood button. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release). - [x] Verify that the button gets hit and the redstone lamp lights up. - [x] Verify that you have 2 arrows of harming in your inventory. - [x] Move close to the arrow of harming on the wood button. - [x] Verify that you pick up the arrow of harming on the wood button. - [x] Verify that you have 3 arrows of harming in your inventory. - [x] Place a block of obsidian on the ground. - [x] Place an end crystal on top of the obsidian. - [x] Using the bow, aim at the end crystal. Shoot with maximum power (hold right mousebutton until the bow no longer changes appearance, then release). - [x] Verify that the end crystal blows up. **NB: My aim still sucks.** Verify Patch Part 3: Multiplayer - [x] Enter the prepared world in survival mode with damage turned on and “host server” checked. - [x] Order your items so that the bow is in hotbar slot 1, the regular arrows are in hotbar slot 2 and the arrows of harming are hotbar slot 3. - [x] In a second client, connect to 127.0.0.1 port 30000. - [x] Using the bow, aim at the second player. Shoot with enough power to hit the other player (hold right mousebutton, then release). - [x] Verify that hitting the second player with the arrow makes a “Ding” hit sound. - [x] Verify that the second player gets damaged by the arrow. - [x] Verify that you have 1 arrow less than before. - [x] Order your items so that the bow is in hotbar slot 1, the arrows of harming are in hotbar slot 2 and the regular arrows are in hotbar slot 3. - [x] Using the bow, aim at the second player. Shoot with enough power to hit the other player (hold right mousebutton, then release). - [x] Verify that hitting the second player with the arrow of harming makes a “Ding” hit sound. - [x] Verify that the second player gets damaged by the arrow of harming. - [x] Verify that you have 1 arrow of harming less than before.
Author
Owner

Yeah, that was an oversight, stone buttons can not be hit.

Yeah, that was an oversight, stone buttons can not be hit.
erlehmann merged commit e2e08f28dd into master 2021-07-13 08:55:59 +02:00
erlehmann deleted branch fix-arrow-selfshoot-3 2021-07-13 08:56:35 +02:00
This repo is archived. You cannot comment on pull requests.
No description provided.