From 822ba9fb42e0308de148b2fafb78b1d2f919e09e Mon Sep 17 00:00:00 2001 From: Chr1Z93 <puls.christian@gmail.com> Date: Wed, 18 Sep 2024 19:14:25 +0200 Subject: [PATCH 1/2] Handling for removed mats --- src/core/NavigationOverlayHandler.ttslua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/core/NavigationOverlayHandler.ttslua b/src/core/NavigationOverlayHandler.ttslua index ad8f37d4..cf5084aa 100644 --- a/src/core/NavigationOverlayHandler.ttslua +++ b/src/core/NavigationOverlayHandler.ttslua @@ -1,3 +1,4 @@ +local guidReferenceApi = require("core/GUIDReferenceApi") local playermatApi = require("playermat/PlayermatApi") fullButtonData = { @@ -185,7 +186,6 @@ end -- XML button creation function createXmlButtonHelper(ui, params) - local guid = self.getGUID() local xml = findTagWithId(ui, params.id) -- add basic image @@ -202,7 +202,7 @@ function createXmlButtonHelper(ui, params) table.insert(xml.children, { tag = "button", attributes = { - onClick = guid .. "/buttonClicked", + onClick = self.getGUID() .. "/buttonClicked", id = d.id, height = d.height, width = d.width, @@ -311,10 +311,18 @@ function loadCamera(player, camera) matColor = camera end + -- if mat is removed, end here + local mat = guidReferenceApi.getObjectByOwnerAndType(matColor, "Playermat") + if mat == nil then + printToColor("This playermat seems to be removed.", player.color) + return + end + -- dynamic view of the play area if index == 2 then -- search the scripting zone on the play area for objects - local bounds = getDynamicViewBounds(getObjectFromGUID("a2f932").getObjects()) + local zone = guidReferenceApi.getObjectByOwnerAndType("Mythos", "PlayAreaZone") + local bounds = getDynamicViewBounds(zone.getObjects()) lookHere = { position = { bounds.middleX, 1.55, bounds.middleZ }, From 4995df98556654832d467ab1520d51748e335718 Mon Sep 17 00:00:00 2001 From: Chr1Z93 <puls.christian@gmail.com> Date: Wed, 18 Sep 2024 21:19:30 +0200 Subject: [PATCH 2/2] updated message --- src/core/NavigationOverlayHandler.ttslua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/NavigationOverlayHandler.ttslua b/src/core/NavigationOverlayHandler.ttslua index cf5084aa..20cf1d7b 100644 --- a/src/core/NavigationOverlayHandler.ttslua +++ b/src/core/NavigationOverlayHandler.ttslua @@ -314,7 +314,7 @@ function loadCamera(player, camera) -- if mat is removed, end here local mat = guidReferenceApi.getObjectByOwnerAndType(matColor, "Playermat") if mat == nil then - printToColor("This playermat seems to be removed.", player.color) + printToColor("Couldn't find this playermat.", player.color) return end