[Mod] Protector Redo [3.4] [protector]

Post Reply
amadin
Member
Posts: 549
Joined: Tue Jun 16, 2015 16:23

Re: [Mod] Protector Redo [1.8] [protector]

by amadin » Post

It does not prevent you to use colored glass blocks in a cblocks mod even more bug.

Image

For me the problem with transparent protector logo is not serious.

auouymous
Member
Posts: 195
Joined: Sun Dec 07, 2014 09:39
GitHub: auouymous
IRC: air
In-game: auouymous

Re: [Mod] Protector Redo [1.8] [protector]

by auouymous » Post

amadin wrote:It does not prevent you to use colored glass blocks in a cblocks mod even more bug. For me the problem with transparent protector logo is not serious.
Not a bug, just a missing feature in minetest. It could easily sort map blocks near to far and draw opaque geometry, then sort them far to near and draw semi-transparent geometry. That solves a lot of alpha rendering issues, and depth peeling (harder) would solve the rest.

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: [Mod] Protector Redo [1.9] [protector]

by TenPlus1 » Post

Updated to version 1.9

- Changed 'protector_pvp_spawn' setting to 'protector_spawn' so that server owners can protect area around static spawnpoint by setting a value above 0.
- Tweaked and tidied code

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: [Mod] Protector Redo [2.0] [protector]

by TenPlus1 » Post

Updated to version 2.0

- Added protector placement tool which lets players stand on a protector, face in a direction and place a new one using protector.radius to protect a larger area a lot more easily :) thanks Shara.

User avatar
firefox
Member
Posts: 1709
Joined: Wed Jan 14, 2015 07:34
In-game: Red_Fox
Location: Xanadu

Re: [Mod] Protector Redo [2.0] [protector]

by firefox » Post

TenPlus1 wrote:Updated to version 2.0

- Added protector placement tool which lets players stand on a protector, face in a direction and place a new one using protector.radius to protect a larger area a lot more easily :) thanks Shara.
woooooooot =(0.0)=

+100
✨🏳️‍🌈♣️✨

User avatar
iska
Member
Posts: 31
Joined: Thu Apr 23, 2015 17:19
In-game: iska
Location: Finland

Re: [Mod] Protector Redo [2.0] [protector]

by iska » Post

TenPlus1 wrote:Updated to version 2.0

- Added protector placement tool which lets players stand on a protector, face in a direction and place a new one using protector.radius to protect a larger area a lot more easily :) thanks Shara.
Hi Ten!

Just tested the new tool on local server, very impressive, we gonna love it so much, thanks Shara and TenPlus1! :)

Suggestions for improving:
Copy added players from original protection to newly created prots
Add vertical support for people with fly priv (makes sense?)
Maybe add 45 degree angles?
Any chance of adding logo-support?

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: [Mod] Protector Redo [2.0] [protector]

by TenPlus1 » Post

Update:

- Admin commands renamed to /protector_remove and /protector_replace

User avatar
Codesound
Member
Posts: 365
Joined: Thu Jun 09, 2016 14:56

Re: [Mod] Protector Redo [2.0] [protector]

by Codesound » Post

Hi,

sorry for my incompetence
, but I can not understand how to use this mod...
I would use it to protect the spawnpoint of my server and protect specific areas of my level....

- I simply placed the "protection Block" (to protect my area), (image 001);
- Right click on this "protection Block" to add my user name: no one except "username" can break anything in this area... (or not......? image 002);
- If I add another player name on this block, ie "Test 2", also Test 2 can break in this area... is correct?
- to modify the range of this area, I simply modified the "minetest.info"......

............... but certainly all wrong..........
anyone can help me understand how to use this mod?

Thanks for your support

R
Attachments
002.png
002.png (182.85 KiB) Viewed 1224 times
001.png
001.png (203.17 KiB) Viewed 1224 times

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: [Mod] Protector Redo [2.0] [protector]

by TenPlus1 » Post

