protector urban planning

Post Reply
User avatar
rnd
Member
Posts: 220
Joined: Sun Dec 28, 2014 12:24
GitHub: ac-minetest
IRC: ac_minetest
In-game: rnd

protector urban planning

by rnd » Post

[Mod] Protector urban planning [protect]

Makes living near areas with more player activity more expensive, as in large urban centers life is more expensive
by making placing the protectors more expensive. This mod is meant as experiment to see how well it will work in real gameplay. As such it needs tweaking of several paramaters.
Based on glomie's protector mod, remade by Zeg9 and reworked by https://github.com/tenplus1/protector. Urban planning features added by rnd.

Code: WTFPL
Mod dependencies: default

Download: https://github.com/ac-minetest/protecto ... anning.git

Detailed description
Spoiler

Urban planning features(short)


Placing protectors is expensive around spawn (more centers can be added). Placing several protectors at one place makes that place expensive. You can place protector in expensive place but after 5 minutes it can be dug up by anyone.

detailed features:

set up several centers around which placing protectors is costly ( requires upgrade )
upon placing/digging protectors a network of protectors is built and counts of all nearby protectors is updated
if certain protector count is exceeded in the network placing new protectors requires upgrade. If protector is placed far away from existing network new network is formed with its own count
protector requiring upgrade has no owner and can be dug up by everyone 5 minutes after place, before that only by placer
upon upgrade ( paying it with enough mese crystals ) the ownership is assigned to player who completed upgrade
INSTALLATION: extract into directory called "protector" inside minetest mod directory

screenshots

upgrade needed
Image

detect when too many protectors around (right protector doesnt require upgrade cause of proper distance from network, top protector is too close and needs upgrade)
Image

adding one more
Image
Attachments
protector_too_many_in_together.jpg
protector_too_many_in_together.jpg (105.73 KiB) Viewed 718 times
protector_detect_spamming.jpg
protector_detect_spamming.jpg (131.78 KiB) Viewed 718 times
protector_upgrade1.jpg
protector_upgrade1.jpg (45.41 KiB) Viewed 718 times
Last edited by rnd on Sat Nov 07, 2015 20:45, edited 8 times in total.
1EvCmxbzl5KDu6XAunE1K853Lq6VVOsT

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: protector urban planning

by orwell » Post

Hello.

Is this mod a re-written version of glomie's/Zeg9s/TenPlus1s protector mod or do I understand something wrong?
If so, maybe you could depend on their mod so that you don't always have to integrate their updates into your version.
But I don't know how far this is useful, it could maybe just save work.

Another thing: Can you please update your topic to the Forum Guidelines in this thread:
viewtopic.php?f=11&t=1271
This would simplify the process of pushing this mod into Mod Releases.

Anyway, it sounds interesting and useful. As I have never used a node based protector mod like this on a server (i have my own), I probably will not use this. But it could be a useful addition to some servers around.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

Sokomine
Member
Posts: 4290
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: protector urban planning

by Sokomine » Post

Having the core area of a city as a more expensive place does sound like a good idea. Space around spawn is more valuable. It ought to contain good buildings and offer space for shops and basic storage needs for all players intrested (if necessary in skyscrapers). If new protectors added to an area where there are lots of protectors already, expanding cities on the outside - where there's usually enough space for doing so - might also become more expensive. That's not so good.

If you want to do something with this mod, why not improve it? Protecting a large area could be done either by placing the protectors out of the player's inventory with a command, or by adding an areas based protection mod so that the protector spam currently needed could be avoided.

The system LinuxGaming employs is what I like most: Valuable space around spawn is sold for ingame currency (which can be obtained by selling stacks of cobble). Space elsewhere can just be protected normally. That helps to keep ugly cobble buildings lower (you can sell it instead of making the landscape uglier) and also makes people consider what they're going to build on those expensive plots.
A list of my mods can be found here.

User avatar
maikerumine
Member
Posts: 1420
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: protector urban planning

by maikerumine » Post

I like this idea, it is up for testing on both ESM CHAOS and Extreme Survival servers.

To add one pro block near spawn, it costs 0ver 700 mese! O_o I may fudge the numbers a bit.
Talamh Survival Minetest-->viewtopic.php?f=10&t=12959

User avatar
rnd
Member
Posts: 220
Joined: Sun Dec 28, 2014 12:24
GitHub: ac-minetest
IRC: ac_minetest
In-game: rnd

Re: protector urban planning

by rnd » Post

