forked from Mirrorlandia_minetest/portalgun
_
This commit is contained in:
@ -412,6 +412,8 @@ minetest.register_craftitem(
|
|||||||
range = 100,
|
range = 100,
|
||||||
inventory_image = "portalgun_gun0_rndr.png",
|
inventory_image = "portalgun_gun0_rndr.png",
|
||||||
wield_image = "portalgun_gun0_rndr.png",
|
wield_image = "portalgun_gun0_rndr.png",
|
||||||
|
--inventory_image = "portalgun_gun_orange.png",
|
||||||
|
--wield_image = "portalgun_gun_orange.png",
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
on_place = function(itemstack, user, pointed_thing)
|
||||||
local node = minetest.get_node(pointed_thing.under)
|
local node = minetest.get_node(pointed_thing.under)
|
||||||
if node.name == "portalgun:button" then
|
if node.name == "portalgun:button" then
|
||||||
|
@ -3,7 +3,51 @@ minetest.register_node(
|
|||||||
{
|
{
|
||||||
description = "Toxic water",
|
description = "Toxic water",
|
||||||
drawtype = "liquid",
|
drawtype = "liquid",
|
||||||
tiles = {"portalgun_toxwat.png"},
|
waving = 3,
|
||||||
|
tiles = {
|
||||||
|
{
|
||||||
|
name = "portal_toxwater_anim.png",
|
||||||
|
backface_culling = false,
|
||||||
|
animation = {
|
||||||
|
type = "vertical_frames",
|
||||||
|
aspect_w = 16,
|
||||||
|
aspect_h = 16,
|
||||||
|
length = 8.0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "portal_toxwater_anim.png",
|
||||||
|
backface_culling = true,
|
||||||
|
animation = {
|
||||||
|
type = "vertical_frames",
|
||||||
|
aspect_w = 16,
|
||||||
|
aspect_h = 16,
|
||||||
|
length = 8.0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
special_tiles = {
|
||||||
|
{
|
||||||
|
name = "portal_toxwater_anim.png",
|
||||||
|
backface_culling = false,
|
||||||
|
animation = {
|
||||||
|
type = "vertical_frames",
|
||||||
|
aspect_w = 16,
|
||||||
|
aspect_h = 16,
|
||||||
|
length = 8.0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "portal_toxwater_anim.png",
|
||||||
|
backface_culling = true,
|
||||||
|
animation = {
|
||||||
|
type = "vertical_frames",
|
||||||
|
aspect_w = 16,
|
||||||
|
aspect_h = 16,
|
||||||
|
length = 8.0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
use_texture_alpha = "blend",
|
use_texture_alpha = "blend",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
@ -30,10 +74,50 @@ minetest.register_node(
|
|||||||
{
|
{
|
||||||
description = "Toxic water 2",
|
description = "Toxic water 2",
|
||||||
drawtype = "flowingliquid",
|
drawtype = "flowingliquid",
|
||||||
tiles = {name = "portalgun_toxwat.png", backface_culling = false},
|
waving = 3,
|
||||||
|
tiles = {
|
||||||
|
{
|
||||||
|
name = "portal_toxwater_anim.png",
|
||||||
|
backface_culling = false,
|
||||||
|
animation = {
|
||||||
|
type = "vertical_frames",
|
||||||
|
aspect_w = 16,
|
||||||
|
aspect_h = 16,
|
||||||
|
length = 8.0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "portal_toxwater_anim.png",
|
||||||
|
backface_culling = true,
|
||||||
|
animation = {
|
||||||
|
type = "vertical_frames",
|
||||||
|
aspect_w = 16,
|
||||||
|
aspect_h = 16,
|
||||||
|
length = 8.0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
special_tiles = {
|
special_tiles = {
|
||||||
{name = "portalgun_toxwat.png", backface_culling = true},
|
{
|
||||||
{name = "portalgun_toxwat.png", backface_culling = false}
|
name = "portal_toxwater_anim.png",
|
||||||
|
backface_culling = false,
|
||||||
|
animation = {
|
||||||
|
type = "vertical_frames",
|
||||||
|
aspect_w = 16,
|
||||||
|
aspect_h = 16,
|
||||||
|
length = 8.0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "portal_toxwater_anim.png",
|
||||||
|
backface_culling = true,
|
||||||
|
animation = {
|
||||||
|
type = "vertical_frames",
|
||||||
|
aspect_w = 16,
|
||||||
|
aspect_h = 16,
|
||||||
|
length = 8.0,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
use_texture_alpha = "blend",
|
use_texture_alpha = "blend",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
@ -113,7 +113,7 @@ minetest.register_entity(
|
|||||||
p = 1
|
p = 1
|
||||||
end
|
end
|
||||||
for i, ob in pairs(minetest.get_objects_inside_radius(pos, 10)) do
|
for i, ob in pairs(minetest.get_objects_inside_radius(pos, 10)) do
|
||||||
if portalgun_visiable(pos1, ob) and (ob:is_player()) then
|
if portalgun_visible(pos1, ob) and (ob:is_player()) then
|
||||||
local a = ob:get_pos()
|
local a = ob:get_pos()
|
||||||
if a.y < pos.y + 2 and a.y > pos.y - 1 then
|
if a.y < pos.y + 2 and a.y > pos.y - 1 then
|
||||||
a = {x = math.floor(a.x), y = math.floor(a.y), z = math.floor(a.z)}
|
a = {x = math.floor(a.x), y = math.floor(a.y), z = math.floor(a.z)}
|
||||||
@ -134,7 +134,11 @@ minetest.register_entity(
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if d then
|
if d then
|
||||||
minetest.add_entity(pos1, "portalgun:bullet1"):set_velocity(d)
|
local bullet_ent = minetest.add_entity(pos1, "portalgun:bullet1")
|
||||||
|
bullet_ent:setvelocity(d)
|
||||||
|
--rotate bullet to by 90 degrees in x axis
|
||||||
|
local yaw = math.rad(math.fmod((math.floor(math.fmod(math.deg(self.object:get_yaw()), 360) / 90) * 90), 360))
|
||||||
|
bullet_ent:set_yaw(yaw)
|
||||||
minetest.sound_play("portalgun_bullet1", {pos = pos, gain = 1, max_hear_distance = 15})
|
minetest.sound_play("portalgun_bullet1", {pos = pos, gain = 1, max_hear_distance = 15})
|
||||||
else
|
else
|
||||||
local obj = minetest.add_entity(pos1, "portalgun:turretgun")
|
local obj = minetest.add_entity(pos1, "portalgun:turretgun")
|
||||||
@ -189,7 +193,8 @@ minetest.register_node("portalgun:turretgun_spawner",
|
|||||||
local objs = minetest.get_objects_inside_radius(pos2, 1)
|
local objs = minetest.get_objects_inside_radius(pos2, 1)
|
||||||
local found = 0
|
local found = 0
|
||||||
for i, obj in pairs(objs) do
|
for i, obj in pairs(objs) do
|
||||||
if obj:get_luaentity().name == "portalgun:turretgun" then
|
local name = obj:get_luaentity().name
|
||||||
|
if name== "portalgun:turretgun" and name == "portalgun:turretgun2" then
|
||||||
found = found + 1
|
found = found + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -216,7 +221,7 @@ minetest.register_entity(
|
|||||||
automatic_rotate = 0,
|
automatic_rotate = 0,
|
||||||
_tmr = 0,
|
_tmr = 0,
|
||||||
_stop = 1,
|
_stop = 1,
|
||||||
visual_size = {x = 6, y = 6},
|
visual_size = {x = 5.8, y = 5.8},
|
||||||
mesh = "turret1.obj",
|
mesh = "turret1.obj",
|
||||||
on_step = function(self, elapsed, moveresult)
|
on_step = function(self, elapsed, moveresult)
|
||||||
self.object:set_yaw(math.rad(math.fmod((math.floor(math.fmod(math.deg(self.object:get_yaw()), 360) / 90) * 90), 360)))
|
self.object:set_yaw(math.rad(math.fmod((math.floor(math.fmod(math.deg(self.object:get_yaw()), 360) / 90) * 90), 360)))
|
||||||
@ -249,7 +254,7 @@ minetest.register_entity(
|
|||||||
|
|
||||||
local d
|
local d
|
||||||
for i, ob in pairs(minetest.get_objects_inside_radius(pos1, 10)) do
|
for i, ob in pairs(minetest.get_objects_inside_radius(pos1, 10)) do
|
||||||
if portalgun_visiable(pos1, ob) and (ob:is_player()) then
|
if portalgun_visible(pos1, ob) and (ob:is_player()) then
|
||||||
local a = ob:get_pos()
|
local a = ob:get_pos()
|
||||||
if a.y < pos.y + 2 and a.y > pos.y - 1 then
|
if a.y < pos.y + 2 and a.y > pos.y - 1 then
|
||||||
a = {x = math.floor(a.x), y = math.floor(a.y), z = math.floor(a.z)}
|
a = {x = math.floor(a.x), y = math.floor(a.y), z = math.floor(a.z)}
|
||||||
@ -281,7 +286,7 @@ minetest.register_entity(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
function portalgun_visiable(pos, ob)
|
function portalgun_visible(pos, ob)
|
||||||
if ob == nil or ob:get_pos() == nil or ob:get_pos().y == nil then
|
if ob == nil or ob:get_pos() == nil or ob:get_pos().y == nil then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@ -320,6 +325,7 @@ minetest.register_entity(
|
|||||||
--collisionbox={-0.01,-0.01,-0.01,0.01,0.01,0.01},
|
--collisionbox={-0.01,-0.01,-0.01,0.01,0.01,0.01},
|
||||||
pointable = false,
|
pointable = false,
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
|
visual_size = {x = 2, y = 2},
|
||||||
mesh = "bullet.obj",
|
mesh = "bullet.obj",
|
||||||
--yellow color as tiles
|
--yellow color as tiles
|
||||||
tiles = {"#color[yellow]"},
|
tiles = {"#color[yellow]"},
|
||||||
|
BIN
textures/portal_toxwater_anim.png
Normal file
BIN
textures/portal_toxwater_anim.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Reference in New Issue
Block a user