add antigrav & fix teleports

master
Irremann 2020-09-19 22:32:37 +03:00
parent 2c49812489
commit 9c8de5ea03
34 changed files with 220 additions and 147 deletions

156
antigrav.lua Normal file
View File

@ -0,0 +1,156 @@
minetest.register_node("ufowreck:alien_antigrav_off", {
description = "Alien Antigrav OFF",
tiles = {
"alien_ag_top_off.png",
"alien_ag_bottom.png",
"alien_ag_side_off.png",
"alien_ag_side_off.png",
"alien_ag_side_off.png",
"alien_ag_side_off.png",
},
groups = {cracky=2, technic_machine = 1, technic_hv = 1},
connect_sides = {"bottom"},
sounds = default.node_sound_metal_defaults(),
drop = "ufowreck:alien_antigrav",
on_rightclick = function(pos, node, clicker)
local meta = minetest.get_meta(pos)
minetest.swap_node(pos,{name = "ufowreck:alien_antigrav"})
meta:set_int("HV_EU_demand", 2000)
meta:set_string("infotext", "Alien Antigrav")
pos.y = pos.y + 1
local yi
if meta:get_int("HV_EU_input") < 2000 then
minetest.sound_play("ag_on",{max_hear_distance = 16,pos = pos,gain = 1.0})
for yi = 0, 100 do
if (minetest.get_node(pos)).name == "air" then
minetest.set_node(pos,{name = "ufowreck:ag_beam"})
else
break
end
pos.y = pos.y + 1
end
end
end,
})
minetest.register_node("ufowreck:alien_antigrav", {
description = "Alien Antigrav",
tiles = {
{name="alien_ag_top.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.00},},
"alien_ag_bottom.png",
{name="alien_ag_side.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.00},},
{name="alien_ag_side.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.00},},
{name="alien_ag_side.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.00},},
{name="alien_ag_side.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.00},},
},
light_source = 5,
groups = {cracky=2, technic_machine = 1, technic_hv = 1},
connect_sides = {"bottom"},
sounds = default.node_sound_metal_defaults(),
drop = "ufowreck:alien_antigrav",
after_place_node = function(pos,placer,itemstack)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Alien Antigrav")
meta:set_int("HV_EU_demand", 2000)
pos.y = pos.y + 1
local yi
if meta:get_int("HV_EU_input") < 2000 then
for yi = 0, 100 do
if (minetest.get_node(pos)).name == "air" then
minetest.set_node(pos,{name = "ufowreck:ag_beam"})
else
break
end
pos.y = pos.y + 1
end
end
end,
after_dig_node = function(pos)
pos.y = pos.y + 1
local yi
for yi = 0, 100 do
if (minetest.get_node(pos)).name == "ufowreck:ag_beam" then
minetest.set_node(pos,{name = "air"})
end
pos.y = pos.y + 1
end
end,
on_rightclick = function(pos, node, clicker)
local meta = minetest.get_meta(pos)
minetest.swap_node(pos,{name = "ufowreck:alien_antigrav_off"})
meta:set_int("HV_EU_demand", 0)
meta:set_string("infotext", "Alien Antigrav Off")
pos.y = pos.y + 1
local yi
for yi = 0, 100 do
if (minetest.get_node(pos)).name == "ufowreck:ag_beam" then
minetest.set_node(pos,{name = "air"})
end
pos.y = pos.y + 1
end
end,
})
technic.register_machine("HV", "ufowreck:alien_antigrav", technic.receiver)
technic.register_machine("HV", "ufowreck:alien_antigrav_off", technic.receiver)
minetest.register_node("ufowreck:ag_beam", {
description = "antigrav beam",
paramtype = "light",
tiles = {
"alien_ag_beam.png",
},
drawtype = "nodebox",
paramtype = "light",
use_texture_alpha = true,
light_source = 14,
sunlight_propagates = true,
pointable = false,
diggable = false,
buildable_to = true,
walkable = false,
climbable = true,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_int("life", 12)
end,
})
minetest.register_abm({
nodenames = {"ufowreck:alien_antigrav"},
interval = 10,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos)
pos.y = pos.y + 1
if meta:get_int("HV_EU_input") < 2000 then
local yi
for yi = 0, 100 do
if (minetest.get_node(pos)).name == "ufowreck:ag_beam" then
minetest.set_node(pos,{name = "air"})
end
pos.y = pos.y + 1
end
else
for yi = 0, 100 do
if (minetest.get_node(pos)).name == "air" then
minetest.set_node(pos,{name = "ufowreck:ag_beam"})
else
break
end
pos.y = pos.y + 1
end
end
end
})
minetest.register_craft({
output = "ufowreck:alien_antigrav",
recipe = {
{"technic:copper_coil", "technic:silver_wire", "technic:copper_coil"},
{"ufowreck:alien_control", "technic:hv_transformer", "ufowreck:alien_control"},
{"ufowreck:alien_metal", "technic:hv_cable", "ufowreck:alien_metal"}
}
})

View File

@ -346,11 +346,12 @@ minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:stone", "default:dirt_with_coniferous_litter", "default:dirt_with_rainforest_litter", "default:dirt_with_snow", "default:snow",
"default:permafrost_with_stones", "default:sand", "default:dirt_with_grass"},
biomes = {"sandstone_desert_ocean", "desert_ocean",
"icesheet_ocean", "tundra_ocean", "taiga_ocean", "snowy_grassland_ocean", "grassland_ocean", "coniferous_forest_ocean", "deciduous_forest_ocean", "cold_desert_ocean", "savanna_ocean",
"rainforest_ocean", "underground", "floatland_coniferous_forest", "floatland_coniferous_forest_ocean"},
biomes = {--"sandstone_desert_ocean", "desert_ocean",
--"tundra_ocean", "taiga_ocean", "snowy_grassland_ocean", "grassland_ocean", "coniferous_forest_ocean", "deciduous_forest_ocean", "cold_desert_ocean", "savanna_ocean",
--"rainforest_ocean", "underground", "floatland_coniferous_forest", "floatland_coniferous_forest_ocean",
"icesheet_ocean"},
sidelen = 5,
fill_ratio = 0.0000000000000000001,
fill_ratio = 0.00000000000000000001,
schematic = ufowreck_base,
rotation = rotx,
y_min = -31000,

View File

@ -7,6 +7,8 @@ dofile(modpath.."/tools.lua")
dofile(modpath.."/miniufo.lua")
dofile(modpath.."/lighter.lua")
dofile(modpath.."/base.lua")
dofile(modpath.."/antigrav.lua")
dofile(modpath.."/teleport.lua")
local _ = {
name = "air",
@ -352,4 +354,4 @@ minetest.register_decoration({
y_min = -20,
y_max = 31000,
flags = {place_center_z = true, place_center_x = true},
})
})

View File

@ -28,8 +28,6 @@ mobs:register_mob("ufowreck:floob", {
visual_size = {x=4, y=4},
makes_footstep_sound = true,
sounds = {
-- random = "amcaw_floob",
-- damage = "amcaw_floobhurt",
shoot_attack = "blaster_long",
death = "amcaw_floobdeath",
},

140
nodes.lua
View File

@ -641,146 +641,6 @@ minetest.register_node("ufowreck:glow_plant", {
light_source = 14,
})
minetest.register_node("ufowreck:pad", {
description = "Alien Teleport",
tiles = {
"scifi_nodes_pad.png",
"scifi_nodes_pad.png",
"scifi_nodes_pad.png",
"scifi_nodes_pad.png",
"scifi_nodes_pad.png",
"scifi_nodes_pad.png"
},
drawtype = "nodebox",
paramtype = "light",
groups = {cracky=1, oddly_breakable_by_hand=1},
light_source = 5,
on_construct = function(pos, node, placer)
local meta = minetest.get_meta(pos)
if position1 == nil then
position1 = pos
meta:set_int("type", 1)
elseif position2 == nil then
position2 = pos
meta:set_int("type", 2)
-- else
-- minetest.chat_send_player(placer:get_player_name(), "There can only be two teleportation pads at a time!")
-- placer:get_player_name() get nil all time
end
end,
on_rightclick = function(pos, node, clicker)
local meta = minetest.get_meta(pos)
if meta:get_int("type") == 1 and position2 ~= nil and position1 ~= nil then
minetest.add_particlespawner(
25, --amount
1.5, --time
{x=pos.x-0.9, y=pos.y-0.3, z=pos.z-0.9}, --minpos
{x=pos.x+0.9, y=pos.y-0.3, z=pos.z+0.9}, --maxpos
{x=0, y=0, z=0}, --minvel
{x=0, y=0, z=0}, --maxvel
{x=-0,y=1,z=-0}, --minacc
{x=0,y=2,z=0}, --maxacc
0.5, --minexptime
1, --maxexptime
2, --minsize
5, --maxsize
false, --collisiondetection
"scifi_nodes_tp_part.png" --texture
)
minetest.after(1, function()
local ppos = clicker:getpos()
if minetest.get_node({x=ppos.x, y=ppos.y, z=ppos.z}).name == "ufowreck:pad" then
clicker:setpos(position2)
end
local objs = minetest.env:get_objects_inside_radius(pos, 3)
for _, obj in pairs(objs) do
if obj:get_luaentity() and not obj:is_player() then
if obj:get_luaentity().name == "__builtin:item" then
local item1 = obj:get_luaentity().itemstring
local obj2 = minetest.env:add_entity(position2, "__builtin:item")
obj2:get_luaentity():set_item(item1)
obj:remove()
end
end
end
end)
elseif meta:get_int("type") == 2 and position1 ~= nil and position2 ~= nil then
minetest.add_particlespawner(
25, --amount
1.5, --time
{x=pos.x-0.9, y=pos.y-0.3, z=pos.z-0.9}, --minpos
{x=pos.x+0.9, y=pos.y-0.3, z=pos.z+0.9}, --maxpos
{x=0, y=0, z=0}, --minvel
{x=0, y=0, z=0}, --maxvel
{x=-0,y=1,z=-0}, --minacc
{x=0,y=2,z=0}, --maxacc
0.5, --minexptime
1, --maxexptime
2, --minsize
5, --maxsize
false, --collisiondetection
"scifi_nodes_tp_part.png" --texture
)
minetest.after(1, function()
local ppos = clicker:getpos()
if minetest.get_node({x=ppos.x, y=ppos.y, z=ppos.z}).name == "ufowreck:pad" then
clicker:setpos(position1)
end
local objs = minetest.env:get_objects_inside_radius(pos, 3)
for _, obj in pairs(objs) do
if obj:get_luaentity() and not obj:is_player() then
if obj:get_luaentity().name == "__builtin:item" then
local item1 = obj:get_luaentity().itemstring
local obj2 = minetest.env:add_entity(position1, "__builtin:item")
obj2:get_luaentity():set_item(item1)
obj:remove()
end
end
end
end)
elseif position1 == nil and meta:get_int("type") ~= 2 then
position1 = pos
meta:set_int("type", 1)
minetest.chat_send_player(clicker:get_player_name(), "Teleporter 1 connected at "..minetest.pos_to_string(pos))
elseif position2 == nil and meta:get_int("type") ~= 1 then
position2 = pos
meta:set_int("type", 2)
minetest.chat_send_player(clicker:get_player_name(), "Teleporter 2 connected at "..minetest.pos_to_string(pos))
else
minetest.chat_send_player(clicker:get_player_name(), "Teleporter error!")
end
end,
on_destruct = function(pos, oldnode, placer)
local meta = minetest.get_meta(pos)
if meta:get_int("type") == 1 then
position1 = nil
meta:set_int("type", 0)
elseif meta:get_int("type") == 2 then
position2 = nil
meta:set_int("type", 0)
end
end,
node_box = {
type = "fixed",
fixed = {
{-0.9375, -0.5, -0.75, 0.875, -0.375, 0.75}, -- NodeBox1
{-0.8125, -0.5, -0.875, 0.75, -0.375, 0.875}, -- NodeBox2
{-0.875, -0.5, -0.8125, 0.8125, -0.375, 0.8125}, -- NodeBox3
{-0.8125, -0.5, -0.75, 0.75, -0.3125, 0.75}, -- NodeBox4
},
sounds = default.node_sound_metal_defaults(),
}
})
minetest.register_craft({
output = "ufowreck:pad",
recipe = {
{"ufowreck:alien_metal", "ufowreck:alien_metal", "ufowreck:alien_metal"},
{"ufowreck:alien_metal", "ufowreck:alien_control", "ufowreck:alien_metal"},
{"ufowreck:alien_metal", "ufowreck:alien_metal", "ufowreck:alien_metal"}
}
})
minetest.register_node("ufowreck:powered_stand", {
description = "Powered Stand",
tiles = {

BIN
sounds/ag_on.ogg Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
sounds/travelnet_travel.ogg Normal file

Binary file not shown.

56
teleport.lua Normal file
View File

@ -0,0 +1,56 @@
minetest.register_node("ufowreck:pad", {
description = "Alien Teleport",
tiles = {
"scifi_nodes_pad.png",
"scifi_nodes_pad.png",
"scifi_nodes_pad.png",
"scifi_nodes_pad.png",
"scifi_nodes_pad.png",
"scifi_nodes_pad.png"
},
drawtype = "nodebox",
paramtype = "light",
groups = {cracky=1, oddly_breakable_by_hand=1},
light_source = 5,
on_rightclick = function(pos, node, clicker)
minetest.add_particlespawner(
25, --amount
1.5, --time
{x=pos.x-0.9, y=pos.y-0.3, z=pos.z-0.9}, --minpos
{x=pos.x+0.9, y=pos.y-0.3, z=pos.z+0.9}, --maxpos
{x=0, y=0, z=0}, --minvel
{x=0, y=0, z=0}, --maxvel
{x=-0,y=1,z=-0}, --minacc
{x=0,y=2,z=0}, --maxacc
0.5, --minexptime
1, --maxexptime
2, --minsize
5, --maxsize
false, --collisiondetection
"scifi_nodes_tp_part.png" --texture
)
minetest.after(1, function()
minetest.sound_play("travelnet_travel", {pos = pos, gain = 0.75, max_hear_distance = 10,});
clicker:setpos({ x = pos.x + math.random(-1,1)*1000, y = pos.y, z = pos.z + math.random(-1,1)*1000})
end)
end,
node_box = {
type = "fixed",
fixed = {
{-0.9375, -0.5, -0.75, 0.875, -0.375, 0.75}, -- NodeBox1
{-0.8125, -0.5, -0.875, 0.75, -0.375, 0.875}, -- NodeBox2
{-0.875, -0.5, -0.8125, 0.8125, -0.375, 0.8125}, -- NodeBox3
{-0.8125, -0.5, -0.75, 0.75, -0.3125, 0.75}, -- NodeBox4
},
sounds = default.node_sound_metal_defaults(),
}
})
minetest.register_craft({
output = "ufowreck:pad",
recipe = {
{"ufowreck:alien_metal", "ufowreck:alien_metal", "ufowreck:alien_metal"},
{"ufowreck:alien_metal", "ufowreck:alien_control", "ufowreck:alien_metal"},
{"ufowreck:alien_metal", "ufowreck:alien_metal", "ufowreck:alien_metal"}
}
})

BIN
textures/alien_ag_beam.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

BIN
textures/alien_ag_side.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

BIN
textures/alien_ag_top.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B