Hi Codesound, placing a protector automatically has you as it's owner, so no-one can break or add anything to the area it protects (shown by the purple field when you punch it)... You can right-click the protector and add other players to the list so they can change that area also :)

If you are looking to protect a large spawn area then the mod has a setting you add to minetest.conf (usually for servers) which does just that:

Code: Select all

# set spawn point to 0,10,0
static_spawnpoint = 0,10,0
# protect 100 blocks around spawn
protector_spawn = 100
.. for more information check out the readme.md file:
https://github.com/tenplus1/protector/b ... /README.md

User avatar
Codesound
Member
Posts: 365
Joined: Thu Jun 09, 2016 14:56

Re: [Mod] Protector Redo [2.0] [protector]

by Codesound » Post

Hi,

I'm stupid!!! I try this mod on my server with others 3 players with all permissions.....

it is clear that they can break everything.... Thanks for your support!!!

R

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: [Mod] Protector Redo [2.0] [protector]

by TenPlus1 » Post

If any player has the 'protection_bypass' privelage then yes, protection wont stop them breaking/adding things.

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: [Mod] Protector Redo [2.0] [protector]

by TenPlus1 » Post

Updated:

- Protectors can no longer be moved by mesecon pistons.

User avatar
ExeterDad
Member
Posts: 1717
Joined: Sun Jun 01, 2014 20:00
In-game: ExeterDad
Location: New Hampshire U.S.A

Re: [Mod] Protector Redo [2.0] [protector]

by ExeterDad » Post

Just putting this out here. I see in past discussion a request for smaller sized pro blocks. I would also like to see this implemented if possible. I'm laying a huge amount of road on a server. These roads are to encourage building in a organized way. And of course for easy access for players. I really would like a block that has a radius that would exactly span the width of my roads so players can build right up to the roads without leaving a "undeveloped" gap that is protected by a oversized pro block. Our roads are seven blocks wide, so would require a radius of three. Having all the pro blocks set at that radius would result in the player having to set way too many pro blocks. Even the default radius of five (11 blocks) is a little small for players to protect properties in my opinion.

I have been working at implementing a custom pro block "road" node. I managed to get it to display properly when punched. But I can't get my mind around the code to work with the standard larger radius and my smaller "road radius". As a result I'm having to rewrite too much of your code and getting myself in deeper then I'm capable of :D

So any help would be appreciated. Whether it's the added feature... or hints of how I can add it myself.

Thanks :)

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: [Mod] Protector Redo [2.0] [protector]

by TenPlus1 » Post

We already have a setting for protection radius which the server/client can reduce to 3 if needed for intricate build protection, failing that a specialised node just for your road with a mini protection routine build in :)

ektor
Member
Posts: 79
Joined: Sat Sep 24, 2016 11:59
IRC: dtarcz
In-game: ektor
Contact:

Re: [Mod] Protector Redo [2.0] [protector]

by ektor » Post

Hi, your work is very much appreciate TenPlus1, and i enjoy playing in Xanadu :)

There is a question I find usefull, but seems you don't answer yet :
deadmenracing wrote:Excellent mod, thank you! Is there an easy way (...) to limit the number of protection blocks a player can put down? I'm seeing it overused a bit.
Can we configure that in the "minetest.conf" file? Or something to change in the code... and if yes, where?
Vive Minetest!

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: [Mod] Protector Redo [2.0] [protector]

by TenPlus1 » Post

I could look into that as a future feature maybe.

ektor
Member
Posts: 79
Joined: Sat Sep 24, 2016 11:59
IRC: dtarcz
In-game: ektor
Contact:

Re: [Mod] Protector Redo [2.0] [protector]

by ektor » Post

OK, thanks.
Vive Minetest!

User avatar
Codesound
Member
Posts: 365
Joined: Thu Jun 09, 2016 14:56

Re: [Mod] Protector Redo [2.0] [protector]

by Codesound » Post

Hi,

I really appreciate this mod, and I would have a request to improve it:

