Skip to content

Commit 9e5f1b8

Browse files
committed
version 1.2 -> radius larger than 20 now available
1 parent 74f5060 commit 9e5f1b8

File tree

5 files changed

+44
-11
lines changed

5 files changed

+44
-11
lines changed

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# aviator
22

3-
Adds a craftabel block to the game.
3+
Adds a craftable block to the game.
44
After placing you will be granted fly priv in an
55
area of 20 nodes radius from placed block.
6-
fly priv will be taken after 10 minutes.
6+
fly priv will be taken after 30 minutes.
77

88
The block can be digged and remaining time is saved
99
Also the block will be saved to inventory if you
@@ -14,4 +14,27 @@ Added a chatcommand "/7" to call back your aviator
1414
to your inventory. This allows climbing and other
1515
more convinient use of it.
1616

17+
You can configue the mod by opening init.lua:
18+
19+
[]....
20+
-- configure mod here
21+
local flength = 1800 -- how many seconds you can fly
22+
local maxdistance = 20 -- maxradius (values >20 will need extra cpu power using forceloaded blocks)
23+
-- end configuration
24+
....[]
25+
26+
maxdistance is the radius counted from position of the aviator node.
27+
with 20 as radius you will be able to fly in a sphere of 40 nodes of diameter
28+
with the aviator node as central point.
29+
30+
Setting maxdistance to bigger values as 20 will need forceloaded blocks. Those can be configured
31+
in your minetest.config or from minetest application in: advanced Settings/server+singleplayer/Game/max_forceloaded_blocks = xxx
32+
33+
34+
35+
36+
37+
38+
39+
1740

description.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Adds a craftable node to grant fly priv in an area around it.

init.lua

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22
aviation = {}
33
aviator_hud_id = {}
44

5-
local flength = 900 -- how many seconds you can fly
6-
local checktime = 1 -- check interval
7-
local maxdistance = 20 -- maxradius
5+
-- configure mod here
6+
local flength = 1800 -- how many seconds you can fly
7+
local maxdistance = 20 -- maxradius (values >20 will need extra cpu power using forceloaded blocks)
8+
-- end configuration
9+
10+
local checktime = 1
811
local timer = 0
12+
local trans = {}
13+
914

1015
local function aviator_remove(pos, player)
1116
local name = player:get_player_name()
@@ -31,6 +36,9 @@ local function aviator_remove(pos, player)
3136
minetest.set_player_privs(name, privs)
3237
minetest.set_node(aviation[name], {name = "air"})
3338
aviation[name] = nil
39+
if maxdistance >20 then
40+
core.forceload_free_block(pos,trans)
41+
end
3442
end
3543
end
3644
return
@@ -83,6 +91,11 @@ minetest.register_node("aviator:aviator", {
8391
minetest.set_node(pointed_thing.above, {name="aviator:aviator"})
8492
itemstack:take_item()
8593
aviation[name]=pointed_thing.above
94+
if maxdistance > 20 then
95+
if core.forceload_block(pointed_thing.above,trans) == false then
96+
minetest.chat_send_all("Forceload Error -- please use radius <21 or check your minetest.config and set max_forceloaded_blocks = 1000")
97+
end
98+
end
8699
if not meta.runtime then
87100
timer:start(flength)
88101
else
@@ -240,14 +253,9 @@ minetest.register_chatcommand("7", {
240253
local player = minetest.get_player_by_name(name)
241254

242255
if aviation[name] ~= nil then
243-
244256
aviator_remove(aviation[name], player)
245-
246257
else
247-
248-
local colorstring = core.colorize('#ff0000', " >>> you did not place an aviator ")
249-
minetest.chat_send_player(name,colorstring)
250-
258+
minetest.chat_send_player(name,core.colorize('#ff0000', " >>> you did not place an aviator "))
251259
end
252260
end
253261

mod.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
name = aviator

screenshot.png

1.29 MB
Loading

0 commit comments

Comments
 (0)