From 23eb745fb62c598741e6a51563793a1fb1654eb1 Mon Sep 17 00:00:00 2001 From: Zughy <4279489-marco_a@users.noreply.gitlab.com> Date: Fri, 2 Jun 2023 23:51:13 +0200 Subject: [PATCH] Add rays --- init.lua | 1 + locale/block_league.it.tr | 3 ++ locale/template.txt | 3 ++ src/game/game_main.lua | 2 -- src/game/misc/rays.lua | 55 ++++++++++++++++++++++++++++++++++++ textures/bl_log_rays.png | Bin 0 -> 183 bytes textures/bl_rays_blue.png | Bin 0 -> 251 bytes textures/bl_rays_orange.png | Bin 0 -> 249 bytes 8 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 src/game/misc/rays.lua create mode 100644 textures/bl_log_rays.png create mode 100644 textures/bl_rays_blue.png create mode 100644 textures/bl_rays_orange.png diff --git a/init.lua b/init.lua index de4b98b..c8dd804 100644 --- a/init.lua +++ b/init.lua @@ -115,6 +115,7 @@ dofile(srcpath .. "/game/game_main.lua") dofile(srcpath .. "/game/input_manager.lua") dofile(srcpath .. "/game/misc/fall.lua") dofile(srcpath .. "/game/misc/immunity.lua") +dofile(srcpath .. "/game/misc/rays.lua") dofile(srcpath .. "/game/misc/stamina.lua") dofile(srcpath .. "/game/TD/ball.lua") -- player diff --git a/locale/block_league.it.tr b/locale/block_league.it.tr index d5849ab..8fdc17d 100644 --- a/locale/block_league.it.tr +++ b/locale/block_league.it.tr @@ -54,6 +54,9 @@ Deaths=Morti Points=Punti Team=Squadra +# game/misc/rays.lua +Rays=Raggi + # game/TD/ball.lua Ball reset=Palla ripristinata NICE POINT!=BEL PUNTO! diff --git a/locale/template.txt b/locale/template.txt index 0d2f18d..9263818 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -54,6 +54,9 @@ Deaths= Points= Team= +# game/misc/rays.lua +Rays= + # game/TD/ball.lua Ball reset= NICE POINT!= diff --git a/src/game/game_main.lua b/src/game/game_main.lua index d864705..a40cc2c 100644 --- a/src/game/game_main.lua +++ b/src/game/game_main.lua @@ -53,9 +53,7 @@ end function round_start(arena) - for pl_name, stats in pairs(arena.players) do - local player = minetest.get_player_by_name(pl_name) if player:get_hp() > 0 then diff --git a/src/game/misc/rays.lua b/src/game/misc/rays.lua new file mode 100644 index 0000000..547559c --- /dev/null +++ b/src/game/misc/rays.lua @@ -0,0 +1,55 @@ +local function register_rays(name, texture) + minetest.register_node("block_league:" .. name, { + description = "Rays", + inventory_image = texture, + tiles = {{ + name = texture, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 0.5 + }} + }, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5} + } + }, + light_source = 10, + walkable = false, + pointable = false, + groups = {oddly_breakable_by_hand = 3} + }) +end + +register_rays("rays_orange", "bl_rays_orange.png") +register_rays("rays_blue", "bl_rays_blue.png") + + + +minetest.register_globalstep(function(dtime) + for _, pl_name in pairs(arena_lib.get_players_in_minigame("block_league")) do + if not arena_lib.is_player_spectating(pl_name) then + local player = minetest.get_player_by_name(pl_name) + local p_nodename = minetest.get_node(player:get_pos()).name + local arena = arena_lib.get_arena_by_player(pl_name) + local p_team = arena.players[pl_name].teamID + + if p_nodename == "block_league:rays_blue" or p_nodename == "block_league:rays_orange" then + if player:get_meta():get_int("bl_has_ball") == 1 then + block_league.get_ball(player):reset() -- TODO non parla di reset ma di palla persa, sistema + end + + if player:get_hp() > 0 and ((p_team == 1 and p_nodename == "block_league:rays_blue") or (p_team == 2 and p_nodename == "block_league:rays_orange")) then + player:set_hp(0) + block_league.HUD_log_update(arena, "bl_log_suicide.png", pl_name, "") + end + end + end + end +end) \ No newline at end of file diff --git a/textures/bl_log_rays.png b/textures/bl_log_rays.png new file mode 100644 index 0000000000000000000000000000000000000000..3dd96762f0303badff7fe697103ced19acc794ef GIT binary patch literal 183 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPE^3h)VW1=9DweKpY0TQIpVDmeK3 zu^shu^v?iA8B2ovf*Bm1-ADs+f<0XvLn?0Bo;}EWz<`6^D|v|e*O?C~|Xr_wq~ zf(CLTZq4!Qhmy=mS}=ZK%@M=u^iei%L@KRoiUl&#hP6njX)ASKrlzGjO8HdKx4~OP zw~Pnk>Nl45Fmw9jgOw7S#~A=%J3|^Z6##1_g6S@R$-5u}u6UR51D8uGt-Fipmr)xk ztl11P>p)WwSAYk?S~&BNC7*zM=fo?Ms`U%*#}077$Oa!{ntcEO002ovPDHLkV1n#j BY1RM$ literal 0 HcmV?d00001 diff --git a/textures/bl_rays_orange.png b/textures/bl_rays_orange.png new file mode 100644 index 0000000000000000000000000000000000000000..a3dac3d4d65635539cbae0987506480cbe0098e3 GIT binary patch literal 249 zcmV{?#AYo8pEWhMemk?nUl0&{J>Z$hSlk#Y~F~LQ`Zy=WTXvikxb^`(OLdg;si1Fzw}@^T z55(1PEbU?D^v4G)B{q*U0Kj&JG-@gU)<^`?T>z7JK?Yp$F5w3*mzGm^7tt@HHdI)% z8DiFfrXa2W4}`UF<{?Wy0r$>{S0+{K7u=5>Z1KLjf)ma&00000NkvXXu0mjfE_!74 literal 0 HcmV?d00001