2020-12-26 19:38:01 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
------------------- anti grav beam initiator off --------------------
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
minetest.register_node("ufowreck:alien_antigrav", {
|
2020-12-26 19:56:38 -08:00
|
|
|
description = minetest.colorize("#0E0", "Alien ")..minetest.colorize("#A0F", "Antigrav Beam"),
|
2020-09-19 12:32:37 -07:00
|
|
|
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",
|
|
|
|
},
|
2020-12-26 19:38:01 -08:00
|
|
|
groups = {cracky=2, mesecon_effector_off = 1 },
|
2020-09-19 12:32:37 -07:00
|
|
|
connect_sides = {"bottom"},
|
|
|
|
sounds = default.node_sound_metal_defaults(),
|
|
|
|
drop = "ufowreck:alien_antigrav",
|
2020-12-26 19:38:01 -08:00
|
|
|
mesecons = {effector = {
|
|
|
|
rules = {
|
|
|
|
{x=0, y=0, z=-1},
|
|
|
|
{x=1, y=0, z=0},
|
|
|
|
{x=-1, y=0, z=0},
|
|
|
|
{x=0, y=0, z=1},
|
|
|
|
{x=1, y=1, z=0},
|
|
|
|
{x=1, y=-1, z=0},
|
|
|
|
{x=-1, y=1, z=0},
|
|
|
|
{x=-1, y=-1, z=0},
|
|
|
|
{x=0, y=1, z=1},
|
|
|
|
{x=0, y=-1, z=1},
|
|
|
|
{x=0, y=1, z=-1},
|
|
|
|
{x=0, y=-1, z=-1},
|
|
|
|
{x=0, y=-1, z=0},
|
|
|
|
},
|
|
|
|
action_on = function (pos, node)
|
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
minetest.swap_node(pos, {name = "ufowreck:alien_antigrav_on"})
|
|
|
|
meta:set_string("infotext", minetest.colorize("#0E0", "Alien ").."Antigrav Beam (On)")
|
|
|
|
pos.y = pos.y + 1
|
|
|
|
local yi
|
|
|
|
|
2020-09-19 12:32:37 -07:00
|
|
|
minetest.sound_play("ag_on",{max_hear_distance = 16,pos = pos,gain = 1.0})
|
|
|
|
for yi = 0, 100 do
|
2020-12-26 19:38:01 -08:00
|
|
|
if (minetest.get_node(pos)).name == "air" or (minetest.get_node(pos)).name == "ufowreck:ag_beam_off" then
|
|
|
|
minetest.set_node(pos,{name = "ufowreck:ag_beam_on"})
|
2020-09-19 12:32:37 -07:00
|
|
|
else
|
|
|
|
break
|
|
|
|
end
|
|
|
|
pos.y = pos.y + 1
|
|
|
|
end
|
2020-12-26 19:38:01 -08:00
|
|
|
|
|
|
|
end,
|
|
|
|
|
|
|
|
}},
|
|
|
|
after_dig_node = function(pos, oldnode, oldmetadata, digger) --gets rid of the beam when it is dug
|
|
|
|
pos.y = pos.y + 1
|
|
|
|
local yi
|
|
|
|
|
|
|
|
for yi = 0, 100 do
|
|
|
|
if (minetest.get_node(pos)).name == "ufowreck:ag_beam_on" or (minetest.get_node(pos)).name == "ufowreck:ag_beam_off" then
|
|
|
|
minetest.set_node(pos,{name = "air"})
|
|
|
|
else
|
|
|
|
break
|
|
|
|
end
|
|
|
|
pos.y = pos.y + 1
|
2020-09-19 12:32:37 -07:00
|
|
|
end
|
2020-12-26 19:38:01 -08:00
|
|
|
|
2020-09-19 12:32:37 -07:00
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
2020-12-26 19:38:01 -08:00
|
|
|
|
|
|
|
|
|
|
|
------------------- anti grav beam initiator on --------------------
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
minetest.register_node("ufowreck:alien_antigrav_on", {
|
|
|
|
description = minetest.colorize("#0E0", "Alien ").."Antigrav Beam (On)",
|
2020-09-19 12:32:37 -07:00
|
|
|
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,
|
2020-12-26 19:38:01 -08:00
|
|
|
groups = {cracky=2, not_in_creative_inventory = 1, mesecon_effector_on = 1,fall_damage_add_percent = -90,},
|
2020-09-19 12:32:37 -07:00
|
|
|
connect_sides = {"bottom"},
|
|
|
|
sounds = default.node_sound_metal_defaults(),
|
|
|
|
drop = "ufowreck:alien_antigrav",
|
2020-12-26 19:38:01 -08:00
|
|
|
|
|
|
|
|
|
|
|
on_construct = function(pos)
|
2020-09-19 12:32:37 -07:00
|
|
|
local meta = minetest.get_meta(pos)
|
2020-12-26 19:38:01 -08:00
|
|
|
meta:set_string("infotext", minetest.colorize("#0E0", "Alien ").."Antigrav Beam (On)")
|
2020-09-19 12:32:37 -07:00
|
|
|
pos.y = pos.y + 1
|
|
|
|
local yi
|
2020-12-26 19:38:01 -08:00
|
|
|
|
2020-09-19 12:32:37 -07:00
|
|
|
for yi = 0, 100 do
|
2020-12-26 19:38:01 -08:00
|
|
|
if (minetest.get_node(pos)).name == "air" then
|
|
|
|
minetest.set_node(pos,{name = "ufowreck:ag_beam_on"})
|
|
|
|
else
|
|
|
|
break
|
2020-09-19 12:32:37 -07:00
|
|
|
end
|
|
|
|
pos.y = pos.y + 1
|
|
|
|
end
|
2020-12-26 19:38:01 -08:00
|
|
|
|
2020-09-19 12:32:37 -07:00
|
|
|
end,
|
2020-12-26 19:38:01 -08:00
|
|
|
|
|
|
|
on_destruct = function(pos) --gets rid of the beam when it is dug
|
2020-09-19 12:32:37 -07:00
|
|
|
pos.y = pos.y + 1
|
|
|
|
local yi
|
2020-12-26 19:38:01 -08:00
|
|
|
|
2020-09-19 12:32:37 -07:00
|
|
|
for yi = 0, 100 do
|
2020-12-26 19:38:01 -08:00
|
|
|
if (minetest.get_node(pos)).name == "ufowreck:ag_beam_on" or (minetest.get_node(pos)).name == "ufowreck:ag_beam_off" then
|
|
|
|
minetest.set_node(pos,{name = "air"})
|
|
|
|
else
|
|
|
|
break
|
2020-09-19 12:32:37 -07:00
|
|
|
end
|
|
|
|
pos.y = pos.y + 1
|
|
|
|
end
|
2020-12-26 19:38:01 -08:00
|
|
|
|
2020-09-19 12:32:37 -07:00
|
|
|
end,
|
|
|
|
|
|
|
|
|
2020-12-26 19:38:01 -08:00
|
|
|
mesecons = {effector = {
|
|
|
|
rules = lightstone_rules,
|
|
|
|
action_off = function (pos, node)
|
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
minetest.swap_node(pos,{name = "ufowreck:alien_antigrav"})
|
|
|
|
meta:set_string("infotext", minetest.colorize("#0E0", "Alien ").."Antigrav Beam (Off)")
|
|
|
|
pos.y = pos.y + 1
|
|
|
|
local yi
|
|
|
|
for yi = 0, 100 do
|
|
|
|
if (minetest.get_node(pos)).name == "ufowreck:ag_beam_on" then
|
|
|
|
minetest.set_node(pos,{name = "air"})
|
|
|
|
end
|
|
|
|
pos.y = pos.y + 1
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
}},
|
2020-09-19 12:32:37 -07:00
|
|
|
|
2020-12-26 19:38:01 -08:00
|
|
|
|
|
|
|
after_dig_node = function(pos, oldnode, oldmetadata, digger) --gets rid of the beam when it is dug
|
2020-09-19 12:32:37 -07:00
|
|
|
pos.y = pos.y + 1
|
|
|
|
local yi
|
|
|
|
|
|
|
|
for yi = 0, 100 do
|
2020-12-26 19:38:01 -08:00
|
|
|
if (minetest.get_node(pos)).name == "ufowreck:ag_beam_on" or (minetest.get_node(pos)).name == "ufowreck:ag_beam_off" then
|
|
|
|
minetest.set_node(pos,{name = "air"})
|
2020-09-19 12:32:37 -07:00
|
|
|
else
|
|
|
|
break
|
|
|
|
end
|
|
|
|
pos.y = pos.y + 1
|
|
|
|
end
|
2020-12-26 19:38:01 -08:00
|
|
|
|
|
|
|
end,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
------------------- anti grav beam nodes -----------------------------
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-------zero_grav effect ------------
|
|
|
|
local gravity = player_monoids.gravity
|
|
|
|
|
|
|
|
local timer = 0
|
|
|
|
ufowreck.antigrav_players = {}
|
|
|
|
minetest.register_globalstep(function(dtime)
|
|
|
|
timer = timer + dtime;
|
|
|
|
if timer >= 1 then
|
|
|
|
for _,player in pairs(minetest.get_connected_players()) do
|
|
|
|
if minetest.get_node(player:get_pos()).name == "ufowreck:ag_beam_on" and ufowreck.antigrav_players[player:get_player_name()] == nil then
|
|
|
|
-- player is standing in the ag_beam_on node, and is not on the list
|
|
|
|
ufowreck.antigrav_players[player:get_player_name()] = player
|
|
|
|
gravity:add_change(player, 0, "ufowreck_0_grav")
|
|
|
|
player:add_velocity(vector.new(0,2,0))
|
|
|
|
else
|
|
|
|
if ufowreck.antigrav_players[player:get_player_name()] ~= nil then
|
|
|
|
--player is on the list
|
|
|
|
if minetest.get_node(player:get_pos()).name ~= "ufowreck:ag_beam_on" then
|
|
|
|
--the player is not in an ag_beam_on node
|
|
|
|
gravity:del_change(player, "ufowreck_0_grav")
|
|
|
|
ufowreck.antigrav_players[player:get_player_name()] = nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2020-09-19 12:32:37 -07:00
|
|
|
end
|
|
|
|
end
|
2020-12-26 19:38:01 -08:00
|
|
|
end)
|
|
|
|
|
|
|
|
minetest.register_on_leaveplayer(function(player)
|
|
|
|
if ufowreck.antigrav_players[player:get_player_name()] == nil then
|
|
|
|
return
|
|
|
|
else
|
|
|
|
ufowreck.antigrav_players[player:get_player_name()] = nil
|
|
|
|
gravity:del_change(player, "ufowreck_0_grav")
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
minetest.register_node("ufowreck:ag_beam_on", {
|
|
|
|
description = "Alien Antigrav Beam node (on)",
|
|
|
|
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 = false,
|
|
|
|
walkable = false,
|
|
|
|
climbable = false,
|
|
|
|
drop = "",
|
|
|
|
on_construct = function(pos)
|
|
|
|
local timer = minetest.get_node_timer(pos)
|
|
|
|
timer:start(.3) -- in seconds
|
|
|
|
end,
|
|
|
|
on_destruct = function(pos)
|
|
|
|
local timer = minetest.get_node_timer(pos)
|
|
|
|
timer:stop()
|
|
|
|
end,
|
|
|
|
on_timer = function(pos)
|
|
|
|
local obj_list = minetest.get_objects_inside_radius(pos, .6)
|
|
|
|
for _,obj in ipairs(obj_list) do
|
|
|
|
local is_p = false
|
|
|
|
if obj:is_player() then
|
2020-12-26 19:42:00 -08:00
|
|
|
|
2020-12-26 19:38:01 -08:00
|
|
|
|
|
|
|
is_p = true
|
|
|
|
end
|
|
|
|
|
|
|
|
if not(is_p) then
|
|
|
|
local ent = obj:get_luaentity()
|
|
|
|
if ent ~= nil then
|
|
|
|
vel = obj:get_velocity()
|
|
|
|
obj:set_velocity({x=vel.x, y=10, z=vel.z})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if minetest.get_node(pos).name == "ufowreck:ag_beam_on" then
|
|
|
|
return true
|
|
|
|
else
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
groups = {not_in_creative_inventory = 1},
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
------------------- CRAFTS -----------------------------
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
|
2020-09-19 12:32:37 -07:00
|
|
|
|
|
|
|
minetest.register_craft({
|
2020-12-26 19:38:01 -08:00
|
|
|
type = "shapeless",
|
|
|
|
output = "ufowreck:alien_antigrav",
|
|
|
|
recipe = {
|
|
|
|
"ufowreck:alien_antigrav_broken",
|
|
|
|
"mesecons_fpga:fpga0000",
|
|
|
|
"default:mese_crystal_fragment",
|
|
|
|
},
|
|
|
|
})
|