Skip to content

Commit 3388115

Browse files
committed
add Lua file to show advisor message about DLL version incompatibility
This uses the new Lua global variable `nam_dll_version`, added in NAMTeam/nam-dll#3
1 parent 6a72ab6 commit 3388115

6 files changed

Lines changed: 96 additions & 0 deletions

File tree

Controller/INRULs/RULConfig.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,3 +333,11 @@ Source: AvenueAdvanced/WideRadiusCurves.rul
333333
Source: AvenueAdvanced/Roundabouts.rul
334334
Source: AvenueAdvanced/TurningLanes.rul
335335
Source: AvenueAdvanced/Intersections.rul
336+
337+
########################################################
338+
339+
File: NetworkAddonMod_Advice.dat
340+
341+
TGI: 0xCA63E2A3 0x4A5E8EF6 0x2A504B00
342+
Compressed: 1
343+
Source: ../../lua/adv_nam_dll.lua

ltext/buttons.pot

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,4 +1441,21 @@ msgstr ""
14411441

14421442
msgctxt "2026960B-EA5524EB-CBE09C9B"
14431443
msgid "RHW"
1444+
msgstr ""
1445+
1446+
msgctxt "2026960B-6A231EA4-2A504BA0"
1447+
msgid "Traffic Planners Have Lost The Plot"
1448+
msgstr ""
1449+
1450+
msgctxt "2026960B-6A231EA4-2A504BA1"
1451+
msgid ""
1452+
"<p>\n"
1453+
"Mayor! It seems our traffic engineers have been taking a wrong turn with the data they received, resulting in some peculiar roadways and puzzling intersections that resemble modern art rather than functional pathways—proof that when you feed the wrong info, even the best engineers can get off track:\n"
1454+
"</p><p>\n"
1455+
"They could not find the correct <u>NAM DLL</u> file in your Plugins.\n"
1456+
"</p><p>\n"
1457+
"Required NAM DLL version: <u>#nam_dll_version_expected#</u>\n"
1458+
"<br>\n"
1459+
"Installed NAM DLL version: <u>#nam_dll_version or 'not installed'#</u>\n"
1460+
"</p>"
14441461
msgstr ""

ltext/de/buttons.po

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,3 +1487,29 @@ msgstr ""
14871487
msgctxt "2026960B-EA5524EB-CBE09C9B"
14881488
msgid "RHW"
14891489
msgstr ""
1490+
1491+
msgctxt "2026960B-6A231EA4-2A504BA0"
1492+
msgid "Traffic Planners Have Lost The Plot"
1493+
msgstr "Verkehrsplaner haben keinen Plan"
1494+
1495+
msgctxt "2026960B-6A231EA4-2A504BA1"
1496+
msgid ""
1497+
"<p>\n"
1498+
"Mayor! It seems our traffic engineers have been taking a wrong turn with the data they received, resulting in some peculiar roadways and puzzling intersections that resemble modern art rather than functional pathways—proof that when you feed the wrong info, even the best engineers can get off track:\n"
1499+
"</p><p>\n"
1500+
"They could not find the correct <u>NAM DLL</u> file in your Plugins.\n"
1501+
"</p><p>\n"
1502+
"Required NAM DLL version: <u>#nam_dll_version_expected#</u>\n"
1503+
"<br>\n"
1504+
"Installed NAM DLL version: <u>#nam_dll_version or 'not installed'#</u>\n"
1505+
"</p>"
1506+
msgstr ""
1507+
"<p>\n"
1508+
"Hoppla! Es scheint, als hätten unsere Verkehrsingenieure den falschen Weg eingeschlagen. Die vorliegenden Daten zeigen bizarre Straßenmuster und verwirrende Kreuzungen, die eher wie moderne Kunstwerke aussehen statt funktionaler Wege – ein Beweis dafür, dass mit den falschen Infos selbst die besten Baumeister vom Pfad abkommen:\n"
1509+
"</p><p>\n"
1510+
"Ihr Plugins-Ordner enthält nicht die richtige <u>NAM-DLL</u>-Datei."
1511+
"</p><p>\n"
1512+
"Benötigte NAM-DLL-Version: <u>#nam_dll_version_expected#</u>\n"
1513+
"<br>\n"
1514+
"Installierte NAM-DLL-Version: <u>#nam_dll_version or 'nicht installiert'#</u>\n"
1515+
"</p>"

