forked from FozLand/landrush
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.lua
121 lines (103 loc) · 3.46 KB
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
minetest.log('action','Loading Land Rush Land Claim')
-- Freeminer Compatibility
if rawget(_G, "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 < -200 ) then
minetest.chat_send_player(player,"You cannot claim below -200")
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:stone','default:steel_ingot','default:stone'},
{'default:steel_ingot','default:mese_crystal','default:steel_ingot'},
{'default:stone','default:steel_ingot','default:stone'}
}
})
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 )