From 6e43882a0ee3594f9ed00c17129f3b28303c0edc Mon Sep 17 00:00:00 2001 From: jacob1 Date: Thu, 12 Dec 2024 23:56:25 -0500 Subject: [PATCH] Prevent creating two tools with the same identifier in tools.allocate --- src/lua/LuaTools.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lua/LuaTools.cpp b/src/lua/LuaTools.cpp index 080f157b8..f3904531f 100644 --- a/src/lua/LuaTools.cpp +++ b/src/lua/LuaTools.cpp @@ -24,6 +24,10 @@ static int allocate(lua_State *L) } auto *lsi = GetLSI(); auto identifier = group + "_TOOL_" + name; + if (lsi->gameModel->GetToolFromIdentifier(identifier)) + { + return luaL_error(L, "Tool identifier already in use."); + } { SimTool tool; tool.Identifier = identifier;