Add files via upload
|
@ -0,0 +1,16 @@
|
|||
name = space
|
||||
description = Space
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
space={timer=0,player={},y=2000,y2=4000}
|
||||
dofile(minetest.get_modpath("space") .. "/mapgen.lua")
|
||||
space.setgrav=function(player,grav)
|
||||
player:set_physics_override({gravity=grav})
|
||||
local aa= 1 - ((1-grav)*0.4)
|
||||
player:set_physics_override({jump=aa})
|
||||
end
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
space.timer=space.timer+dtime
|
||||
if space.timer<5 then return end
|
||||
space.timer=0
|
||||
local pos
|
||||
local name
|
||||
for i, player in pairs(minetest.get_connected_players()) do
|
||||
pos=player:getpos().y
|
||||
name=player:get_player_name()
|
||||
if pos<space.y and space.player[name]~=0 then
|
||||
space.toggle(player)
|
||||
elseif pos<space.y2 and space.player[name]~=1 then
|
||||
space.toggle(player)
|
||||
elseif pos>space.y2 and space.player[name]~=2 then
|
||||
space.toggle(player)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
space.toggle=function(player)
|
||||
local name=player:get_player_name()
|
||||
local pos=player:getpos().y
|
||||
if pos<space.y then
|
||||
space.player[name]=0
|
||||
space.setgrav(player,1)
|
||||
minetest.after(0.1,function()
|
||||
player:set_sky({r=0, g=0, b=0},"regular",{})
|
||||
player:set_clouds({
|
||||
thickness=16,
|
||||
color={r=240, g=240, b=255, a=229},
|
||||
ambient={r=0, g=0, b=0, a=255},
|
||||
density=0.4,
|
||||
height=120,
|
||||
speed={y=-2,x=0}
|
||||
})
|
||||
end)
|
||||
elseif pos<space.y2 then
|
||||
space.player[name]=1
|
||||
space.setgrav(player,0.1)
|
||||
minetest.after(0.1,function()
|
||||
player:set_sky({r=0, g=0, b=0},"skybox",{"space_sky.png","space_sky2.png","space_sky.png","space_sky.png","space_sky.png","space_sky.png"})
|
||||
player:set_clouds({density=0,speed=0})
|
||||
end)
|
||||
elseif pos>space.y2 then
|
||||
space.player[name]=2
|
||||
space.setgrav(player,0.1)
|
||||
minetest.after(0.1,function()
|
||||
player:set_sky({r=0, g=0, b=0},"skybox",{"space_sky.png","space_sky.png","space_sky.png","space_sky.png","space_sky.png","space_sky.png"})
|
||||
player:set_clouds({density=0,speed=0})
|
||||
end)
|
||||
end
|
||||
end
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
minetest.after(0.1,function()
|
||||
space.toggle(player)
|
||||
end)
|
||||
end)
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
local name=player:get_player_name()
|
||||
space.player[name]=nil
|
||||
end)
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
local name=player:get_player_name()
|
||||
space.player[name]=0
|
||||
minetest.after(0.1,function()
|
||||
space.toggle(player)
|
||||
end)
|
||||
end)
|
||||
|
||||
minetest.register_craft({
|
||||
output = "space:water",
|
||||
recipe = {
|
||||
{"default:ice"},
|
||||
}
|
||||
})
|
|
@ -0,0 +1,136 @@
|
|||
minetest.register_node("space:air", {
|
||||
description = "Air",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
post_effect_color = {a = 20, r = 220, g = 200, b = 100},
|
||||
groups = {msa=1,not_in_creative_inventory=0},
|
||||
paramtype = "light",
|
||||
sunlight_propagates =true,
|
||||
drawtype = "glasslike",
|
||||
tiles = {"default_cloud.png^[colorize:#E0E0E033"},
|
||||
alpha = 0.1,
|
||||
})
|
||||
|
||||
minetest.register_node("space:water", {
|
||||
description = "Space water",
|
||||
drawtype = "liquid",
|
||||
tiles = {"default_water.png"},
|
||||
alpha = 160,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
liquid_viscosity = 1,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing="space:water",
|
||||
liquid_alternative_source="space:water",
|
||||
liquid_renewable = false,
|
||||
liquid_range = 0,
|
||||
drowning = 1,
|
||||
sunlight_propagates = true,
|
||||
post_effect_color = {a = 103, r = 30, g = 60, b = 90},
|
||||
groups = {water = 3, liquid = 3, puts_out_fire = 1,crumbly = 3},
|
||||
})
|
||||
|
||||
minetest.register_node("space:astroid_spawner", {
|
||||
description = "Astroid spawner",
|
||||
drawtype="airlike",
|
||||
groups = {not_in_creative_inventory=1}
|
||||
})
|
||||
|
||||
minetest.register_node("space:ore_pawner", {
|
||||
description = "Ore spawner",
|
||||
drawtype="airlike",
|
||||
groups = {not_in_creative_inventory=1}
|
||||
})
|
||||
|
||||
minetest.register_node("space:moon_stone", {
|
||||
description = "Moon stone",
|
||||
tiles = {"default_gravel.png^[colorize:#ffffff22"},
|
||||
groups = {spacestuff=1,cracky = 2},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("space:stone", {
|
||||
description = "Stone",
|
||||
tiles = {"default_stone.png"},
|
||||
groups = {cracky = 1,stone=1,spacestuff=1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
drop="default:cobble"
|
||||
})
|
||||
|
||||
minetest.register_lbm({
|
||||
name="space:astroid_spawners",
|
||||
nodenames = {"space:astroid_spawner"},
|
||||
run_at_every_load = true,
|
||||
action = function(pos, node)
|
||||
minetest.set_node(pos, {name = "default:stone"})
|
||||
if minetest.find_node_near(pos, 10,{"group:spacestuff"}) then return end
|
||||
local r=math.random(1,10)
|
||||
if r>5 then r=math.random(1,10) end
|
||||
if r>6 then r=math.random(1,10) end
|
||||
local t=minetest.get_modpath("space").."/schematics/space_astroid" .. r .. ".mts"
|
||||
minetest.place_schematic({x=pos.x,y=pos.y,z=pos.z}, t,"random",nil,false)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_lbm({
|
||||
name="space:ore_pawners",
|
||||
nodenames = {"space:ore_pawner"},
|
||||
run_at_every_load = true,
|
||||
action = function(pos, node)
|
||||
local r=math.random(1,8)
|
||||
if space.ores[r].scarcity==6 then r=math.random(1,8) end
|
||||
minetest.set_node(pos, {name = space.ores[r].ore})
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone",
|
||||
wherein = "air",
|
||||
clust_scarcity = 80 * 80 * 80,
|
||||
clust_num_ores = 1,
|
||||
clust_size = 1,
|
||||
y_min = space.y,
|
||||
y_max = 31000,
|
||||
})
|
||||
|
||||
space.ores={
|
||||
{scarcity=6,ore="space:water"},
|
||||
{scarcity=6,ore="default:ice"},
|
||||
{scarcity=6,ore="default:stone_with_diamond"},
|
||||
{scarcity=6,ore="default:stone_with_mese"},
|
||||
{scarcity=6,ore="default:stone_with_gold"},
|
||||
{scarcity=5,ore="default:stone_with_copper"},
|
||||
{scarcity=4,ore="default:stone_with_iron"},
|
||||
{scarcity=2,ore="default:stone_with_coal"},
|
||||
{scarcity=1,ore="space:astroid_spawner"},
|
||||
}
|
||||
|
||||
for i, ore in pairs(space.ores) do
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = ore.ore,
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = ore.scarcity * ore.scarcity * ore.scarcity,
|
||||
clust_num_ores = 1,
|
||||
clust_size = 1,
|
||||
y_min = space.y,
|
||||
y_max =31000,
|
||||
})
|
||||
if ore.scarcity~=1 then
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = ore.ore,
|
||||
wherein = "space:stone",
|
||||
clust_scarcity = (ore.scarcity*3) * (ore.scarcity*3) * (ore.scarcity*3),
|
||||
clust_num_ores = 1,
|
||||
clust_size = 1,
|
||||
y_min = space.y,
|
||||
y_max = 31000,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
space.ores[8]={scarcity=2,ore="default:stone"}
|
|
@ -0,0 +1,3 @@
|
|||
name = space
|
||||
description = Space
|
||||
depends = default
|
After Width: | Height: | Size: 9.3 KiB |
After Width: | Height: | Size: 290 KiB |
|
@ -0,0 +1,10 @@
|
|||
minetest.after(1,function()
|
||||
local pos={x=0,y=space.y+500,z=0}
|
||||
local n=minetest.get_node(pos)
|
||||
if n and n.name=="ignore" then
|
||||
minetest.set_node(pos, {name = "default:stone"})
|
||||
local t=minetest.get_modpath("space").."/schematics/space_moon.mts"
|
||||
minetest.place_schematic(pos, t)
|
||||
minetest.log("Space: Moon spawned")
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,3 @@
|
|||
name = space_moon
|
||||
description = Moon
|
||||
depends = space
|
|
@ -0,0 +1,204 @@
|
|||
space.planet_last={x=0,y=0,z=0}
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "space_planets:planet_spawner",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 3 * 3 * 3,
|
||||
clust_num_ores = 1,
|
||||
clust_size = 1,
|
||||
y_min = space.y2+100,
|
||||
y_max = 31000,
|
||||
})
|
||||
|
||||
minetest.register_node("space_planets:planet_earthlike", {
|
||||
description = "Planet earthlike",
|
||||
drawtype="airlike",
|
||||
sunlight_propagates =true,
|
||||
})
|
||||
minetest.register_node("space_planets:planet_desert", {
|
||||
description = "Planet desert",
|
||||
drawtype="airlike",
|
||||
sunlight_propagates =true,
|
||||
})
|
||||
minetest.register_node("space_planets:planet_cool", {
|
||||
description = "Planet cool",
|
||||
drawtype="airlike",
|
||||
sunlight_propagates =true,
|
||||
})
|
||||
minetest.register_node("space_planets:planet_rnd", {
|
||||
description = "Planet rnd",
|
||||
drawtype="airlike",
|
||||
sunlight_propagates =true,
|
||||
})
|
||||
minetest.register_node("space_planets:planet_dryearth", {
|
||||
description = "Planet dryearth",
|
||||
drawtype="airlike",
|
||||
sunlight_propagates =true,
|
||||
})
|
||||
|
||||
minetest.register_node("space_planets:planet_spawner", {
|
||||
description = "Planet spawner",
|
||||
tiles = {"default_cloud.png^[colorize:#19ffd655"},
|
||||
paramtype = "light",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-1,-1,-1,1,1,1},
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"space_planets:planet_spawner"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.set_node(pos, {name = "air"})
|
||||
local rs=vector.distance(pos,space.planet_last)
|
||||
print("distance to last planet: " .. rs)
|
||||
if rs < 1000 or minetest.find_node_near(pos, 200,{"group:spacestuff"}) then print("planet spawning failed") return end
|
||||
print("planet is spawning")
|
||||
space.planet_last=pos
|
||||
local r=math.random(1,5)
|
||||
local c=math.random(1,17)
|
||||
local planet={}
|
||||
local t=minetest.get_modpath("space").."/schematics/space_plant.mts"
|
||||
planet[1]={grass="default:dirt_with_grass",dirt="default:dirt",deco="space_planets:planet_earthlike",stone="space:stone"}
|
||||
planet[2]={grass="default:desert_sand",dirt="default:desert_sand",deco="space_planets:planet_desert",stone="default:desert_stone"}
|
||||
planet[3]={grass="default:snowblock",dirt="default:snowblock",deco="space_planets:planet_cool",stone="space:stone"}
|
||||
planet[4]={grass="",dirt="",deco="space_planets:planet_rnd",stone="space:stone"}
|
||||
planet[5]={grass="default:dirt_with_dry_grass",dirt="default:dirt",deco="space_planets:planet_dryearth",stone="space:stone"}
|
||||
|
||||
planet=planet[r]
|
||||
|
||||
if r==4 then
|
||||
local stuff={"default:cobble","default:dirt_with_dry_grass","default:stone","default:dirt_with_grass","default:cactus","default:ice","default:clay","default:gravel","default:desert_sand","default:sand","default:obsidian","default:sandstone","default:desert_cobble","space:moon_stone"}
|
||||
planet.dirt=stuff[math.random(1,14)]
|
||||
planet.grass=stuff[math.random(1,14)]
|
||||
end
|
||||
|
||||
local elemets={["space:stone"]=planet.stone,["default:cobble"]=planet.grass,["default:wood"]=planet.dirt,["default:junglewood"]=planet.deco}
|
||||
|
||||
minetest.place_schematic({x=pos.x,y=pos.y,z=pos.z}, t,"0",elemets,true)
|
||||
|
||||
minetest.after(1,function(elemets,t,pos)
|
||||
minetest.place_schematic({x=pos.x,y=pos.y,z=pos.z-170}, t,"90",elemets,true)
|
||||
end,elemets,t,pos)
|
||||
minetest.after(2,function(elemets,t,pos)
|
||||
minetest.place_schematic({x=pos.x-170,y=pos.y,z=pos.z-170}, t,"180",elemets,true)
|
||||
end,elemets,t,pos)
|
||||
minetest.after(3,function(elemets,t,pos)
|
||||
minetest.place_schematic({x=pos.x-170,y=pos.y,z=pos.z}, t,"270",elemets,true)
|
||||
end,elemets,t,pos)
|
||||
for i, ob in pairs(minetest.get_objects_inside_radius(pos, 50)) do
|
||||
local p=ob:getpos()
|
||||
p.y=pos.y+75
|
||||
ob:moveto(p)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"space_planets:planet_earthlike"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local r=math.random(1,19)
|
||||
local stuff={
|
||||
"default:grass_3",
|
||||
"default:junglesapling",
|
||||
"default:sapling",
|
||||
"default:aspen_sapling",
|
||||
"default:junglesapling",
|
||||
"default:sapling",
|
||||
"default:aspen_sapling",
|
||||
"default:junglegrass",
|
||||
"default:grass_3",
|
||||
"flowers:mushroom_brown",
|
||||
"flowers:mushroom_red",
|
||||
"flowers:rose",
|
||||
"flowers:tulip",
|
||||
"flowers:dandelion_yellow",
|
||||
"flowers:geranium",
|
||||
"flowers:viola",
|
||||
"flowers:dandelion_white",
|
||||
"farming:wheat_" .. math.random(4,8),
|
||||
"farming:cotton_" .. math.random(4,8),
|
||||
""}
|
||||
minetest.set_node(pos, {name = stuff[r]})
|
||||
local t=minetest.get_modpath("space").."/schematics/space_lightfix.mts"
|
||||
minetest.place_schematic(pos, t,"random",nil,false)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"space_planets:planet_desert"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local r=math.random(1,3)
|
||||
local stuff={
|
||||
"default:cactus",
|
||||
"default:dry_shrub",
|
||||
"default:desert_stone",
|
||||
""}
|
||||
minetest.set_node(pos, {name = stuff[r]})
|
||||
local t=minetest.get_modpath("space").."/schematics/space_lightfix.mts"
|
||||
minetest.place_schematic(pos, t,"random",nil,false)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"space_planets:planet_dryearth"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local r=math.random(1,4)
|
||||
local stuff={
|
||||
"default:cactus",
|
||||
"default:acacia_sapling",
|
||||
"default:dry_shrub",
|
||||
"default:desert_stone",
|
||||
""}
|
||||
if r==1 then
|
||||
minetest.set_node({x=pos.x,y=pos.y-1,z=pos.z}, {name = "default:sand"})
|
||||
end
|
||||
minetest.set_node(pos, {name = stuff[r]})
|
||||
local t=minetest.get_modpath("space").."/schematics/space_lightfix.mts"
|
||||
minetest.place_schematic(pos, t,"random",nil,false)
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"space_planets:planet_cool"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local r=math.random(1,3)
|
||||
local stuff={
|
||||
"default:snow",
|
||||
"default:ice",
|
||||
"default:dirt_with_snow",
|
||||
"default:pine_sapling",
|
||||
""}
|
||||
minetest.set_node(pos, {name = stuff[r]})
|
||||
local t=minetest.get_modpath("space").."/schematics/space_lightfix.mts"
|
||||
minetest.place_schematic(pos, t,"random",nil,false)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"space_planets:planet_rnd"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.set_node(pos, {name = "air"})
|
||||
local t=minetest.get_modpath("space").."/schematics/space_lightfix.mts"
|
||||
minetest.place_schematic(pos, t,"random",nil,false)
|
||||
end,
|
||||
})
|
|
@ -0,0 +1,3 @@
|
|||
name = space_planets
|
||||
description = Moon
|
||||
depends = space
|
|
@ -0,0 +1,52 @@
|
|||
|
||||
minetest.register_craft({
|
||||
output = "spacesuit:door1_1 2",
|
||||
recipe = {
|
||||
{"","spacesuit:shieldblock",""},
|
||||
{"","spacesuit:shieldblock", ""},
|
||||
{"","spacesuit:shieldblock", ""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "spacesuit:airgen5",
|
||||
recipe = {
|
||||
{"spacesuit:shieldblock","spacesuit:air_gassbotte","spacesuit:shieldblock"},
|
||||
{"spacesuit:shieldblock","spacesuit:oxogen", "spacesuit:shieldblock"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "spacesuit:air_gassbotte 2",
|
||||
recipe = {
|
||||
{"default:steel_ingot","spacesuit:oxogen","default:steel_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "spacesuit:sp",
|
||||
recipe = {
|
||||
{"spacesuit:sp","spacesuit:air_gassbotte",""}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "spacesuit:steelwallblock 8",
|
||||
recipe = {
|
||||
{"default:steel_ingot","default:steel_ingot","default:steel_ingot"},
|
||||
{"default:steel_ingot","", "default:steel_ingot"},
|
||||
{"default:steel_ingot","default:steel_ingot","default:steel_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "spacesuit:shieldblock 4",
|
||||
recipe = {
|
||||
{"default:steel_ingot","default:steel_ingot","default:iron_lump"},
|
||||
{"default:steel_ingot","default:steel_ingot", ""},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 118 KiB |
|
@ -0,0 +1,86 @@
|
|||
minetest.register_on_leaveplayer(function(player)
|
||||
spacesuit.player_sp[player:get_player_name()]=nil
|
||||
end)
|
||||
|
||||
-- place air2 if near to it (or it will messup with corrently)
|
||||
minetest.register_on_dignode(function(pos, oldnode, digger)
|
||||
if pos.y<space.y then return end
|
||||
local np=minetest.find_node_near(pos, 1,{"space:air"})
|
||||
if np~=nil then
|
||||
minetest.set_node(pos, {name = "space:air"})
|
||||
end
|
||||
end)
|
||||
|
||||
function spacesuit_replacenode(pos)
|
||||
local np=minetest.find_node_near(pos, 1,{"space:air"})
|
||||
if np then
|
||||
minetest.set_node(pos, {name = "space:air"})
|
||||
else
|
||||
minetest.set_node(pos, {name = "air"})
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
spacesuit.breath_timer=spacesuit.breath_timer+dtime
|
||||
if spacesuit.breath_timer<2 then return end
|
||||
spacesuit.breath_timer=0
|
||||
for i, player in pairs(minetest.get_connected_players()) do
|
||||
local l=player:get_pos()
|
||||
if l.y>space.y then
|
||||
local user = spacesuit.player_sp[player:get_player_name()]
|
||||
local n = minetest.get_node({x=l.x,y=l.y+2,z=l.z}).name
|
||||
local inv = player:get_inventory()
|
||||
|
||||
if user.sp==1 then
|
||||
--(have spacesuit)
|
||||
if n=="space:air" and inv:get_stack("main", 1):get_name()=="spacesuit:sp" and inv:get_stack("main", 1):get_wear()>0 then
|
||||
local w=inv:get_stack("main", 1):get_wear()- (65534/20)
|
||||
if w<0 then w=0 end
|
||||
inv:set_stack("main", 1,ItemStack({name="spacesuit:sp",wear=w}))
|
||||
elseif n~="space:air" and inv:get_stack("main", 1):get_name()=="spacesuit:sp" then
|
||||
if inv:get_stack("main", 1):get_name()~="" and inv:get_stack("main", 1):get_wear()<65533 then
|
||||
player:set_breath(11)
|
||||
local w=inv:get_stack("main", 1):get_wear()+ (65534/900)
|
||||
if w>65533 then w=65533 end
|
||||
inv:set_stack("main", 1,ItemStack({name="spacesuit:sp",wear=w}))
|
||||
elseif inv:get_stack("main", 1):get_name()=="spacesuit:sp" and inv:get_stack("main", 1):get_wear()>=65533 then
|
||||
local have_more=0
|
||||
for i=0,32,1 do
|
||||
if inv:get_stack("main", i):get_name()=="spacesuit:air_gassbotte" then
|
||||
local c=inv:get_stack("main", i):get_count()-1
|
||||
inv:set_stack("main", i,ItemStack({name="spacesuit:air_gassbotte",count=c}))
|
||||
inv:set_stack("main", 1,ItemStack({name="spacesuit:sp",wear=0}))
|
||||
minetest.sound_play("spacesuit_pff", {pos=pos, gain = 1, max_hear_distance = 8,})
|
||||
have_more=1
|
||||
if c<4 and c>1 then minetest.chat_send_player(player:get_player_name(), "Warning: Gassbottes left: " .. c) end
|
||||
if c==0 then minetest.chat_send_player(player:get_player_name(), "Warning: Gassbottes are over!") end
|
||||
break
|
||||
end
|
||||
end
|
||||
if have_more==0 then
|
||||
user.sp=0
|
||||
minetest.chat_send_player(player:get_player_name(), "Warning: You are out of air!")
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif user.sp==0 and inv:get_stack("main", 1):get_name()=="spacesuit:sp" and inv:get_stack("main", 1):get_wear()<65533 then
|
||||
--(set up spacesuit)
|
||||
user.sp=1
|
||||
spacesuit.tmpuser=player
|
||||
local m=minetest.add_entity(player:get_pos(), "spacesuit:sp1")
|
||||
m:set_attach(player, "", {x=0,y=-3,z=0}, {x=0,y=0,z=0})
|
||||
user.skin=player:get_properties().textures
|
||||
player:set_properties({visual = "mesh",textures = {"spacesuit_sp2.png"},visual_size = {x=1, y=1}})
|
||||
elseif n=="air" and n~="ignore" then
|
||||
--(no spacesuit and in default air: lose 8 hp)
|
||||
player:set_hp(player:get_hp()-8)
|
||||
elseif n~="space:air" and n~="ignore" then
|
||||
--(no spacesuit and inside something else: lose 1 hp)
|
||||
player:set_hp(player:get_hp()-1)
|
||||
elseif user.sp==0 and n=="space:air" and inv:get_stack("main", 1):get_name()=="spacesuit:sp" and inv:get_stack("main", 1):get_wear()>=65533 then
|
||||
--(set up spacesuit inair but empty)
|
||||
user.sp=1
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,71 @@
|
|||
spacesuit={
|
||||
breath_timer=0,
|
||||
player_sp={},
|
||||
air=21,
|
||||
player_space={},
|
||||
itemdroptime=tonumber(minetest.settings:get("item_entity_ttl")),
|
||||
}
|
||||
|
||||
spacesuit.itemdroptime = spacesuit.itemdroptime and spacesuit.itemdroptime - 20 or 880
|
||||
|
||||
dofile(minetest.get_modpath("spacesuit") .. "/nodes.lua")
|
||||
dofile(minetest.get_modpath("spacesuit") .. "/craft.lua")
|
||||
dofile(minetest.get_modpath("spacesuit") .. "/functions.lua")
|
||||
|
||||
minetest.register_tool("spacesuit:sp", {
|
||||
description = "Spacesuit (wear slot 1, works in space only)",
|
||||
inventory_image = "spacesuit_sp.png",
|
||||
})
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
spacesuit.player_sp[player:get_player_name()]={sp=0,skin={}}
|
||||
end)
|
||||
|
||||
minetest.register_entity("spacesuit:sp1",{
|
||||
hp_max = 100,
|
||||
physical = false,
|
||||
weight = 0,
|
||||
collisionbox = {-0.1,-0.1,-0.1, 0.1,0.1,0.1},
|
||||
visual = "cube",
|
||||
visual_size = {x=0.5, y=0.5},
|
||||
textures = {"spacesuit_air.png","spacesuit_air.png","spacesuit_air.png","spacesuit_air.png","spacesuit_air.png","spacesuit_air.png"},
|
||||
spritediv = {x=1, y=1},
|
||||
is_visible = true,
|
||||
makes_footstep_sound = false,
|
||||
automatic_rotate = false,
|
||||
timer=0,
|
||||
on_activate=function(self, staticdata)
|
||||
if spacesuit.tmpuser then
|
||||
self.user=spacesuit.tmpuser
|
||||
spacesuit.tmpuser=nil
|
||||
self.hud=self.user:hud_add({
|
||||
hud_elem_type = "image",
|
||||
text ="spacesuit_scene.png",
|
||||
name = "spacesuit_sky",
|
||||
scale = {x=-100, y=-100},
|
||||
position = {x=0, y=0},
|
||||
alignment = {x=1, y=1},
|
||||
})
|
||||
else
|
||||
self.object:remove()
|
||||
end
|
||||
end,
|
||||
on_step= function(self, dtime)
|
||||
self.timer=self.timer+dtime
|
||||
if self.timer<2 then return end
|
||||
self.timer=0
|
||||
local p = spacesuit.player_sp[self.user:get_player_name()]
|
||||
if not (self.user:get_pos() or p) then
|
||||
self.object:remove()
|
||||
return self
|
||||
elseif self.user:get_inventory():get_stack("main", 1):get_name()~="spacesuit:sp" then
|
||||
self.object:set_detach()
|
||||
self.user:set_properties({mesh = "character.b3d",textures = p.skin})
|
||||
p.skin={}
|
||||
p.sp=0
|
||||
self.user:hud_remove(self.hud)
|
||||
self.object:remove()
|
||||
return self
|
||||
end
|
||||
end
|
||||
})
|
|
@ -0,0 +1,3 @@
|
|||
name = spacesuit
|
||||
description = Spacesuit
|
||||
depends = space,default
|
|
@ -0,0 +1,303 @@
|
|||
|
||||
minetest.register_node("spacesuit:door2_1", {
|
||||
description = "Door",
|
||||
drop="spacesuit:door2_1",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.125, 0.5, 0.5, 0.125},
|
||||
}
|
||||
},
|
||||
tiles = {"spacesuit_warntape.png","spacesuit_warntape.png","spacesuit_door2.png","spacesuit_warntape.png","spacesuit_door2.png","spacesuit_door2_2.png",},
|
||||
groups = {cracky = 1, level = 2, not_in_creative_inventory=0},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
local p={x=pos.x,y=pos.y+1,z=pos.z}
|
||||
if minetest.registered_nodes[minetest.get_node(p).name].walkable then
|
||||
return false
|
||||
else
|
||||
minetest.set_node(p, {name = "spacesuit:door2_2",param2=minetest.get_node(pos).param2})
|
||||
end
|
||||
end,
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
local p={x=pos.x,y=pos.y+1,z=pos.z}
|
||||
minetest.swap_node(p, {name="spacesuit:door2_open_2", param2=minetest.get_node(pos).param2})
|
||||
minetest.swap_node(pos, {name="spacesuit:door2_open_1", param2=minetest.get_node(pos).param2})
|
||||
minetest.sound_play("spacesuit_door2", {pos=pos, gain = 1, max_hear_distance = 5})
|
||||
minetest.after(2, function(pos,p)
|
||||
if minetest.get_node(pos).name=="spacesuit:door2_open_1" then
|
||||
minetest.sound_play("spacesuit_door2", {pos=pos, gain = 1, max_hear_distance = 5})
|
||||
minetest.swap_node(p, {name="spacesuit:door2_2", param2=minetest.get_node(pos).param2})
|
||||
minetest.swap_node(pos, {name="spacesuit:door2_1", param2=minetest.get_node(pos).param2})
|
||||
end
|
||||
end, pos,p)
|
||||
end,
|
||||
after_dig_node = function (pos, name, digger)
|
||||
spacesuit_replacenode({x=pos.x,y=pos.y+1,z=pos.z})
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("spacesuit:door2_2", {
|
||||
description = "Door 2-1",
|
||||
drawtype = "nodebox",
|
||||
drop="spacesuit:door2_1",
|
||||
paramtype = "light",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.125, 0.5, 0.5, 0.125},
|
||||
}
|
||||
},
|
||||
tiles = {"spacesuit_warntape.png","spacesuit_warntape.png","spacesuit_door2.png","spacesuit_warntape.png","spacesuit_door2.png","spacesuit_door2_2.png",},
|
||||
groups = {cracky = 1, level = 2, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
local p={x=pos.x,y=pos.y-1,z=pos.z}
|
||||
minetest.swap_node(p, {name="spacesuit:door2_open_1", param2=minetest.get_node(pos).param2})
|
||||
minetest.swap_node(pos, {name="spacesuit:door2_open_2", param2=minetest.get_node(pos).param2})
|
||||
minetest.sound_play("spacesuit_door2", {pos=pos, gain = 1, max_hear_distance = 5})
|
||||
minetest.after(2, function(pos,p)
|
||||
if minetest.get_node(pos).name=="spacesuit:door2_open_2" then
|
||||
minetest.sound_play("spacesuit_door2", {pos=pos, gain = 1, max_hear_distance = 5})
|
||||
minetest.swap_node(p, {name="spacesuit:door2_1", param2=minetest.get_node(pos).param2})
|
||||
minetest.swap_node(pos, {name="spacesuit:door2_2", param2=minetest.get_node(pos).param2})
|
||||
end
|
||||
end, pos,p)
|
||||
end,
|
||||
after_dig_node = function (pos, name, digger)
|
||||
spacesuit_replacenode({x=pos.x,y=pos.y-1,z=pos.z})
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("spacesuit:door2_open_1", {
|
||||
description = "Door (open) 2-o-1",
|
||||
drop="spacesuit:door2_1",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{0.41, -0.5, -0.124, 1.41, 0.5, 0.125},
|
||||
}
|
||||
},
|
||||
tiles = {"spacesuit_warntape.png","spacesuit_warntape.png","spacesuit_door2_open.png","spacesuit_warntape.png","spacesuit_door2_open.png","spacesuit_door2_2_open.png",},
|
||||
groups = {cracky = 1, level = 2, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
after_dig_node = function (pos, name, digger)
|
||||
spacesuit_replacenode({x=pos.x,y=pos.y+1,z=pos.z})
|
||||
end,
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
local p={x=pos.x,y=pos.y+1,z=pos.z}
|
||||
minetest.sound_play("spacesuit_door2", {pos=pos, gain = 1, max_hear_distance = 5})
|
||||
minetest.swap_node(p, {name="spacesuit:door2_2", param2=minetest.get_node(pos).param2})
|
||||
minetest.swap_node(pos, {name="spacesuit:door2_1", param2=minetest.get_node(pos).param2})
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("spacesuit:door2_open_2", {
|
||||
description = "Door (open) 2-o-1",
|
||||
drawtype = "nodebox",
|
||||
drop="spacesuit:door2_1",
|
||||
paramtype = "light",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{0.41, -0.5, -0.124, 1.41, 0.5, 0.125},
|
||||
}
|
||||
},
|
||||
tiles = {"spacesuit_warntape.png","spacesuit_warntape.png","spacesuit_door2_open.png","spacesuit_warntape.png","spacesuit_door2_open.png","spacesuit_door2_2_open.png",},
|
||||
groups = {cracky = 1, level = 2, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
after_dig_node = function (pos, name, digger)
|
||||
spacesuit_replacenode({x=pos.x,y=pos.y-1,z=pos.z})
|
||||
end,
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
local p={x=pos.x,y=pos.y-1,z=pos.z}
|
||||
minetest.sound_play("spacesuit_door2", {pos=pos, gain = 1, max_hear_distance = 5})
|
||||
minetest.swap_node(p, {name="spacesuit:door2_1", param2=minetest.get_node(pos).param2})
|
||||
minetest.swap_node(pos, {name="spacesuit:door2_2", param2=minetest.get_node(pos).param2})
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
-- checks if the area is too big or if its outside in 14 directions
|
||||
local airgen_tmpn=1
|
||||
for i=0,5,1 do
|
||||
if i==5 then airgen_tmpn=0 end
|
||||
minetest.register_node("spacesuit:airgen" .. i, {
|
||||
description = "Air Generator " .. i*20 .."% power",
|
||||
tiles = {"spacesuit_shieldblock.png^default_obsidian_glass.png","spacesuit_gen" .. i ..".png"},
|
||||
groups = {dig_immediate=3,not_in_creative_inventory=airgen_tmpn},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_construct = function(pos)
|
||||
minetest.get_meta(pos):set_string("infotext", "Air Generater " .. i*20 .."% power")
|
||||
end,
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
if pos.y<space.y then return false end
|
||||
if minetest.is_protected(pos,player:get_player_name())==false and minetest.get_node(pos).name~="spacesuit:airgen0" then
|
||||
local ch={xp=1,xm=1,yp=1,ym=1,zp=1,zm=1, ypxz=1,ypz=1,ypx=1,ypmxz=1, ymxz=1,ymz=1,ymx=1,ymmxz=1,all=14}
|
||||
for ii=1,spacesuit.air-2,1 do
|
||||
if ch.xp==1 and minetest.get_node({x=pos.x+ii,y=pos.y,z=pos.z}).name~="air" then ch.xp=0 ch.all=ch.all-1 end
|
||||
if ch.xm==1 and minetest.get_node({x=pos.x-ii,y=pos.y,z=pos.z}).name~="air" then ch.xm=0 ch.all=ch.all-1 end
|
||||
if ch.zp==1 and minetest.get_node({x=pos.x,y=pos.y,z=pos.z+ii}).name~="air" then ch.zp=0 ch.all=ch.all-1 end
|
||||
if ch.zm==1 and minetest.get_node({x=pos.x,y=pos.y,z=pos.z-ii}).name~="air" then ch.zm=0 ch.all=ch.all-1 end
|
||||
|
||||
if ch.yp==1 and minetest.get_node({x=pos.x,y=pos.y+ii,z=pos.z}).name~="air" then ch.yp=0 ch.all=ch.all-1 end
|
||||
if ch.ym==1 and minetest.get_node({x=pos.x,y=pos.y-ii,z=pos.z}).name~="air" then ch.ym=0 ch.all=ch.all-1 end
|
||||
|
||||
if ch.ypxz==1 and minetest.get_node({x=pos.x+ii,y=pos.y+ii,z=pos.z+ii}).name~="air" then ch.ypxz=0 ch.all=ch.all-1 end
|
||||
if ch.ypz==1 and minetest.get_node({x=pos.x-ii,y=pos.y+ii,z=pos.z+ii}).name~="air" then ch.ypz=0 ch.all=ch.all-1 end
|
||||
if ch.ypx==1 and minetest.get_node({x=pos.x+ii,y=pos.y+ii,z=pos.z-ii}).name~="air" then ch.ypx=0 ch.all=ch.all-1 end
|
||||
if ch.ypmxz==1 and minetest.get_node({x=pos.x-ii,y=pos.y+ii,z=pos.z-ii}).name~="air" then ch.ypmxz=0 ch.all=ch.all-1 end
|
||||
|
||||
if ch.ymxz==1 and minetest.get_node({x=pos.x+ii,y=pos.y-ii,z=pos.z+ii}).name~="air" then ch.ymxz=0 ch.all=ch.all-1 end
|
||||
if ch.ymz==1 and minetest.get_node({x=pos.x-ii,y=pos.y-ii,z=pos.z+ii}).name~="air" then ch.ymz=0 ch.all=ch.all-1 end
|
||||
if ch.ymx==1 and minetest.get_node({x=pos.x+ii,y=pos.y-ii,z=pos.z-ii}).name~="air" then ch.ymx=0 ch.all=ch.all-1 end
|
||||
if ch.ymmxz==1 and minetest.get_node({x=pos.x-ii,y=pos.y-ii,z=pos.z-ii}).name~="air" then ch.ymmxz=0 ch.all=ch.all-1 end
|
||||
if ch.all==0 then break end
|
||||
end
|
||||
if ch.all>0 then
|
||||
minetest.get_meta(pos):set_string("infotext", "Air Generater " .. i*20 .."% power [This area is too big (max " .. spacesuit.air-1 .. ") you have to rebuild]")
|
||||
return
|
||||
end
|
||||
local done=0
|
||||
for ii=1,17,1 do
|
||||
minetest.get_meta(pos):set_int("prl",0)
|
||||
local np=minetest.find_node_near(pos,1,{"air"})
|
||||
if np~=nil then
|
||||
minetest.set_node(np, {name = "spacesuit:air"})
|
||||
minetest.get_meta(np):set_int("prl",1)
|
||||
done=1
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
if done==1 then
|
||||
minetest.swap_node(pos, {name = "spacesuit:airgen" .. (i-1)})
|
||||
minetest.get_meta(pos):set_string("infotext", "Air Generater " .. (i-1)*20 .."% power")
|
||||
minetest.sound_play("spacesuit_pff", {pos=pos, gain = 1, max_hear_distance = 8,})
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
minetest.register_node("spacesuit:air", {
|
||||
description = "Air (unstabile)",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
drawtype = "glasslike",
|
||||
post_effect_color = {a = 180, r = 120, g = 120, b = 120},
|
||||
alpha = 20,
|
||||
tiles = {"default_cloud.png^[colorize:#E0E0E099"},
|
||||
groups = {msa=1,not_in_creative_inventory=0},
|
||||
paramtype = "light",
|
||||
sunlight_propagates =true,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(30)
|
||||
end,
|
||||
on_timer = function (pos, elapsed)
|
||||
minetest.set_node(pos, {name = "space:air"})
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("spacesuit:shieldblock", {
|
||||
description = "Shieldblock",
|
||||
tiles = {"spacesuit_shieldblock.png"},
|
||||
groups = {cracky = 1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
minetest.register_node("spacesuit:steelwallblock", {
|
||||
description = "Steel wallblock",
|
||||
tiles = {"spacesuit_wall.png"},
|
||||
groups = {cracky = 1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("spacesuit:oxogen", {
|
||||
description = "Oxygen block",
|
||||
tiles = {"spacesuit_oxogen.png"},
|
||||
drawtype="glasslike",
|
||||
groups = {crumbly = 2},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
alpha = 50,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("spacesuit:air_gassbotte", {
|
||||
description = "Air gassbotte",
|
||||
tiles = {"default_steel_block.png"},
|
||||
--inventory_image = "default_steel_block.png",
|
||||
drawtype = "nodebox",
|
||||
groups = {dig_immediate=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
is_ground_content = false,
|
||||
--paramtype2 = "facedir",
|
||||
paramtype = "light",
|
||||
node_box = {
|
||||
type="fixed",
|
||||
fixed={-0.1,-0.5,-0.1,0.1,0.3,0.1}},
|
||||
})
|
||||
|
||||
-- spread air gass in a level system
|
||||
minetest.register_abm({
|
||||
nodenames = {"air"},
|
||||
neighbors = {"spacesuit:air"},
|
||||
interval = 3,
|
||||
chance = 1,
|
||||
action = function(pos)
|
||||
local np=minetest.find_node_near(pos, 1,{"spacesuit:air"})
|
||||
local n
|
||||
if np~=nil then n=minetest.get_node(np) end
|
||||
if n and n.name=="spacesuit:air" then
|
||||
local r=minetest.get_meta(np):get_int("prl")
|
||||
if r>0 and r<spacesuit.air then
|
||||
minetest.set_node(pos, {name = "spacesuit:air"})
|
||||
minetest.get_meta(pos):set_int("prl",r+1)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"space:air"},
|
||||
neighbors = {"air"},
|
||||
interval = 10,
|
||||
chance = 3,
|
||||
action = function(pos)
|
||||
minetest.set_node(pos, {name = "air"})
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "spacesuit:oxogen",
|
||||
wherein = "space:stone",
|
||||
clust_scarcity = 15 * 15 * 15,
|
||||
clust_num_ores = 1,
|
||||
clust_size = 1,
|
||||
y_min = space.y,
|
||||
y_max = 31000,
|
||||
})
|
After Width: | Height: | Size: 167 B |
After Width: | Height: | Size: 545 B |
After Width: | Height: | Size: 534 B |
After Width: | Height: | Size: 563 B |
After Width: | Height: | Size: 550 B |
After Width: | Height: | Size: 293 B |
After Width: | Height: | Size: 300 B |
After Width: | Height: | Size: 305 B |
After Width: | Height: | Size: 307 B |
After Width: | Height: | Size: 306 B |
After Width: | Height: | Size: 305 B |
After Width: | Height: | Size: 446 B |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 216 B |
After Width: | Height: | Size: 802 B |
After Width: | Height: | Size: 402 B |
After Width: | Height: | Size: 313 B |
After Width: | Height: | Size: 435 B |