Major gameplay change, localization

This commit is contained in:
Kimapr 2019-12-20 23:50:58 +05:00
parent 10569e64c8
commit 33817d2eec
15 changed files with 248 additions and 354 deletions

113
nc_crystal/init.lua Normal file
View File

@ -0,0 +1,113 @@
-- LUALOCALS < ---------------------------------------------------------
local nodecore, minetest
= nodecore, minetest
-- LUALOCALS > ---------------------------------------------------------
local S = minetest.get_translator("nc_crystal")
local addhint = nodecore.addhint
local modname = minetest.get_current_modname()
local stone_nodes = {}
local tex = "(nc_lode_ore.png^nc_crystal_living.png)^[mask:nc_lode_mask_prill.png"
local tex_ore = "nc_terrain_stone.png^((nc_lode_ore.png^nc_crystal_living.png)^[mask:nc_lode_mask_ore.png)"
local crystal = modname .. ":crystal"
local ore = modname..":ore"
addhint(S"plant lode crystal",
"lode crystal planting"
)
minetest.register_craftitem(crystal, {
description = S"Lode Crystal",
inventory_image = tex,
wield_image = tex,
sounds = nodecore.sounds("nc_lode_annealed"),
on_place = function(itemstack, placer, pointed_thing, ...)
if not nodecore.interact(placer) then return end
if itemstack:get_name() == crystal and pointed_thing.type == "node" then
local pos = pointed_thing.under
for _, v in ipairs(stone_nodes) do
if nodecore.match(pos, {
name = v,
}) then
minetest.set_node(pos,{name=ore})
minetest.sound_play("nc_lode_annealed",{pos=pos})
itemstack:set_count(itemstack:get_count() - 1)
if placer then
nodecore.player_stat_add(1, placer, "lode crystal planting",
S"plant lode crystal")
end
return itemstack
end
end
end
return itemstack
end
})
minetest.register_node(ore, {
description = S"Lode Crystal Stone",
tiles = {tex_ore},
is_ground_content = true,
groups = {cracky = 2, lodey = 1},
sounds = nodecore.sounds("nc_terrain_stony"),
drop_in_place = "nc_terrain:stone",
drop = crystal
})
local growdirs = {
{x= 1,y=0,z=0},
{x=0,y= 1,z=0},
{x=0,y=0,z= 1},
{x=-1,y=0,z=0},
{x=0,y=-1,z=0},
{x=0,y=0,z=-1},
}
nodecore.register_limited_abm({
label = "Lode Crystal growing",
nodenames = {ore},
neighbours = {"group:lava"},
interval = 10,
chance = 10,
action = function(pos,node)
local vdirs = {}
for _,off in pairs(growdirs) do
local pos = vector.add(pos,off)
if minetest.get_item_group(minetest.get_node(pos).name,"stone") > 0 then
table.insert(vdirs,pos)
end
end
if #vdirs > 0 then
local pos = vdirs[math.random(1,#vdirs)]
if minetest.find_node_near(pos,1,{"group:lava"}) then
minetest.set_node(pos,{name=ore})
minetest.sound_play("nc_lode_annealed",{pos=pos})
end
end
end
})
nodecore.register_craft({
label = "kill poor crystal",
action = "pummel",
nodes = {
{match = ore, replace = "nc_lode:ore"}
},
toolgroups = {thumpy = 2}
})
minetest.after(0.001,function()
for name,def in pairs(minetest.registered_nodes) do
if minetest.get_item_group(name,"stone") > 0 then
table.insert(stone_nodes,name)
end
end
end)

View File

@ -0,0 +1,4 @@
# textdomain: nc_crystal
Lode Crystal=Lode Crystal
Lode Crystal Stone=Lode Crystal Stone
plant lode crystal=plant lode crystal

View File

@ -0,0 +1,4 @@
# textdomain: nc_crystal
Lode Crystal=Металлический Кристалл
Lode Crystal Stone=Камень с Металлический Кристалл
plant lode crystal=посадить металлический кристал

2
nc_crystal/mod.conf Normal file
View File

@ -0,0 +1,2 @@
name = nc_crystal
depends = nc_api, nc_api_craft, nc_terrain, nc_lode, nc_guide

Binary file not shown.

After

Width:  |  Height:  |  Size: 1004 B

View File

@ -1,8 +0,0 @@
-- LUALOCALS < ---------------------------------------------------------
local include, nodecore
= include, nodecore
-- LUALOCALS > ---------------------------------------------------------
nodecore.amcoremod()
include("sieve")

View File

@ -1,2 +0,0 @@
name = nc_sieve
depends = nc_woodwork, nc_stonework, nc_terrain, nc_lode, nc_lux, nc_api

View File

@ -1,301 +0,0 @@
-- LUALOCALS < ---------------------------------------------------------
local minetest, nodecore, pairs
= minetest, nodecore, pairs
-- LUALOCALS > ---------------------------------------------------------
local modname = minetest.get_current_modname()
local wmodname = "nc_woodwork"
local side = "nc_tree_tree_side.png"
local top = wmodname.. "_plank.png"
local top_sieve = wmodname .. "_plank.png^[mask:"..modname.."_sieve.png^nc_tree_leaves.png"
local stop = "nc_terrain_stone.png"
local sside = "nc_terrain_stone.png"
local stop_sieve = "nc_terrain_stone.png^[mask:"..modname.."_sieve.png^nc_terrain_cobble.png"
function regsieve(suff,top,side,top_sieve,groups)
local mname = #suff == 0 and "Wooden" or suff:sub(1,1):upper()..suff:sub(2)
suff = #suff == 0 and suff or "_"..suff
minetest.register_node(modname .. ":table"..suff, {
description = mname.." Table",
drawtype = "nodebox",
node_box = nodecore.fixedbox(
{-0.5, 7/16, -0.5, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, -7/16, 7/16, -7/16},
{-0.5, -0.5, 7/16, -7/16, 7/16, 0.5},
{7/16, -0.5, -0.5, 0.5, 7/16, -7/16},
{7/16, -0.5, 7/16, 0.5, 7/16, 0.5}
),
selection_box = nodecore.fixedbox(),
collision_box = nodecore.fixedbox(),
tiles = { top, top, side },
groups = groups,
paramtype = "light",
sounds = nodecore.sounds("nc_tree_woody"),
})
minetest.register_node(modname .. ":table_broken"..suff, {
description = "Broken "..mname.." Table",
drawtype = "nodebox",
node_box = nodecore.fixedbox(
{-0.5, 7/16, -0.5, -0.5+4/16,0.5,0.5},
{0.5-4/16, 7/16, -0.5, 0.5, 0.5, 0.5},
{-8/32, 7/16, 8/32, 8/32, 0.5, 0.5},
{-8/32, 7/16, -0.5, 8/32, 0.5, -8/32},
{-0.5, -0.5, -0.5, -7/16, 7/16, -7/16},
{-0.5, -0.5, 7/16, -7/16, 7/16, 0.5},
{7/16, -0.5, -0.5, 0.5, 7/16, -7/16},
{7/16, -0.5, 7/16, 0.5, 7/16, 0.5}
),
selection_box = nodecore.fixedbox(),
collision_box = nodecore.fixedbox(),
tiles = { top, top, side },
groups = groups,
paramtype = "light",
sounds = nodecore.sounds("nc_tree_woody"),
})
minetest.register_node(modname .. ":sieve"..suff, {
description = mname.." Sieve",
drawtype = "nodebox",
use_texture_alpha = true,
node_box = nodecore.fixedbox(
{-4/16,7/16,-4/16,4/16,0.5,4/16},
{-0.5, 7/16, -0.5, -0.5+4/16,0.5,0.5},
{0.5-4/16, 7/16, -0.5, 0.5, 0.5, 0.5},
{-8/32, 7/16, 8/32, 8/32, 0.5, 0.5},
{-8/32, 7/16, -0.5, 8/32, 0.5, -8/32},
{-0.5, -0.5, -0.5, -7/16, 7/16, -7/16},
{-0.5, -0.5, 7/16, -7/16, 7/16, 0.5},
{7/16, -0.5, -0.5, 0.5, 7/16, -7/16},
{7/16, -0.5, 7/16, 0.5, 7/16, 0.5}
),
selection_box = nodecore.fixedbox(),
collision_box = nodecore.fixedbox(),
tiles = { top_sieve, top_sieve, side },
groups = groups,
paramtype = "light",
sounds = nodecore.sounds("nc_tree_woody"),
})
end
regsieve("",top,side,top_sieve,{
choppy = 1,
flammable = 2,
fire_fuel = 3,
})
regsieve("stone",stop,sside,stop_sieve,{
cracky = 2,
})
minetest.register_craftitem(modname..":random_dust",{
description = "Dust of random minerals",
inventory_image = modname.."_random_dust.png"
})
minetest.register_craftitem(modname..":super_random_dust",{
description = "Dust of very random minerals",
inventory_image = modname.."_random_dust.png"
})
nodecore.register_craft({
label = "break a wooden table",
action = "pummel",
toolgroups = {choppy = 1},
nodes = {
{match = modname .. ":table", replace = modname .. ":table_broken"}
},
})
nodecore.register_craft({
label = "break a stone table",
action = "pummel",
toolgroups = {cracky = 4},
nodes = {
{match = modname .. ":table_stone", replace = modname .. ":table_broken_stone"}
},
})
local duo = {
items={{name = modname..":random_dust", count = 1, scatter = 2}}
}
local duo2 = {
items={{name = modname..":random_dust", count = 2, scatter = 2}}
}
local duo3 = {
items={{name = modname..":super_random_dust", count = 2, scatter = 2}}
}
local duo4 = {
items={{name = modname..":super_random_dust", count = 4, scatter = 2}}
}
for _,dat in pairs({
{
sievables = {
["nc_terrain:gravel"] = duo,
["nc_terrain:gravel_loose"] = duo,
["nc_terrain:sand"] = duo2,
["nc_terrain:sand_loose"] = duo2,
["nc_tree:leaves_loose"] = {node = "nc_terrain:water_source"},
},
name = modname..":sieve"
},
{
sievables = {
["nc_terrain:gravel"] = duo3,
["nc_terrain:gravel_loose"] = duo3,
["nc_terrain:sand"] = duo4,
["nc_terrain:sand_loose"] = duo4,
["nc_tree:leaves_loose"] = {node = "nc_terrain:water_source"},
},
name = modname..":sieve_stone"
}
})
do
for k,v in pairs(dat.sievables) do
nodecore.register_craft({
label = "use a sieve with "..k,
action = "pummel",
toolgroups = {crumbly = 1},
nodes = {
{match = {name = k}, replace = v.node or "air"},
{y=-1,match = dat.name}
},
items = v.items
})
end
end
for _,dat in pairs({
{
drop = {
["nc_terrain:cobble"] = 30,
["nc_lode:cobble_loose"] = 10,
["nc_lux:cobble1_loose"] = 1,
["nc_sponge:sponge_living"]=1
},
name = modname..":random_dust"
},
{
drop = {
["nc_terrain:cobble"] = 50,
["nc_lode:cobble_loose"] = 50,
["nc_lux:cobble1_loose"] = 5,
["nc_sponge:sponge_living"]=5,
["rdust"]=1
},
name = modname..":super_random_dust"
}
})
do
nodecore.register_craft({
label = "pack random dust into cobble",
action = "pummel",
toolgroups = {thumpy = 3},
nodes = {
{match = {name = dat.name,count=16},replace = "nc_terrain:cobble"}
},
after = function(pos)
local chances = {}
local mc = 1
for k,v in pairs(dat.drop) do
for n=mc,mc-1+v do
chances[n] = k
end
mc=mc+v
end
local ore = chances[math.random(1,mc-1)]
if ore == "rdust" then
nodecore.item_eject(pos,modname..":super_random_dust",5,20)
else
minetest.set_node(pos,{name=ore})
end
end
})
end
nodecore.register_craft({
label = "assemble wood sieve",
norotate = true,
nodes = {
{y = -1, match = modname .. ":table_broken", replace = modname .. ":sieve"},
{match = "nc_tree:leaves_loose", replace = "air"},
}
})
nodecore.register_craft({
label = "assemble stone sieve",
norotate = true,
nodes = {
{y = -1, match = modname .. ":table_broken_stone", replace = modname .. ":sieve_stone"},
{match = "nc_terrain:cobble_loose", replace = "air"},
}
})
nodecore.register_craft({
label = "assemble wood table",
norotate = true,
nodes = {
{match = wmodname .. ":plank", replace = modname .. ":table"},
{x = -1, z = -1, match = wmodname .. ":staff", replace = "air"},
{x = 1, z = -1, match = wmodname .. ":staff", replace = "air"},
{x = -1, z = 1, match = wmodname .. ":staff", replace = "air"},
{x = 1, z = 1, match = wmodname .. ":staff", replace = "air"},
}
})
nodecore.register_craft({
label = "assemble wood table",
norotate = true,
nodes = {
{match = wmodname .. ":plank", replace = modname .. ":table"},
{x = 0, z = -1, match = wmodname .. ":staff", replace = "air"},
{x = 0, z = 1, match = wmodname .. ":staff", replace = "air"},
{x = -1, z = 0, match = wmodname .. ":staff", replace = "air"},
{x = 1, z = 0, match = wmodname .. ":staff", replace = "air"},
}
})
nodecore.register_craft({
label = "assemble stone table",
action = "pummel",
toolgroups = {thumpy = 4},
priority = 1,
norotate = true,
nodes = {
{match = "nc_terrain:cobble_loose", replace = modname .. ":table_stone"},
{x = -1, z = -1, match = "nc_lode:rod_annealed", replace = "air"},
{x = 1, z = -1, match = "nc_lode:rod_annealed", replace = "air"},
{x = -1, z = 1, match = "nc_lode:rod_annealed", replace = "air"},
{x = 1, z = 1, match = "nc_lode:rod_annealed", replace = "air"},
}
})
nodecore.register_craft({
label = "assemble stone table",
action = "pummel",
toolgroups = {thumpy = 4},
priority = 1,
norotate = true,
nodes = {
{match = "nc_terrain:cobble_loose", replace = modname .. ":table_stone"},
{x = 0, z = -1, match = "nc_lode:rod_annealed", replace = "air"},
{x = 0, z = 1, match = "nc_lode:rod_annealed", replace = "air"},
{x = -1, z = 0, match = "nc_lode:rod_annealed", replace = "air"},
{x = 1, z = 0, match = "nc_lode:rod_annealed", replace = "air"},
}
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

View File

@ -1,22 +1,47 @@
--nothing-- --nothing--
local S = minetest.get_translator("nc_sky_isgen")
local grass = "nc_terrain:dirt_with_grass" local grass = "nc_terrain:dirt_with_grass"
local dirt = "nc_terrain:dirt" local dirt = "nc_terrain:dirt"
local tree = "nc_tree:eggcorn_planted" local tree = "nc_tree:eggcorn_planted"
local stone = "nc_terrain:stone" local stone = "nc_terrain:stone"
local queue = {} local queue = {}
local cooldown = 120
local cooldowns = {}
local function maxval(octaves,persistence,scale) local function maxval(octaves,persistence,scale)
local m = scale local m = 1
local poc = scale local poc = 1
if octaves > 1 then if octaves > 1 then
for n=2,octaves do for n=2,octaves do
poc = poc*persistence poc = poc*persistence
m=m+poc m=m+poc
end end
end end
return m return scale/m
end end
local function dist(x1,y1,z1, x2,y2,z2)
local x,y,z = x2-x1, y2-y1, z2-z1
return (x*x+y*y+z*z)^0.5
end
local function cosify(x)
return 1-math.cos(x*math.pi/2)
end
local pers = 0.9
local oct = 4
local noise = PerlinNoise{
scale = maxval(oct,pers,32),
spread = {x=64,y=64,z=64},
seed=1297,
octaves = oct,
persistence = pers,
lacunarity = 2,
flags = "eased"
}
local function island(pos,r) local function island(pos,r)
local x,y,z = pos.x,pos.y,pos.z local x,y,z = pos.x,pos.y,pos.z
minetest.emerge_area({x=x-r,y=y-r,z=z-r},{x=x+r,y=y+r,z=z+r},function(bp,act,crem) minetest.emerge_area({x=x-r,y=y-r,z=z-r},{x=x+r,y=y+r,z=z+r},function(bp,act,crem)
@ -26,35 +51,42 @@ local function island(pos,r)
local n = 0 local n = 0
local c = 0 local c = 0
local cm = (r*2+1)^3 local cm = (r*2+1)^3
local function geto(x,y,z) local function geto(x1,y1,z1,n)
local dist = (x*x+y*y+z*z)^0.5 local r1 = 48+n*2-1
local uvdist = (y+r)/(r*2) local dista = dist(0,0,0,x1,y1*3,z1)
local hdist = (x*x+z*z)^0.5 local m = math.max(0,1-dista/r1)
local uhdist = (math.max(0,r-hdist)/r)^((1-uvdist)^3*5) local r2 = -r1
local udist = math.max(0,r-dist)/r if y1 <= 0 and y1 >= r2 then
local m = ((math.max(r-(hdist),0)/r)^0.1*(uhdist^2))-uhdist*uvdist^3 local r3 = (1-math.sin(y1/r2*math.pi/2))*r1
return m local distb = dist(0,y1,0,x1,y1,z1)
local m2 = math.max(0,1-distb/r3)
m = math.max(m2,m)
end
return cosify(m)
end end
local grasses = {} local grasses = {}
local stones = {}
for x=-r,r do for x=-r,r do
for z=-r,r do for z=-r,r do
for y=-r,r do for y=-r,r do
local xx,yy,zz = pos.x+x,pos.y+y,pos.z+z local xx,yy,zz = pos.x+x,pos.y+y,pos.z+z
local o,o2 = geto(x,y,z),geto(x,y+1,z) local ppos = {x=xx,y=yy,z=zz}
local o,o2 = geto(x,y,z,noise:get_3d(ppos)),geto(x,y+1,z,noise:get_3d({x=xx,y=yy+1,z=zz}))
local oc = (o > 0.4) local oc = (o > 0.4)
local oc2 = o2 > 0.4 local oc2 = o2 > 0.4
local og = (o > 0.6) local og = (o > 0.5) and o2 > 0.4
if oc then if oc then
n=n+1 n=n+1
local nam = dirt local nam = dirt
if not og and not oc2 then if not og and not oc2 then
nam = grass nam = grass
table.insert(grasses,{x=xx,y=yy,z=zz}) table.insert(grasses,ppos)
end end
if og then if og then
nam = stone nam = stone
table.insert(stones,ppos)
end end
minetest.set_node({x=xx,y=yy,z=zz},{name=nam}) minetest.set_node(ppos,{name=nam})
else else
n=n+0.01 n=n+0.01
end end
@ -65,7 +97,19 @@ local function island(pos,r)
end end
end end
end end
for n=1,4 do for n=1,24 do
if #stones > 1 then
local n = math.random(1,#stones)
local v = table.remove(stones,n)
minetest.set_node(v,{name="nc_crystal:ore"})
end
if #stones > 1 then
local n = math.random(1,#stones)
local v = table.remove(stones,n)
minetest.set_node(v,{name="nc_lux:stone"})
end
end
for n=1,8 do
if #grasses > 1 then if #grasses > 1 then
local n = math.random(1,#grasses) local n = math.random(1,#grasses)
local v = table.remove(grasses,n) local v = table.remove(grasses,n)
@ -80,7 +124,7 @@ local f,abs = math.floor, math.abs
local function spawn_island(name,pos) local function spawn_island(name,pos)
local ref = minetest.get_player_by_name(name) local ref = minetest.get_player_by_name(name)
pos = {x=f(pos.x),y=f(pos.y),z=f(pos.z)} pos = {x=f(pos.x),y=f(pos.y),z=f(pos.z)}
island(pos,16,name) island(pos,48,name)
ref:set_pos({x=pos.x,y=pos.y+256,z=pos.z}) ref:set_pos({x=pos.x,y=pos.y+256,z=pos.z})
end end
local store = minetest.get_mod_storage() local store = minetest.get_mod_storage()
@ -112,9 +156,10 @@ do
end end
local air_c = minetest.get_content_id("air") local air_c = minetest.get_content_id("air")
local ignore_c = minetest.get_content_id("ignore")
local function island_range(x,y,z) local function island_range(x,y,z)
return {x=x-32,y=y-32,z=z-32},{x=x+32,y=y+32,z=z+32} return {x=x-64,y=y-64,z=z-64},{x=x+64,y=y+64,z=z+64}
end end
local function checkpos(x,y,z) local function checkpos(x,y,z)
local vm = VoxelManip(island_range(x,y,z)) local vm = VoxelManip(island_range(x,y,z))
@ -124,7 +169,8 @@ local function checkpos(x,y,z)
for x = x-32,x+32 do for x = x-32,x+32 do
for y = y-32,y+32 do for y = y-32,y+32 do
for z = z-32,z+32 do for z = z-32,z+32 do
if dat[ar:index(x,y,z)] ~= air_c then local d = dat[ar:index(x,y,z)]
if d ~= air_c and d ~= ignore_c then
return false return false
end end
end end
@ -251,16 +297,16 @@ minetest.register_globalstep(function(dt)
end) end)
minetest.register_chatcommand("register", { minetest.register_chatcommand("register", {
description = "Register island", description = S"Register island",
privs = {server = true}, privs = {server = true},
func = function(name,param) func = function(name,param)
if get_standing_island(name) then if get_standing_island(name) then
minetest.chat_send_player(name,"There is an island already") minetest.chat_send_player(name,S"There is an island already")
return return
end end
local ref = minetest.get_player_by_name(name) local ref = minetest.get_player_by_name(name)
local pos = ref:get_pos() local pos = ref:get_pos()
ip = {x=f(pos.x+.5),y=f(pos.y+.5)-11,z=f(pos.z+.5)} ip = {x=f(pos.x+.5),y=f(pos.y+.5),z=f(pos.z+.5)}
table.insert(cells,{pos=ip, valid=false}) table.insert(cells,{pos=ip, valid=false})
minetest.chat_send_player(name,"OK") minetest.chat_send_player(name,"OK")
save() save()
@ -268,12 +314,12 @@ minetest.register_chatcommand("register", {
}) })
minetest.register_chatcommand("unregister", { minetest.register_chatcommand("unregister", {
description = "Unregister island", description = S"Unregister island",
privs = {server = true}, privs = {server = true},
func = function(name,param) func = function(name,param)
local is = get_standing_island(name) local is = get_standing_island(name)
if not is then if not is then
minetest.chat_send_player(name,"No island here") minetest.chat_send_player(name,S"No island here")
return return
end end
if is.t == cells then if is.t == cells then
@ -283,18 +329,18 @@ minetest.register_chatcommand("unregister", {
local nam = is.owner local nam = is.owner
players[nam] = nil players[nam] = nil
end end
minetest.chat_send_player(name,"OK") minetest.chat_send_player(name,S"OK")
save() save()
end end
}) })
minetest.register_chatcommand("assign", { minetest.register_chatcommand("assign", {
description = "Reassign this island", description = S"Reassign this island",
privs = {server = true}, privs = {server = true},
func = function(name,param) func = function(name,param)
local is = get_standing_island(name) local is = get_standing_island(name)
if not minetest.get_player_by_name(param) then if not minetest.get_player_by_name(param) then
minetest.chat_send_player(name,"No player "..param) minetest.chat_send_player(name,S("No player @1",param))
return return
end end
if players[param] then if players[param] then
@ -303,28 +349,28 @@ minetest.register_chatcommand("assign", {
players[param] = nil players[param] = nil
end end
if not is then if not is then
minetest.chat_send_player(name,"No island here") minetest.chat_send_player(name,S"No island here")
return return
else else
players[name] = {pos = is.pos, valid = is.valid} players[name] = {pos = is.pos, valid = is.valid}
is.t[is.k] = nil is.t[is.k] = nil
end end
minetest.chat_send_player(name,"OK") minetest.chat_send_player(name,S"OK")
save() save()
end end
}) })
minetest.register_chatcommand("unassign", { minetest.register_chatcommand("unassign", {
description = "Unassign this island", description = S"Unassign this island",
privs = {server = true}, privs = {server = true},
func = function(name,param) func = function(name,param)
local is = get_standing_island(name) local is = get_standing_island(name)
if not is then if not is then
minetest.chat_send_player(name,"No island here") minetest.chat_send_player(name,S"No island here")
return return
end end
if is.t == cells then if is.t == cells then
minetest.chat_send_player(name,"Island is already unassigned") minetest.chat_send_player(name,S"Island is already unassigned")
return return
end end
if is.t == players then if is.t == players then
@ -332,21 +378,21 @@ minetest.register_chatcommand("unassign", {
players[nam] = nil players[nam] = nil
table.insert(cells,{pos=is.pos,valid=is.valid}) table.insert(cells,{pos=is.pos,valid=is.valid})
end end
minetest.chat_send_player(name,"OK") minetest.chat_send_player(name,S"OK")
save() save()
end end
}) })
minetest.register_chatcommand("validate", { minetest.register_chatcommand("validate", {
description = "Make this island avaible for newcomers, if not owned by a player", description = S"Make this island avaible for newcomers, if not owned by a player",
privs = {server = true}, privs = {server = true},
func = function(name,param) func = function(name,param)
local is = get_standing_island(name) local is = get_standing_island(name)
if is then if is then
is.t[is.k].valid = true is.t[is.k].valid = true
minetest.chat_send_player(name,"OK") minetest.chat_send_player(name,S"OK")
else else
minetest.chat_send_player(name,"No island here") minetest.chat_send_player(name,S"No island here")
return return
end end
save() save()
@ -354,15 +400,15 @@ minetest.register_chatcommand("validate", {
}) })
minetest.register_chatcommand("invalidate", { minetest.register_chatcommand("invalidate", {
description = "Make this island unavaible for newcomers", description = S"Make this island unavaible for newcomers",
privs = {server = true}, privs = {server = true},
func = function(name,param) func = function(name,param)
local is = get_standing_island(name) local is = get_standing_island(name)
if is then if is then
is.t[is.k].valid = false is.t[is.k].valid = false
minetest.chat_send_player(name,"OK") minetest.chat_send_player(name,S"OK")
else else
minetest.chat_send_player(name,"No island here") minetest.chat_send_player(name,S"No island here")
return return
end end
save() save()
@ -370,7 +416,7 @@ minetest.register_chatcommand("invalidate", {
}) })
minetest.register_chatcommand("query", { minetest.register_chatcommand("query", {
description = "Query information about this island", description = S"Query information about this island",
func = function(name,param) func = function(name,param)
local is = get_standing_island(name) local is = get_standing_island(name)
if is then if is then
@ -380,16 +426,23 @@ minetest.register_chatcommand("query", {
minetest.chat_send_player(name," pos: "..minetest.pos_to_string(is.pos)) minetest.chat_send_player(name," pos: "..minetest.pos_to_string(is.pos))
minetest.chat_send_player(name,"]") minetest.chat_send_player(name,"]")
else else
minetest.chat_send_player(name,"No island here") minetest.chat_send_player(name,S"No island here")
end end
save() save()
end end
}) })
minetest.register_chatcommand("reset",{ minetest.register_chatcommand("reset",{
description = "Get a new island", description = S"Get a new island",
privs = {interact = true}, privs = {interact = true},
func = function(name) func = function(name)
local utime = minetest.get_server_uptime()
local cd = cooldowns[name]
if cd and cd > utime then
minetest.chat_send_player(name,S("You can't get a new island yet. Wait @1 secs.",(cd-utime)))
return
end
cooldowns[name] = utime + cooldown
local pl = players[name] local pl = players[name]
if pl then if pl then
players[name] = nil players[name] = nil

View File

@ -0,0 +1,14 @@
# textdomain: nc_sky_isgen
You can't get a new island yet. Wait @1 secs.=You can't get a new island yet. Wait @1 secs.
No island here=No island here
No player @1=No player @1
Island is already unassigned=Island is already unassigned
There is an island already=There is an island already
OK=OK
Query information about this island=Query information about this island
Make this island unavaible for newcomers=Make this island unavaible for newcomers
Make this island avaible for newcomers, if not owned by a player=Make this island avaible for newcomers, if not owned by a player
Unassign this island=Unassign this island
Reassign this island=Reassign this island
Unregister island=Unregister island
Register island=Register island

View File

@ -0,0 +1,15 @@
# textdomain: nc_sky_isgen
You can't get a new island yet. Wait @1 secs.=Вы не можете получить новый остров сейчас. Подождите @1 секунд
No island here=Здесь нет острова
No player @1=Игрока @1 нет
Island is already unassigned=Остров ни на кого не назначен
There is an island already=Здесь уже есть остров
OK=ОК
Query information about this island=Получить информацию об этом острове
Make this island unavaible for newcomers=Сделать остров недоступным для получения его новыми игроками
Make this island avaible for newcomers, if not owned by a player=Сделать остров доступным для получения его новыми игроками, если он не назначен на какого-либо игрока
Unassign this island=Разназначить этот остров
Reassign this island=Переназначить этот остров
Unregister island=Разрегистрировать остров
Register island=Зарегистрировать остров
Get a new island=Получить новый остров

View File

@ -1,2 +1,2 @@
name = nc_sky_isgen name = nc_sky_isgen
depends = nc_api, nc_terrain, nc_tree depends = nc_api, nc_terrain, nc_tree, nc_lode, nc_crystal