it is possible to add the possibility to set for each protector the size of the area that it protects?
In its menu that appears, you could add the ability to enter values ​​that correspond to the XYZ coordinates of protection for each block?

it's just a question....
many and many thanks for all!

R

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: [Mod] Protector Redo [2.0] [protector]

by TenPlus1 » Post

I could but checks like that would slow things down... Protector Redo does have a setting for the minetest.conf file however to set protected area size: protector_radius = 5

To protect specific areas of different sizes you could always try the Areas mod.

User avatar
poikilos
Member
Posts: 67
Joined: Thu Feb 18, 2016 13:45
GitHub: Poikilos
In-game: Poikilos

Re: [Mod] Protector Redo [2.0] [protector]

by poikilos » Post

Hello, I looked into this crash but the attached log doesn't help me pinpoint why it crashes. It happens when killing yourself (and possibly other death) by digging in a protected area with latest git version of Minetest server (and windows git build). It seems to be infinite recursion (same function called over and over, lua memory usage approaching 1GB).

NOTE: I made one change to your code to prevent a different crash. Please consider making this change permanent:
return protector.can_dig(1, pos, player:get_player_name(), true, 1)
to
return player and protector.can_dig(1, pos, player:get_player_name(), true, 1) or false
The change above fixes a nil player crash, but I'm not sure if it has other consequences or is related to the problem below.
I was not able to fix the crash below nor understand the cause using the debug output:


