version 1.2 -> radius larger than 20 now available

This commit is contained in:
berengma 2017-05-10 13:29:07 +02:00
parent 74f5060067
commit 9e5f1b8c0b
5 changed files with 44 additions and 11 deletions

View File

@ -1,9 +1,9 @@
# aviator
Adds a craftabel block to the game.
Adds a craftable block to the game.
After placing you will be granted fly priv in an
area of 20 nodes radius from placed block.
fly priv will be taken after 10 minutes.
fly priv will be taken after 30 minutes.
The block can be digged and remaining time is saved
Also the block will be saved to inventory if you
@ -14,4 +14,27 @@ Added a chatcommand "/7" to call back your aviator
to your inventory. This allows climbing and other
more convinient use of it.
You can configue the mod by opening init.lua:
[]....
-- configure mod here
local flength = 1800 -- how many seconds you can fly
local maxdistance = 20 -- maxradius (values >20 will need extra cpu power using forceloaded blocks)
-- end configuration
....[]
maxdistance is the radius counted from position of the aviator node.
with 20 as radius you will be able to fly in a sphere of 40 nodes of diameter
with the aviator node as central point.
Setting maxdistance to bigger values as 20 will need forceloaded blocks. Those can be configured
in your minetest.config or from minetest application in: advanced Settings/server+singleplayer/Game/max_forceloaded_blocks = xxx

1
description.txt Normal file
View File

@ -0,0 +1 @@
Adds a craftable node to grant fly priv in an area around it.

View File

@ -2,10 +2,15 @@
aviation = {}
aviator_hud_id = {}
local flength = 900 -- how many seconds you can fly
local checktime = 1 -- check interval
local maxdistance = 20 -- maxradius
-- configure mod here
local flength = 1800 -- how many seconds you can fly
local maxdistance = 20 -- maxradius (values >20 will need extra cpu power using forceloaded blocks)
-- end configuration
local checktime = 1
local timer = 0
local trans = {}
local function aviator_remove(pos, player)
local name = player:get_player_name()
@ -31,6 +36,9 @@ local function aviator_remove(pos, player)
minetest.set_player_privs(name, privs)
minetest.set_node(aviation[name], {name = "air"})
aviation[name] = nil
if maxdistance >20 then
core.forceload_free_block(pos,trans)
end
end
end
return
@ -83,6 +91,11 @@ minetest.register_node("aviator:aviator", {
minetest.set_node(pointed_thing.above, {name="aviator:aviator"})
itemstack:take_item()
aviation[name]=pointed_thing.above
if maxdistance > 20 then
if core.forceload_block(pointed_thing.above,trans) == false then
minetest.chat_send_all("Forceload Error -- please use radius <21 or check your minetest.config and set max_forceloaded_blocks = 1000")
end
end
if not meta.runtime then
timer:start(flength)
else
@ -240,14 +253,9 @@ minetest.register_chatcommand("7", {
local player = minetest.get_player_by_name(name)
if aviation[name] ~= nil then
aviator_remove(aviation[name], player)
else
local colorstring = core.colorize('#ff0000', " >>> you did not place an aviator ")
minetest.chat_send_player(name,colorstring)
minetest.chat_send_player(name,core.colorize('#ff0000', " >>> you did not place an aviator "))
end
end

1
mod.conf Normal file
View File

@ -0,0 +1 @@
name = aviator

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB