/traderous

To get this branch, use:
bzr branch /bzr/traderous

« back to all changes in this revision

Viewing changes to trade_view.lua

  • Committer: Josh C
  • Date: 2013-06-23 03:10:51 UTC
  • Revision ID: josh@9ix.org-20130623031051-3142chix333jkmqi
pay to fix shield

Show diffs side-by-side

added added

removed removed

131
131
 
132
132
              self:add(b)
133
133
 
 
134
              local sh = the.player.shield
 
135
              local cost = (sh.max - sh.strength) * sh.cost
 
136
              b = Button:new{
 
137
                 x = boxL, y = boxT,
 
138
                 width = 800,
 
139
                 -- WTF: trailing space makes it not wrap?
 
140
                 label = Text:new{ text = 'Repair shields (' .. cost .. ') ',
 
141
                                   x = 3, y = 2 },
 
142
                 onMouseDown = function(self)
 
143
                                  if the.player.money >= cost and sh.strength < sh.max then
 
144
                                     the.player.money = the.player.money - cost
 
145
                                     sh.strength = sh.max
 
146
                                     self.visible = false
 
147
                                  end
 
148
                               end
 
149
              }
 
150
 
 
151
              local tw, th = b.label:getSize()
 
152
              b.background = Fill:new{
 
153
                 fill = {100,100,100},
 
154
                 width = tw + 3,
 
155
                 height = th + 4
 
156
              }
 
157
              b.x = boxR - b.background.width - 60
 
158
              b.y = boxB - b.background.height - 10
 
159
 
 
160
              if sh.strength < sh.max then
 
161
                 self:add(b)
 
162
              end
 
163
 
134
164
              self.playerMoney = Text:new{
135
165
                 text = 'Your money: ',
136
166
                 width = 200,