The debug output below is from a sitation in multiplayer that I couldn't replicate exactly (player names hidden for privacy):
(parts in between . . . lines were repeated many times)
Spoiler
2017-02-22 16:49:45: ACTION[Server]: Player j********** punched by player l**********, damage 8 HP
2017-02-22 16:49:45: ACTION[Server]: l********** punches object 70: player j**********
2017-02-22 16:49:45: ACTION[Server]: Player j********** punched by player l**********, damage 0 HP
2017-02-22 16:49:45: ACTION[Server]: l********** punches object 70: player j**********
2017-02-22 16:49:45: ACTION[Server]: Player j********** punched by player l**********, damage 0 HP
2017-02-22 16:49:45: ACTION[Server]: 1********** digs default:cobble at (141,-312,221)
2017-02-22 16:49:45: ACTION[Server]: l********** punches object 148: player b**********
2017-02-22 16:49:45: ACTION[Server]: Player b********** punched by player l**********, damage 0 HP
2017-02-22 16:49:45: ACTION[Server]: l********** punches object 148: player b**********
2017-02-22 16:49:45: ACTION[Server]: Player b********** punched by player l**********, damage 0 HP
2017-02-22 16:49:45: ACTION[Server]: l********** punches object 148: player b**********
2017-02-22 16:49:45: ACTION[Server]: Player b********** punched by player l**********, damage 3 HP
2017-02-22 16:49:45: ACTION[Server]: l********** punches object 148: player b**********
2017-02-22 16:49:45: ACTION[Server]: Player b********** punched by player l**********, damage 0 HP
2017-02-22 16:49:46: ACTION[Server]: l********** punches object 148: player b**********
2017-02-22 16:49:46: ACTION[Server]: Player b********** punched by player l**********, damage 8 HP
2017-02-22 16:49:46: ACTION[Server]: l********** punches object 148: player b**********
2017-02-22 16:49:46: ACTION[Server]: Player b********** punched by player l**********, damage 0 HP
2017-02-22 16:49:46: ACTION[Server]: l********** punches object 148: player b**********
2017-02-22 16:49:46: ACTION[Server]: Player b********** punched by player l**********, damage 0 HP
2017-02-22 16:49:46: ACTION[Server]: Player l********** tried to access [object 70] from too far: d=73.1352, max_d=40. ignoring.
2017-02-22 16:49:46: ACTION[Server]: Player l********** tried to access [object 70] from too far: d=72.2024, max_d=40. ignoring.
2017-02-22 16:49:48: ACTION[Server]: l********** punches object 148: player b**********
2017-02-22 16:49:48: ACTION[Server]: Player b********** punched by player l**********, damage 8 HP
. . .
2017-02-22 16:50:00: WARNING[Server]: Failed to add armor to bones node.
. . .
2017-02-22 16:50:06: ACTION[Main]: [fishing] Server shuts down. saving trophies table
. . .
2017-02-22 16:50:07: ERROR[Main]: ServerError: Lua: Runtime error from mod '' in callback on_dieplayer(): Runtime error from mod '' in callback on_dieplayer(): Runtime error from mod '' in callback on_dieplayer(): Runtime error from mod '' in callback on_dieplayer(): Runtime error from mo
. . .
2017-02-22 16:50:07: ERROR[Main]: k on_dieplayer(): Runtime error from mod '' in callback on_dieplayer(): Runtime error from mod '' in callback on_dieplayer(): Runtime error from mod '' in callback on_dieplayer(): OOM error from mod '' in callback on_dieplayer(): not enough memory
2017-02-22 16:50:07: ERROR[Main]: Current Lua memory usage: 964 MB
. . .
2017-02-22 16:50:07: ERROR[Main]: stack traceback:
2017-02-22 16:50:07: ERROR[Main]: [C]: in function 'set_hp'
2017-02-22 16:50:07: ERROR[Main]: ...cal/share/minetest/games/ENLIVEN/mods/protector/init.lua:279: in function 'is_protected'
2017-02-22 16:50:07: ERROR[Main]: /usr/local/share/minetest/games/ENLIVEN/mods/bones/init.lua:191: in function </usr/local/share/minetest/games/ENLIVEN/mods/bones/init.lua:162>
2017-02-22 16:50:07: ERROR[Main]: /usr/local/share/minetest/builtin/game/register.lua:412: in function </usr/local/share/minetest/builtin/game/register.lua:392>
2017-02-22 16:50:07: ERROR[Main]: [C]: in function 'set_hp'
2017-02-22 16:50:07: ERROR[Main]: ...cal/share/minetest/games/ENLIVEN/mods/protector/init.lua:279: in function 'is_protected'
2017-02-22 16:50:07: ERROR[Main]: /usr/local/share/minetest/games/ENLIVEN/mods/bones/init.lua:191: in function </usr/local/share/minetest/games/ENLIVEN/mods/bones/init.lua:162>
2017-02-22 16:50:07: ERROR[Main]: /usr/local/share/minetest/builtin/game/register.lua:412: in function </usr/local/share/minetest/builtin/game/register.lua:392>
2017-02-22 16:50:07: ERROR[Main]: [C]: in function 'set_hp'
2017-02-22 16:50:07: ERROR[Main]: ...cal/share/minetest/games/ENLIVEN/mods/protector/init.lua:279: in function 'is_protected'
2017-02-22 16:50:07: ERROR[Main]: ...
2017-02-22 16:50:07: ERROR[Main]: /usr/local/share/minetest/games/ENLIVEN/mods/bones/init.lua:191: in function </usr/local/share/minetest/games/ENLIVEN/mods/bones/init.lua:162>
2017-02-22 16:50:07: ERROR[Main]: /usr/local/share/minetest/builtin/game/register.lua:412: in function </usr/local/share/minetest/builtin/game/register.lua:392>
2017-02-22 16:50:07: ERROR[Main]: [C]: in function 'set_hp'
2017-02-22 16:50:07: ERROR[Main]: ...cal/share/minetest/games/ENLIVEN/mods/protector/init.lua:279: in function 'is_protected'
2017-02-22 16:50:07: ERROR[Main]: /usr/local/share/minetest/games/ENLIVEN/mods/bones/init.lua:191: in function </usr/local/share/minetest/games/ENLIVEN/mods/bones/init.lua:162>
2017-02-22 16:50:07: ERROR[Main]: /usr/local/share/minetest/builtin/game/register.lua:412: in function </usr/local/share/minetest/builtin/game/register.lua:392>
2017-02-22 16:50:07: ERROR[Main]: [C]: in function 'set_hp'
2017-02-22 16:50:07: ERROR[Main]: ...cal/share/minetest/games/ENLIVEN/mods/protector/init.lua:279: in function 'is_protected'
2017-02-22 16:50:07: ERROR[Main]: /usr/local/share/minetest/games/ENLIVEN/mods/bones/init.lua:191: in function </usr/local/share/minetest/games/ENLIVEN/mods/bones/init.lua:162>
2017-02-22 16:50:07: ERROR[Main]: /usr/local/share/minetest/builtin/game/register.lua:412: in function </usr/local/share/minetest/builtin/game/register.lua:392>
. . .
I generated the debug output below by killing myself by punching a protected dirt block over and over until I died (similar to above, but [only sometimes] involves may_replace])
(parts in between . . . lines were repeated many times--stack trace with set_hp error had may set_hp errors per stack trace, until the last stack trace had 1)
Spoiler
2017-02-22 17:19:14: ACTION[Server]: mrg2 tried to dig flowers:geranium at protected position (26,2,15)
2017-02-22 17:19:15: ACTION[Server]: mrg2 tried to dig flowers:geranium at protected position (26,2,15)
2017-02-22 17:19:15: ACTION[Server]: mrg2 tried to dig flowers:geranium at protected position (26,2,15)
2017-02-22 17:19:16: ACTION[Server]: mrg2 tried to dig flowers:geranium at protected position (26,2,15)
. . .
2017-02-22 17:19:27: WARNING[Server]: Failed to add armor to bones node.
. . .
2017-02-22 17:19:27: ACTION[Main]: [fishing] Server shuts down. saving trophies table
. . .
2017-02-22 17:19:28: ERROR[Main]: ServerError: Lua: Runtime error from mod '3d_armor' in callback node_on_dig(): Runtime error from mod '3d_armor' in callback on_dieplayer(): Runtime error from mod '3d_armor' in callback on_dieplayer(): Runtime error from mod '3d_armor' in callback on_die
. . .
2017-02-22 17:19:28: ERROR[Main]: llback on_dieplayer(): Runtime error from mod '3d_armor' in callback on_dieplayer(): OOM error from mod '3d_armor' in callback on_dieplayer(): not enough memory
2017-02-22 17:19:28: ERROR[Main]: Current Lua memory usage: 968 MB
. . .
2017-02-22 17:19:49: ERROR[Main]: stack traceback:
2017-02-22 17:19:49: ERROR[Main]: [C]: in function 'set_hp'
2017-02-22 17:19:49: ERROR[Main]: ...cal/share/minetest/games/ENLIVEN/mods/protector/init.lua:279: in function 'is_protected'
2017-02-22 17:19:49: ERROR[Main]: /usr/local/share/minetest/games/ENLIVEN/mods/bones/init.lua:148: in function 'may_replace'
2017-02-22 17:19:49: ERROR[Main]: /usr/local/share/minetest/games/ENLIVEN/mods/bones/init.lua:189: in function </usr/local/share/minetest/games/ENLIVEN/mods/bones/init.lua:162>
2017-02-22 17:19:49: ERROR[Main]: /usr/local/share/minetest/builtin/game/register.lua:412: in function </usr/local/share/minetest/builtin/game/register.lua:392>
2017-02-22 17:19:49: ERROR[Main]: [C]: in function 'set_hp'
2017-02-22 17:19:49: ERROR[Main]: ...cal/share/minetest/games/ENLIVEN/mods/protector/init.lua:279: in function 'is_protected'
2017-02-22 17:19:49: ERROR[Main]: /usr/local/share/minetest/builtin/game/item.lua:452: in function </usr/local/share/minetest/builtin/game/item.lua:443>
. . .

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: [Mod] Protector Redo [2.0] [protector]

