Skip to content

Commit 9ac1c11

Browse files
committed
Added support for GoMud specific engine info in GMCP, as well as fixed the mmp namespace init.
1 parent 31330dc commit 9ac1c11

File tree

5 files changed

+37
-34
lines changed

5 files changed

+37
-34
lines changed

mfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"package": "GoMudMapper",
33
"title": "GoMud Mapper",
44
"description": "Custom GMCP mapper for GoMud.",
5-
"version": "2.0.1",
5+
"version": "2.0.2",
66
"author": "Morquin - forked from the IRE Mudlet Mapper",
77
"icon": "gomud-mapper-icon.png",
88
"dependencies": "",

src/scripts/GoMudMapper/core/load_settings.lua

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,18 @@ mmp.lagtable = {
2525
[4] = { description = "Bad. Terrible. Terribad.", time = 5 },
2626
[5] = { description = "Carrier Pigeon", time = 10 },
2727
}
28-
local newversion = "2.0.1"
28+
local newversion = "2.0.2"
2929
if mmp.version and mmp.version ~= newversion then
3030
if not mmp.game then
31-
mmp.echo(
32-
"Mapper script updated - Thanks! I don't know what game are you connected to, though - so please reconnect, if you could."
33-
)
31+
-- Check if this is GoMud via GMCP
32+
if gmcp and gmcp.Game and gmcp.Game.Info and gmcp.Game.Info.engine == "GoMud" then
33+
mmp.game = "GoMud"
34+
mmp.echo("Mapper script updated - thanks! You don't need to restart.")
35+
else
36+
mmp.echo(
37+
"Mapper script updated - Thanks! I don't know what game are you connected to, though - so please reconnect, if you could."
38+
)
39+
end
3440
else
3541
mmp.echo("Mapper script updated - thanks! You don't need to restart.")
3642
end

src/scripts/GoMudMapper/core/utilities.lua

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,34 @@
22

33
-- Deep copy function to create a complete copy of a table
44
function mmp.deepcopy(orig)
5-
local orig_type = type(orig)
6-
local copy
7-
if orig_type == "table" then
8-
copy = {}
9-
for orig_key, orig_value in next, orig, nil do
10-
copy[mmp.deepcopy(orig_key)] = mmp.deepcopy(orig_value)
11-
end
12-
setmetatable(copy, mmp.deepcopy(getmetatable(orig)))
13-
else -- number, string, boolean, etc
14-
copy = orig
15-
end
16-
return copy
5+
local orig_type = type(orig)
6+
local copy
7+
if orig_type == "table" then
8+
copy = {}
9+
for orig_key, orig_value in next, orig, nil do
10+
copy[mmp.deepcopy(orig_key)] = mmp.deepcopy(orig_value)
11+
end
12+
setmetatable(copy, mmp.deepcopy(getmetatable(orig)))
13+
else -- number, string, boolean, etc
14+
copy = orig
15+
end
16+
return copy
1717
end
1818

1919
function mmp.highlight_unfinished_rooms()
20-
if not mmp.areatable then
21-
return
22-
end
23-
for a, b in pairs(mmp.areatable) do
24-
local roomList = getAreaRooms(b) or {}
25-
for c, d in pairs(roomList) do
26-
if getRoomName(d) == "" then
27-
local fgr, fgg, fgb = unpack(color_table.red)
28-
local bgr, bgg, bgb = unpack(color_table.blue)
29-
highlightRoom(d, fgr, fgg, fgb, bgr, bgg, bgb, 1, 100, 100)
30-
end
31-
end
32-
end
20+
if not mmp.areatable then
21+
return
22+
end
23+
for a, b in pairs(mmp.areatable) do
24+
local roomList = getAreaRooms(b) or {}
25+
for c, d in pairs(roomList) do
26+
if getRoomName(d) == "" then
27+
local fgr, fgg, fgb = unpack(color_table.red)
28+
local bgr, bgg, bgb = unpack(color_table.blue)
29+
highlightRoom(d, fgr, fgg, fgb, bgr, bgg, bgb, 1, 100, 100)
30+
end
31+
end
32+
end
3333
end
3434

3535
-- GoMud-specific utility functions can be added here

src/scripts/GoMud_Mapper.lua

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/scripts/scripts.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"name": "GoMudMapper",
44
"isActive": "yes",
5-
"script": "",
5+
"script": "mudlet = mudlet or {};mudlet.mapper_script = true;mmp = mmp or {}",
66
"isFolder": "yes"
77
}
88
]

0 commit comments

Comments
 (0)