mirror of
				https://github.com/sys4-fr/server-nalc.git
				synced 2025-10-30 20:15:33 +01:00 
			
		
		
		
	[markers] Update
This commit is contained in:
		| @@ -92,22 +92,36 @@ markers.get_area_list_formspec = function(ppos, player, mode, pos, mode_data, se | ||||
|  | ||||
|    -- show only areas that do not have parents | ||||
|    elseif( mode=='main_areas' ) then | ||||
|       title  = 'All main areas:'; | ||||
|       title  = 'All main areas withhin '..tostring( markers.AREA_RANGE )..' m:'; | ||||
|       tlabel = '*all main areas*'; | ||||
|       for id, area in pairs(areas.areas) do | ||||
|  | ||||
|          if( not( area.parent )) then | ||||
|          if( not( area.parent ) | ||||
|            -- ppos is always available | ||||
|            and(   (area.pos1.x >= ppos.x-markers.AREA_RANGE and area.pos1.x <= ppos.x+markers.AREA_RANGE ) | ||||
|                 or(area.pos2.x >= ppos.x-markers.AREA_RANGE and area.pos2.x <= ppos.x+markers.AREA_RANGE )) | ||||
|            and(   (area.pos1.y >= ppos.y-markers.AREA_RANGE and area.pos1.y <= ppos.y+markers.AREA_RANGE ) | ||||
|                 or(area.pos2.y >= ppos.y-markers.AREA_RANGE and area.pos2.y <= ppos.y+markers.AREA_RANGE )) | ||||
|            and(   (area.pos1.z >= ppos.z-markers.AREA_RANGE and area.pos1.z <= ppos.z+markers.AREA_RANGE ) | ||||
|                 or(area.pos2.z >= ppos.z-markers.AREA_RANGE and area.pos2.z <= ppos.z+markers.AREA_RANGE ))) then | ||||
|             table.insert( id_list, id ); | ||||
|          end | ||||
|       end | ||||
|  | ||||
|  | ||||
|    elseif( mode=='all' ) then | ||||
|       title  = 'All areas:'; | ||||
|       title  = 'All areas withhin '..tostring( markers.AREA_RANGE )..' m:'; | ||||
|       tlabel = '*all areas*'; | ||||
|  | ||||
|       for id, area in pairs(areas.areas) do | ||||
|          table.insert( id_list, id ); | ||||
|          if(  (   (area.pos1.x >= ppos.x-markers.AREA_RANGE and area.pos1.x <= ppos.x+markers.AREA_RANGE ) | ||||
|                 or(area.pos2.x >= ppos.x-markers.AREA_RANGE and area.pos2.x <= ppos.x+markers.AREA_RANGE )) | ||||
|            and(   (area.pos1.y >= ppos.y-markers.AREA_RANGE and area.pos1.y <= ppos.y+markers.AREA_RANGE ) | ||||
|                 or(area.pos2.y >= ppos.y-markers.AREA_RANGE and area.pos2.y <= ppos.y+markers.AREA_RANGE )) | ||||
|            and(   (area.pos1.z >= ppos.z-markers.AREA_RANGE and area.pos1.z <= ppos.z+markers.AREA_RANGE ) | ||||
|                 or(area.pos2.z >= ppos.z-markers.AREA_RANGE and area.pos2.z <= ppos.z+markers.AREA_RANGE ))) then | ||||
|             table.insert( id_list, id ); | ||||
|          end | ||||
|       end | ||||
|    end | ||||
|  | ||||
| @@ -504,9 +518,9 @@ markers.form_input_handler_areas = function( player, formname, fields) | ||||
|       minetest.chat_send_player( pname, 'Area successfully renamed.'); | ||||
|       -- shwo the renamed area | ||||
|       formspec = markers.get_area_desc_formspec( menu_data.selected, player, menu_data.pos ); | ||||
|   | ||||
|  | ||||
|  | ||||
|  | ||||
|     | ||||
|    -- change owner the area | ||||
|    elseif( fields.change_owner | ||||
|           and menu_data.selected | ||||
| @@ -666,9 +680,9 @@ markers.form_input_handler_areas = function( player, formname, fields) | ||||
|          formspec = markers.get_area_list_formspec(ppos, player, 'player',   menu_data.pos, old_owner, nil ); | ||||
|       end | ||||
|  | ||||
|     | ||||
|  | ||||
|  | ||||
|    elseif( fields.show_parent | ||||
|    elseif( fields.show_parent  | ||||
|           and menu_data.selected | ||||
|           and areas.areas[ menu_data.selected ] | ||||
|           and areas.areas[ menu_data.selected ].parent ) then | ||||
|   | ||||
							
								
								
									
										36
									
								
								mods/markers/config.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								mods/markers/config.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
|  | ||||
| -- stores up to 4 marker positions for each player | ||||
| markers.positions = {} | ||||
|  | ||||
| -- store the positions of that many markers for each player (until server restart) | ||||
| markers.MAX_MARKERS  = 50; | ||||
|  | ||||
| -- the protection against digging of the marker by other players expires after this time | ||||
| markers.EXPIRE_AFTER = 60*60*24; | ||||
|  | ||||
| -- self-protected areas can not get higher than 100 blocks | ||||
| markers.MAX_HEIGHT   = 100; | ||||
|  | ||||
| -- only areas up to this size (in square meters) can be protected | ||||
| markers.MAX_SIZE     = 1024; -- 32m * 32m = 1024 m^2 | ||||
|  | ||||
| -- show only areas withhin this range when showing the list of ALL areas | ||||
| -- (else it does get too crowded on multiplayer servers) | ||||
| -- set to something >60000 in order to view all areas; set to a smaller | ||||
| -- value (i.e. 500) on multiplayer servers with many protected areas | ||||
|  | ||||
| if(     #areas.areas > 1000 ) then | ||||
| 	markers.AREA_RANGE   = 100; | ||||
| elseif( #areas.areas > 100 ) then | ||||
| 	markers.AREA_RANGE   = 1000; | ||||
| else | ||||
| 	markers.AREA_RANGE   = 100000; | ||||
| end | ||||
|  | ||||
| -- for most cases, the default values ought to work | ||||
| --markers.AREA_RANGE   = 100000; | ||||
|  | ||||
| if( io.open(minetest.get_worldpath().."/markers_settings.txt","r")) then | ||||
| 	io.close() | ||||
| 	dofile(minetest.get_worldpath().."/markers_settings.txt") | ||||
| end | ||||
| @@ -5,26 +5,9 @@ | ||||
|  | ||||
| markers = {} | ||||
|  | ||||
| -- stores up to 4 marker positions for each player | ||||
| markers.positions = {} | ||||
|  | ||||
| -- store the positions of that many markers for each player (until server restart) | ||||
| markers.MAX_MARKERS  = 50; | ||||
|  | ||||
| -- the protection against digging of the marker by other players expires after this time | ||||
| markers.EXPIRE_AFTER = 60*60*24; | ||||
|  | ||||
| -- self-protected areas can not get higher than 100 blocks | ||||
| markers.MAX_HEIGHT   = 100; | ||||
|  | ||||
| -- only areas up to this size (in square meters) can be protected | ||||
| markers.MAX_SIZE     = 1024; -- 32m * 32m = 1024 m^2 | ||||
|  | ||||
|  | ||||
| dofile(minetest.get_modpath("markers").."/config.lua"); | ||||
| dofile(minetest.get_modpath("markers").."/areas.lua"); | ||||
|  | ||||
| dofile(minetest.get_modpath("markers").."/marker_stone.lua"); | ||||
|  | ||||
| dofile(minetest.get_modpath("markers").."/land_title_register.lua"); | ||||
|  | ||||
|  | ||||
| @@ -331,8 +314,8 @@ markers.get_marker_formspec = function(player, pos, error_msg) | ||||
|                     "button_exit[2,6.0;2,0.5;abort;OK]"; | ||||
|     else | ||||
|        formspec =   formspec.. | ||||
|                     'label[0.5,2.0;Buying this area will cost you ]'.. | ||||
|                     'label[4.7,2.0;'..markers.calculate_area_price_text( coords[1], coords[2], name )..'.]'.. | ||||
| --                    'label[0.5,2.0;Buying this area will cost you ]'.. | ||||
| --                    'label[4.7,2.0;'..markers.calculate_area_price_text( coords[1], coords[2], name )..'.]'.. | ||||
|  | ||||
|                     'label[0.5,3.0;Your area ought to go..]'.. | ||||
|                     'label[0.5,3.5;this many blocks up:]'.. | ||||
| @@ -348,7 +331,7 @@ markers.get_marker_formspec = function(player, pos, error_msg) | ||||
|  | ||||
|                     "button_exit[2,6.0;2,0.5;abort;Abort]".. | ||||
|                     -- code the position in the "Buy area" field | ||||
|                     "button_exit[6,6.0;2,0.5;"..minetest.pos_to_string(pos)..";Buy area]"; | ||||
|                     "button_exit[6,6.0;2,0.5;"..minetest.pos_to_string(pos)..";Protect area]"; | ||||
|     end | ||||
|  | ||||
|    return formspec; | ||||
| @@ -469,7 +452,7 @@ markers.form_input_handler = function( player, formname, fields) | ||||
|       --- decode the position of the marker (which is hidden in the Buy-buttons name | ||||
|       local pos = {}; | ||||
|       for k, v in pairs( fields ) do | ||||
|          if( v == 'Buy area' ) then | ||||
|          if( v == 'Protect area' ) then | ||||
|             pos = minetest.string_to_pos( k ); | ||||
|          end | ||||
|       end | ||||
|   | ||||
		Reference in New Issue
	
	Block a user