by TenPlus1 » Post

Thanks expertmm, change has been applied to git code.

User avatar
poikilos
Member
Posts: 67
Joined: Thu Feb 18, 2016 13:45
GitHub: Poikilos
In-game: Poikilos

Re: [Mod] Protector Redo [2.0] [protector]

by poikilos » Post

Ok I seemed to have fixed the set_hp infinite recursion bug by adding the following checks before continuing the not protector.can_dig case in the is_protected function (I'm not actually sure why it would be infinite recursion otherwise). I came upon this solution because one of the errors was regarding set_hp and below makes sure digger is really a player before we process protector violations for digger (make sure you add "end" directly before return true as in the code below, so that protected status will return even if digger is not a player):

Code: Select all

	-- is area protected against digger?
	if not protector.can_dig(protector.radius, pos, digger, false, 1) then
		local player = minetest.get_player_by_name(digger)
		if player and player:is_player() and player:get_hp() > 0 then -- ADDED THIS LINE
			-- hurt player if protection violated

                        ------- process all of those violations (no change to this part of code except indent) -------
		end  -- ADDED THIS LINE
		return true
	end

	-- otherwise can dig or place

As you can see, only two lines of code were added in the code above:

Code: Select all

if player and player:is_player() and player:get_hp() > 0 then
and

Code: Select all

end
(the "end" before "return true")
--the other code is just shown for placement.

And here is a debug version (You can safely insert this debug code before the "if player" line above in order to show some helpful info):
Spoiler
(the debug version below provides the information that the digger is not nil, but blank (that isn't a problem though, and the actual problem is fixed by either the above version or the version below). This case was used after "get_player_by_name" as opposed to wrapping the checks after that in the if statement above, and is only for debugging purposes:

Code: Select all

		if player then
			if not player:is_player() then
				print(player:get_player_name() .. " tried to dig in a protected area but was not a player")
				player = nil
			elseif player:get_hp() <= 0 then
				print(player:get_player_name() .. " tried to dig in a protected area but was dead")
				player = nil
			end
		else
			if digger then
				print(digger .. " tried to dig in a protected area but was not able to be found in the player table")
			else
				print("<nil> tried to dig in a protected area but this is impossible")
			end
		end
I also added some debug output to bones/init.lua after drop(pos, ItemStack("bones:bones"))

Code: Select all

minetest.log("action", "[bones] " .. player:get_player_name() .. "'s bones do not remain since area is_protected -- died at " .. minetest.pos_to_string(pos))
sample output:
mrg2 tried to dig in a protected area but was dead
mrg2 tried to dig in a protected area but was dead
ACTION[Main]: [bones] mrg's bones do not remain since area is_protected -- died at 27,2,11
2017-02-22 22:20:16: ACTION[Server]: mrg2 respawns at (-1,10,-1)
2017-02-22 22:20:16: WARNING[Server]: Failed to add armor to bones node.
tried to dig in a protected area but was not able to be found in the player table
. . . [that "tried to dig" line with a blank but non-nil digger string repeats a couple times a minute or so, but I expect that is normal for some reason--ABMs in protected areas I suppose]
You can also remove all of the "and player" checks now (unless using the debug version without the real fix afterward which wraps the violation processing) and move the "then" to the previous line, since player is checked before any violations are processed.

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: [Mod] Protector Redo [2.0] [protector]

by TenPlus1 » Post

expertmm: Player check added with some changes... I would recommend joining github so you can post issues and pull requests there :)

User avatar
Hybrid Dog
Member
Posts: 2828
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: [Mod] Protector Redo [2.0] [protector]

by Hybrid Dog » Post

Please save the date, accuracy in seconds, to the meta when someone places a protector. It allows admins to remove old protector nodes of specific people.

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: [Mod] Protector Redo [2.0] [protector]

by TenPlus1 » Post

We already have a /protector_remove command to handle removal of player protectors.

Post Reply

Who is online

Users browsing this forum: Google [Bot], Renaud and 20 guests