From 04527c097219451c07a6183104ab4c97e7ae69a4 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 3 Feb 2025 04:27:57 -0800 Subject: [PATCH] add stub gui/spectate --- docs/gui/spectate.rst | 16 ++++++++++++++++ gui/spectate.lua | 31 +++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 docs/gui/spectate.rst create mode 100644 gui/spectate.lua diff --git a/docs/gui/spectate.rst b/docs/gui/spectate.rst new file mode 100644 index 0000000000..e6034cbf80 --- /dev/null +++ b/docs/gui/spectate.rst @@ -0,0 +1,16 @@ +gui/spectate +============ + +.. dfhack-tool:: + :summary: Automated spectator mode. + :tags: fort inspection interface + +This is an in-game configuration interface for `spectate`, which automatically +sets the camera to follow interesting units. + +Usage +----- + +:: + + gui/spectate diff --git a/gui/spectate.lua b/gui/spectate.lua new file mode 100644 index 0000000000..4cea75855d --- /dev/null +++ b/gui/spectate.lua @@ -0,0 +1,31 @@ +local gui = require('gui') +local spectate = require('plugins.spectate') +local widgets = require('gui.widgets') + +Spectate = defclass(Spectate, widgets.Window) +Spectate.ATTRS { + frame_title='Spectate', + frame={w=50, h=45}, + resizable=true, + resize_min={w=50, h=20}, +} + +function Spectate:init() + self:addviews{ + } +end + +SpectateScreen = defclass(SpectateScreen, gui.ZScreen) +SpectateScreen.ATTRS { + focus_path='spectate', +} + +function SpectateScreen:init() + self:addviews{Spectate{}} +end + +function SpectateScreen:onDismiss() + view = nil +end + +view = view and view:raise() or SpectateScreen{}:show()