-
Notifications
You must be signed in to change notification settings - Fork 577
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
Fix the possibility to put fire in a protected area #3129
Fix the possibility to put fire in a protected area #3129
Conversation
Since the flame will always appear at pointed_thing.above why not remove the protection check for pointed_thing.below ? |
I decided to leave it because despite the fire will appear in a non-protected area, using Flint and Steel can be interpreted as igniting the pointed object, and I think players shouldn't be able to ignite protected objects, at least directly. Maybe it'd be even better to disable the possibility to ignite voxels adjacent to protected ones but it's controversial and requires discussing/consideration, and I think it's unnecessary if the fire won't be able to spread to the protected area. |
Your assumption is unfortunately wrong. If there is an
Indeed, but does it really help to disallow this in flint and steel code? Since fire spreads, I can just light an adjacent node on fire, which will spread to the protected area? Disallowing setting adjacent nodes on fire more generally doesn't help either: I can just build a "chain" of flammable nodes. The only "proper" solution I see would be to assign "owners" to flames, but that'd need some discussion and is definitely out of scope for this PR. Nitpick: You check eagerly whether the "above" node is protected. This means that now, igniting a node in an unprotected area won't be possible if there is a protected area right above, even if no flame is placed in the above node. For example you couldn't ignite TNT in your own area below a foreign protected area. Currently I don't see a significant benefit in this PR, but I also see no significant harm, so I'm mostly neutral. |
How about:
|
Moving the check to right before the |
It does respect protection on both sides though and yes will allow a flame if the node beside the tnt is unprotected which should be fine. This is how I've done it in Fire Redo: https://codeberg.org/tenplus1/fire/src/branch/master/init.lua#L166 |
mods/fire/init.lua
Outdated
if minetest.is_protected(pointed_thing.under, player_name) then | ||
if minetest.is_protected(pointed_thing.under, player_name) | ||
or minetest.is_protected(pointed_thing.above, player_name) then | ||
minetest.chat_send_player(player_name, "This area is protected") | ||
return | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend firing on violation callbacks too, i.e.:
if minetest.is_protected(pointed_thing.under, player_name) then
minetest.record_protection_violation(pointed_thing.under, player_name)
return
elseif minetest.is_protected(pointed_thing.above, player_name) then
minetest.record_protection_violation(pointed_thing.above, player_name)
return
end
For most protection mods, they do the notification for you. Don't worry about the "This area is protected" message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thank you!
Yes, it can theoretically spread to the protected area but I think this problem is out of scope of the current patch since the patch addresses the specific behavior of "Flint and Steel" while spreading of fire isn't related to the tool. Also, many server owners disable spreading of fire for understandable reasons which will prevent fire enter a protected area through spreading, while this bug will still allow to place fire in an actual protected area.
As another solution - don't allow fire to cross the boundary from an unprotected to a protected area, or between two protected areas owned by different players, however it's controversial and requires additional discussion (for example, it could allow to cheat by protecting area around uncontrolled spreading fire). Also, it's unclear if it can be considered a bug at all, and players which play on servers where fire can spread should probably take it into account when building and protecting area.
The |
Thank you, I'll move the check to the latest condition since we don't need it when calling |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
It's currently possible to put fire in a protected area which is adjacent to a non-protected one. That's because when putting fire with a "Flint and Steel", it only checks the protection of the area in which the pointed node resides, but doesn't check the protection of the area, in which the fire will be actually put in. So, it's possible to put fire in a protected area if the pointed node at the same time resides in a non-protected one.