forked from Mirrorlandia_minetest/portalgun
_
This commit is contained in:
parent
e6726191a4
commit
910d9e0979
@ -412,6 +412,8 @@ minetest.register_craftitem(
|
||||
range = 100,
|
||||
inventory_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)
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
if node.name == "portalgun:button" then
|
||||
|
@ -3,7 +3,51 @@ minetest.register_node(
|
||||
{
|
||||
description = "Toxic water",
|
||||
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",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
@ -30,10 +74,50 @@ minetest.register_node(
|
||||
{
|
||||
description = "Toxic water 2",
|
||||
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 = {
|
||||
{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",
|
||||
paramtype = "light",
|
||||
|
@ -113,7 +113,7 @@ minetest.register_entity(
|
||||
p = 1
|
||||
end
|
||||
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()
|
||||
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)}
|
||||
@ -134,7 +134,11 @@ minetest.register_entity(
|
||||
end
|
||||
end
|
||||
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})
|
||||
else
|
||||
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 found = 0
|
||||
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
|
||||
end
|
||||
end
|
||||
@ -216,7 +221,7 @@ minetest.register_entity(
|
||||
automatic_rotate = 0,
|
||||
_tmr = 0,
|
||||
_stop = 1,
|
||||
visual_size = {x = 6, y = 6},
|
||||
visual_size = {x = 5.8, y = 5.8},
|
||||
mesh = "turret1.obj",
|
||||
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)))
|
||||
@ -249,7 +254,7 @@ minetest.register_entity(
|
||||
|
||||
local d
|
||||
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()
|
||||
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)}
|
||||
@ -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
|
||||
return false
|
||||
end
|
||||
@ -320,6 +325,7 @@ minetest.register_entity(
|
||||
--collisionbox={-0.01,-0.01,-0.01,0.01,0.01,0.01},
|
||||
pointable = false,
|
||||
visual = "mesh",
|
||||
visual_size = {x = 2, y = 2},
|
||||
mesh = "bullet.obj",
|
||||
--yellow color as tiles
|
||||
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 |
Loading…
Reference in New Issue
Block a user