lua/adv_nam_dll.lua

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
--#-package:2A504B00# -- package signature
2+
----------------------------------------------------------------------
3+
-- This file defines advisor messages related to the NAM DLL.
4+
5+
-- Note that this Lua file is not intended for distribution with the DLL itself, but for distribution with the NAM DBPF files to ensure compatibility between NAM and DLL.
6+
nam_dll_version_expected = "1.1.0" -- needs to be updated whenever a new DLL version is released
7+
8+
-- (When this script is first executed, the `nam_dll_version` is still `nil`, but it gets defined before the trigger conditions are evaluated.)
9+
function is_nam_dll_correct()
10+
local version = rawget(globals(), "nam_dll_version")
11+
return version ~= nil and version == nam_dll_version_expected
12+
end
13+
14+
------------ Advice record ----
15+
a = create_advice_transportation('2a504ba0')
16+
a.trigger = "not is_nam_dll_correct()"
17+
a.title = [[text@2a504ba0 Traffic Planners Have Lost The Plot]]
18+
a.message = [[text@2a504ba1 They could not find the correct NAM DLL file in your Plugins. Required NAM DLL version: #nam_dll_version_expected#, Installed NAM DLL version: #nam_dll_version or 'not installed'#]]
19+
a.once = 0 -- must be 0, since 1 means once per city (saving after closing the message would prevent message from ever appearing again, even after restarting the game or upgrading to a newer DLL version – unless the GUID is changed for every new DLL version)
20+
a.persist = 1 -- irrelevant as trigger is not random (after game is restarted with correct DLL, the trigger seems to be evaluated anyway, so message disappears)
21+
a.frequency = 90 -- days
22+
a.timeout = tuning_constants.ADVICE_TIMEOUT_SHORT
23+
a.no_timeout = 1 -- message stays active in background after closing popup, so the popup doesn't reappear every few months
24+
a.priority = tuning_constants.ADVICE_PRIORITY_URGENT
25+
a.mood = advice_moods.BAD_JOB
26+
27+
------------ Advice record ----
28+
-- for debugging only
29+
-- a = create_advice_transportation('2a504b90')
30+
-- a.trigger = "is_nam_dll_correct()"
31+
-- a.title = [[Debug: Traffic Planners On The Right Track]]
32+
-- a.message = [[The correct version of the NAM DLL is installed: #nam_dll_version or 'not installed'#]]
33+
-- a.once = 0
34+
-- a.persist = 1
35+
-- a.frequency = 90
36+
-- a.timeout = tuning_constants.ADVICE_TIMEOUT_SHORT
37+
-- a.no_timeout = 1
38+
-- a.priority = tuning_constants.ADVICE_PRIORITY_URGENT
39+
-- a.mood = advice_moods.GREAT_JOB

lua/adv_nam_dll.lua.TGI

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CA63E2A3
2+
4A5E8EF6
3+
2A504B00

src/scripts/compile-release-inruls.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,7 @@ cp -p "$PROJECT_ROOT/Controller/INRULs/NetworkAddonMod_IndividualNetworkRULs_LHD
5555
# Avenue turning lanes
5656
cp -p "$PROJECT_ROOT/Controller/INRULs/NetworkAddonMod_TurningLanes_Avenues_Plugin_INRULs.dat" "target/controllers/"
5757

58+
# advisor messages
59+
cp -p "$PROJECT_ROOT/Controller/INRULs/NetworkAddonMod_Advice.dat" "target/controllers/"
60+
5861
rm -rf "$TEMP"

0 commit comments

Comments
 (0)