Add files via upload

master
AiTechEye 2018-08-06 21:57:42 +02:00 committed by GitHub
parent 598d58336f
commit 8691503718
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 1083 additions and 0 deletions

36
craft.lua Normal file
View File

@ -0,0 +1,36 @@
minetest.register_craft({
output = "afterearth:plastic_block",
recipe = {
{"afterearth:bag_empty","afterearth:bag_empty","afterearth:bag_empty"},
{"afterearth:bag_empty","afterearth:bag_empty","afterearth:bag_empty"},
{"afterearth:bag_empty","afterearth:bag_empty","afterearth:bag_empty"},
}
})
minetest.register_craft({
output = "afterearth:rubberblock 9",
recipe = {
{"afterearth:tire","afterearth:tire","afterearth:tire"},
{"afterearth:tire","afterearth:tire","afterearth:tire"},
{"afterearth:tire","afterearth:tire","afterearth:tire"},
}
})
minetest.register_craft({
type = "fuel",
recipe = "afterearth:plastic_block",
burntime=50,
})
minetest.register_craft({
type = "fuel",
recipe = "afterearth:bag",
burntime=5,
})
minetest.register_craft({
type = "fuel",
recipe = "afterearth:bag_empty",
burntime=5,
})

2
depends.txt Normal file
View File

@ -0,0 +1,2 @@
default
flowers?

2
description.txt Normal file
View File

@ -0,0 +1,2 @@
The earth's ecosystem has collapsed, and there ain't no biologically environment left.
And this planet has become a difficult place to live on.

416
init.lua Normal file
View File

