From 56429cd7287eacfeb2c50fe3ea48be725939ff18 Mon Sep 17 00:00:00 2001 From: Eugenio Marzo Date: Sun, 3 Jan 2021 18:28:25 +0100 Subject: [PATCH] fixed pod logs --- assets/box.png | Bin 3293 -> 3293 bytes assets/kubelinter.atlas | 8 ++ assets/kubelinterbox.png | Bin 0 -> 3293 bytes assets/podlogbox.png | Bin 0 -> 5779 bytes main/gui.gui | 179 ++++++++++++++++++++++++++++++++++ main/kubeinvaders.gui_script | 16 ++- main/mymodules/kubelinter.lua | 2 +- main/mymodules/pod_api.lua | 1 + main/spaceship.script | 25 +++-- 9 files changed, 218 insertions(+), 13 deletions(-) create mode 100644 assets/kubelinterbox.png create mode 100644 assets/podlogbox.png diff --git a/assets/box.png b/assets/box.png index bd835887cd95eb1c14c35da790d81501b02b8183..3218b1fd537d9883600af99bf0f0557a30cfd4e0 100644 GIT binary patch delta 20 ccmcaBc~^47Q$}_HbpzK;?PZ(aFn;6$09h9ZfB*mh delta 20 ccmcaBc~^47Q$}`vb?qB#S6$!yhVdg80AUvii~s-t diff --git a/assets/kubelinter.atlas b/assets/kubelinter.atlas index 93f84f9..f387f83 100644 --- a/assets/kubelinter.atlas +++ b/assets/kubelinter.atlas @@ -2,6 +2,14 @@ images { image: "/assets/box.png" sprite_trim_mode: SPRITE_TRIM_MODE_OFF } +images { + image: "/assets/podlogbox.png" + sprite_trim_mode: SPRITE_TRIM_MODE_OFF +} +images { + image: "/assets/kubelinterbox.png" + sprite_trim_mode: SPRITE_TRIM_MODE_OFF +} margin: 0 extrude_borders: 2 inner_padding: 0 diff --git a/assets/kubelinterbox.png b/assets/kubelinterbox.png new file mode 100644 index 0000000000000000000000000000000000000000..5933858441c2cffc2fab62d7911f522aa1921903 GIT binary patch literal 3293 zcmeAS@N?(olHy`uVBq!ia0y~yU~^z#VASDY1B%R^Th9UHv}QUx2Y5O=D-;yvr)B1( zGB9XNtet40Bu1{<5aBID6jX zFN_|S*Gw`$a8S`8YQdY*`Q_!?&%eDt@7bR^2F{m7wHrG%tbp;tmgMd3!f+D|KOUL^ z6yYrJh%9Dc;1&j9Muu5)B!GhKC7!;n>`xh)1vHpzfBjky6p}1)jVN)>&&^HED`9Xh zN=+EaktaqI0}|19A`nf8b8Z#bM(jp5wcATCgN zRl1U4uYP?GA}khZW#p=yT`}`mVLsZ0Hz)K7zT&Hxn~>ow{4z# zSmxiJzg21X&YgKvw!89MO|~Q0nGfdw`t;M_{k`|kpLT~E8~dj}yL`8_@{PS;16X<} z#p2LOZ=)^+C9WY*FpNgjXhe;s(*{r?U>L0mhD>{gKE>AT{eS+>-hF<}>nvMv`gpMa z2@B~##Lsjh)310=eDSQyI-4Wd!6sRFpWd}@dm5O{;AO+a4Q8GA$*Z?YYo+Oe5^WIQ M)78&qol`;+0MXDYRR910 literal 0 HcmV?d00001 diff --git a/assets/podlogbox.png b/assets/podlogbox.png new file mode 100644 index 0000000000000000000000000000000000000000..dab3cd8b2934e140b59b1b2ed328be0d061da87c GIT binary patch literal 5779 zcmeAS@N?(olHy`uVBq!ia0y~yU~^z#V2a>i1BzH3({f^9U~J8Fb`J1#c2+1T%1_J8 zNo8Qrm{>c}*5h!1NUMLa>qIYh?JkRy6@Fqat}TvrHWwT8+1#QkFTm6{|X?tXCV zg9qo6t{yxZ8O|Q=DDa1|u(&v=WTMb}Z!X=WJs&FMpWiL6cyH&hV*1Rq(jMknd9zo# z#GFY9Ke{fQMZiVkuf&9zsb@Tcg!X+c^}icZZaDAh{qN~tS6Oy5GES_RCb`UakE6}r zOzAn_JC)aHtUmJmNU~b&gdY=McOB24!>z|{W1O@s`129Lq>UGjc}Z_xv{KMt&^^?5 zd5z-Zji)NRH;1j;^vw1rx3gt!>de<$+9n=Qnx^2`(xm03aoDY=Y_15mrd9v%AMG*w zUG!RGR1J!B7BKN{dd>d7`TpjupC${(1!?e=?6Wv`oa4e)Zj-FO&$VwXdW98!@Wi~- ztzXJ_re;!HcIHK8g+076G22a2`FGr5WSh@(b4skHhxdu+jo*!bEz`MB&i!RgWpVbr z$6pvdF0Ywne&C>@LDYgbrSr?nx1WD|f8Mh{bqt&@i)uG^YFGi|g)Pb3-G$*M7=Ao7 z11Q2-;1OBOz`!jG!i)^F=12eq*-JcqUD=;9G7A{0ntZ?J1r(Ajag8W(&d<$F%`0JW zE=o--Nlj5G&n(GMaQE~L2yf&QXJ8P?@^o98Pix^BK$Qj6kCq7zBz8A&da!2Cx8wB@+jjF=12y91igC zD3(mtNrQxu*B=H*s1>mYfJGGCsUYyY^nLT~w`rze6CW59pF1mU?*QgB$S|^i87Bls z1%LrTPI%1O%lPDW3OE!G9IV^U_l<3W|7<2OpZ&LF@|u2-h(1hYcfRZ!UWITNH+maL zRvgCt{ha}#^TQWvCID(AqER!zQA*W}IU1&;VamWTnxw#~fGSnpXpS1qQKLC(wCw=O z1)~KD4f+zJ1?*@6J6gcfw}4I0XZUF#2~Kw(-q2)(U^G_`v0QyF?XH!81K80Gn_*)& zbGEN#hK}c0%>Hh8?9&Se=;+b8XS+%j8o|glB UkB3a0uo`5Wr>mdKI;Vst0I};`L;wH) literal 0 HcmV?d00001 diff --git a/main/gui.gui b/main/gui.gui index 02a468a..8c42d29 100644 --- a/main/gui.gui +++ b/main/gui.gui @@ -708,6 +708,185 @@ nodes { template_node_child: false size_mode: SIZE_MODE_AUTO } +nodes { + position { + x: -893.0 + y: -739.0 + z: 0.0 + w: 1.0 + } + rotation { + x: 0.0 + y: 0.0 + z: 0.0 + w: 1.0 + } + scale { + x: 1.0 + y: 1.0 + z: 1.0 + w: 1.0 + } + size { + x: 1600.0 + y: 600.0 + z: 0.0 + w: 1.0 + } + color { + x: 1.0 + y: 1.0 + z: 1.0 + w: 1.0 + } + type: TYPE_BOX + blend_mode: BLEND_MODE_ALPHA + texture: "kubelinter/podlogbox" + id: "podlog_box" + xanchor: XANCHOR_NONE + yanchor: YANCHOR_NONE + pivot: PIVOT_CENTER + adjust_mode: ADJUST_MODE_FIT + layer: "" + inherit_alpha: true + slice9 { + x: 0.0 + y: 0.0 + z: 0.0 + w: 0.0 + } + clipping_mode: CLIPPING_MODE_NONE + clipping_visible: true + clipping_inverted: false + alpha: 1.0 + template_node_child: false + size_mode: SIZE_MODE_AUTO +} +nodes { + position { + x: 0.0 + y: 0.0 + z: 0.0 + w: 1.0 + } + rotation { + x: 0.0 + y: 0.0 + z: 0.0 + w: 1.0 + } + scale { + x: 1.0 + y: 1.0 + z: 1.0 + w: 1.0 + } + size { + x: 1200.0 + y: 1000.0 + z: 0.0 + w: 1.0 + } + color { + x: 0.0 + y: 1.0 + z: 0.0 + w: 1.0 + } + type: TYPE_TEXT + blend_mode: BLEND_MODE_ALPHA + text: "" + font: "arcade" + id: "pod_log_text" + xanchor: XANCHOR_NONE + yanchor: YANCHOR_NONE + pivot: PIVOT_CENTER + outline { + x: 1.0 + y: 1.0 + z: 1.0 + w: 1.0 + } + shadow { + x: 1.0 + y: 1.0 + z: 1.0 + w: 1.0 + } + adjust_mode: ADJUST_MODE_FIT + line_break: true + parent: "podlog_box" + layer: "" + inherit_alpha: true + alpha: 1.0 + outline_alpha: 1.0 + shadow_alpha: 1.0 + template_node_child: false + text_leading: 1.0 + text_tracking: 0.0 +} +nodes { + position { + x: 709.0 + y: 105.0 + z: 0.0 + w: 1.0 + } + rotation { + x: 0.0 + y: 0.0 + z: 0.0 + w: 1.0 + } + scale { + x: 1.0 + y: 1.0 + z: 1.0 + w: 1.0 + } + size { + x: 500.0 + y: 100.0 + z: 0.0 + w: 1.0 + } + color { + x: 1.0 + y: 1.0 + z: 1.0 + w: 1.0 + } + type: TYPE_TEXT + blend_mode: BLEND_MODE_ALPHA + text: "" + font: "error" + id: "error1" + xanchor: XANCHOR_NONE + yanchor: YANCHOR_NONE + pivot: PIVOT_W + outline { + x: 1.0 + y: 1.0 + z: 1.0 + w: 1.0 + } + shadow { + x: 1.0 + y: 1.0 + z: 1.0 + w: 1.0 + } + adjust_mode: ADJUST_MODE_FIT + line_break: true + layer: "" + inherit_alpha: true + alpha: 1.0 + outline_alpha: 1.0 + shadow_alpha: 1.0 + template_node_child: false + text_leading: 1.0 + text_tracking: 0.0 +} material: "/builtins/materials/gui.material" adjust_reference: ADJUST_REFERENCE_PARENT max_nodes: 512 diff --git a/main/kubeinvaders.gui_script b/main/kubeinvaders.gui_script index ba4abf5..045273d 100644 --- a/main/kubeinvaders.gui_script +++ b/main/kubeinvaders.gui_script @@ -20,16 +20,26 @@ function on_message(self, message_id, message, sender) elseif message_id == hash("info") then gui.set_text(gui.get_node("info"), message.infomessage) elseif message_id == hash("pod_log") then - gui.set_text(gui.get_node("pod_log"), message.infomessage) + --gui.set_text(gui.get_node("pod_log"), message.infomessage) + if message.infomessage and message.infomessage ~= '' and not kubelinter_read then + gui.set_text(gui.get_node("pod_log_text"), message.infomessage) + gui.set_position(gui.get_node("podlog_box"), vmath.vector3(893, 539, 0)) + --gui.set_position(gui.get_node("pod_log_text"), vmath.vector3(850, 500, 0)) + elseif not kubelinter_read and message.infomessage then + gui.set_position(gui.get_node("podlog_box"), vmath.vector3(-893, -739, 0)) + gui.set_text(gui.get_node("pod_log_text"), message.infomessage) + end + elseif message_id == hash("error1") then + gui.set_text(gui.get_node("error1"), message.errormessage) elseif message_id == hash("error") then gui.set_text(gui.get_node("error"), message.errormessage) elseif message_id == hash("mode") then gui.set_text(gui.get_node("mode"), message.mode) elseif message_id == hash("open_kubelinter_box") then gui.set_position(gui.get_node("kubelinter"), message.position) - gui.set_position(gui.get_node("kubelinter_box"), vmath.vector3(893, 739, 0)) + gui.set_position(gui.get_node("kubelinter_box"), vmath.vector3(893, 539, 0)) elseif message_id == hash("close_kubelinter_box") then - gui.set_position(gui.get_node("kubelinter_box"), vmath.vector3(-893, -739, 0)) + gui.set_position(gui.get_node("kubelinter_box"), vmath.vector3(-893, -539, 0)) elseif message_id == hash("set_kubelinter_text") then gui.set_text(gui.get_node("kubelinter"), message.kubelintermessage) diff --git a/main/mymodules/kubelinter.lua b/main/mymodules/kubelinter.lua index 471f41e..2c4f3c2 100644 --- a/main/mymodules/kubelinter.lua +++ b/main/mymodules/kubelinter.lua @@ -11,7 +11,7 @@ function M.http_kubelinter_result(self, _, response) print(response.status) print(response.response) print(response.headers) - msg.post("ui#gui","open_kubelinter_box",{ position = vmath.vector3(850, 750, 0) }) + msg.post("ui#gui","open_kubelinter_box",{ position = vmath.vector3(850, 550, 0) }) kubelinter_table = json.decode(response.response) kubelinter_read = true kubelinter_index = 0 diff --git a/main/mymodules/pod_api.lua b/main/mymodules/pod_api.lua index a0beb2d..74075a5 100644 --- a/main/mymodules/pod_api.lua +++ b/main/mymodules/pod_api.lua @@ -33,6 +33,7 @@ end function M.http_pod_log_result(self, _, response) msg.post("ui#gui","pod_log",{infomessage = response.response}) + current_pod_log = response.response end function M.delete_pod(pod_name) diff --git a/main/spaceship.script b/main/spaceship.script index d155949..d7f314e 100644 --- a/main/spaceship.script +++ b/main/spaceship.script @@ -16,6 +16,7 @@ pod_update_time = 0.5 kubernetes_pods = {} last_pod_log = false last_pod_log_time = false +current_pod_log = "" start_chaos = false bullet_collision_action = "delete_pod" @@ -103,6 +104,12 @@ function start_chaos() kubelinter.run(pod_name) kubelinter_pod = false end + + if kubelinter_read or current_pod_log ~= "" then + msg.post("ui#gui", "error1",{ errormessage = "Press SPACE!" }) + else + msg.post("ui#gui", "error1",{ errormessage = "" }) + end end) timer.repeat_seconds(1, function() spaceship.auto() @@ -132,29 +139,21 @@ end function on_input(self, action_id, action) p = go.get_position() if action_id == hash("up") then - msg.post("ui#gui","pod_log",{infomessage = ''}) - last_pod_log = false if p.y < 1000 then p.y = p.y + 4 go.set_position(p) end elseif action_id == hash("down") then - msg.post("ui#gui","pod_log",{infomessage = ''}) - last_pod_log = false if p.y > 1 then p.y = p.y - 4 go.set_position(p) end elseif action_id == hash("left") then - msg.post("ui#gui","pod_log",{infomessage = ''}) - last_pod_log = false if p.x > 1 then p.x = p.x - 4 go.set_position(p) end elseif action_id == hash("right") then - msg.post("ui#gui","pod_log",{infomessage = ''}) - last_pod_log = false if p.x < 1800 then p.x = p.x + 4 go.set_position(p) @@ -210,6 +209,9 @@ function on_input(self, action_id, action) msg.post("ui#gui", "info",{ infomessage = info }) elseif ((action_id == hash("space")) or (action_id == hash("kubelinter"))) and action.pressed then + msg.post("ui#gui","pod_log",{infomessage = ''}) + last_pod_log = false + current_pod_log = "" if action_id == hash("space") then bullet_collision_action = "delete_pod" @@ -245,7 +247,9 @@ function on_input(self, action_id, action) return end - msg.post("ui#gui", "error",{ errormessage = "" }) + if not kubelinter_read then + msg.post("ui#gui", "error",{ errormessage = "" }) + end -- Returns an approximation of the amount in seconds of CPU time used by the program. current_hit_time = os.clock() if automatic == false then @@ -270,6 +274,9 @@ function on_message(self, message_id, message, sender) current_time = os.clock() print('DEBUG' .. message_id) if message_id == COLLISION_RESPONSE and started_chaos then + + msg.post("ui#gui","pod_log") + for i,value in ipairs(current_pods) do if (message["other_id"] == value["id"]) then pod_name = value["pod_name"]