Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Landmines #1001

Merged
merged 35 commits into from
Dec 2, 2024
Merged

Introduce Landmines #1001

merged 35 commits into from
Dec 2, 2024

Conversation

xenonca
Copy link
Contributor

@xenonca xenonca commented Apr 24, 2022

This PR aims to add landmines to CTF.
The landmine is triggered and explodes when a player walks on it and it damages enemies inside a radius of ~3 nodes.
Craftable with 4 steel ingots and one frag grenade.
Can be found in treasure chests, cannot be triggered by and does not damage team mates.

mods/ctf/ctf_map/ctf_traps.lua Outdated Show resolved Hide resolved
mods/ctf/ctf_map/ctf_traps.lua Outdated Show resolved Hide resolved
mods/ctf/ctf_map/ctf_traps.lua Outdated Show resolved Hide resolved
mods/ctf/ctf_map/ctf_traps.lua Outdated Show resolved Hide resolved
mods/ctf/ctf_map/ctf_traps.lua Outdated Show resolved Hide resolved
mods/ctf/ctf_map/ctf_traps.lua Outdated Show resolved Hide resolved
mods/ctf/ctf_map/ctf_traps.lua Outdated Show resolved Hide resolved
mods/ctf/ctf_map/ctf_traps.lua Outdated Show resolved Hide resolved
xenonca added 3 commits July 20, 2022 21:16
make landmines walkable, remove y limits, prevent friendly fire and triggering, do not save player's team, add damage group, increase damage
Copy link
Contributor

@savilli savilli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how useful landmines will be. For me they feel slow, and an enemy can easily run over them. I think we should test them with more people and get their feedback.

@LoneWolfHT
Copy link
Member

Merge conflicts need resolving

@magnetar47
Copy link
Contributor

@xenonca Please add a description to the PR, explaining how the landmines work, how to craft, how to place, the damage caused, and other stuff we should take note of. Thanks.

@xenonca
Copy link
Contributor Author

xenonca commented Aug 14, 2022

I'm not sure how useful landmines will be. For me they feel slow, and an enemy can easily run over them. I think we should test them with more people and get their feedback.

If nobody objects I'll go ahead and ping Testers on Discord for this purpose

@magnetar47
Copy link
Contributor

I'm not sure how useful landmines will be. For me they feel slow, and an enemy can easily run over them. I think we should test them with more people and get their feedback.

If nobody objects I'll go ahead and ping Testers on Discord for this purpose

Let's start the testing phase. 👍

Copy link
Contributor

@Lucyucy Lucyucy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To compensate for the long reaction time I'd suggest a more discreet design/smaller size

@LuismiInTheZone
Copy link
Contributor

LuismiInTheZone commented Aug 19, 2022

Emm, when I enter into the game and try to test it the game kick me so... I can't test it if first thing I see is how it kicks me

@magnetar47
Copy link
Contributor

Emm, when I enter into the game and try to test it the game kick me so... I can't test it if first thing I see is how it kicks me

Posting the reason that got you "kicked" would be useful in solving your problem.

@LuismiInTheZone
Copy link
Contributor

Emm, when I enter into the game and try to test it the game kick me so... I can't test it if first thing I see is how it kicks me

Posting the reason that got you "kicked" would be useful in solving your problem.

I went to get on the landmine and it kicked me

@magnetar47
Copy link
Contributor

Emm, when I enter into the game and try to test it the game kick me so... I can't test it if first thing I see is how it kicks me

Posting the reason that got you "kicked" would be useful in solving your problem.

I went to get on the landmine and it kicked me

Kicked you as in kicked you from the game? What's the message you got?

@xenonca
Copy link
Contributor Author

xenonca commented Aug 19, 2022

I think I know what that might have been, @Lucyucy pointed out a bug to me a few days ago, I'll try to fix it soon.

@farooqkz
Copy link
Contributor

farooqkz commented Jun 11, 2024

@LoneWolfHT This is ready for another review and finally merging. The low value of globalstep threshold is because otherwise people could run over landmine undetected.

EDIT:

Landmine is a separate mod because otherwise, it would generate a circular dependency graph.

@mrtechtroid
Copy link
Contributor

@farooqkz @LoneWolfHT Merge?

@farooqkz
Copy link
Contributor

farooqkz commented Nov 1, 2024

Last time I checked there isn't anything preventing it from being merged. Tho I can't say if there are recent changes in CTF conflicting with it. And the merge is up to someone with push access anyway.

@LoneWolfHT
Copy link
Member

On switching this from an ABM to a globalstep (braindump):

  • Track the positions of all placed landmines in a table (table[minetest.pos_to_string(vector.round(pos))] = <placer's team> or something)
  • Set up a globalstep that runs every 0.5 seconds. The following indented points should be inside this globalstep:
    • Create a playerref table of the style {pname = {pteam = player:get_player_name(), pos = player:get_pos()}, ...} filled with all online players in a team
    • Loop over your table of landmines, and compare their positions/owning-teams with the players stored in your playerref table. Explode if they're close enough, maybe looping over your playerref table and comparing positions a second time to find nearby players to hit.
  • Remember to remove landmine positions from your landmines table in the landmine node's on_destruct(). Make sure the key (landmine position) you use to do that is rounded and converted to string form
  • Completely empty your landmine table in a ctf_api.register_on_match_end()

Something still needs to be done about this

@pl608
Copy link
Contributor

pl608 commented Nov 2, 2024 via email

@farooqkz
Copy link
Contributor

farooqkz commented Nov 2, 2024

On switching this from an ABM to a globalstep (braindump):

  • Track the positions of all placed landmines in a table (table[minetest.pos_to_string(vector.round(pos))] = <placer's team> or something)

  • Set up a globalstep that runs every 0.5 seconds. The following indented points should be inside this globalstep:

    • Create a playerref table of the style {pname = {pteam = player:get_player_name(), pos = player:get_pos()}, ...} filled with all online players in a team
    • Loop over your table of landmines, and compare their positions/owning-teams with the players stored in your playerref table. Explode if they're close enough, maybe looping over your playerref table and comparing positions a second time to find nearby players to hit.
  • Remember to remove landmine positions from your landmines table in the landmine node's on_destruct(). Make sure the key (landmine position) you use to do that is rounded and converted to string form

  • Completely empty your landmine table in a ctf_api.register_on_match_end()

Something still needs to be done about this

As far as I remember I did this. so better check the code.

mods/ctf/ctf_landmine/init.lua Outdated Show resolved Hide resolved
mods/ctf/ctf_map/maps Outdated Show resolved Hide resolved
mods/ctf/ctf_modebase/crafting.lua Outdated Show resolved Hide resolved
mods/ctf/ctf_map/maps Outdated Show resolved Hide resolved
@farooqkz
Copy link
Contributor

farooqkz commented Dec 2, 2024

Before merge, there is a bug here. See the kill log:

screenshot_20241202_204321

Edit: nevermind I didn't see the error.

@farooqkz
Copy link
Contributor

farooqkz commented Dec 2, 2024

Before merge, there is a bug here. See the kill log:

screenshot_20241202_204321

Edit: nevermind I didn't see the error.

fixed

@LoneWolfHT LoneWolfHT merged commit efbf414 into MT-CTF:master Dec 2, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants