From 9fb64e49be5d991a0bf4bc1f6f162f40276ba2f5 Mon Sep 17 00:00:00 2001 From: Aki Date: Tue, 5 Sep 2017 02:41:02 +0200 Subject: Disallow nauts duplicates and empty as selection --- config/menus/select.lua | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'config') 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) -- cgit v1.1