From 33817d2eec7d5d9eb237d5ee15588417bdae42af Mon Sep 17 00:00:00 2001 From: Kimapr Date: Fri, 20 Dec 2019 23:50:58 +0500 Subject: [PATCH] Major gameplay change, localization --- {nc_sieve => nc_crystal}/LICENSE | 0 nc_crystal/init.lua | 113 ++++++++ nc_crystal/locale/nc_crystal.en.tr | 4 + nc_crystal/locale/nc_crystal.ru.tr | 4 + nc_crystal/mod.conf | 2 + nc_crystal/textures/nc_crystal_living.png | Bin 0 -> 1004 bytes nc_sieve/init.lua | 8 - nc_sieve/mod.conf | 2 - nc_sieve/sieve.lua | 301 --------------------- nc_sieve/textures/nc_sieve_random_dust.png | Bin 303 -> 0 bytes nc_sieve/textures/nc_sieve_sieve.png | Bin 180 -> 0 bytes nc_sky_isgen/init.lua | 137 +++++++--- nc_sky_isgen/locale/nc_sky_isgen.en.tr | 14 + nc_sky_isgen/locale/nc_sky_isgen.ru.tr | 15 + nc_sky_isgen/mod.conf | 2 +- 15 files changed, 248 insertions(+), 354 deletions(-) rename {nc_sieve => nc_crystal}/LICENSE (100%) create mode 100644 nc_crystal/init.lua create mode 100644 nc_crystal/locale/nc_crystal.en.tr create mode 100644 nc_crystal/locale/nc_crystal.ru.tr create mode 100644 nc_crystal/mod.conf create mode 100644 nc_crystal/textures/nc_crystal_living.png delete mode 100644 nc_sieve/init.lua delete mode 100644 nc_sieve/mod.conf delete mode 100644 nc_sieve/sieve.lua delete mode 100644 nc_sieve/textures/nc_sieve_random_dust.png delete mode 100644 nc_sieve/textures/nc_sieve_sieve.png create mode 100644 nc_sky_isgen/locale/nc_sky_isgen.en.tr create mode 100644 nc_sky_isgen/locale/nc_sky_isgen.ru.tr diff --git a/nc_sieve/LICENSE b/nc_crystal/LICENSE similarity index 100% rename from nc_sieve/LICENSE rename to nc_crystal/LICENSE diff --git a/nc_crystal/init.lua b/nc_crystal/init.lua new file mode 100644 index 0000000..50f51b4 --- /dev/null +++ b/nc_crystal/init.lua @@ -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) \ No newline at end of file diff --git a/nc_crystal/locale/nc_crystal.en.tr b/nc_crystal/locale/nc_crystal.en.tr new file mode 100644 index 0000000..f89b81a --- /dev/null +++ b/nc_crystal/locale/nc_crystal.en.tr @@ -0,0 +1,4 @@ +# textdomain: nc_crystal +Lode Crystal=Lode Crystal +Lode Crystal Stone=Lode Crystal Stone +plant lode crystal=plant lode crystal diff --git a/nc_crystal/locale/nc_crystal.ru.tr b/nc_crystal/locale/nc_crystal.ru.tr new file mode 100644 index 0000000..521f9e0 --- /dev/null +++ b/nc_crystal/locale/nc_crystal.ru.tr @@ -0,0 +1,4 @@ +# textdomain: nc_crystal +Lode Crystal=Металлический Кристалл +Lode Crystal Stone=Камень с Металлический Кристалл +plant lode crystal=посадить металлический кристал diff --git a/nc_crystal/mod.conf b/nc_crystal/mod.conf new file mode 100644 index 0000000..29dfbc0 --- /dev/null +++ b/nc_crystal/mod.conf @@ -0,0 +1,2 @@ +name = nc_crystal +depends = nc_api, nc_api_craft, nc_terrain, nc_lode, nc_guide diff --git a/nc_crystal/textures/nc_crystal_living.png b/nc_crystal/textures/nc_crystal_living.png new file mode 100644 index 0000000000000000000000000000000000000000..1aaae5cb2691727ef3b5522a60f0edd579b07de3 GIT binary patch literal 1004 zcmVGr(qwJ2QIa(Iqp}(- z*A`pnP_qPyNhc@bMnnVQbN8B)qb;OmN{XROJdY zE58GvsqbJ_#wgV`V7DB>EOqil^R1U%JKN-Kg<*-%qItZ=v>yKMx`}hade%|_?B?@G z;vI6WCak7vbR$OEh+`Np0wTZsRX^6`>YD5SbylFtGlVGA0s|=0UEmL(35zL$k-bT1 z@gmVAlxj{~wzo;74j~F*Zrt64*DgtT9iQ+>-flj7e#qB#;GbBobekWhhB2}|m}MRK znRF(LroNAE1nAg#fR7qaF}=J-G`T~fD7ToN#%rzRPaS;}&xw40$?|R6>I6g6XHk`M zB;h_A9X{4l@6oz_f8DExP5UfmZDS3&H|QH_6fuklhLHgf5#&O_zK`ZDPA2a~@H(#0 zyfs8hw<8L0A*7A;UkvrdulI2Bat4cBC*V?x@Ov_xc|j}j6>HP!NR*auBFx7!^d7QT zS5*3fAAjqlcla!-X$gzzG`dlZVJL{=B^j4ZB9-}&gI{l(PGuBiaS&Ar5~v)guBi0Y z;Mp5|eA6(!!=M{hqU$HH$Sq7Q4YHa-!s{49V1n7`E67qminNvZgKq9bB4Igsb=(=7 z;N2f1EGJqK1RDT?U?Y*fK#|ifu)W|bR#PW&STtl&C8Z}Q$_2OWG-LBK6h8DNv1BRp zu@A^Gj{u*O(wkA_ILY+Wu)$iumi%i}dDii}vovhJOz6$>ifrFAys_sDrCOFc-%b4P zEPi*E-Ni?Mg8z#YIcrg*QD&p1h(aeN+G2G@rLT^SPjYleF96B(ODIw!Ip*WUl6};8 z{rpG5VVOh{U*qp+45zi5x%*vV*5=3Ei3vK+A44~W8DF@Bs@y}7rqPXZGT9cY@+Zm5 adE#HIj8~}v%sNg00000 --------------------------------------------------------- - -nodecore.amcoremod() - -include("sieve") diff --git a/nc_sieve/mod.conf b/nc_sieve/mod.conf deleted file mode 100644 index e5aeefc..0000000 --- a/nc_sieve/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = nc_sieve -depends = nc_woodwork, nc_stonework, nc_terrain, nc_lode, nc_lux, nc_api diff --git a/nc_sieve/sieve.lua b/nc_sieve/sieve.lua deleted file mode 100644 index 435187c..0000000 --- a/nc_sieve/sieve.lua +++ /dev/null @@ -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"}, - } - }) diff --git a/nc_sieve/textures/nc_sieve_random_dust.png b/nc_sieve/textures/nc_sieve_random_dust.png deleted file mode 100644 index 9165c655363479793ce9303090b6f5d374fd2a3c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 303 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#F_(zAfU)Y9yWv0~$r9Iy66gHf+|;}h2Ir#G#FEq$h4Rdj3lr7_2c&Zn6JY;&$jwo{rh`+d7AEo zOMH+#)Z+ble*SMsA75WdKDqzL51c#KcUeF!W>(}58Oa?H=Zq|@t&Qi{)k-b*p0UC5 z_ig!PwiKynLV{XE z)7O>#F_#FxwRDL~6%SBIvcxr_#5q4VH#M(>!MP|ku_QG`p**uBL&4qCHz2%`PaLR7 z&(p;*#Nu@Fpa1{=*Rydk2s5`PJm5`m6i-M=Njb8d(e_N6qePF?fddCDW{FEM+_L16 UtlepQ4XBgB)78&qol`;+09)TM{r~^~ diff --git a/nc_sky_isgen/init.lua b/nc_sky_isgen/init.lua index 91168f7..518f1cb 100644 --- a/nc_sky_isgen/init.lua +++ b/nc_sky_isgen/init.lua @@ -1,22 +1,47 @@ --nothing-- +local S = minetest.get_translator("nc_sky_isgen") local grass = "nc_terrain:dirt_with_grass" local dirt = "nc_terrain:dirt" local tree = "nc_tree:eggcorn_planted" local stone = "nc_terrain:stone" local queue = {} +local cooldown = 120 +local cooldowns = {} local function maxval(octaves,persistence,scale) - local m = scale - local poc = scale + local m = 1 + local poc = 1 if octaves > 1 then for n=2,octaves do poc = poc*persistence m=m+poc end end - return m + return scale/m 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 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) @@ -26,35 +51,42 @@ local function island(pos,r) local n = 0 local c = 0 local cm = (r*2+1)^3 - local function geto(x,y,z) - local dist = (x*x+y*y+z*z)^0.5 - local uvdist = (y+r)/(r*2) - local hdist = (x*x+z*z)^0.5 - local uhdist = (math.max(0,r-hdist)/r)^((1-uvdist)^3*5) - local udist = math.max(0,r-dist)/r - local m = ((math.max(r-(hdist),0)/r)^0.1*(uhdist^2))-uhdist*uvdist^3 - return m + local function geto(x1,y1,z1,n) + local r1 = 48+n*2-1 + local dista = dist(0,0,0,x1,y1*3,z1) + local m = math.max(0,1-dista/r1) + local r2 = -r1 + if y1 <= 0 and y1 >= r2 then + local r3 = (1-math.sin(y1/r2*math.pi/2))*r1 + 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 local grasses = {} + local stones = {} for x=-r,r do for z=-r,r do for y=-r,r do 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 oc2 = o2 > 0.4 - local og = (o > 0.6) + local og = (o > 0.5) and o2 > 0.4 if oc then n=n+1 local nam = dirt if not og and not oc2 then nam = grass - table.insert(grasses,{x=xx,y=yy,z=zz}) + table.insert(grasses,ppos) end if og then nam = stone + table.insert(stones,ppos) end - minetest.set_node({x=xx,y=yy,z=zz},{name=nam}) + minetest.set_node(ppos,{name=nam}) else n=n+0.01 end @@ -65,7 +97,19 @@ local function island(pos,r) 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 local n = math.random(1,#grasses) local v = table.remove(grasses,n) @@ -80,7 +124,7 @@ local f,abs = math.floor, math.abs local function spawn_island(name,pos) local ref = minetest.get_player_by_name(name) 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}) end local store = minetest.get_mod_storage() @@ -112,9 +156,10 @@ do end local air_c = minetest.get_content_id("air") +local ignore_c = minetest.get_content_id("ignore") 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 local function checkpos(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 y = y-32,y+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 end end @@ -251,16 +297,16 @@ minetest.register_globalstep(function(dt) end) minetest.register_chatcommand("register", { - description = "Register island", + description = S"Register island", privs = {server = true}, func = function(name,param) 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 end local ref = minetest.get_player_by_name(name) 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}) minetest.chat_send_player(name,"OK") save() @@ -268,12 +314,12 @@ minetest.register_chatcommand("register", { }) minetest.register_chatcommand("unregister", { - description = "Unregister island", + description = S"Unregister island", privs = {server = true}, func = function(name,param) local is = get_standing_island(name) if not is then - minetest.chat_send_player(name,"No island here") + minetest.chat_send_player(name,S"No island here") return end if is.t == cells then @@ -283,18 +329,18 @@ minetest.register_chatcommand("unregister", { local nam = is.owner players[nam] = nil end - minetest.chat_send_player(name,"OK") + minetest.chat_send_player(name,S"OK") save() end }) minetest.register_chatcommand("assign", { - description = "Reassign this island", + description = S"Reassign this island", privs = {server = true}, func = function(name,param) local is = get_standing_island(name) 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 end if players[param] then @@ -303,28 +349,28 @@ minetest.register_chatcommand("assign", { players[param] = nil end if not is then - minetest.chat_send_player(name,"No island here") + minetest.chat_send_player(name,S"No island here") return else players[name] = {pos = is.pos, valid = is.valid} is.t[is.k] = nil end - minetest.chat_send_player(name,"OK") + minetest.chat_send_player(name,S"OK") save() end }) minetest.register_chatcommand("unassign", { - description = "Unassign this island", + description = S"Unassign this island", privs = {server = true}, func = function(name,param) local is = get_standing_island(name) if not is then - minetest.chat_send_player(name,"No island here") + minetest.chat_send_player(name,S"No island here") return end 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 end if is.t == players then @@ -332,21 +378,21 @@ minetest.register_chatcommand("unassign", { players[nam] = nil table.insert(cells,{pos=is.pos,valid=is.valid}) end - minetest.chat_send_player(name,"OK") + minetest.chat_send_player(name,S"OK") save() end }) 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}, func = function(name,param) local is = get_standing_island(name) if is then is.t[is.k].valid = true - minetest.chat_send_player(name,"OK") + minetest.chat_send_player(name,S"OK") else - minetest.chat_send_player(name,"No island here") + minetest.chat_send_player(name,S"No island here") return end save() @@ -354,15 +400,15 @@ minetest.register_chatcommand("validate", { }) minetest.register_chatcommand("invalidate", { - description = "Make this island unavaible for newcomers", + description = S"Make this island unavaible for newcomers", privs = {server = true}, func = function(name,param) local is = get_standing_island(name) if is then is.t[is.k].valid = false - minetest.chat_send_player(name,"OK") + minetest.chat_send_player(name,S"OK") else - minetest.chat_send_player(name,"No island here") + minetest.chat_send_player(name,S"No island here") return end save() @@ -370,7 +416,7 @@ minetest.register_chatcommand("invalidate", { }) minetest.register_chatcommand("query", { - description = "Query information about this island", + description = S"Query information about this island", func = function(name,param) local is = get_standing_island(name) 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,"]") else - minetest.chat_send_player(name,"No island here") + minetest.chat_send_player(name,S"No island here") end save() end }) minetest.register_chatcommand("reset",{ - description = "Get a new island", + description = S"Get a new island", privs = {interact = true}, 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] if pl then players[name] = nil diff --git a/nc_sky_isgen/locale/nc_sky_isgen.en.tr b/nc_sky_isgen/locale/nc_sky_isgen.en.tr new file mode 100644 index 0000000..da9adc4 --- /dev/null +++ b/nc_sky_isgen/locale/nc_sky_isgen.en.tr @@ -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 diff --git a/nc_sky_isgen/locale/nc_sky_isgen.ru.tr b/nc_sky_isgen/locale/nc_sky_isgen.ru.tr new file mode 100644 index 0000000..d99be06 --- /dev/null +++ b/nc_sky_isgen/locale/nc_sky_isgen.ru.tr @@ -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=Получить новый остров diff --git a/nc_sky_isgen/mod.conf b/nc_sky_isgen/mod.conf index e294b6c..1a548e4 100644 --- a/nc_sky_isgen/mod.conf +++ b/nc_sky_isgen/mod.conf @@ -1,2 +1,2 @@ name = nc_sky_isgen -depends = nc_api, nc_terrain, nc_tree +depends = nc_api, nc_terrain, nc_tree, nc_lode, nc_crystal