protector urban planning

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 » Wed Nov 04, 2015 12:35

[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
Attachments
protector_too_many_in_together.jpg
(105.73 KiB) Not downloaded yet
protector_detect_spamming.jpg
(131.78 KiB) Not downloaded yet
protector_upgrade1.jpg
(45.41 KiB) Not downloaded yet
Last edited by rnd on Sat Nov 07, 2015 20:45, edited 8 times in total.
1EvCmxbzl5KDu6XAunE1K853Lq6VVOsT
 

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

Re: protector urban planning

by orwell » Wed Nov 04, 2015 14:01

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:
https://forum.minetest.net/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: 3918
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: protector urban planning

by Sokomine » Wed Nov 04, 2015 16:58

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: 1350
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: protector urban planning

by maikerumine » Wed Nov 04, 2015 19:00

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.
 

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 » Wed Nov 04, 2015 20:15

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 » Sun Nov 08, 2015 12:55

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: 891
Joined: Sun Jul 31, 2011 11:23
Location: Ukraine
IRC: Fixer
In-game: Fixer

Re: protector urban planning

by Fixer » Sun Nov 08, 2015 13:25

-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 » Sun Nov 08, 2015 14:31

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: 2637
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: protector urban planning

by TenPlus1 » Sun Nov 08, 2015 14:34

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 » Sun Nov 08, 2015 15:15

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: 1350
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: protector urban planning

by maikerumine » Fri Nov 13, 2015 14:39

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
 

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

Re: protector urban planning

by ManElevation » Wed Jul 26, 2017 23:02

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


Return to WIP Mods



Who is online

Users browsing this forum: MSN [Bot], ThorfinnS and 5 guests