Simple tweak can enable protecting large areas with no restrictions to protector count if far away from centers of activity. Its still possible to protect large areas with no extra cost, just not it one piece but in several medium sized regions limited by protector count. Its designed in such a way there will be enough space between regions for roads ( if player avoids upgrading ).

This mod makes it possible for protector costs to evolve on its own based on protector placements by players, without admin interference. If you are very rich you can for example make a big region with lot of protectors to protect close to you, should discourage "casual" griefing too.
1EvCmxbzl5KDu6XAunE1K853Lq6VVOsT

User avatar
rnd
Member
Posts: 220
Joined: Sun Dec 28, 2014 12:24
GitHub: ac-minetest
IRC: ac_minetest
In-game: rnd

Re: protector urban planning

by rnd » Post

updates:
-more expensive updates with increasing protector counts inside city center ( quadratic ), less expensive outside 2x city radius (default 2*75=150 blocks)
-not updated protector now gives temporary protection for 5 minutes. After that it can be dug up by everyone
-digging your updated protector gives you temporary bonus ( "get your money back") to be used in next upgrade
-building permit: owner of protector with most "counts" can upgrade your protector for free. And no, you cant give yourself permit :)


All this offers interesting gameplay, you can for example play "protector wars", to hinder other player by making his area "expensive" (each time you update protector all counts of nearby protectors are increased by 1). This mod is best used with mese crystal farm mod by rba since with lot of protectors you will need lot of mese.
1EvCmxbzl5KDu6XAunE1K853Lq6VVOsT

User avatar
Fixer
Member
Posts: 904
Joined: Sun Jul 31, 2011 11:23
IRC: Fixer
In-game: Fixer
Location: Ukraine

Re: protector urban planning

by Fixer » Post

-not updated protector now gives temporary protection for 5 minutes. After that it can be dug up by everyone
This is controversial. I don't like this change, you need to pay a lot of attention to not loose your protector to a griefer.

User avatar
rnd
Member
Posts: 220
Joined: Sun Dec 28, 2014 12:24
GitHub: ac-minetest
IRC: ac_minetest
In-game: rnd

Re: protector urban planning

by rnd » Post

Fixerol wrote:
-not updated protector now gives temporary protection for 5 minutes. After that it can be dug up by everyone
This is controversial. I don't like this change, you need to pay a lot of attention to not loose your protector to a griefer.
You get a very clear chat message " PROTECTOR: please right click me to UPGRADE or punch to DIG me."
also you will immediately see the problem cause the owner is set to ""
1EvCmxbzl5KDu6XAunE1K853Lq6VVOsT

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

Re: protector urban planning

by TenPlus1 » Post

I feel that you are over-complicating a simple mod, so why not make the protector recipe expensive so that players have to work hard to gain protection.

User avatar
rnd
Member
Posts: 220
Joined: Sun Dec 28, 2014 12:24
GitHub: ac-minetest
IRC: ac_minetest
In-game: rnd

Re: protector urban planning

by rnd » Post

because:
1. you hurt new players with high price, they start placing locked chests everywhere, locked doors, leave server after house griefed..
2. doesnt stop spammers
3. doesnt stop griefers placing protector near your house to annoy you
4. boring
1EvCmxbzl5KDu6XAunE1K853Lq6VVOsT

User avatar
maikerumine
Member
Posts: 1420
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: protector urban planning

by maikerumine » Post

I hate to be a bother...

I figured out why the servers crash all the time now: BUT it is NOT reproducible

Code: Select all

	[C]: in function 'set_hp'
	...TE\bin\..\games\extreme_survival\mods\protector\init.lua:147: in function 'can_dig'
	...TE\bin\..\games\extreme_survival\mods\protector\init.lua:208: in function 'is_protected'
	...R-LITE\bin\..\games\extreme_survival\mods\bones\init.lua:140: in function 'may_replace'
	...R-LITE\bin\..\games\extreme_survival\mods\bones\init.lua:162: in function <...R-LITE\bin\..\games\extreme_survival\mods\bones\init.lua:143>
	D:\MTSERVER-LITE\bin\..\builtin\game\register.lua:355: in function <D:\MTSERVER-LITE\bin\..\builtin\game\register.lua:335>
	[C]: in function 'set_hp'
	...TE\bin\..\games\extreme_survival\mods\protector\init.lua:147: in function 'can_dig'
	...TE\bin\..\games\extreme_survival\mods\protector\init.lua:456: in function <...TE\bin\..\games\extreme_survival\mods\protector\init.lua:455>
