From 5028ce9700ac1e087bd897e3f96812d005ecc93f Mon Sep 17 00:00:00 2001 From: Lajos Meszaros Date: Thu, 2 Jun 2022 22:28:53 +0200 Subject: [PATCH] Script: Remove unnecessary extra hitbox detection for player MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit v2: Keep the 10 unit offset for the player, add changelog entry This change affects the following scripts: graph/obj3d/interactive/fix_inter/elevator_plateau/elevator_plateau.asl The player no longer takes damage if on top of the elevater AND inside the damage zone but this condition is impossible as the check is executed when the elevator is on top of the damage zone. And if the condition were possible, this would be a bug fix. graph/obj3d/interactive/fix_inter/pressurepad_gob/pressurepad_gob_0010/pressurepad_gob.asl The affected code is unreachable. graph/obj3d/interactive/fix_inter/pressurepad_gob/pressurepad_gob_0021/pressurepad_gob.asl graph/obj3d/interactive/fix_inter/pressurepad_gob/pressurepad_gob_0022/pressurepad_gob.asl graph/obj3d/interactive/fix_inter/pressurepad_gob/pressurepad_gob_0023/pressurepad_gob.asl graph/obj3d/interactive/fix_inter/pressurepad_gob/pressurepad_gob_0024/pressurepad_gob.asl An additional IF (§levitate == 1) ACCEPT check is executed but this check is redundant so there is no noticeable change. Signed-off-by: Daniel Scharrer --- CHANGELOG | 1 + src/graphics/data/Mesh.cpp | 10 ++-------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7a6346bde6..f2af3273dd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -44,6 +44,7 @@ Modding: * Added the weapon/summoned/spell ID as parameter 3 to the hit script event (feature request #1599) * Added the damage type flags as parameter 4 to the hit script event * Added support for stopping specific spells using the destroy script command +* Fixed the ^$objontop script variable to not have a leading space and don't repeat 'player' Debugging: diff --git a/src/graphics/data/Mesh.cpp b/src/graphics/data/Mesh.cpp index 5d397bf545..3827169892 100644 --- a/src/graphics/data/Mesh.cpp +++ b/src/graphics/data/Mesh.cpp @@ -165,17 +165,11 @@ long MakeTopObjString(Entity * entity, std::string & dest) { dest = ""; - if(player.pos.x > box.min.x && player.pos.x < box.max.x - && player.pos.z > box.min.z && player.pos.z < box.max.z) { - if(glm::abs(player.pos.y + 160.f - box.min.y) < 50.f) { - dest += " player"; - } - } - for(const Entity & other : entities.inScene(IO_NPC | IO_ITEM)) { if(&other != entity) { if(other.pos.x > box.min.x && other.pos.x < box.max.x && other.pos.z > box.min.z && other.pos.z < box.max.z) { - if(glm::abs(other.pos.y - box.min.y) < 40.f) { + float offset = (&other == entities.player() ? 10.f : 0.f); + if(glm::abs(other.pos.y - offset - box.min.y) < 40.f + offset) { if(dest.length() != 0) { dest += ' '; }