From 910d9e097977f413d653c72e8304740f8ec090ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Sun, 14 Aug 2022 16:00:16 +0200 Subject: [PATCH] _ --- scripts/portalgun.lua | 2 + scripts/toxicwater.lua | 92 ++++++++++++++++++++++++++++-- scripts/turrets.lua | 18 ++++-- textures/portal_toxwater_anim.png | Bin 0 -> 1205 bytes 4 files changed, 102 insertions(+), 10 deletions(-) create mode 100644 textures/portal_toxwater_anim.png diff --git a/scripts/portalgun.lua b/scripts/portalgun.lua index e490511..e5c6742 100644 --- a/scripts/portalgun.lua +++ b/scripts/portalgun.lua @@ -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 diff --git a/scripts/toxicwater.lua b/scripts/toxicwater.lua index 1a44170..f6447fb 100644 --- a/scripts/toxicwater.lua +++ b/scripts/toxicwater.lua @@ -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", diff --git a/scripts/turrets.lua b/scripts/turrets.lua index e7c0ee1..2df13a2 100644 --- a/scripts/turrets.lua +++ b/scripts/turrets.lua @@ -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]"}, diff --git a/textures/portal_toxwater_anim.png b/textures/portal_toxwater_anim.png new file mode 100644 index 0000000000000000000000000000000000000000..f317d1b4b3aabee62c7c0b4ff7645f5dc74f6625 GIT binary patch literal 1205 zcmeAS@N?(olHy`uVBq!ia0vp^0t^g{0vyahR$mm$b0DWC)7d#7GdY=oL1SX=L|c!; z4l+mMqnEly$-Y_eXu?9PNCDBpD_SB8omPlOl^X2)!ad7GMN_Y@Df{5T{-dj!yEm`n zTi2xUgYnUeCre%^ss7W~+|u#!!4CQN?`+@QWBljVx-#v$#e%G96aCa$a`Hks_9?Z* zxfpazIO0?5CldTYCjR?}k6-o9ZQgVKuceaLy_5!jg?XvF5(V=G{PUx%p4UFo(Dvl| zX!&u5qqs`llU;8?N9E*mAR=iUz@Z~JfbvB!KtA~>ePw@PIJO~MT9eN`B(gCm)Y;3H!~*Hph#x{ zm*}L&?EjnZ-<{QZlG9vs4#TeaoZrbT9PgOU?#iu~zg_m3g~Nt9JnD9QE`#y>CD(69 zz2SIqn@w-s?OA)+W8N_^`|nEe=o4A+QeULuyYa7OG8gK(zpUB0ck8#pUkoWLR$t*Q zDB$Q3)2zPx`0m1U_x{;le)XPRGP$3r;=}{=6;i^5drCgzo_;y)qMZ} literal 0 HcmV?d00001