fixed treedecay
|
@ -378,7 +378,7 @@ minetest.register_abm({
|
|||
end
|
||||
})
|
||||
|
||||
--[[ disabled till i can get around the tree being in 2 chunks and dieing
|
||||
--
|
||||
-- treedecay
|
||||
--
|
||||
|
||||
|
@ -411,7 +411,7 @@ minetest.register_abm({
|
|||
minetest.get_node(pos1).name == "default:tree" or minetest.get_node(pos1).name == "default:tree_gen" or
|
||||
minetest.get_node(pos1).name == "default:jungletree" or minetest.get_node(pos1).name == "default:jungletree_gen" or
|
||||
minetest.get_node(pos1).name == "default:acaciatree" or minetest.get_node(pos1).name == "default:acaciatree_gen" or
|
||||
minetest.get_node(pos1).name == "default:acaciatree_t" or
|
||||
minetest.get_node(pos1).name == "default:acaciatree_t" or minetest.get_node(pos1).name == "ignore"
|
||||
minetest.get_node(pos1).name == "default:desert_sand" or minetest.get_item_group(node_under.name, "tree") > 0 then
|
||||
return
|
||||
else
|
||||
|
@ -429,5 +429,5 @@ minetest.register_abm({
|
|||
end
|
||||
end
|
||||
end
|
||||
})]]--
|
||||
})
|
||||
|
||||
|
|
|
@ -6,7 +6,11 @@ minetest.register_on_newplayer(function(player)
|
|||
player:get_inventory():add_item('main', 'default:torch 99')
|
||||
player:get_inventory():add_item('main', 'default:axe_steel')
|
||||
player:get_inventory():add_item('main', 'default:shovel_steel')
|
||||
player:get_inventory():add_item('main', 'default:cobble 99')
|
||||
player:get_inventory():add_item('main', 'default:cobble 80')
|
||||
player:get_inventory():add_item('main', 'default:wood 160')
|
||||
player:get_inventory():add_item('main', 'landclaim 2')
|
||||
player:get_inventory():add_item('main', 'default:locked_chest 4')
|
||||
player:get_inventory():add_item('main', 'default:apple 5')
|
||||
end
|
||||
end)
|
||||
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
Code license: GNU LGPL version 2
|
||||
|
||||
Image license: CC Attribution-ShareAlike 3.0
|
||||
|
||||
Plugin dependencies: none (bucket, default, and fire are supported, however)
|
||||
|
||||
|
||||
This is a fork of 0gb.us' landclaim mod http://forum.minetest.net/viewtopic.php?id=3679.
|
||||
|
||||
|
||||
Imagine the entire map is divided into chunks. You place your land rush land claim block and it protects that chunk (then the land claim block disappears).
|
||||
|
||||
Chunk size is configurable, default is 16x16. There are three stages of vertical protection:
|
||||
-30 thru 120
|
||||
|
||||
120 thru vertical map limit,
|
||||
|
||||
-200 thru -30.
|
||||
|
||||
This is a partial protection mod. This is intended for PvP type maps.
|
||||
|
||||
1) Your areas are fully protected if you are offline.
|
||||
|
||||
2) You are not protected if you are online, but you will receive chat messages when somebody starts to grief one of your protected areas. Anybody you have shared the area with will also be notified. The griefer also gets a chat message that they are griefing in case it's an accident. This way you can initiate a conversation with the griefer or go and fight them.
|
||||
|
||||
|
||||
There are two modes for this Mod
|
||||
|
||||
1) You are required to claim areas you wish the build on. You cannot dig or build in unclaimed areas. The exception to this are ladders, you can place and dig ladders in unclaimed areas to get yourself out of a hole or something like that. With this mode you really have to give people a few land rush land claim blocks when they first log in. Edit init.lua and change requireClaim = true to use this mode.
|
||||
|
||||
2) Anybody can dig or build in unclaimed areas. Edit init.lua and change requireClaim = false to use this mode.
|
||||
|
||||
Craft Recipe
|
||||
|
||||
S = Stone
|
||||
|
||||
I = Steel Ingot
|
||||
|
||||
M = Mese / Mese Crystal
|
||||
|
||||
S I S
|
||||
|
||||
I M I
|
||||
|
||||
S I S
|
||||
|
||||
Chat Commands
|
||||
|
||||
/showarea - Draws a box around the current chunk you are in
|
||||
|
||||
/landowner - shows the current owner of the chunk you are in
|
||||
|
||||
/unclaim - remove your claim on the current chunk you are in
|
||||
|
||||
/sharearea <name> - shares the area with <name>
|
||||
|
||||
/unsharearea <name> - removes <name> from the share
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
if minetest.get_modpath("bucket") then
|
||||
minetest.register_craftitem(":bucket:bucket_empty", {
|
||||
description = "Emtpy bucket",
|
||||
inventory_image = "bucket.png",
|
||||
stack_max = 1,
|
||||
liquids_pointable = true,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
-- Must be pointing to node
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
end
|
||||
-- Check if pointing to a liquid source
|
||||
n = minetest.env:get_node(pointed_thing.under)
|
||||
liquiddef = bucket.liquids[n.name]
|
||||
if liquiddef ~= nil and liquiddef.source == n.name and liquiddef.itemname ~= nil then
|
||||
local player = user:get_player_name()
|
||||
if landrush.can_interact(pointed_thing.under, player) then
|
||||
minetest.env:add_node(pointed_thing.under, {name="air"})
|
||||
return {name=liquiddef.itemname}
|
||||
else
|
||||
owner = landrush.get_owner(pointed_thing.under)
|
||||
minetest.chat_send_player(user:get_player_name(), "Area owned by "..owner)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
for key, value in pairs(bucket.liquids) do
|
||||
if minetest.registered_items[value.itemname].on_use then
|
||||
local item = minetest.registered_items[value.itemname]
|
||||
local on_use = item.on_use
|
||||
function item.on_use(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
end
|
||||
n = minetest.env:get_node(pointed_thing.under)
|
||||
local player = user:get_player_name()
|
||||
if minetest.registered_nodes[n.name].buildable_to then
|
||||
if landrush.can_interact(pointed_thing.under, player) then
|
||||
return on_use(itemstack, user, pointed_thing)
|
||||
else
|
||||
minetest.chat_send_player(player, "Area owned by "..landrush.get_owner(pointed_thing.above))
|
||||
end
|
||||
else
|
||||
if landrush.can_interact(pointed_thing.above, player) then
|
||||
return on_use(itemstack, user, pointed_thing)
|
||||
else
|
||||
minetest.chat_send_player(player, "Area owned by "..landrush.get_owner(pointed_thing.above))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,203 @@
|
|||
|
||||
minetest.register_chatcommand("landowner", {
|
||||
params = "",
|
||||
description = "tells the owner of the current map chunk",
|
||||
privs = {interact=true},
|
||||
func = function(name, param)
|
||||
local player = minetest.env:get_player_by_name(name)
|
||||
local pos = player:getpos()
|
||||
local owner = landrush.get_owner(pos)
|
||||
if owner then
|
||||
minetest.chat_send_player(name, "This area is owned by "..owner)
|
||||
else
|
||||
minetest.chat_send_player(name, "This area is unowned.")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("userunclaim", {
|
||||
params = "player",
|
||||
privs = {landrush=true},
|
||||
description = "Unclaims all of a players areas",
|
||||
func = function(name, param)
|
||||
qdone = 0
|
||||
for k,v in pairs(landrush.claims) do
|
||||
if landrush.claims[k].owner == param then
|
||||
landrush.claims[k] = nil
|
||||
qdone = qdone + 1
|
||||
end
|
||||
end
|
||||
landrush.save_claims()
|
||||
minetest.chat_send_player(name,tostring(qdone).." claims unclaims for "..param)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("unclaim", {
|
||||
params = "",
|
||||
description = "unclaims the current map chunk",
|
||||
privs = {interact=true},
|
||||
func = function(name, param)
|
||||
local player = minetest.env:get_player_by_name(name)
|
||||
local pos = player:getpos()
|
||||
local owner = landrush.get_owner(pos)
|
||||
local inv = player:get_inventory()
|
||||
if owner then
|
||||
if owner == name or minetest.check_player_privs(name, {landrush=true}) then
|
||||
chunk = landrush.get_chunk(pos)
|
||||
landrush.claims[chunk] = nil
|
||||
landrush.save_claims()
|
||||
minetest.chat_send_player(name, "You renounced your claim on this area.")
|
||||
else
|
||||
minetest.chat_send_player(name, "This area is owned by "..owner)
|
||||
end
|
||||
else
|
||||
minetest.chat_send_player(name, "This area is unowned.")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("sharearea", {
|
||||
params = "<name> or *all to retain ownership but allow anyone to build",
|
||||
description = "shares the current map chunk with <name>",
|
||||
privs = {interact=true},
|
||||
func = function(name, param)
|
||||
local player = minetest.env:get_player_by_name(name)
|
||||
local pos = player:getpos()
|
||||
local owner = landrush.get_owner(pos)
|
||||
if owner then
|
||||
if ( owner == name and name ~= param ) or minetest.check_player_privs(name, {landrush=true}) then
|
||||
if minetest.env:get_player_by_name(param) or param=="*all" then
|
||||
landrush.claims[landrush.get_chunk(pos)].shared[param] = param
|
||||
landrush.save_claims()
|
||||
minetest.chat_send_player(name, param.." may now edit this area.")
|
||||
minetest.chat_send_player(param, name.." has just shared an area with you.")
|
||||
else
|
||||
minetest.chat_send_player(name, param.." is not a valid player.")
|
||||
end
|
||||
else
|
||||
minetest.chat_send_player(name, "This area is owned by "..owner)
|
||||
end
|
||||
else
|
||||
minetest.chat_send_player(name, "This area is unowned.")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("unsharearea", {
|
||||
params = "<name>",
|
||||
description = "unshares the current map chunk with <name>",
|
||||
privs = {interact=true},
|
||||
func = function(name, param)
|
||||
local player = minetest.env:get_player_by_name(name)
|
||||
local pos = player:getpos()
|
||||
local owner = landrush.get_owner(pos)
|
||||
if owner then
|
||||
if owner == name or minetest.check_player_privs(name, {landrush=true}) then
|
||||
if name ~= param then
|
||||
landrush.claims[landrush.get_chunk(pos)].shared[param] = nil
|
||||
landrush.save_claims()
|
||||
minetest.chat_send_player(name, param.." may no longer edit this area.")
|
||||
minetest.chat_send_player(param, name.." has just revoked your editing privileges in an area.")
|
||||
else
|
||||
minetest.chat_send_player(name, 'Use "/unclaim" to unclaim the area.')
|
||||
end
|
||||
else
|
||||
minetest.chat_send_player(name, "This area is owned by "..owner)
|
||||
end
|
||||
else
|
||||
minetest.chat_send_player(name, "This area is unowned.")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("mayedit", {
|
||||
params = "",
|
||||
description = "lists the people who may edit the current map chunk",
|
||||
privs = {interact=true},
|
||||
func = function(name, param)
|
||||
local player = minetest.env:get_player_by_name(name)
|
||||
local pos = player:getpos()
|
||||
local mayedit = landrush.get_owner(pos)
|
||||
if mayedit then
|
||||
local chunk = landrush.get_chunk(pos)
|
||||
for user, user in pairs(landrush.claims[chunk].shared) do
|
||||
mayedit = mayedit..", "..user
|
||||
end
|
||||
minetest.chat_send_player(name, mayedit)
|
||||
else
|
||||
minetest.chat_send_player(name, "This area is unowned.")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("showarea", {
|
||||
params = "",
|
||||
description = "highlights the boundaries of the current protected area",
|
||||
privs = {interact=true},
|
||||
func = function(name, param)
|
||||
local player = minetest.env:get_player_by_name(name)
|
||||
local pos = player:getpos()
|
||||
local entpos = landrush.get_chunk_center(pos)
|
||||
entpos.y = (pos.y-1)
|
||||
minetest.env:add_entity(entpos, "landrush:showarea")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("shareall", {
|
||||
params = "<name>",
|
||||
description = "shares all your landclaims with <name>",
|
||||
privs = {interact=true},
|
||||
func = function(name, param)
|
||||
|
||||
if minetest.env:get_player_by_name(param) then
|
||||
local qdone = 0
|
||||
for k,v in pairs(landrush.claims) do
|
||||
if landrush.claims[k].owner == name then
|
||||
landrush.claims[k].shared[param] = param
|
||||
qdone = qdone + 1
|
||||
end
|
||||
end
|
||||
|
||||
landrush.save_claims()
|
||||
|
||||
if qdone > 0 then
|
||||
minetest.chat_send_player(name, param.." may now edit all of your areas.")
|
||||
minetest.chat_send_player(name, qdone.." total areas were shared.")
|
||||
minetest.chat_send_player(param, name.." has just shared all of their areas with you.")
|
||||
else
|
||||
minetest.chat_send_player(name, param.." was not given any permissions. You may not own any land.")
|
||||
end
|
||||
else
|
||||
minetest.chat_send_player(name, param.." is not a valid player. Player must be online to share.")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("unshareall", {
|
||||
params = "<name>",
|
||||
description = "unshares all your landclaims with <name>",
|
||||
privs = {interact=true},
|
||||
func = function(name, param)
|
||||
if name ~= param then
|
||||
local qdone = 0
|
||||
for k,v in pairs(landrush.claims) do
|
||||
if landrush.claims[k].owner == name then
|
||||
landrush.claims[k].shared[param] = nil
|
||||
qdone = qdone + 1
|
||||
end
|
||||
end
|
||||
|
||||
landrush.save_claims()
|
||||
|
||||
if qdone > 0 then
|
||||
minetest.chat_send_player(name, param.." may no longer edit any of your areas.")
|
||||
minetest.chat_send_player(name, qdone.." total areas were unshared.")
|
||||
minetest.chat_send_player(param, name.." has just unshared all of their areas with you.")
|
||||
else
|
||||
minetest.chat_send_player(name, param.." had no permissions being revoked. You may not own any land.")
|
||||
end
|
||||
else
|
||||
minetest.chat_send_player(name, 'Use "/unclaim" to unclaim any of your areas.')
|
||||
end
|
||||
end,
|
||||
})
|
|
@ -0,0 +1,109 @@
|
|||
-- add a special chest that is shared among the land-possesors
|
||||
|
||||
minetest.register_node("landrush:shared_chest", {
|
||||
description = "Land Rush Shared Chest",
|
||||
tiles = {"landrush_shared_chest_top.png", "landrush_shared_chest_top.png", "landrush_shared_chest_side.png", "landrush_shared_chest_side.png", "landrush_shared_chest_side.png", "landrush_shared_chest_front.png"},
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,tubedevice=1,tubedevice_receiver=1},
|
||||
paramtype2 = "facedir",
|
||||
legacy_facedir_simple = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("main")
|
||||
end,
|
||||
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec",default.chest_formspec)
|
||||
meta:set_string("infotext", "Shared Chest")
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if not landrush.can_interact(pos,player:get_player_name()) then
|
||||
minetest.log("action", player:get_player_name() .. " tried to access a shared chest at ".. minetest.pos_to_string(pos))
|
||||
return 0
|
||||
end
|
||||
return count
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if not landrush.can_interact(pos,player:get_player_name()) then
|
||||
minetest.log("action", player:get_player_name() .. " tried to access a shared chest at ".. minetest.pos_to_string(pos))
|
||||
return 0
|
||||
end
|
||||
return stack:get_count()
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if not landrush.can_interact(pos,player:get_player_name()) then
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" tried to access a shared chest at "..
|
||||
minetest.pos_to_string(pos))
|
||||
return 0
|
||||
end
|
||||
return stack:get_count()
|
||||
end,
|
||||
|
||||
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" moves stuff in shared chest at "..minetest.pos_to_string(pos))
|
||||
end,
|
||||
|
||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" puts stuff into shared chest at "..minetest.pos_to_string(pos))
|
||||
end,
|
||||
|
||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" takes stuff from shared chest at "..minetest.pos_to_string(pos))
|
||||
end,
|
||||
|
||||
tube = {
|
||||
insert_object = function(pos, node, stack, direction)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local inventory = meta:get_inventory()
|
||||
return inventory:add_item("main",stack)
|
||||
end,
|
||||
|
||||
can_insert = function(pos, node, stack, direction)
|
||||
local meta=minetest.env:get_meta(pos)
|
||||
local inventory = meta:get_inventory()
|
||||
return inventory:room_for_item("main",stack)
|
||||
end,
|
||||
input_inventory="main",
|
||||
connect_sides = {left=1, right=1, back=1, top=1, bottom=1},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'landrush:shared_chest',
|
||||
recipe = {
|
||||
{'group:wood','group:wood','group:wood'},
|
||||
{'group:wood','landrush:landclaim','group:wood'},
|
||||
{'group:wood','group:wood','group:wood'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'landrush:shared_chest',
|
||||
recipe = {
|
||||
{'landrush:landclaim'},
|
||||
{'default:chest'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'landrush:shared_chest',
|
||||
recipe = {
|
||||
{'landrush:landclaim'},
|
||||
{'default:chest_locked'}
|
||||
}
|
||||
})
|
|
@ -0,0 +1,46 @@
|
|||
landrush.claimFile = worldpath.."/landrush-claims"
|
||||
landrush.claims = {}
|
||||
|
||||
function landrush.load_claims()
|
||||
local file = io.open(landrush.claimFile, "r")
|
||||
if file then
|
||||
for line in file:lines() do
|
||||
if line ~= "" then
|
||||
local area = line:split(" ")
|
||||
local shared = {}
|
||||
if area[3] and area[3] ~= "*" then
|
||||
for k,v in ipairs(area[3]:split(",")) do
|
||||
shared[v] = v
|
||||
end
|
||||
end
|
||||
local claimtype
|
||||
if area[4] then
|
||||
claimtype = area[4]
|
||||
else
|
||||
claimtype = "landrush:landclaim"
|
||||
end
|
||||
landrush.claims[area[1]] = {owner=area[2], shared=shared, claimtype=claimtype}
|
||||
end
|
||||
end
|
||||
file:close()
|
||||
end
|
||||
end
|
||||
|
||||
function landrush.save_claims()
|
||||
local file = io.open(landrush.claimFile, "w")
|
||||
for key,value in pairs(landrush.claims) do
|
||||
local sharedata = ""
|
||||
for k,v in pairs(value.shared) do
|
||||
sharedata = sharedata..v..","
|
||||
end
|
||||
local sharestring
|
||||
if sharedata == "" then
|
||||
sharestring = "*"
|
||||
else
|
||||
sharestring = sharedata:sub(1,-2)
|
||||
end
|
||||
file:write(key.." "..value.owner.." "..sharestring.." "..value.claimtype.."\n")
|
||||
end
|
||||
file:close()
|
||||
end
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
-- copied config section from technic
|
||||
worldpath = minetest.get_worldpath()
|
||||
|
||||
landrush.config = Settings(worldpath.."/landrush.conf")
|
||||
|
||||
local conf_table = landrush.config:to_table()
|
||||
|
||||
local defaults = {
|
||||
requireClaim = "false",
|
||||
onlineProtection = "true",
|
||||
offenseDamage = "1",
|
||||
autoBan = "false",
|
||||
banLevel = "40",
|
||||
banWarning = "40",
|
||||
offenseReset = "1440",
|
||||
adminUser = nil,
|
||||
chunkSize = "16",
|
||||
enableHud = "true",
|
||||
noBanTime = 240,
|
||||
noDamageTime = 600
|
||||
}
|
||||
|
||||
for k, v in pairs(defaults) do
|
||||
if conf_table[k] == nil then
|
||||
landrush.config:set(k, v)
|
||||
end
|
||||
end
|
||||
|
||||
-- Create the config file if it doesn't exist
|
||||
landrush.config:write()
|
||||
|
||||
-- These are items that can be dug in unclaimed areas when landrush.config:get_bool("requireClaim") is true
|
||||
landrush.global_dig_list = {["default:ladder"]=true,["default:leaves"]=true,["default:tree"]=true,["default:grass"]=true,["default:grass_1"]=true,["default:grass_2"]=true,["default:grass_3"]=true,["default:grass_4"]=true}
|
||||
|
||||
if minetest.get_modpath("whoison") then
|
||||
landrush.whoison=true
|
||||
else
|
||||
landrush.whoison=false
|
||||
end
|
|
@ -0,0 +1,45 @@
|
|||
if minetest.get_modpath("default") then
|
||||
minetest.register_node(":default:sign_wall", {
|
||||
description = "Sign",
|
||||
drawtype = "signlike",
|
||||
tiles = {"default_sign_wall.png"},
|
||||
inventory_image = "default_sign_wall.png",
|
||||
wield_image = "default_sign_wall.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
--wall_top = <default>
|
||||
--wall_bottom = <default>
|
||||
--wall_side = <default>
|
||||
},
|
||||
groups = {choppy=2,dig_immediate=2},
|
||||
legacy_wallmounted = true,
|
||||
sounds = default.node_sound_defaults(),
|
||||
on_construct = function(pos)
|
||||
--local n = minetest.env:get_node(pos)
|
||||
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
meta:set_string("formspec", "hack:sign_text_input")
|
||||
meta:set_string("infotext", "\"\"")
|
||||
end,
|
||||
on_receive_fields = function(pos, formname, fields, sender)
|
||||
--print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
|
||||
local name = sender:get_player_name()
|
||||
if landrush.can_interact(pos, name) then
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
fields.text = fields.text or ""
|
||||
print((name or "").." wrote \""..fields.text..
|
||||
"\" to sign at "..minetest.pos_to_string(pos))
|
||||
meta:set_string("text", fields.text)
|
||||
meta:set_string("infotext", '"'..fields.text..'"')
|
||||
else
|
||||
local owner = landrush.get_owner(pos)
|
||||
minetest.chat_send_player(name, "Area owned by "..owner)
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
whoison?
|
||||
doors
|
|
@ -0,0 +1,28 @@
|
|||
if minetest.get_modpath("doors") then
|
||||
function landrush.protect_against_door(door)
|
||||
local definition = minetest.registered_items[door]
|
||||
local on_place = definition.on_place
|
||||
function definition.on_place(itemstack, placer, pointed_thing)
|
||||
local bottom = pointed_thing.above
|
||||
local top = {x=pointed_thing.above.x, y=pointed_thing.above.y+1, z=pointed_thing.above.z}
|
||||
local name = placer:get_player_name()
|
||||
if landrush.can_interact(top,name) and landrush.can_interact(bottom, name) then
|
||||
return on_place(itemstack, placer, pointed_thing)
|
||||
else
|
||||
topowner = landrush.get_owner(top)
|
||||
bottomowner = landrush.get_owner(bottom)
|
||||
if topowner and bottomowner and topowner ~= bottomowner then
|
||||
minetest.chat_send_player(name, "Area owned by "..topowner.." and "..bottomowner)
|
||||
elseif topowner then
|
||||
minetest.chat_send_player(name, "Area owned by "..topowner)
|
||||
else
|
||||
minetest.chat_send_player(name, "Area owned by "..bottomowner)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
landrush.protect_against_door("doors:door_wood")
|
||||
landrush.protect_against_door("doors:door_steel")
|
||||
end
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
if minetest.get_modpath("fire") then
|
||||
landrush.default_flame_should_extinguish = fire.flame_should_extinguish
|
||||
|
||||
function fire.flame_should_extinguish(pos)
|
||||
corner0 = landrush.can_interact({x=pos.x-1,y=pos.y-1,z=pos.z-1},"-!-")
|
||||
corner1 = landrush.can_interact({x=pos.x-1,y=pos.y-1,z=pos.z+1},"-!-")
|
||||
corner2 = landrush.can_interact({x=pos.x-1,y=pos.y+1,z=pos.z-1},"-!-")
|
||||
corner3 = landrush.can_interact({x=pos.x-1,y=pos.y+1,z=pos.z+1},"-!-")
|
||||
corner4 = landrush.can_interact({x=pos.x+1,y=pos.y-1,z=pos.z-1},"-!-")
|
||||
corner5 = landrush.can_interact({x=pos.x+1,y=pos.y-1,z=pos.z+1},"-!-")
|
||||
corner6 = landrush.can_interact({x=pos.x+1,y=pos.y+1,z=pos.z-1},"-!-")
|
||||
corner7 = landrush.can_interact({x=pos.x+1,y=pos.y+1,z=pos.z+1},"-!-")
|
||||
if corner0 and corner1 then
|
||||
return landrush.default_flame_should_extinguish(pos)
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
function landrush.get_chunk(pos)
|
||||
local x = math.floor(pos.x/landrush.config:get("chunkSize"))
|
||||
-- 3 levels of vertical protection
|
||||
local y = 0
|
||||
|
||||
if ( pos.y < -200 ) then
|
||||
y = - 32000
|
||||
elseif ( pos.y < -60 ) then
|
||||
y = -200
|
||||
elseif ( pos.y < 140 ) then
|
||||
y = -30
|
||||
else
|
||||
y = 90
|
||||
end
|
||||
|
||||
|
||||
local z = math.floor(pos.z/landrush.config:get("chunkSize"))
|
||||
return x..","..y..","..z
|
||||
end
|
||||
|
||||
function landrush.get_chunk_center(pos)
|
||||
local x = math.floor(pos.x/landrush.config:get("chunkSize"))*landrush.config:get("chunkSize")+7.5
|
||||
local y = 0
|
||||
|
||||
if ( pos.y < -200 ) then
|
||||
y = - 32000
|
||||
elseif ( pos.y < -60 ) then
|
||||
y = -200
|
||||
elseif ( pos.y < 120 ) then
|
||||
y = -30
|
||||
else
|
||||
y = 120
|
||||
end
|
||||
|
||||
local z = math.floor(pos.z/landrush.config:get("chunkSize"))*landrush.config:get("chunkSize")+7.5
|
||||
return {x=x,y=y,z=z}
|
||||
end
|
||||
|
||||
function landrush.get_owner(pos)
|
||||
local chunk = landrush.get_chunk(pos)
|
||||
if landrush.claims[chunk] then
|
||||
return landrush.claims[chunk].owner
|
||||
end
|
||||
end
|
||||
|
||||
function landrush.get_distance(pos1,pos2)
|
||||
if ( pos1 ~= nil and pos2 ~= nil ) then
|
||||
return math.abs(math.floor(math.sqrt( (pos1.x - pos2.x)^2 + (pos1.z - pos2.z)^2 )))
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
function landrush.get_timeonline(name)
|
||||
-- a wrapper for whoison.getTimeOnline since whoison is an optional dependancy
|
||||
if ( landrush.whoison == true ) then
|
||||
return (whoison.getTimeOnline(name) / 60)
|
||||
else
|
||||
return -1
|
||||
end
|
||||
end
|
|
@ -0,0 +1,40 @@
|
|||
landrush.gstepCount = 0
|
||||
landrush.playerHudItems = {}
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
landrush.gstepCount = landrush.gstepCount + dtime
|
||||
if ( landrush.gstepCount > 2 ) then
|
||||
landrush.gstepCount=0
|
||||
local oplayers = minetest.get_connected_players()
|
||||
for _,player in ipairs(oplayers) do
|
||||
local name = player:get_player_name()
|
||||
local sameowner = false
|
||||
owner = landrush.get_owner(player:getpos())
|
||||
|
||||
if ( landrush.playerHudItems[name] ~= nil ) then
|
||||
if ( landrush.playerHudItems[name].lastowner == owner ) then
|
||||
-- same owner as last time don't update the hud
|
||||
sameowner = true
|
||||
end
|
||||
end
|
||||
|
||||
if ( landrush.playerHudItems[name] ~= nil and sameowner == false ) then
|
||||
player:hud_remove(landrush.playerHudItems[name].hud)
|
||||
landrush.playerHudItems[name] = nil
|
||||
end
|
||||
|
||||
if ( owner ~= nil and sameowner == false ) then
|
||||
--minetest.log('action','Redraw hud for '..name)
|
||||
landrush.playerHudItems[name] = {hud = player:hud_add({
|
||||
hud_elem_type = "text",
|
||||
name = "LandOwner",
|
||||
number = 0xFFFFFF,
|
||||
position = {x=.2, y=.98},
|
||||
text="Land Owner: "..owner,
|
||||
scale = {x=200,y=25},
|
||||
alignment = {x=0, y=0},
|
||||
}), lastowner=owner}
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,121 @@
|
|||
minetest.log('action','Loading Land Rush Land Claim')
|
||||
|
||||
-- Freeminer Compatibility
|
||||
if freeminer then
|
||||
minetest = freeminer
|
||||
end
|
||||
|
||||
landrush = {}
|
||||
|
||||
local path = minetest.get_modpath("landrush")
|
||||
|
||||
dofile(path.."/config.lua")
|
||||
dofile(path.."/functions.lua")
|
||||
dofile(path.."/claims.lua")
|
||||
dofile(path.."/protection.lua")
|
||||
dofile(path.."/shared_door.lua")
|
||||
--dofile(path.."/chest.lua")
|
||||
dofile(path.."/sign.lua")
|
||||
|
||||
if ( landrush.config:get_bool("enableHud") ) then
|
||||
dofile(path.."/hud.lua")
|
||||
end
|
||||
|
||||
minetest.register_privilege("landrush", "Allows player to dig and build anywhere, and use the landrush chat commands.")
|
||||
|
||||
landrush.load_claims()
|
||||
|
||||
minetest.register_node("landrush:landclaim", {
|
||||
description = "Land Rush Land Claim",
|
||||
tiles = {"landrush_landclaim.png"},
|
||||
groups = {oddly_breakable_by_hand=2},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
owner = landrush.get_owner(pointed_thing.above)
|
||||
player = placer:get_player_name()
|
||||
|
||||
if player:find("[gG]uest") then
|
||||
minetest.chat_send_player(player,"Guests cannot claim land")
|
||||
return itemstack
|
||||
end
|
||||
|
||||
if ( pointed_thing.above.y < -2000 ) then
|
||||
minetest.chat_send_player(player,"You cannot claim below -2000")
|
||||
return itemstack
|
||||
end
|
||||
|
||||
if owner then
|
||||
minetest.chat_send_player(player, "This area is already owned by "..owner)
|
||||
else
|
||||
minetest.env:remove_node(pointed_thing.above)
|
||||
chunk = landrush.get_chunk(pointed_thing.above)
|
||||
landrush.claims[chunk] = {owner=placer:get_player_name(),shared={},claimtype="landclaim"}
|
||||
landrush.save_claims()
|
||||
minetest.chat_send_player(landrush.claims[chunk].owner, "You now own this area.")
|
||||
itemstack:take_item()
|
||||
return itemstack
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'landrush:landclaim',
|
||||
recipe = {
|
||||
{'default:steel_ingot', 'default:steel_ingot','default:steel_ingot'},
|
||||
{'default:steel_ingot', 'default:coal_block', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'default:steel_ingot','default:steel_ingot'}
|
||||
}
|
||||
})
|
||||
minetest.register_alias("landclaim", "landrush:landclaim")
|
||||
minetest.register_alias("landrush:landclaim_b","landrush:landclaim")
|
||||
|
||||
|
||||
minetest.register_entity("landrush:showarea",{
|
||||
on_activate = function(self, staticdata, dtime_s)
|
||||
minetest.after(16,function()
|
||||
self.object:remove()
|
||||
end)
|
||||
end,
|
||||
initial_properties = {
|
||||
hp_max = 1,
|
||||
physical = true,
|
||||
weight = 0,
|
||||
collisionbox = {
|
||||
landrush.config:get("chunkSize")/-2,
|
||||
landrush.config:get("chunkSize")/-2,
|
||||
landrush.config:get("chunkSize")/-2,
|
||||
landrush.config:get("chunkSize")/2,
|
||||
landrush.config:get("chunkSize")/2,
|
||||
landrush.config:get("chunkSize")/2,
|
||||
},
|
||||
visual = "mesh",
|
||||
visual_size = {
|
||||
x=landrush.config:get("chunkSize")+0.1,
|
||||
y=landrush.config:get("chunkSize")+0.1
|
||||
},
|
||||
mesh = "landrush_showarea.x",
|
||||
textures = {nil, nil, "landrush_showarea.png", "landrush_showarea.png", "landrush_showarea.png", "landrush_showarea.png"}, -- number of required textures depends on visual
|
||||
colors = {}, -- number of required colors depends on visual
|
||||
spritediv = {x=1, y=1},
|
||||
initial_sprite_basepos = {x=0, y=0},
|
||||
is_visible = true,
|
||||
makes_footstep_sound = false,
|
||||
automatic_rotate = false,
|
||||
}
|
||||
})
|
||||
|
||||
if ( minetest.get_modpath("money2") ) then
|
||||
minetest.log('action','Loading Landrush Land Sale')
|
||||
dofile(path.."/landsale.lua")
|
||||
end
|
||||
|
||||
minetest.after(0, function ()
|
||||
|
||||
dofile(path.."/default.lua")
|
||||
--dofile(path.."/bucket.lua")
|
||||
dofile(path.."/doors.lua")
|
||||
dofile(path.."/fire.lua")
|
||||
dofile(path.."/chatcommands.lua")
|
||||
dofile(path.."/screwdriver.lua")
|
||||
--dofile(path.."/snow.lua")
|
||||
|
||||
end )
|
|
@ -0,0 +1,96 @@
|
|||
|
||||
minetest.register_node("landrush:sale_block",{
|
||||
description="Landrush Sale Block",
|
||||
tiles={"landrush_sale_block.png"},
|
||||
groups = {crumbly=2,snappy=2,oddly_breakable_by_hand=2},
|
||||
drop = "landrush:sale_block",
|
||||
|
||||
after_place_node = function (pos, placer)
|
||||
local name = placer:get_player_name()
|
||||
local owner = landrush.get_owner(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if ( name == owner ) then
|
||||
meta:set_int("price",0)
|
||||
meta:set_string("infotext", "For sale by "..owner)
|
||||
meta:set_string("note","")
|
||||
meta:set_string("formspec", landrush.sell_formspec(pos, placer))
|
||||
else
|
||||
meta:set_string("infotext","Not for sale")
|
||||
minetest.chat_send_player(name,"You can't sell a claim you don't own")
|
||||
end
|
||||
end,
|
||||
|
||||
on_punch = function (pos, node, puncher)
|
||||
-- do the sale -- maybe a are you sure formspec?
|
||||
local name = puncher:get_player_name()
|
||||
local owner = landrush.get_owner(pos)
|
||||
if ( name ~= owner and owner ~= nil ) then
|
||||
local meta = minetest.get_meta(pos)
|
||||
local price = meta:get_int("price")
|
||||
|
||||
if ( price == 0 ) then
|
||||
minetest.chat_send_player(name,'Land Sale setup not complete')
|
||||
return
|
||||
end
|
||||
|
||||
if ( money.get(name) >= price ) then
|
||||
local transfer = money.transfer(name,owner,price)
|
||||
if ( transfer == nil ) then
|
||||
chunk = landrush.get_chunk(pos)
|
||||
landrush.claims[chunk] = {owner=name,shared={},claimtype='landclaim'}
|
||||
landrush.save_claims()
|
||||
minetest.chat_send_player(landrush.claims[chunk].owner, "You now own this claim.")
|
||||
minetest.remove_node(pos)
|
||||
|
||||
if ( chatplus ) then
|
||||
table.insert(chatplus.players[owner].messages,"mail from <LandRush>: "..name.." has bought your claim at "..minetest.pos_to_string(pos).." for "..tostring(price))
|
||||
end
|
||||
|
||||
else
|
||||
minetest.chat_send_player(name,"Money transfer failed: "..transfer)
|
||||
end
|
||||
else
|
||||
minetest.chat_send_player(name,"You do not have enough to purchase this claim")
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
on_receive_fields = function ( pos, formname, fields, sender )
|
||||
--process formspec
|
||||
local name = sender:get_player_name()
|
||||
local owner = landrush.get_owner(pos)
|
||||
if ( name == owner ) then
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("price",fields.price)
|
||||
meta:set_string("note",fields.note)
|
||||
meta:set_string("infotext","For sale by "..owner.." for " .. tostring(fields.price) .." "..fields.note)
|
||||
meta:set_string("formspec",landrush.sell_formspec(pos,sender))
|
||||
else
|
||||
minetest.chat_send_player(name,"You can't configure this sale!")
|
||||
end
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "landrush:sale_block",
|
||||
recipe = {
|
||||
{"","group:wood","group:wood"},
|
||||
{"","group:wood",""},
|
||||
{"group:wood","group:wood",""}
|
||||
}
|
||||
})
|
||||
|
||||
function landrush.sell_formspec(pos,player)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local price = meta:get_int("price")
|
||||
local note = meta:get_string("note")
|
||||
|
||||
local formspec = "size[4,6;]"
|
||||
.."label[0,0;Setup Sale]"
|
||||
.."field[.25,2;2,1;price;Sale Price;"..price.."]"
|
||||
.."field[.25,4;4,1;note;Notes;"..note.."]"
|
||||
.."button_exit[.75,5;2,1;save;Save]"
|
||||
|
||||
return formspec
|
||||
end
|
After Width: | Height: | Size: 12 KiB |
|
@ -0,0 +1,220 @@
|
|||
xof 0303txt 0032
|
||||
|
||||
Frame Root {
|
||||
FrameTransformMatrix {
|
||||
1.000000, 0.000000, 0.000000, 0.000000,
|
||||
0.000000, 0.000000, 1.000000, 0.000000,
|
||||
0.000000, 1.000000,-0.000000, 0.000000,
|
||||
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||
}
|
||||
Frame Cube {
|
||||
FrameTransformMatrix {
|
||||
5.000000, 0.000000, 0.000000, 0.000000,
|
||||
0.000000, 5.000000, 0.000000, 0.000000,
|
||||
0.000000, 0.000000, 5.000000, 0.000000,
|
||||
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||
}
|
||||
Mesh { //Cube_001 Mesh
|
||||
48;
|
||||
-1.000000; 1.000000;-1.000000;,
|
||||
-1.000000;-1.000000;-1.000000;,
|
||||
1.000000;-1.000000;-1.000000;,
|
||||
1.000000; 1.000000;-1.000000;,
|
||||
0.999999;-1.000001; 1.000000;,
|
||||
-1.000000;-1.000000; 1.000000;,
|
||||
-1.000000; 1.000000; 1.000000;,
|
||||
1.000000; 0.999999; 1.000000;,
|
||||
1.000000;-1.000000;-1.000000;,
|
||||
0.999999;-1.000001; 1.000000;,
|
||||
1.000000; 0.999999; 1.000000;,
|
||||
1.000000; 1.000000;-1.000000;,
|
||||
-1.000000;-1.000000;-1.000000;,
|
||||
-1.000000;-1.000000; 1.000000;,
|
||||
0.999999;-1.000001; 1.000000;,
|
||||
1.000000;-1.000000;-1.000000;,
|
||||
-1.000000; 1.000000;-1.000000;,
|
||||
-1.000000; 1.000000; 1.000000;,
|
||||
-1.000000;-1.000000; 1.000000;,
|
||||
-1.000000;-1.000000;-1.000000;,
|
||||
-1.000000; 1.000000; 1.000000;,
|
||||
-1.000000; 1.000000;-1.000000;,
|
||||
1.000000; 1.000000;-1.000000;,
|
||||
1.000000; 0.999999; 1.000000;,
|
||||
1.000000;-1.000000;-1.000000;,
|
||||
-1.000000;-1.000000;-1.000000;,
|
||||
-1.000000; 1.000000;-1.000000;,
|
||||
1.000000; 1.000000;-1.000000;,
|
||||
-1.000000; 1.000000; 1.000000;,
|
||||
-1.000000;-1.000000; 1.000000;,
|
||||
0.999999;-1.000001; 1.000000;,
|
||||
1.000000; 0.999999; 1.000000;,
|
||||
1.000000; 0.999999; 1.000000;,
|
||||
0.999999;-1.000001; 1.000000;,
|
||||
1.000000;-1.000000;-1.000000;,
|
||||
1.000000; 1.000000;-1.000000;,
|
||||
0.999999;-1.000001; 1.000000;,
|
||||
-1.000000;-1.000000; 1.000000;,
|
||||
-1.000000;-1.000000;-1.000000;,
|
||||
1.000000;-1.000000;-1.000000;,
|
||||
-1.000000;-1.000000; 1.000000;,
|
||||
-1.000000; 1.000000; 1.000000;,
|
||||
-1.000000; 1.000000;-1.000000;,
|
||||
-1.000000;-1.000000;-1.000000;,
|
||||
1.000000; 1.000000;-1.000000;,
|
||||
-1.000000; 1.000000;-1.000000;,
|
||||
-1.000000; 1.000000; 1.000000;,
|
||||
1.000000; 0.999999; 1.000000;;
|
||||
12;
|
||||
4;0;1;2;3;,
|
||||
4;4;5;6;7;,
|
||||
4;8;9;10;11;,
|
||||
4;12;13;14;15;,
|
||||
4;16;17;18;19;,
|
||||
4;20;21;22;23;,
|
||||
4;24;25;26;27;,
|
||||
4;28;29;30;31;,
|
||||
4;32;33;34;35;,
|
||||
4;36;37;38;39;,
|
||||
4;40;41;42;43;,
|
||||
4;44;45;46;47;;
|
||||
MeshNormals { //Cube_001 Normals
|
||||
48;
|
||||
0.000000; 0.000000;-1.000000;,
|
||||
0.000000; 0.000000;-1.000000;,
|
||||
0.000000; 0.000000;-1.000000;,
|
||||
0.000000; 0.000000;-1.000000;,
|
||||
0.000000;-0.000000; 1.000000;,
|
||||
0.000000;-0.000000; 1.000000;,
|
||||
0.000000;-0.000000; 1.000000;,
|
||||
0.000000;-0.000000; 1.000000;,
|
||||
1.000000;-0.000000; 0.000000;,
|
||||
1.000000;-0.000000; 0.000000;,
|
||||
1.000000;-0.000000; 0.000000;,
|
||||
1.000000;-0.000000; 0.000000;,
|
||||
-0.000000;-1.000000;-0.000000;,
|
||||
-0.000000;-1.000000;-0.000000;,
|
||||
-0.000000;-1.000000;-0.000000;,
|
||||
-0.000000;-1.000000;-0.000000;,
|
||||
-1.000000; 0.000000;-0.000000;,
|
||||
-1.000000; 0.000000;-0.000000;,
|
||||
-1.000000; 0.000000;-0.000000;,
|
||||
-1.000000; 0.000000;-0.000000;,
|
||||
0.000000; 1.000000; 0.000000;,
|
||||
0.000000; 1.000000; 0.000000;,
|
||||
0.000000; 1.000000; 0.000000;,
|
||||
0.000000; 1.000000; 0.000000;,
|
||||
0.000000;-0.000000; 1.000000;,
|
||||
0.000000;-0.000000; 1.000000;,
|
||||
0.000000;-0.000000; 1.000000;,
|
||||
0.000000;-0.000000; 1.000000;,
|
||||
0.000000; 0.000000;-1.000000;,
|
||||
0.000000; 0.000000;-1.000000;,
|
||||
0.000000; 0.000000;-1.000000;,
|
||||
0.000000; 0.000000;-1.000000;,
|
||||
-1.000000; 0.000000;-0.000000;,
|
||||
-1.000000; 0.000000;-0.000000;,
|
||||
-1.000000; 0.000000;-0.000000;,
|
||||
-1.000000; 0.000000;-0.000000;,
|
||||
0.000000; 1.000000; 0.000000;,
|
||||
0.000000; 1.000000; 0.000000;,
|
||||
0.000000; 1.000000; 0.000000;,
|
||||
0.000000; 1.000000; 0.000000;,
|
||||
1.000000;-0.000000; 0.000000;,
|
||||
1.000000;-0.000000; 0.000000;,
|
||||
1.000000;-0.000000; 0.000000;,
|
||||
1.000000;-0.000000; 0.000000;,
|
||||
-0.000000;-1.000000;-0.000000;,
|
||||
-0.000000;-1.000000;-0.000000;,
|
||||
-0.000000;-1.000000;-0.000000;,
|
||||
-0.000000;-1.000000;-0.000000;;
|
||||
12;
|
||||
4;0;1;2;3;,
|
||||
4;4;5;6;7;,
|
||||
4;8;9;10;11;,
|
||||
4;12;13;14;15;,
|
||||
4;16;17;18;19;,
|
||||
4;20;21;22;23;,
|
||||
4;24;25;26;27;,
|
||||
4;28;29;30;31;,
|
||||
4;32;33;34;35;,
|
||||
4;36;37;38;39;,
|
||||
4;40;41;42;43;,
|
||||
4;44;45;46;47;;
|
||||
} //End of Cube_001 Normals
|
||||
MeshMaterialList { //Cube_001 Material List
|
||||
1;
|
||||
12;
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0;;
|
||||
Material Material {
|
||||
0.640000; 0.640000; 0.640000; 0.000000;;
|
||||
96.078431;
|
||||
0.500000; 0.500000; 0.500000;;
|
||||
0.000000; 0.000000; 0.000000;;
|
||||
TextureFilename {"0gb.us_showarea.png";}
|
||||
}
|
||||
} //End of Cube_001 Material List
|
||||
MeshTextureCoords { //Cube_001 UV Coordinates
|
||||
48;
|
||||
0.000000; 0.000000;,
|
||||
1.000000; 0.000000;,
|
||||
1.000000; 1.000000;,
|
||||
0.000000; 1.000000;,
|
||||
0.000000; 0.000000;,
|
||||
1.000000; 0.000000;,
|
||||
1.000000; 1.000000;,
|
||||
0.000000; 1.000000;,
|
||||
0.000000; 0.000000;,
|
||||
1.000000; 0.000000;,
|
||||
1.000000; 1.000000;,
|
||||
0.000000; 1.000000;,
|
||||
0.000000; 0.000000;,
|
||||
1.000000; 0.000000;,
|
||||
1.000000; 1.000000;,
|
||||
0.000000; 1.000000;,
|
||||
0.000000; 0.000000;,
|
||||
1.000000; 0.000000;,
|
||||
1.000000; 1.000000;,
|
||||
0.000000; 1.000000;,
|
||||
0.000000; 0.000000;,
|
||||
1.000000; 0.000000;,
|
||||
1.000000; 1.000000;,
|
||||
0.000000; 1.000000;,
|
||||
1.000000; 1.000000;,
|
||||
1.000000; 0.000000;,
|
||||
0.000000; 0.000000;,
|
||||
0.000000; 1.000000;,
|
||||
1.000000; 1.000000;,
|
||||
1.000000; 0.000000;,
|
||||
0.000000; 0.000000;,
|
||||
0.000000; 1.000000;,
|
||||
1.000000; 1.000000;,
|
||||
1.000000; 0.000000;,
|
||||
0.000000; 0.000000;,
|
||||
0.000000; 1.000000;,
|
||||
1.000000; 1.000000;,
|
||||
1.000000; 0.000000;,
|
||||
0.000000; 0.000000;,
|
||||
0.000000; 1.000000;,
|
||||
1.000000; 1.000000;,
|
||||
1.000000; 0.000000;,
|
||||
0.000000; 0.000000;,
|
||||
0.000000; 1.000000;,
|
||||
1.000000; 1.000000;,
|
||||
1.000000; 0.000000;,
|
||||
0.000000; 0.000000;,
|
||||
0.000000; 1.000000;;
|
||||
} //End of Cube_001 UV Coordinates
|
||||
} //End of Cube_001 Mesh
|
||||
} //End of Cube
|
||||
} //End of Root Frame
|
|
@ -0,0 +1,202 @@
|
|||
landrush.offense = {}
|
||||
|
||||
function landrush.can_interact(pos, name)
|
||||
|
||||
if ( pos.y < -200 or name == '' or name == nil ) then
|
||||
return true
|
||||
end
|
||||
|
||||
if ( minetest.check_player_privs(name, {landrush=true}) ) then
|
||||
return true
|
||||
end
|
||||
|
||||
if ( minetest.check_player_privs(name, {server=true}) ) then
|
||||
return true
|
||||
end
|
||||
|
||||
local chunk = landrush.get_chunk(pos)
|
||||
|
||||
if ( landrush.claims[chunk] ~= nil ) then
|
||||
if ( landrush.claims[chunk].shared['*all'] ) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- return landrush.claims[chunk] == nil or landrush.claims[chunk].owner == name or landrush.claims[chunk].shared[name]
|
||||
if ( landrush.claims[chunk] == nil ) then
|
||||
if ( landrush.config:get_bool("requireClaim") == true ) then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
-- see if the owner is offline, and area is not shared then it's off limits
|
||||
if ( landrush.claims[chunk].owner ~= name and landrush.config:get_bool("onlineProtection") == false ) then
|
||||
if ( minetest.get_player_by_name(owner) ~= nil ) then
|
||||
minetest.chat_send_player( landrush.claims[chunk].owner, "You are being griefed by "..name.." at "..minetest.pos_to_string(pos) )
|
||||
|
||||
for u,u in pairs(landrush.claims[chunk].shared) do
|
||||
minetest.chat_send_player( u, name.." is griefing your shared claim at "..minetest.pos_to_string(pos) )
|
||||
end
|
||||
|
||||
minetest.chat_send_player( name, "You are griefing "..landrush.claims[chunk].owner )
|
||||
return true
|
||||
end
|
||||
end
|
||||
return landrush.claims[chunk].owner == name or landrush.claims[chunk].shared[name]
|
||||
end
|
||||
|
||||
function landrush.do_autoban(pos,name)
|
||||
-- moved this to it's own function so landrush.protection_violation is a little cleaner, and this could be overwritten as well
|
||||
|
||||
if ( landrush.offense[name] == nil ) then
|
||||
landrush.offense[name] = {count=0,lastpos=nil,lasttime=os.time(),bancount=0}
|
||||
end
|
||||
|
||||
local timediff = (os.time() - landrush.offense[name].lasttime)/60
|
||||
local distance = landrush.get_distance(landrush.offense[name].lastpos,pos)
|
||||
|
||||
-- reset offenses after a given time period
|
||||
if timediff > tonumber(landrush.config:get("offenseReset")) then
|
||||
landrush.offense[name].count=0
|
||||
end
|
||||
|
||||
-- offense amount starts at 10 and is decreased based on the length of time between offenses
|
||||
-- and the distance from the last offense. This weighted system tries to make it fair for people who aren't
|
||||
-- intentionally griefing
|
||||
offenseAmount = ( 10 - ( timediff / 10 ) ) - ( ( distance / landrush.config:get("chunkSize") ) * 0.5 )
|
||||
|
||||
landrush.offense[name].count=landrush.offense[name].count + offenseAmount
|
||||
minetest.log("action",name.." greifing attempt")
|
||||
|
||||
if ( landrush.offense[name].count > tonumber(landrush.config:get("banLevel")) ) then
|
||||
landrush.offense[name].bancount = landrush.offense[name].bancount + 1
|
||||
|
||||
local banlength = landrush.offense[name].bancount * 10
|
||||
|
||||
if ( landrush.offense[name].bancount < 4 ) then
|
||||
minetest.chat_send_player(name, "You have been banned for "..tostring(banlength).." minutes!")
|
||||
else
|
||||
minetest.chat_send_player(name, "You have been banned!")
|
||||
end
|
||||
|
||||
minetest.log("action",name.." has been banned for griefing attempts")
|
||||
minetest.chat_send_all(name.." has been banned for griefing attempts")
|
||||
|
||||
if ( chatplus and landrush.config:get("adminUser") ~= nil) then
|
||||
table.insert(chatplus.names[landrush.config:get("adminUser")].messages,"mail from <LandRush>: "..name.." banned for "..tostring(banlength).." minutes for attempted griefing")
|
||||
end
|
||||
minetest.ban_player(name)
|
||||
|
||||
landrush.offense[name].count = 0
|
||||
landrush.offense[name].lastpos = nil
|
||||
|
||||
if ( landrush.offense[name].bancount < 4 ) then
|
||||
minetest.after( (banlength * 60), minetest.unban_player_or_ip,name )
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
if ( landrush.offense[name].count > tonumber(landrush.config:get("banWarning")) ) then
|
||||
minetest.chat_send_player(name, "Stop trying to dig in claimed areas or you will be banned!")
|
||||
minetest.chat_send_player(name, "Use /showarea and /landowner to see the protected area and who owns it.")
|
||||
minetest.sound_play("landrush_ban_warning", {to_player=name,gain = 10.0})
|
||||
end
|
||||
|
||||
landrush.offense[name].lasttime = os.time()
|
||||
landrush.offense[name].lastpos = pos
|
||||
end
|
||||
|
||||
function landrush.protection_violation(pos,name)
|
||||
-- this function can be overwritten to apply whatever discipline the server admin wants
|
||||
-- this is the default discipline
|
||||
|
||||
local player = minetest.get_player_by_name(name)
|
||||
|
||||
if ( player == nil ) then
|
||||
return
|
||||
end
|
||||
|
||||
local owner = landrush.get_owner(pos)
|
||||
|
||||
if ( landrush.config:get_bool("requireClaim") == true ) then
|
||||
if ( owner == nil ) then
|
||||
minetest.chat_send_player(name,"This area is unowned, but you must claim it to build or mine")
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
minetest.chat_send_player(name, "Area owned by "..tostring(owner).." stop trying to dig here!")
|
||||
if ( tonumber(landrush.config:get("noDamageTime")) > landrush.get_timeonline(name) ) then
|
||||
player:set_hp( player:get_hp() - landrush.config:get("offenseDamage") )
|
||||
end
|
||||
|
||||
if ( landrush.config:get_bool("autoBan") == true ) then
|
||||
if ( tonumber(landrush.config:get("noBanTime")) > landrush.get_timeonline(name) ) then
|
||||
landrush.do_autoban(pos,name)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
landrush.default_is_protected = minetest.is_protected
|
||||
|
||||
function minetest.is_protected (pos, name)
|
||||
if ( landrush.can_interact(pos, name) ) then
|
||||
return landrush.default_is_protected(pos,name)
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_on_protection_violation( landrush.protection_violation )
|
||||
|
||||
|
||||
-- I'm keeping this just for the TNT workaround
|
||||
landrush.default_place = minetest.item_place
|
||||
|
||||
function minetest.item_place(itemstack, placer, pointed_thing)
|
||||
owner = landrush.get_owner(pointed_thing.above)
|
||||
name = placer:get_player_name()
|
||||
if landrush.can_interact(pointed_thing.above,name) or itemstack:get_name() == "" then
|
||||
-- add a workaround for TNT, since overwriting the registered node seems not to work
|
||||
if itemstack:get_name() == "tnt:tnt" or itemstack:get_name() == "tnt:tnt_burning" then
|
||||
local pos = pointed_thing.above
|
||||
local temp_pos = pos
|
||||
temp_pos.x = pos.x + 2
|
||||
if name ~= landrush.get_owner( temp_pos ) then
|
||||
minetest.chat_send_player( name, "Do not place TNT near claimed areas..." )
|
||||
return itemstack
|
||||
end
|
||||
temp_pos.x = pos.x - 2
|
||||
if name ~= landrush.get_owner( temp_pos ) then
|
||||
minetest.chat_send_player( name, "Do not place TNT near claimed areas..." )
|
||||
return itemstack
|
||||
end
|
||||
temp_pos.z = pos.z + 2
|
||||
if name ~= landrush.get_owner( temp_pos ) then
|
||||
minetest.chat_send_player( name, "Do not place TNT near claimed areas..." )
|
||||
return itemstack
|
||||
end
|
||||
temp_pos.z = pos.z - 2
|
||||
if name ~= landrush.get_owner( temp_pos ) then
|
||||
minetest.chat_send_player( name, "Do not place TNT near claimed areas..." )
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
-- end of the workaround
|
||||
return landrush.default_place(itemstack, placer, pointed_thing)
|
||||
else
|
||||
if ( owner ~= nil ) then
|
||||
minetest.chat_send_player(name, "Area owned by "..owner)
|
||||
return itemstack
|
||||
else
|
||||
minetest.chat_send_player(name,"Area unclaimed, claim this area to build")
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
--[[
|
||||
Screwdriver replacement to fit the needs of the landrush mod.
|
||||
Otherwise it will be possible to open doors without permission.
|
||||
]]
|
||||
|
||||
if minetest.get_modpath("screwdriver") then
|
||||
-- Start overwriting the standard function
|
||||
tmp_tool = minetest.registered_tools["screwdriver:screwdriver"]
|
||||
if tmp_tool == nil then
|
||||
print("Something went wrong when correcting the screwdriver...")
|
||||
end
|
||||
if tmp_tool.on_use == nil then
|
||||
print( "tmp_tool.on_use is a nil value... ")
|
||||
end
|
||||
tmp_tool.on_use = function(itemstack, user, pointed_thing)
|
||||
safe_screwdriver_handler(itemstack, user, pointed_thing)
|
||||
return itemstack
|
||||
end
|
||||
minetest.registered_tools["screwdriver:screwdriver"] = tmp_tool
|
||||
for i = 1,4,1 do
|
||||
tmp_tool = minetest.registered_tools["screwdriver:screwdriver"..i]
|
||||
tmp_tool.on_use = function(itemstack, user, pointed_thing)
|
||||
safe_screwdriver_handler(itemstack, user, pointed_thing)
|
||||
return itemstack
|
||||
end
|
||||
minetest.registered_tools["screwdriver:screwdriver"..i] = tmp_tool
|
||||
end
|
||||
print( "Rewritten screwdriver routines..." )
|
||||
end
|
||||
|
||||
|
||||
function safe_screwdriver_handler (itemstack,user,pointed_thing)
|
||||
local keys=user:get_player_control()
|
||||
local player_name=user:get_player_name()
|
||||
local item=itemstack:to_table()
|
||||
if item["metadata"]=="" or keys["sneak"]==true then return screwdriver_setmode(user,itemstack) end
|
||||
local mode=tonumber((item["metadata"]))
|
||||
if pointed_thing.type~="node" then return end
|
||||
local pos=minetest.get_pointed_thing_position(pointed_thing,above)
|
||||
-- Landrush fix
|
||||
if not landrush.can_interact( pos, player_name ) then
|
||||
return nil
|
||||
end
|
||||
-- end fix
|
||||
local node=minetest.get_node(pos)
|
||||
local node_name=node.name
|
||||
if minetest.registered_nodes[node_name].paramtype2 == "facedir" then
|
||||
if minetest.registered_nodes[node_name].drawtype == "nodebox" then
|
||||
if minetest.registered_nodes[node_name].node_box["type"]~="fixed" then return end
|
||||
end
|
||||
if node.param2==nil then return end
|
||||
-- Get ready to set the param2
|
||||
local n = node.param2
|
||||
local axisdir=math.floor(n/4)
|
||||
local rotation=n-axisdir*4
|
||||
if mode==1 then
|
||||
rotation=rotation+1
|
||||
if rotation>3 then rotation=0 end
|
||||
n=axisdir*4+rotation
|
||||
end
|
||||
|
||||
if mode==2 then
|
||||
local ppos=user:getpos()
|
||||
local pvect=user:get_look_dir()
|
||||
local face=get_node_face(pos,ppos,pvect)
|
||||
if face == nil then return end
|
||||
local index=convertFaceToIndex(face)
|
||||
local face1=faces_table[n*6+index+1]
|
||||
local found = 0
|
||||
while found == 0 do
|
||||
n=n+1
|
||||
if n>23 then n=0 end
|
||||
if faces_table[n*6+index+1]==face1 then found=1 end
|
||||
end
|
||||
end
|
||||
|
||||
if mode==3 then
|
||||
axisdir=axisdir+1
|
||||
if axisdir>5 then axisdir=0 end
|
||||
n=axisdir*4
|
||||
end
|
||||
|
||||
if mode==4 then
|
||||
local ppos=user:getpos()
|
||||
local pvect=user:get_look_dir()
|
||||
local face=get_node_face(pos,ppos,pvect)
|
||||
if face == nil then return end
|
||||
if axisdir == face then
|
||||
rotation=rotation+1
|
||||
if rotation>3 then rotation=0 end
|
||||
n=axisdir*4+rotation
|
||||
else
|
||||
n=face*4
|
||||
end
|
||||
end
|
||||
--print (dump(axisdir..", "..rotation))
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta0 = meta:to_table()
|
||||
node.param2 = n
|
||||
minetest.set_node(pos,node)
|
||||
meta = minetest.get_meta(pos)
|
||||
meta:from_table(meta0)
|
||||
local item=itemstack:to_table()
|
||||
local item_wear=tonumber((item["wear"]))
|
||||
item_wear=item_wear+327
|
||||
if item_wear>65535 then itemstack:clear() return itemstack end
|
||||
item["wear"]=tostring(item_wear)
|
||||
itemstack:replace(item)
|
||||
return itemstack
|
||||
end
|
||||
end
|
|
@ -0,0 +1,63 @@
|
|||
function landrush.on_rightclick(pos, dir, check_name, replace, replace_dir, params)
|
||||
pos.y = pos.y+dir
|
||||
if not minetest.get_node(pos).name == check_name then
|
||||
return
|
||||
end
|
||||
local p2 = minetest.get_node(pos).param2
|
||||
p2 = params[p2+1]
|
||||
|
||||
local meta = minetest.get_meta(pos):to_table()
|
||||
minetest.set_node(pos, {name=replace_dir, param2=p2})
|
||||
minetest.get_meta(pos):from_table(meta)
|
||||
|
||||
pos.y = pos.y-dir
|
||||
meta = minetest.get_meta(pos):to_table()
|
||||
minetest.set_node(pos, {name=replace, param2=p2})
|
||||
minetest.get_meta(pos):from_table(meta)
|
||||
end
|
||||
|
||||
doors.register_door("landrush:shared_door", {
|
||||
description = "Shared Door",
|
||||
inventory_image = "shared_door_inv.png",
|
||||
groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2,door=1},
|
||||
tiles_bottom = {"shared_door_b.png", "door_blue.png"},
|
||||
tiles_top = {"shared_door_a.png", "door_blue.png"},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'landrush:shared_door',
|
||||
recipe = {
|
||||
{'default:steel_ingot','default:steel_ingot',''},
|
||||
{'default:steel_ingot','landrush:landclaim',''},
|
||||
{'default:steel_ingot','default:steel_ingot',''}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
minetest.registered_nodes['landrush:shared_door_b_1'].on_rightclick = function(pos, node, clicker)
|
||||
if ( landrush.can_interact(pos,clicker:get_player_name()) ) then
|
||||
landrush.on_rightclick(pos, 1, "landrush:shared_door_t_1", "landrush:shared_door_b_2", "landrush:shared_door_t_2", {1,2,3,0})
|
||||
end
|
||||
end
|
||||
|
||||
minetest.registered_nodes['landrush:shared_door_t_1'].on_rightclick = function(pos, node, clicker)
|
||||
if ( landrush.can_interact(pos,clicker:get_player_name()) ) then
|
||||
landrush.on_rightclick(pos, -1, "landrush:shared_door_b_1", "landrush:shared_door_t_2", "landrush:shared_door_b_2", {1,2,3,0})
|
||||
end
|
||||
end
|
||||
|
||||
-- Fix for duplicating Bug!
|
||||
-- Bug was caused, because the reverse order of the on_rightclick was not taken into account
|
||||
|
||||
minetest.registered_nodes['landrush:shared_door_b_2'].on_rightclick = function(pos, node, clicker)
|
||||
if ( landrush.can_interact(pos,clicker:get_player_name()) ) then
|
||||
landrush.on_rightclick(pos, 1, "landrush:shared_door_t_2", "landrush:shared_door_b_1", "landrush:shared_door_t_1", {3,0,1,2})
|
||||
end
|
||||
end
|
||||
|
||||
minetest.registered_nodes['landrush:shared_door_t_2'].on_rightclick = function(pos, node, clicker)
|
||||
if ( landrush.can_interact(pos,clicker:get_player_name()) ) then
|
||||
landrush.on_rightclick(pos, -1, "landrush:shared_door_b_2", "landrush:shared_door_t_1", "landrush:shared_door_b_1", {3,0,1,2})
|
||||
end
|
||||
end
|
|
@ -0,0 +1,45 @@
|
|||
-- create a new type of sign that is not protected by landrush mod
|
||||
minetest.register_node("landrush:unlocked_sign", {
|
||||
description = "Unprotected Sign",
|
||||
drawtype = "signlike",
|
||||
tiles = {"default_sign_wall.png"},
|
||||
inventory_image = "default_sign_wall.png",
|
||||
wield_image = "default_sign_wall.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
--wall_top = <default>
|
||||
--wall_bottom = <default>
|
||||
--wall_side = <default>
|
||||
},
|
||||
groups = {choppy=2,dig_immediate=2,attached_node=1},
|
||||
legacy_wallmounted = true,
|
||||
sounds = default.node_sound_defaults(),
|
||||
on_construct = function(pos)
|
||||
--local n = minetest.get_node(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", "field[text;;${text}]")
|
||||
meta:set_string("infotext", "\"\"")
|
||||
end,
|
||||
on_receive_fields = function(pos, formname, fields, sender)
|
||||
local meta = minetest.get_meta(pos)
|
||||
fields.text = fields.text or ""
|
||||
print((sender:get_player_name() or "").." wrote \""..fields.text..
|
||||
"\" to sign at "..minetest.pos_to_string(pos))
|
||||
meta:set_string("text", fields.text)
|
||||
meta:set_string("infotext", '"'..fields.text..'"')
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'landrush:unlocked_sign 6',
|
||||
recipe = {
|
||||
{'default:wood','default:wood','default:wood'},
|
||||
{'default:wood','default:wood','landrush:landclaim'},
|
||||
{'','default:stick',''}
|
||||
}
|
||||
})
|
|
@ -0,0 +1,27 @@
|
|||
--[[
|
||||
Snow mod rewrite to make it secure for use on landrush
|
||||
This is a quick workaround before we can upload
|
||||
an working fix which restores original functionality
|
||||
]]
|
||||
if minetest.get_modpath( 'snow' ) then
|
||||
local entity_prototype = minetest.registered_entities['snow:snowball_entity']
|
||||
if not entity_prototype then
|
||||
print( 'COuld not detect snowball prototype...')
|
||||
return
|
||||
end
|
||||
entity_prototype.on_step = function(self, dtime)
|
||||
self.timer=self.timer+dtime
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.lastpos.x~=nil then
|
||||
if node.name ~= "air" then
|
||||
if landrush.can_interact( pos, ' ' ) then
|
||||
snow.place(pos)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos={x=pos.x, y=pos.y, z=pos.z} -- Set lastpos-->Node will be added at last pos outside the node
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 152 B |
After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 383 B |
After Width: | Height: | Size: 304 B |
After Width: | Height: | Size: 281 B |
After Width: | Height: | Size: 291 B |