diff options
| author | Alexander Gavrilov | 2012-09-06 12:37:29 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-09-06 12:37:29 +0400 |
| commit | d5ea05ebb88b40483b62aaf5dfe20e1b24e8a28a (patch) | |
| tree | d900522e6e8599029f5534e34fb744f0a595bb09 /library/lua | |
| parent | 8d876cc7d92faf1616d914e03c890772256ebb83 (diff) | |
| download | dfhack-d5ea05ebb88b40483b62aaf5dfe20e1b24e8a28a.tar.gz dfhack-d5ea05ebb88b40483b62aaf5dfe20e1b24e8a28a.tar.bz2 dfhack-d5ea05ebb88b40483b62aaf5dfe20e1b24e8a28a.tar.xz | |
Implement a pressure plate sensitive to machine power.
When built next to a gearbox, it will monitor its powered state.
Diffstat (limited to 'library/lua')
| -rw-r--r-- | library/lua/dfhack.lua | 2 | ||||
| -rw-r--r-- | library/lua/gui.lua | 8 | ||||
| -rw-r--r-- | library/lua/gui/dialogs.lua | 6 |
3 files changed, 7 insertions, 9 deletions
diff --git a/library/lua/dfhack.lua b/library/lua/dfhack.lua index a1e89976..e96bb0f4 100644 --- a/library/lua/dfhack.lua +++ b/library/lua/dfhack.lua @@ -84,7 +84,7 @@ function mkmodule(module,env) error("Not a table in package.loaded["..module.."]") end end - local plugname = string.match(module,'^plugins%.(%w+)$') + local plugname = string.match(module,'^plugins%.([%w%-]+)$') if plugname then dfhack.open_plugin(pkg,plugname) end diff --git a/library/lua/gui.lua b/library/lua/gui.lua index 23904c14..f9b6ab6d 100644 --- a/library/lua/gui.lua +++ b/library/lua/gui.lua @@ -162,10 +162,10 @@ function Painter:fill(x1,y1,x2,y2,pen,bg,bold) if type(x1) == 'table' then x1, y1, x2, y2, pen, bg, bold = x1.x1, x1.y1, x1.x2, x1.y2, y1, x2, y2 end - x1 = math.max(x1,self.clip_x1) - y1 = math.max(y1,self.clip_y1) - x2 = math.min(x2,self.clip_x2) - y2 = math.min(y2,self.clip_y2) + x1 = math.max(x1+self.x1,self.clip_x1) + y1 = math.max(y1+self.y1,self.clip_y1) + x2 = math.min(x2+self.x1,self.clip_x2) + y2 = math.min(y2+self.y1,self.clip_y2) dscreen.fillRect(to_pen(self.cur_pen,pen,bg,bold),x1,y1,x2,y2) return self end diff --git a/library/lua/gui/dialogs.lua b/library/lua/gui/dialogs.lua index 35720f87..c4f15c9a 100644 --- a/library/lua/gui/dialogs.lua +++ b/library/lua/gui/dialogs.lua @@ -127,7 +127,7 @@ function InputBox:onRenderBody(dc) dc:newline(1) dc:pen(self.input_pen or COLOR_LIGHTCYAN) - dc:fill(dc.x1+1,dc.y,dc.x2-1,dc.y) + dc:fill(1,dc:localY(),dc.width-2,dc:localY()) local cursor = '_' if math.floor(dfhack.getTickCount()/300) % 2 == 0 then @@ -135,9 +135,7 @@ function InputBox:onRenderBody(dc) end local txt = self.input .. cursor if #txt > dc.width-2 then - txt = string.sub(txt, #txt-dc.width+3) - -- Add prefix arrow - dc:advance(-1):char(27) + txt = string.char(27)..string.sub(txt, #txt-dc.width+4) end dc:string(txt) end |