stack traceback:
	[C]: in function 'set_hp'
	...TE\bin\..\games\extreme_survival\mods\protector\init.lua:147: in function 'can_dig'
	...TE\bin\..\games\extreme_survival\mods\protector\init.lua:456: in function <...TE\bin\..\games\extreme_survival\mods\protector\init.lua:455>
Your protector when someone dies their bones are not allowed to be placed or dug?

BONES PROBLEM:

Code: Select all

minetest.register_on_dieplayer(function(player)
	if minetest.setting_getbool("creative_mode") then
		return
	end
	
	local player_inv = player:get_inventory()
	if player_inv:is_empty("main") and
		player_inv:is_empty("craft") then
		return
	end

	local pos = player:getpos()
	pos.x = math.floor(pos.x+0.5)
	pos.y = math.floor(pos.y+0.5)
	pos.z = math.floor(pos.z+0.5)
	local param2 = minetest.dir_to_facedir(player:get_look_dir())
	local player_name = player:get_player_name()
	local player_inv = player:get_inventory()

	if (not may_replace(pos, player)) then
		if (may_replace({x=pos.x, y=pos.y+1, z=pos.z}, player)) then
			-- drop one node above if there's space
			-- this should solve most cases of protection related deaths in which players dig straight down
			-- yet keeps the bones reachable
			pos.y = pos.y+1
		else
			-- drop items instead of delete
			for i=1,player_inv:get_size("main") do
				minetest.add_item(pos, player_inv:get_stack("main", i))
			end
			for i=1,player_inv:get_size("craft") do
				minetest.add_item(pos, player_inv:get_stack("craft", i))
			end
			-- empty lists main and craft
			player_inv:set_list("main", {})
			player_inv:set_list("craft", {})
			return
		end
	end
	
Protector Problem:
line 147 = player:set_hp(0);

Code: Select all

local positions = minetest.find_nodes_in_area(
		{x = pos.x - r, y = pos.y - r, z = pos.z - r},
		{x = pos.x + r, y = pos.y + r, z = pos.z + r},
		{"protector:protect"})

	local meta, owner, members
	for _, pos in ipairs(positions) do
		meta = minetest.get_meta(pos)
		owner = meta:get_string("owner")
		members = meta:get_string("members")

		if owner ~= digger then
			if onlyowner or not protector.is_member(meta, digger) then

				if infolevel == 1 then
					minetest.chat_send_player(digger,
					"This area is owned by " .. owner .. " !")

					local warn = meta:get_int("warn");local kill = meta:get_int("kill");
					local player = minetest.get_player_by_name(digger);
					if kill==1 then
						player:set_hp(0);
						minetest.after(1, function()
							local inv = player:get_inventory();
							inv:set_list("main", {});inv:set_list("craft", {})
						end)
						minetest.chat_send_player(digger, "PROTECTOR: You died inside protected area at " .. minetest.pos_to_string(pos) .. ". Next time try not to dig or hit players.");
					return false end
					if warn==1 then
						local form = "size [2,2] textarea[0,0;2.7,2;help;WARNING;This area belongs to " .. meta:get_string("owner") .."]" ..
						"button_exit[0.5,1.5;1.5,1;close;Close]"
						minetest.show_formspec(digger, "protector_warn", form)
						return false
					end

				elseif infolevel == 2 then
					minetest.chat_send_player(digger,
					"This area is owned by " .. owner .. ".")
					minetest.chat_send_player(digger,
					"Protection located at: " .. minetest.pos_to_string(pos) .. ", upgrade price was " .. meta:get_int("cost") .. ", protector count is " .. meta:get_int("count"))
					if members ~= "" then
						minetest.chat_send_player(digger,
						"Members: " .. members .. ".")
					end
				end

				return false
			end
		end
and protector line 208:

Code: Select all

	if not protector.can_dig(protector.radius, pos, digger, false, 1) then
		return true
	end

	return protector.old_is_protected(pos, digger)

end
Talamh Survival Minetest-->viewtopic.php?f=10&t=12959

User avatar
ManElevation
Member
Posts: 896
Joined: Tue Aug 02, 2016 22:04
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation
Location: Madrid,Spain

Re: protector urban planning

by ManElevation » Post

This a really smart Idea!
My Public Mods! Discord: Rottweiler Games#3368

Post Reply

Who is online

Users browsing this forum: No registered users and 60 guests