summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-09-05 02:41:02 +0200
committerAki <nthirtyone@gmail.com>2017-09-05 02:41:02 +0200
commit9fb64e49be5d991a0bf4bc1f6f162f40276ba2f5 (patch)
tree350b5b759b7c7efe098dd3b35828b1c80ce4b0a6
parent975e5663c09f0d74b2d0a18a7a5ce1297362a4a2 (diff)
downloadroflnauts-9fb64e49be5d991a0bf4bc1f6f162f40276ba2f5.zip
roflnauts-9fb64e49be5d991a0bf4bc1f6f162f40276ba2f5.tar.gz
roflnauts-9fb64e49be5d991a0bf4bc1f6f162f40276ba2f5.tar.bz2
Disallow nauts duplicates and empty as selection
-rw-r--r--config/menus/select.lua18
1 files changed, 16 insertions, 2 deletions
diff --git a/config/menus/select.lua b/config/menus/select.lua
index 2341556..0540bd5 100644
--- a/config/menus/select.lua
+++ b/config/menus/select.lua
@@ -16,8 +16,6 @@ end
-- TODO: Temporary group for naut selectors. This isn't production code at any means!
-- TODO: New nauts selector is missing random rolling!
--- TODO: New nauts selector allows empty naut as selection!
--- TODO: New nauts selector allows non-unique selections within groups!
local group, get
do
local atlas = love.graphics.newImage("assets/portraits.png")
@@ -29,10 +27,26 @@ do
group = Group(menu)
+ local
+ function attack (self)
+ if not self.lock then
+ if self.index == 1 then
+ return
+ end
+ if self.index == 2 then
+ return -- roll random, soon.
+ end
+ if self:isUnique() then
+ self.lock = true
+ end
+ end
+ end
+
for i,_ in pairs(Controller.getSets()) do
group:addChild(Selector(nauts, group, menu))
:set("icons_atlas", atlas)
:set("icons_quads", icons)
+ :set("attack", attack)
end
group:set("margin", 16)