/traderous

To get this branch, use:
bzr branch http://9ix.org/bzr/traderous

« back to all changes in this revision

Viewing changes to trade_view.lua

  • Committer: Josh C
  • Date: 2013-06-16 03:53:05 UTC
  • Revision ID: josh@9ix.org-20130616035305-33ca39wd4q3q4v13
bullets don't go through planets

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 
164
134
              self.playerMoney = Text:new{
165
135
                 text = 'Your money: ',
166
136
                 width = 200,
169
139
              }
170
140
              self:add(self.playerMoney)
171
141
 
172
 
              self.availSpace = Text:new{
173
 
                 text = 'Available cargo space: ',
174
 
                 width = 200,
175
 
                 x = boxL + 10,
176
 
                 y = boxB - 2 * th - 12
177
 
              }
178
 
              self:add(self.availSpace)
179
 
 
180
 
              if the.player.kills > 0 then
181
 
                 local award = the.player.kills * 100
182
 
                 self:add(Text:new{
183
 
                             text = 'You have been awarded ' ..
184
 
                                award ..
185
 
                                ' credits for killing bandits.',
186
 
                             width = 450,
187
 
                             align = 'center',
188
 
                             x = boxL,
189
 
                             y = boxB - 4 * th - 12
190
 
                          })
191
 
 
192
 
                 the.player.money = the.player.money + award
193
 
                 the.player.kills = 0
194
 
              end
195
 
 
196
142
              -- give the buttons a cycle to get out of the T/L corner
197
143
              self:update(0)
198
144
           end,
205
151
                 Subview.activate(self)
206
152
              end,
207
153
   close = function (self)
208
 
              the.player:save()
209
 
 
210
154
              the.cursor.visible = true
211
155
              love.mouse.setVisible(false)
212
156
              love.mouse.setGrab(true)
220
164
                 end
221
165
 
222
166
                 self.playerMoney.text = 'Your money: ' .. the.player.money
223
 
                 self.availSpace.text = 'Available cargo space: ' .. the.player:availableSpace()
224
167
 
225
168
                 for good, have in pairs(self.have) do
226
169
                    have.text = the.player.goods[good] or 0