2026-05-01 19:45:45 -03:00
|
|
|
-- @Title: Spawn Visualizer
|
|
|
|
|
-- @Description: Draws spawn radius circles as an overlay on the map
|
|
|
|
|
-- @Author: VLL Systems
|
|
|
|
|
-- @Version: 1.0.0
|
|
|
|
|
-- @AutoRun: true
|
feat: add Lua API modules and Script Manager UI (#161)
This commit adds the full Lua scripting API and integrates the Script Manager into the application.
It builds on top of the scripting engine introduced in #158, exposing all the API modules that Lua scripts can use and making everything accessible from the UI.
Changes:
- Added all Lua API modules: map, tile, item, brush, image, position, selection, creature, color, app, dialog, noise, algo, geo, json, http.
- Added map overlay system for scripts to draw on the map view.
- Added event system, context menu registration, persistent storage, and transaction support with undo/redo.
- Added support for package scripts (directory with manifest.lua) and script metadata tags.
- Added Scripts menu to the menubar with per-script execution and reload.
- Connected the Script Manager window to the UI.
- Added missing build dependencies and fixed MSVC compilation errors.
Notes:
- Build dependencies were added for HTTP and noise generation support.
- Some code was adjusted to compile correctly on MSVC.
2026-03-28 19:15:57 -03:00
|
|
|
if not app.hasMap() then
|
2026-05-01 19:45:45 -03:00
|
|
|
return
|
feat: add Lua API modules and Script Manager UI (#161)
This commit adds the full Lua scripting API and integrates the Script Manager into the application.
It builds on top of the scripting engine introduced in #158, exposing all the API modules that Lua scripts can use and making everything accessible from the UI.
Changes:
- Added all Lua API modules: map, tile, item, brush, image, position, selection, creature, color, app, dialog, noise, algo, geo, json, http.
- Added map overlay system for scripts to draw on the map view.
- Added event system, context menu registration, persistent storage, and transaction support with undo/redo.
- Added support for package scripts (directory with manifest.lua) and script metadata tags.
- Added Scripts menu to the menubar with per-script execution and reload.
- Connected the Script Manager window to the UI.
- Added missing build dependencies and fixed MSVC compilation errors.
Notes:
- Build dependencies were added for HTTP and noise generation support.
- Some code was adjusted to compile correctly on MSVC.
2026-03-28 19:15:57 -03:00
|
|
|
end
|
|
|
|
|
|
2026-05-01 19:45:45 -03:00
|
|
|
-- Register the overlay
|
feat: add Lua API modules and Script Manager UI (#161)
This commit adds the full Lua scripting API and integrates the Script Manager into the application.
It builds on top of the scripting engine introduced in #158, exposing all the API modules that Lua scripts can use and making everything accessible from the UI.
Changes:
- Added all Lua API modules: map, tile, item, brush, image, position, selection, creature, color, app, dialog, noise, algo, geo, json, http.
- Added map overlay system for scripts to draw on the map view.
- Added event system, context menu registration, persistent storage, and transaction support with undo/redo.
- Added support for package scripts (directory with manifest.lua) and script metadata tags.
- Added Scripts menu to the menubar with per-script execution and reload.
- Connected the Script Manager window to the UI.
- Added missing build dependencies and fixed MSVC compilation errors.
Notes:
- Build dependencies were added for HTTP and noise generation support.
- Some code was adjusted to compile correctly on MSVC.
2026-03-28 19:15:57 -03:00
|
|
|
app.mapView.addOverlay("spawn_visualizer", {
|
2026-05-01 19:45:45 -03:00
|
|
|
enabled = true,
|
|
|
|
|
order = 10,
|
feat: add Lua API modules and Script Manager UI (#161)
This commit adds the full Lua scripting API and integrates the Script Manager into the application.
It builds on top of the scripting engine introduced in #158, exposing all the API modules that Lua scripts can use and making everything accessible from the UI.
Changes:
- Added all Lua API modules: map, tile, item, brush, image, position, selection, creature, color, app, dialog, noise, algo, geo, json, http.
- Added map overlay system for scripts to draw on the map view.
- Added event system, context menu registration, persistent storage, and transaction support with undo/redo.
- Added support for package scripts (directory with manifest.lua) and script metadata tags.
- Added Scripts menu to the menubar with per-script execution and reload.
- Connected the Script Manager window to the UI.
- Added missing build dependencies and fixed MSVC compilation errors.
Notes:
- Build dependencies were added for HTTP and noise generation support.
- Some code was adjusted to compile correctly on MSVC.
2026-03-28 19:15:57 -03:00
|
|
|
|
2026-05-01 19:45:45 -03:00
|
|
|
ondraw = function(ctx)
|
|
|
|
|
local view = ctx.view
|
|
|
|
|
local map = app.map
|
|
|
|
|
if not map then
|
|
|
|
|
return
|
|
|
|
|
end
|
feat: add Lua API modules and Script Manager UI (#161)
This commit adds the full Lua scripting API and integrates the Script Manager into the application.
It builds on top of the scripting engine introduced in #158, exposing all the API modules that Lua scripts can use and making everything accessible from the UI.
Changes:
- Added all Lua API modules: map, tile, item, brush, image, position, selection, creature, color, app, dialog, noise, algo, geo, json, http.
- Added map overlay system for scripts to draw on the map view.
- Added event system, context menu registration, persistent storage, and transaction support with undo/redo.
- Added support for package scripts (directory with manifest.lua) and script metadata tags.
- Added Scripts menu to the menubar with per-script execution and reload.
- Connected the Script Manager window to the UI.
- Added missing build dependencies and fixed MSVC compilation errors.
Notes:
- Build dependencies were added for HTTP and noise generation support.
- Some code was adjusted to compile correctly on MSVC.
2026-03-28 19:15:57 -03:00
|
|
|
|
2026-05-01 19:45:45 -03:00
|
|
|
local z = view.z
|
feat: add Lua API modules and Script Manager UI (#161)
This commit adds the full Lua scripting API and integrates the Script Manager into the application.
It builds on top of the scripting engine introduced in #158, exposing all the API modules that Lua scripts can use and making everything accessible from the UI.
Changes:
- Added all Lua API modules: map, tile, item, brush, image, position, selection, creature, color, app, dialog, noise, algo, geo, json, http.
- Added map overlay system for scripts to draw on the map view.
- Added event system, context menu registration, persistent storage, and transaction support with undo/redo.
- Added support for package scripts (directory with manifest.lua) and script metadata tags.
- Added Scripts menu to the menubar with per-script execution and reload.
- Connected the Script Manager window to the UI.
- Added missing build dependencies and fixed MSVC compilation errors.
Notes:
- Build dependencies were added for HTTP and noise generation support.
- Some code was adjusted to compile correctly on MSVC.
2026-03-28 19:15:57 -03:00
|
|
|
|
2026-05-01 19:45:45 -03:00
|
|
|
-- Scan visible area for spawns
|
|
|
|
|
for y = view.y1, view.y2 do
|
|
|
|
|
for x = view.x1, view.x2 do
|
|
|
|
|
local tile = map:getTile(x, y, z)
|
|
|
|
|
if tile and tile.hasSpawn then
|
|
|
|
|
local spawn = tile.spawn
|
|
|
|
|
local radius = spawn.size
|
feat: add Lua API modules and Script Manager UI (#161)
This commit adds the full Lua scripting API and integrates the Script Manager into the application.
It builds on top of the scripting engine introduced in #158, exposing all the API modules that Lua scripts can use and making everything accessible from the UI.
Changes:
- Added all Lua API modules: map, tile, item, brush, image, position, selection, creature, color, app, dialog, noise, algo, geo, json, http.
- Added map overlay system for scripts to draw on the map view.
- Added event system, context menu registration, persistent storage, and transaction support with undo/redo.
- Added support for package scripts (directory with manifest.lua) and script metadata tags.
- Added Scripts menu to the menubar with per-script execution and reload.
- Connected the Script Manager window to the UI.
- Added missing build dependencies and fixed MSVC compilation errors.
Notes:
- Build dependencies were added for HTTP and noise generation support.
- Some code was adjusted to compile correctly on MSVC.
2026-03-28 19:15:57 -03:00
|
|
|
|
2026-05-01 19:45:45 -03:00
|
|
|
-- Draw spawn radius as a rectangle outline (circle approximation)
|
|
|
|
|
ctx.rect({
|
|
|
|
|
x = x - radius,
|
|
|
|
|
y = y - radius,
|
|
|
|
|
z = z,
|
|
|
|
|
w = radius * 2 + 1,
|
|
|
|
|
h = radius * 2 + 1,
|
|
|
|
|
filled = false,
|
|
|
|
|
width = 1,
|
|
|
|
|
style = "dashed",
|
|
|
|
|
color = {
|
|
|
|
|
r = 255,
|
|
|
|
|
g = 100,
|
|
|
|
|
b = 100,
|
|
|
|
|
a = 140,
|
|
|
|
|
},
|
|
|
|
|
})
|
feat: add Lua API modules and Script Manager UI (#161)
This commit adds the full Lua scripting API and integrates the Script Manager into the application.
It builds on top of the scripting engine introduced in #158, exposing all the API modules that Lua scripts can use and making everything accessible from the UI.
Changes:
- Added all Lua API modules: map, tile, item, brush, image, position, selection, creature, color, app, dialog, noise, algo, geo, json, http.
- Added map overlay system for scripts to draw on the map view.
- Added event system, context menu registration, persistent storage, and transaction support with undo/redo.
- Added support for package scripts (directory with manifest.lua) and script metadata tags.
- Added Scripts menu to the menubar with per-script execution and reload.
- Connected the Script Manager window to the UI.
- Added missing build dependencies and fixed MSVC compilation errors.
Notes:
- Build dependencies were added for HTTP and noise generation support.
- Some code was adjusted to compile correctly on MSVC.
2026-03-28 19:15:57 -03:00
|
|
|
|
2026-05-01 19:45:45 -03:00
|
|
|
-- Draw center marker
|
|
|
|
|
ctx.rect({
|
|
|
|
|
x = x,
|
|
|
|
|
y = y,
|
|
|
|
|
z = z,
|
|
|
|
|
w = 1,
|
|
|
|
|
h = 1,
|
|
|
|
|
filled = true,
|
|
|
|
|
color = {
|
|
|
|
|
r = 255,
|
|
|
|
|
g = 50,
|
|
|
|
|
b = 50,
|
|
|
|
|
a = 180,
|
|
|
|
|
},
|
|
|
|
|
})
|
feat: add Lua API modules and Script Manager UI (#161)
This commit adds the full Lua scripting API and integrates the Script Manager into the application.
It builds on top of the scripting engine introduced in #158, exposing all the API modules that Lua scripts can use and making everything accessible from the UI.
Changes:
- Added all Lua API modules: map, tile, item, brush, image, position, selection, creature, color, app, dialog, noise, algo, geo, json, http.
- Added map overlay system for scripts to draw on the map view.
- Added event system, context menu registration, persistent storage, and transaction support with undo/redo.
- Added support for package scripts (directory with manifest.lua) and script metadata tags.
- Added Scripts menu to the menubar with per-script execution and reload.
- Connected the Script Manager window to the UI.
- Added missing build dependencies and fixed MSVC compilation errors.
Notes:
- Build dependencies were added for HTTP and noise generation support.
- Some code was adjusted to compile correctly on MSVC.
2026-03-28 19:15:57 -03:00
|
|
|
|
2026-05-01 19:45:45 -03:00
|
|
|
-- Draw creature name if present
|
|
|
|
|
if tile.hasCreature then
|
|
|
|
|
local creature = tile.creature
|
|
|
|
|
if creature then
|
|
|
|
|
ctx.text({
|
|
|
|
|
x = x,
|
|
|
|
|
y = y - 1,
|
|
|
|
|
z = z,
|
|
|
|
|
text = creature.name,
|
|
|
|
|
color = {
|
|
|
|
|
r = 255,
|
|
|
|
|
g = 200,
|
|
|
|
|
b = 200,
|
|
|
|
|
a = 220,
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end,
|
feat: add Lua API modules and Script Manager UI (#161)
This commit adds the full Lua scripting API and integrates the Script Manager into the application.
It builds on top of the scripting engine introduced in #158, exposing all the API modules that Lua scripts can use and making everything accessible from the UI.
Changes:
- Added all Lua API modules: map, tile, item, brush, image, position, selection, creature, color, app, dialog, noise, algo, geo, json, http.
- Added map overlay system for scripts to draw on the map view.
- Added event system, context menu registration, persistent storage, and transaction support with undo/redo.
- Added support for package scripts (directory with manifest.lua) and script metadata tags.
- Added Scripts menu to the menubar with per-script execution and reload.
- Connected the Script Manager window to the UI.
- Added missing build dependencies and fixed MSVC compilation errors.
Notes:
- Build dependencies were added for HTTP and noise generation support.
- Some code was adjusted to compile correctly on MSVC.
2026-03-28 19:15:57 -03:00
|
|
|
|
2026-05-01 19:45:45 -03:00
|
|
|
onhover = function(info)
|
|
|
|
|
local tile = info.tile
|
|
|
|
|
if not tile then
|
|
|
|
|
return nil
|
|
|
|
|
end
|
feat: add Lua API modules and Script Manager UI (#161)
This commit adds the full Lua scripting API and integrates the Script Manager into the application.
It builds on top of the scripting engine introduced in #158, exposing all the API modules that Lua scripts can use and making everything accessible from the UI.
Changes:
- Added all Lua API modules: map, tile, item, brush, image, position, selection, creature, color, app, dialog, noise, algo, geo, json, http.
- Added map overlay system for scripts to draw on the map view.
- Added event system, context menu registration, persistent storage, and transaction support with undo/redo.
- Added support for package scripts (directory with manifest.lua) and script metadata tags.
- Added Scripts menu to the menubar with per-script execution and reload.
- Connected the Script Manager window to the UI.
- Added missing build dependencies and fixed MSVC compilation errors.
Notes:
- Build dependencies were added for HTTP and noise generation support.
- Some code was adjusted to compile correctly on MSVC.
2026-03-28 19:15:57 -03:00
|
|
|
|
2026-05-01 19:45:45 -03:00
|
|
|
if tile.hasSpawn then
|
|
|
|
|
local spawn = tile.spawn
|
|
|
|
|
local text = "Spawn (radius: " .. spawn.size .. ")"
|
|
|
|
|
if tile.hasCreature then
|
|
|
|
|
local creature = tile.creature
|
|
|
|
|
text = text .. "\n" .. creature.name .. " (spawn: " .. creature.spawnTime .. "s)"
|
|
|
|
|
end
|
|
|
|
|
return {
|
|
|
|
|
tooltip = text,
|
|
|
|
|
highlight = {
|
|
|
|
|
x = tile.x - spawn.size,
|
|
|
|
|
y = tile.y - spawn.size,
|
|
|
|
|
z = tile.z,
|
|
|
|
|
w = spawn.size * 2 + 1,
|
|
|
|
|
h = spawn.size * 2 + 1,
|
|
|
|
|
filled = false,
|
|
|
|
|
width = 2,
|
|
|
|
|
color = {
|
|
|
|
|
r = 255,
|
|
|
|
|
g = 255,
|
|
|
|
|
b = 0,
|
|
|
|
|
a = 180,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
end
|
feat: add Lua API modules and Script Manager UI (#161)
This commit adds the full Lua scripting API and integrates the Script Manager into the application.
It builds on top of the scripting engine introduced in #158, exposing all the API modules that Lua scripts can use and making everything accessible from the UI.
Changes:
- Added all Lua API modules: map, tile, item, brush, image, position, selection, creature, color, app, dialog, noise, algo, geo, json, http.
- Added map overlay system for scripts to draw on the map view.
- Added event system, context menu registration, persistent storage, and transaction support with undo/redo.
- Added support for package scripts (directory with manifest.lua) and script metadata tags.
- Added Scripts menu to the menubar with per-script execution and reload.
- Connected the Script Manager window to the UI.
- Added missing build dependencies and fixed MSVC compilation errors.
Notes:
- Build dependencies were added for HTTP and noise generation support.
- Some code was adjusted to compile correctly on MSVC.
2026-03-28 19:15:57 -03:00
|
|
|
|
2026-05-01 19:45:45 -03:00
|
|
|
return nil
|
|
|
|
|
end,
|
feat: add Lua API modules and Script Manager UI (#161)
This commit adds the full Lua scripting API and integrates the Script Manager into the application.
It builds on top of the scripting engine introduced in #158, exposing all the API modules that Lua scripts can use and making everything accessible from the UI.
Changes:
- Added all Lua API modules: map, tile, item, brush, image, position, selection, creature, color, app, dialog, noise, algo, geo, json, http.
- Added map overlay system for scripts to draw on the map view.
- Added event system, context menu registration, persistent storage, and transaction support with undo/redo.
- Added support for package scripts (directory with manifest.lua) and script metadata tags.
- Added Scripts menu to the menubar with per-script execution and reload.
- Connected the Script Manager window to the UI.
- Added missing build dependencies and fixed MSVC compilation errors.
Notes:
- Build dependencies were added for HTTP and noise generation support.
- Some code was adjusted to compile correctly on MSVC.
2026-03-28 19:15:57 -03:00
|
|
|
})
|
|
|
|
|
|
2026-05-01 19:45:45 -03:00
|
|
|
-- Register toggle in View menu
|
feat: add Lua API modules and Script Manager UI (#161)
This commit adds the full Lua scripting API and integrates the Script Manager into the application.
It builds on top of the scripting engine introduced in #158, exposing all the API modules that Lua scripts can use and making everything accessible from the UI.
Changes:
- Added all Lua API modules: map, tile, item, brush, image, position, selection, creature, color, app, dialog, noise, algo, geo, json, http.
- Added map overlay system for scripts to draw on the map view.
- Added event system, context menu registration, persistent storage, and transaction support with undo/redo.
- Added support for package scripts (directory with manifest.lua) and script metadata tags.
- Added Scripts menu to the menubar with per-script execution and reload.
- Connected the Script Manager window to the UI.
- Added missing build dependencies and fixed MSVC compilation errors.
Notes:
- Build dependencies were added for HTTP and noise generation support.
- Some code was adjusted to compile correctly on MSVC.
2026-03-28 19:15:57 -03:00
|
|
|
app.mapView.registerShow("Spawn Radius Overlay", "spawn_visualizer", {
|
2026-05-01 19:45:45 -03:00
|
|
|
enabled = true,
|
feat: add Lua API modules and Script Manager UI (#161)
This commit adds the full Lua scripting API and integrates the Script Manager into the application.
It builds on top of the scripting engine introduced in #158, exposing all the API modules that Lua scripts can use and making everything accessible from the UI.
Changes:
- Added all Lua API modules: map, tile, item, brush, image, position, selection, creature, color, app, dialog, noise, algo, geo, json, http.
- Added map overlay system for scripts to draw on the map view.
- Added event system, context menu registration, persistent storage, and transaction support with undo/redo.
- Added support for package scripts (directory with manifest.lua) and script metadata tags.
- Added Scripts menu to the menubar with per-script execution and reload.
- Connected the Script Manager window to the UI.
- Added missing build dependencies and fixed MSVC compilation errors.
Notes:
- Build dependencies were added for HTTP and noise generation support.
- Some code was adjusted to compile correctly on MSVC.
2026-03-28 19:15:57 -03:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
print("[Spawn Visualizer] Overlay registered. Toggle via View menu.")
|