@ -0,0 +1,416 @@
afterearth={
day_timer=0,
currtime=0,
timer=1,
storm={},
trashdrops={},
trashdropscount=50,
storm_chance=400,
storm_chance_end=50,
item_age=tonumber(minetest.settings:get("item_entity_ttl")),
not_in_trash={
["default:diamondblock"]=1,
["default:steelblock"]=1,
["default:bronzeblock"]=1,
["default:tinblock"]=1,
["default:mese"]=1,
["default:copperblock"]=1,
["default:diamond"]=1,
["default:mese_crystal"]=1,
["doors:door_steel"]=1,
["default:coalblock"]=1,
}
}
dofile(minetest.get_modpath("afterearth") .. "/items.lua")
dofile(minetest.get_modpath("afterearth") .. "/craft.lua")
if afterearth.item_age=="" or afterearth.item_age==nil then
afterearth.item_age=895
else
afterearth.item_age=afterearth.item_age-5
end
minetest.register_on_dieplayer(function(player)
local pos=player:getpos()
pos={x=pos.x,y=pos.y+1.5,z=pos.z}
local def=minetest.registered_nodes[minetest.get_node(pos).name]
if def and def.buildable_to then
minetest.set_node(pos,{name="afterearth:air3"})
end
end)
minetest.register_on_joinplayer(function(player) -- set sky for joining players
afterearth.daycircle(player)
end)
minetest.register_globalstep(function(dtime) -- set sky for players
afterearth.day_timer=afterearth.day_timer+dtime
if afterearth.day_timer<afterearth.timer then return end
afterearth.day_timer=0
afterearth.daycircle()
end)
afterearth.weather=function(d)
-- intensively sunshine between 11:00 and 14:00
if d>0.458 and d<0.58 then
for _,player in ipairs(minetest.get_connected_players()) do
local pos=player:getpos()
local l=minetest.get_node_light(pos)
for i, ob in pairs(minetest.get_objects_inside_radius(pos, 30)) do
local pos2=ob:getpos()
local l=minetest.get_node_light(pos2)
if l and l>=default.LIGHT_MAX then
local n=minetest.registered_nodes[minetest.get_node(pos2).name]
if n and n.buildable_to and not minetest.is_protected(pos,"") then
minetest.set_node(pos2, {name = "fire:basic_flame"})
end
ob:punch(ob,1,{full_punch_interval=1,damage_groups={fleshy=1}})
end
end
end
end
if not afterearth.storm.dir and math.random(1,afterearth.storm_chance)==1 then
local d={{x=1,z=0},{x=-1,z=0},{x=0,z=1},{x=0,z=-1}}
local max
local min
d=d[math.random(1,4)]
if d.x==1 then
max={x=-15,z=15}
min={x=-15,z=-15}
elseif d.x==-1 then
max={x=15,z=15}
min={x=15,z=-15}
elseif d.z==1 then
max={x=15,z=-15}
min={x=-15,z=-15}
else --if d.z==-1 then
max={x=15,z=15}
min={x=-15,z=15}
end
afterearth.storm.max=max
afterearth.storm.min=min
afterearth.storm.dir=d
elseif afterearth.storm.dir then
if math.random(1,afterearth.storm_chance_end)==1 then
afterearth.storm={}
return
end
local d=afterearth.storm.dir
local max=afterearth.storm.max
local min=afterearth.storm.min
for _,player in ipairs(minetest.get_connected_players()) do
local pos=player:getpos()
local l=minetest.get_node_light(pos)
if l and l>=default.LIGHT_MAX-1 then
afterearth.new_dust=1
local e=minetest.add_entity({x=pos.x+math.random(min.x,max.x),y=pos.y+math.random(1,10), z=pos.z+math.random(min.z,max.z)}, "afterearth:duster")
e:setvelocity({x=afterearth.storm.dir.x*5, y=-2, z=afterearth.storm.dir.z*5})
e:setacceleration({x=afterearth.storm.dir.x*5, y=-2, z=afterearth.storm.dir.z*5})
afterearth.new_dust=nil
local pos3={x=pos.x+max.x, y=pos.y+5, z=pos.z+max.z}
minetest.add_particlespawner({
amount = 20,
time=2,
maxpos = {x=pos.x+min.x, y=pos.y, z=pos.z+min.z},
minpos = pos3,
minvel = {x=d.x*10, y=-1, z=d.z*10},
maxvel = {x=d.x*20, y=0.5, z=d.z*20},
minacc = {x=d.x*5, y=-1, z=d.z*5},
maxacc = {x=d.x*10, y=-10, z=d.z*10},
minexptime = 0.5,
maxexptime = 2,
minsize = 0.8,
maxsize = 1.3,
texture = "default_dirt.png",
collisiondetection=true,
})
afterearth.new_dust=1
for i, ob in pairs(minetest.get_objects_inside_radius(pos, 20)) do
if ob:get_luaentity() and not ob:get_luaentity().dust and afterearth.visiable(ob:getpos(),pos3) then
if ob:get_luaentity().itemstring then
ob:get_luaentity().age=afterearth.item_age
end
minetest.add_entity(ob:getpos(), "afterearth:duster")
end
end
afterearth.new_dust=nil
end
end
end
end
afterearth.visiable=function(pos1,pos2)
if not (pos2 and pos2.x and pos1 and pos1.x) then return nil end
local v = {x = pos1.x - pos2.x, y = pos1.y - pos2.y-1, z = pos1.z - pos2.z}
v.y=v.y-1
local amount = (v.x ^ 2 + v.y ^ 2 + v.z ^ 2) ^ 0.5
local d=math.sqrt((pos1.x-pos2.x)*(pos1.x-pos2.x) + (pos1.y-pos2.y)*(pos1.y-pos2.y)+(pos1.z-pos2.z)*(pos1.z-pos2.z))
v.x = (v.x / amount)*-1
v.y = (v.y / amount)*-1
v.z = (v.z / amount)*-1
for i=1,d,1 do
local node=minetest.get_node({x=pos1.x+(v.x*i),y=pos1.y+(v.y*i),z=pos1.z+(v.z*i)})
if node and node.name and minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].walkable then
return false
end
end
return true
end
afterearth.daycircle=function(join) --set sky color and clouds
--[joined player] [time changed by command] [evening or night] [night or morning]
--evening and morning = set timer to 0.2, else 1
local d=minetest.get_timeofday()
afterearth.weather(d)
if join or (d-0.1>afterearth.currtime or d+0.1<afterearth.currtime) or (d>=0.75 and d<0.81) or (d>0.19 and d<0.26) then
afterearth.currtime=d
local t=1
if d>=0.75 and d<0.8 then
t=(0.8-d)*20
afterearth.timer=0.33
elseif d>0.8 or d<0.2 then
t=0
afterearth.timer=1
elseif d>=0.2 and d<0.25 then
t=(-0.2+d)*20
afterearth.timer=0.3
elseif d>0.25 then
t=1
afterearth.timer=1
end
if join then
join:set_sky({r=255*t, g=240*t, b=170*t},"plain",{})
join:set_clouds({
color={r=255, g=240, b=70, a=200*t},
ambient={r=255, g=255, b=170, a=100},
density=0.5,
height=200,
speed=-40
})
return
end
for _,player in ipairs(minetest.get_connected_players()) do
player:set_sky({r=255*t, g=240*t, b=170*t},"plain",{})
player:set_clouds({
color={r=255, g=240, b=70, a=200*t},
ambient={r=255, g=255, b=170, a=100},
density=0.5,
height=200,
speed=-40
})
end
else
afterearth.timer=1
end
afterearth.currtime=d
end
minetest.register_on_dignode(function(pos, oldnode, digger)
if pos.y<1 then
local a=minetest.find_node_near(pos, 1,"air")
if a then
minetest.set_node(pos, {name = "afterearth:air"})
end
end
end)
minetest.register_abm({
nodenames = {"air","afterearth:air2"},
neighbors = {"group:sand","group:stone","default:gravel"},
interval = 10,
chance = 10,
action = function(pos,node)
if node.name=="air" then
local l=minetest.get_node_light(pos)
if l and l>=11 then
minetest.set_node(pos, {name = "afterearth:air2"})
end
elseif node.name=="afterearth:air2" then
local l=minetest.get_node_light(pos)
if l and l<11 then
minetest.set_node(pos, {name = "air"})
end
end
end,
})
minetest.register_abm({
nodenames = {"air"},
interval = 10,
chance = 10,
action = function(pos,node)
if pos.y<-20 then
minetest.set_node(pos, {name = "afterearth:air"})
end
end,
})
minetest.clear_registered_biomes()
minetest.clear_registered_decorations()
minetest.register_biome({
name = "land",
--node_dust = "default:sand",
node_top = "afterearth:waste",
depth_top = 10,
node_filler = "default:sand",
depth_filler = 3,
node_stone = "default:stone",
node_water_top = "afterearth:air",
depth_water_top =5 ,
node_water = "afterearth:source",
node_river_water = "afterearth:source",
y_min = -31000,
y_max = 400,
heat_point = 50,
humidity_point = 50,
})
minetest.register_biome({
name = "sand",
node_dust = "afterearth:air2",
node_top = "default:sand",
depth_top = 10,
node_filler = "afterearth:waste",
depth_filler = 3,
node_stone = "default:stone",
node_water_top = "afterearth:air",
depth_water_top =1 ,
node_water = "afterearth:source",
node_river_water = "afterearth:source",
y_min = 10,
y_max = 400,
heat_point = 25,
humidity_point = 50,
})
minetest.register_ore({
ore_type = "blob",
ore = "afterearth:waste2",
wherein = {"afterearth:waste"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -55,
y_max = 400,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
seed = -316,
octaves = 1,
persist = 0.0
},
})
minetest.register_ore({
ore_type = "blob",
ore = "afterearth:waste3",
wherein = {"afterearth:waste"},
clust_scarcity = 50 * 50 * 50,
clust_size = 7,
y_min = -55,
y_max = 20,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
seed = -316,
octaves = 1,
persist = 0.0
},
})
minetest.register_ore({
ore_type = "blob",
ore = "afterearth:trash",
wherein = {"afterearth:waste","group:sand"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -55,
y_max = 400,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
seed = -316,
octaves = 1,
persist = 0.0
},
})
minetest.register_ore({
ore_type = "scatter",
ore = "afterearth:air",
wherein = "air",
clust_scarcity = 1 * 1 * 1,
clust_num_ores = 2,
clust_size = 2,
y_min = -31000,
y_max = 0,
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"afterearth:waste"},
sidelen = 16,
noise_params = {
offset = -0.0004,
scale = 0.0008,
spread = {x = 250, y = 250, z = 250},
seed = 230,
octaves = 2,
persist = 0.5
},
biomes = {"land"},
y_min = 1,
y_max = 400,
decoration = {"default:tree","default:jungletree","default:pine_tree","default:pine_tree","default:acacia_tree","default:aspen_tree"},
height = 1,
height_max = 5,
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"afterearth:waste"},
sidelen = 16,
noise_params = {
offset = -0.0004,
scale = 0.0008,
spread = {x = 250, y = 250, z = 250},
seed = 230,
octaves = 2,
persist = 0.5
},
biomes = {"land"},
y_min = 1,
y_max = 400,
decoration = {"default:tree","default:jungletree","default:pine_tree","default:pine_tree","default:acacia_tree","default:aspen_tree"},
height = 1,
height_max = 5,
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"afterearth:waste"},
sidelen = 16,
noise_params = {
offset = 0.001,
scale = 0.0005,
spread = {x = 10, y = 10, z = 10},
},
biomes = {"land"},
y_min = 1,
y_max = 400,
decoration = {"afterearth:tire"},
height = 1,
height_max = 1,
})

627
items.lua Normal file
View File

@ -0,0 +1,627 @@
minetest.after(0, function()
for v, s in pairs(core.registered_items) do
if not (s.groups and s.groups.not_in_creative_inventory==1) and not afterearth.not_in_trash[v] then
local c=minetest.get_craft_recipe(v)
if c.items then
table.insert(afterearth.trashdrops,v)
elseif type(s.drop)=="string" and s.drop~="" and not (afterearth.trashdrops[s.drop] or afterearth.not_in_trash[v]) then
table.insert(afterearth.trashdrops,v)
end
end
end
afterearth.trashdropscount=math.floor(#afterearth.trashdrops/4)
end)
local drownings={
"default:torch",
"default:torch_wall",
"default:torch_ceiling",
"default:stone",
"default:cobble",
"default:dirt",
"default:sand",
"default:gravel",
}
for i, s in pairs(drownings) do
if core.registered_items[s] then
minetest.override_item(s,{drowning=1})
end
end
local eatsbles={
"default:leaves",
"default:jungleleaves",
"default:acacia_leaves",
"default:aspen_leaves",
"default:bush_leaves",
"default:acacia_bush_leaves",
"default:junglegrass",
"default:grass_1",
"default:grass_2",
"default:grass_3",
"default:grass_4",
"default:grass_5",
"default:dry_grass_1",
"default:dry_grass_2",
"default:dry_grass_3",
"default:dry_grass_4",
"default:dry_grass_5",
"default:bush_leaves",
"default:acacia_bush_leaves",
"default:cactus",
"default:papyrus",
"default:dry_shrub",
"flowers:rose",
"flowers:tulip",
"flowers:dandelion_yellow",
"flowers:geranium",
"flowers:viola",
"flowers:waterlily",
"flowers:dandelion_white"
}
for i, s in pairs(eatsbles) do
if core.registered_items[s] then
minetest.override_item(s,{
on_use = minetest.item_eat(1),
})
table.insert(afterearth.trashdrops,s)
end
end
minetest.register_node("afterearth:rubberblock", {
description = "Rubberblock",
tiles = {"afterearth_rubber.png"},
groups = {cracky=3,fall_damage_add_percent=-75,bouncy=99},
drowning=1,
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node("afterearth:tire", {
description = "Tire",
tiles = {"afterearth_rubber.png"},
groups = {snappy=3,flammable=2,dig_immediate=3,fall_damage_add_percent=-75,bouncy=100},
drowning=1,
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates =true,
selection_box = {
type = "fixed",
fixed = {{-0.5,-0.5,-0.5,0.5,-0.31,0.5}},
},
node_box = {
type = "fixed",
fixed = {
{-0.375, -0.5, -0.375, -0.3125, -0.3125, 0.375},
{-0.4375, -0.5, -0.375, -0.375, -0.3125, 0.375},
{-0.5, -0.5, -0.25, -0.4375, -0.3125, 0.25},
{-0.25, -0.5, 0.4375, 0.25, -0.3125, 0.5},
{-0.375, -0.5, 0.375, 0.375, -0.3125, 0.4375},
{-0.3125, -0.5, 0.3125, 0.375, -0.3125, 0.375},
{-0.25, -0.5, -0.5, 0.25, -0.3125, -0.4375},
{-0.375, -0.5, -0.4375, 0.375, -0.3125, -0.375},
{-0.3125, -0.5, -0.375, 0.375, -0.3125, -0.3125},
{0.4375, -0.5, -0.25, 0.5, -0.3125, 0.25},
{0.375, -0.5, -0.375, 0.4375, -0.3125, 0.375},
{0.3125, -0.5, -0.3125, 0.375, -0.3125, 0.3125},
{0.25, -0.5, 0.1875, 0.3125, -0.3125, 0.3125},
{-0.3125, -0.5, 0.25, -0.1875, -0.3125, 0.3125},
{-0.3125, -0.5, 0.1875, -0.25, -0.3125, 0.25},
{0.1875, -0.5, -0.3125, 0.3125, -0.3125, -0.25},
{0.25, -0.5, -0.25, 0.3125, -0.3125, -0.1875},
{-0.3125, -0.5, -0.3125, -0.1875, -0.3125, -0.25},
{-0.3125, -0.5, -0.25, -0.25, -0.3125, -0.1875},
{0.1875, -0.5, 0.25, 0.25, -0.3125, 0.3125},
}
},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node("afterearth:bag_empty", {
description = "Empty plastic bag",
stack_max=10,
inventory_image = "afterearth_bag.png",
wield_image = "afterearth_bag.png",
tiles = {"eafterearth_plastic_block.png"},
groups = {snappy=2,flammable=2,dig_immediate=3},
drowning=1,
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates =true,
walkable=false,
selection_box = {
type = "fixed",
fixed = {{-0.3125, -0.5, -0.1875, 0.25, 0.25, 0.1875}}
},
node_box = {
type = "fixed",
fixed = {
{0.1875, -0.5, -0.125, 0.25, 0.125, 0.125},
{-0.3125, -0.5, -0.125, -0.25, 0.125, 0.125},
{-0.25, -0.5, 0.125, 0.1875, 0.25, 0.1875},
{-0.25, -0.5, -0.1875, 0.1875, 0.25, -0.125},
{-0.25, -0.5, -0.125, 0.1875, -0.4375, 0.125},
{0.1875, 0.1875, -0.125, 0.25, 0.25, 0.125},
{-0.3125, 0.1875, -0.125, -0.25, 0.25, 0.125},
}
},
sounds = default.node_sound_leaves_defaults(),
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local n=player:get_player_name()
if n~=minetest.get_meta(pos):get_string("owner") and minetest.is_protected(pos,n) then
return 0
end
return stack:get_count()
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local n=player:get_player_name()
if n~=minetest.get_meta(pos):get_string("owner") and minetest.is_protected(pos,n) then
return 0
end
return stack:get_count()
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local n=player:get_player_name()
if n~=minetest.get_meta(pos):get_string("owner") and minetest.is_protected(pos,n) then
return 0
end
return count
end,
can_dig = function(pos, player)
return minetest.get_meta(pos):get_inventory():is_empty("main")
end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
local meta=minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name())
meta:set_string("infotext", "Plastic bag")
meta:get_inventory():set_size("main", 4)
meta:set_string("formspec",
"size[8,5]" ..
"list[context;main;2,0;4,1;]" ..
"list[current_player;main;0,1;8,4;]" ..
"listring[current_player;main]" ..
"listring[current_name;main]")
end,
on_use=function(itemstack, user, pointed_thing)
local pos=user:getpos()
pos.y=pos.y+1.5
local def=minetest.registered_nodes[minetest.get_node(pos).name]
if def and def.drowning==0 then
itemstack:take_item(1)
user:get_inventory():add_item("main", "afterearth:bag")
end
return itemstack
end})
minetest.register_craftitem("afterearth:bag", {
description = "Plastic bag",
stack_max=10,
inventory_image = "afterearth_bag.png",
groups={not_in_creative_inventory=1},
on_use=function(itemstack, user, pointed_thing)
itemstack:take_item(1)
user:get_inventory():add_item("main", "afterearth:bag_empty")
user:set_breath(11)
return itemstack
end})
minetest.register_node("afterearth:plastic_block", {
description = "Plastic block",
tiles = {"eafterearth_plastic_block.png"},
groups = {crumbly = 2,snappy=2,flammable=2},
drowning=1,
sounds = default.node_sound_dirt_defaults(),
})
minetest.register_node("afterearth:waste", {
description = "Waste",
tiles = {"afterearth_waste.png"},
groups = {crumbly = 3},
sounds = default.node_sound_dirt_defaults(),
drowning=1,
})
minetest.register_node("afterearth:trash", {
description = "Trash",
drop="",
tiles = {"afterearth_trash.png"},
groups = {crumbly = 3,snappy=3,flammable=2},
sounds = default.node_sound_dirt_defaults(),
after_dig_node = function(pos, node, metadata, digger)
local inv=digger:get_inventory()
if not inv or not inv:room_for_item("main", "afterearth:trash") then
minetest.set_node(pos,node)
return
end
for s, v in pairs(afterearth.trashdrops) do
if math.random(1,afterearth.trashdropscount)==1 then
local it=v
if minetest.registered_tools[v] then
it=v .. " 1 " ..(math.random(40,60)*1000)
end
inv:add_item("main", it)
break
end
end
if math.random(1,2)==1 then
inv:add_item("main", "afterearth:bag_empty")
end
local tool=inv:get_stack(digger:get_wield_list(), digger:get_wield_index()):get_name()
if minetest.registered_tools[tool] then return end
local a=0
if math.random(1,10)<3 then return end
for i=0,20,1 do
if math.random(1,2)==1 then
break
end
a=i
end
digger:punch(digger,a,{full_punch_interval=1,damage_groups={fleshy=4}})
end
})
minetest.register_node("afterearth:waste2", {
description = "Waste",
tiles = {"afterearth_waste.png"},
groups = {crumbly = 3},
walkable=false,
drowning=1,
sounds = default.node_sound_dirt_defaults(),
after_dig_node = function(pos)
local a=0
local c={
{x=1,z=0},
{x=-1,z=0},
{x=0,z=1},
{x=0,z=-1},
{x=1,z=1},
{x=-1,z=-1},
{x=1,z=-1},
{x=-1,z=1}
}
minetest.after(1, function(pos,c)
for v, s in pairs(c) do
if minetest.get_node({x=pos.x+s.x,y=pos.y,z=pos.z+s.z}).name=="afterearth:waste2" then
a=a+1
if a>1 then
minetest.set_node(pos, {name = "afterearth:waste2"})
return
end
end
end
end,pos,c)
end
})
minetest.register_node("afterearth:air", {
description = "Air",
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
drawtype = "airlike",
drowning=1,
groups = {not_in_creative_inventory=1},
paramtype = "light",
sunlight_propagates =true,
})
minetest.register_node("afterearth:air2", {
description = "Hot air",
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
drawtype = "airlike",
damage_per_second = 1,
drowning=1,
groups = {not_in_creative_inventory=1,igniter=1},
paramtype = "light",
sunlight_propagates =true,
})
minetest.register_node("afterearth:air3", {
description = "Air",
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
drawtype = "airlike",
drowning=1,
groups = {not_in_creative_inventory=1},
paramtype = "light",
sunlight_propagates =true,
post_effect_color = {a=250, r=0,g=0,b=0},
on_construct = function(pos)
minetest.get_node_timer(pos):start(1)
end,
on_timer = function (pos, elapsed)
for i, ob in pairs(minetest.get_objects_inside_radius(pos, 2)) do
return true
end
minetest.remove_node(pos)
return true
end,
})
minetest.register_node("afterearth:waste3", {
description = "Toxic sludge",
drawtype = "liquid",
tiles = {"afterearth_source2.png"},
paramtype = "light",
walkable = false,
buildable_to = true,
is_ground_content = false,
drowning = 1,
liquidtype = "source",
liquid_range = 1,
damage_per_second = 11,
liquid_alternative_flowing = "afterearth:waste3b",
liquid_alternative_source = "afterearth:waste3",
liquid_viscosity = 15,
post_effect_color = {a=240, r=100,g=120,b=0},
groups = {liquid = 4,crumbly = 1, sand = 1},
alpha = 245,
pointable = false,
diggable = false,
sounds = default.node_sound_water_defaults(),
})
minetest.register_node("afterearth:waste3b", {
description = "Toxic sludge",
drawtype = "flowingliquid",
tiles = {"afterearth_source2.png"},
special_tiles = {
{
name = "afterearth_source2.png",
backface_culling = false,
},
{
name = "afterearth_source2.png",
backface_culling = true,
},
},
alpha = 245,
post_effect_color = {a=240, r=100,g=120,b=0},
paramtype = "light",
pointable = false,
diggable = false,
paramtype2 = "flowingliquid",
walkable = false,
buildable_to = true,
is_ground_content = false,
drop = "",
damage_per_second = 11,
drowning = 1,
liquidtype = "flowing",
liquid_alternative_flowing = "afterearth:waste3b",
liquid_alternative_source = "afterearth:waste3",
liquid_viscosity = 1,
liquid_range = 1,
post_effect_color = {a = 103, r = 30, g = 76, b = 90},
groups = {liquid = 4, not_in_creative_inventory = 1},
sounds = default.node_sound_water_defaults(),
})
minetest.register_node("afterearth:source", {
description = "Sludge",
drawtype = "liquid",
tiles = {"afterearth_source.png"},
paramtype = "light",
walkable = false,
buildable_to = true,
is_ground_content = false,
drowning = 1,
liquidtype = "source",
liquid_range = 2,
liquid_alternative_flowing = "afterearth:source2",
liquid_alternative_source = "afterearth:source",
liquid_viscosity = 15,
post_effect_color = {a=240, r=100,g=120,b=0},
groups = {liquid = 4,crumbly = 1, sand = 1},
alpha = 245,
pointable = false,
diggable = false,
sounds = default.node_sound_water_defaults(),
})
minetest.register_node("afterearth:source2", {
description = "Sludge",
drawtype = "flowingliquid",
tiles = {"afterearth_source.png"},
special_tiles = {
{
name = "afterearth_source.png",
backface_culling = false,
},
{
name = "afterearth_source.png",
backface_culling = true,
},
},
alpha = 245,
post_effect_color = {a=240, r=100,g=120,b=0},
paramtype = "light",
pointable = false,
diggable = false,
paramtype2 = "flowingliquid",
walkable = false,
buildable_to = true,
is_ground_content = false,
drop = "",
drowning = 1,
liquidtype = "flowing",
liquid_alternative_flowing = "afterearth:source2",
liquid_alternative_source = "afterearth:source",
liquid_viscosity = 1,
liquid_range = 2,
post_effect_color = {a = 103, r = 30, g = 76, b = 90},
groups = {liquid = 4, not_in_creative_inventory = 1},
sounds = default.node_sound_water_defaults(),
})
afterearth.spawn_dust=function(pos)
if not (pos and afterearth.storm.dir and minetest.is_protected(pos,"")==false) then return end
local drop=minetest.get_node_drops(minetest.get_node(pos).name)[1]
local n=minetest.registered_nodes[minetest.get_node(pos).name]
if not (n and n.walkable) or drop=="" or type(drop)~="string" then return end
local t=n.tiles
if not t[1] then return end
local tx={}
local tt={}
tt.t1=t[1]
tt.t2=t[1]
tt.t3=t[1]
if t[2] then tt.t2=t[2] tt.t3=t[2] end
if t[3] and t[3].name then tt.t3=t[3].name
elseif t[3] then tt.t3=t[3]
end
if type(tt.t3)=="table" then return end
tx[1]=tt.t1
tx[2]=tt.t2
tx[3]=tt.t3
tx[4]=tt.t3
tx[5]=tt.t3
tx[6]=tt.t3
afterearth.new_dust={t=tx,drop=drop}
local e=minetest.add_entity(pos, "afterearth:dust")
e:setvelocity({x=afterearth.storm.dir.x*5, y=2, z=afterearth.storm.dir.z*5})
e:setacceleration({x=afterearth.storm.dir.x*5, y=-1, z=afterearth.storm.dir.z*5})
afterearth.new_dust=nil
minetest.remove_node(pos)
end
minetest.register_entity("afterearth:duster",{
hp_max = 1000,
physical =true,
weight = 0,
collisionbox = {-0.1,-0.1,-0.1,0.1,0.1,0.1},
visual = "sprite",
visual_size = {x=1,y=1},
pointable=false,
textures ={"afterearth_air.png"},
spritediv = {x=1, y=1},
initial_sprite_basepos = {x=0, y=0},
is_visible = true,
makes_footstep_sound = false,
on_activate=function(self, staticdata)
if not (afterearth.new_dust and afterearth.storm.dir) then
self.object:remove()
return self
end
self.d=afterearth.storm.dir
return self
end,
on_step=function(self, dtime)
self.time=self.time+dtime
self.time2=self.time2+dtime
if self.time2<0.1 then return self end
self.time2=0
local pos=self.object:getpos()
local pos2={x=pos.x+self.d.x,y=pos.y,z=pos.z+self.d.z}
local u=minetest.registered_nodes[minetest.get_node(pos2).name]
if not self.atta and u and u.walkable and minetest.get_item_group(u.name,"cracky")==0 and not minetest.is_protected(pos2,"") then
afterearth.spawn_dust(pos2)
self.object:remove()
elseif self.time>3 or u and u.walkable then
self.object:remove()
elseif self.atta then
local v=self.object:getvelocity()
local pos2={x=pos.x+self.d.x,y=pos.y-1,z=pos.z+self.d.z}
local u2=minetest.registered_nodes[minetest.get_node(pos2).name]
if (u2 and u2.walkable) or (v.x+v.z==0) then
self.atta:punch(self.atta,4,{full_punch_interval=1,damage_groups={fleshy=4}})
self.object:remove()
return self
end
elseif not self.atta then
for i, ob in pairs(minetest.get_objects_inside_radius(pos, 1)) do
if not (ob:get_luaentity() and ob:get_luaentity().dust) then
self.object:moveto({x=pos.x,y=pos.y+1,z=pos.z})
self.object:set_properties({collisionbox={-0.5,-0.5,-0.5,0.5,0.5,0.5}})
ob:set_attach(self.object, "",{x = 0, y = 0, z = 0}, {x = 0, y =0, z = 0})
self.atta=ob
self.time=-30
self.object:setvelocity({x=self.d.x*15, y=1, z=self.d.z*15})
self.object:setacceleration({x=0, y=-0.2, z=0})
return self
end
end
end
return self
end,
time=0,
time2=0,
dust=1,
})
minetest.register_entity("afterearth:dust",{
hp_max = 1000,
physical =true,
weight = 0,
collisionbox = {-0.5,-0.5,-0.5,0.5,0.5,0.5},
visual = "cube",
visual_size = {x=1,y=1},
textures ={"air.png"},
spritediv = {x=1, y=1},
initial_sprite_basepos = {x=0, y=0},
is_visible = true,
makes_footstep_sound = true,
on_punch2=function(self)
minetest.add_item(self.object:getpos(),self.drop)
self.object:remove()
return self
end,
on_activate=function(self, staticdata)
if not (afterearth.new_dust and afterearth.storm.dir) then self.object:remove() return self end
self.drop=afterearth.new_dust.drop
self.object:set_properties({textures = afterearth.new_dust.t})
self.d=afterearth.storm.dir
return self
end,
on_step=function(self, dtime)
self.time=self.time+dtime
if self.time<self.timer then return self end
self.time=0
self.timer2=self.timer2-1
local pos=self.object:getpos()
local u=minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name]
for i, ob in pairs(minetest.get_objects_inside_radius({x=pos.x+self.d.x,y=pos.y-1,z=pos.z+self.d.z}, 2)) do
if not (ob:get_luaentity() and ob:get_luaentity().dust) then
ob:punch(ob,9,{full_punch_interval=1,damage_groups={fleshy=9}})
break
end
end
if u and u.walkable then
local n=minetest.registered_nodes[minetest.get_node(pos).name]
if n and n.buildable_to and minetest.registered_nodes[self.drop] then
minetest.set_node(pos,{name=self.drop})
self.object:remove()
else
self.on_punch2(self)
end
return self
elseif self.timer2<0 then
self.on_punch2(self)
end
return self
end,
time=0,
timer=2,
timer2=10,
dust=1,
})

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
textures/4444.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

BIN
textures/afterearth_air.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

BIN
textures/afterearth_bag.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 952 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 881 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 831 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 683 B