From 488a913cd99e865c18889f9602f68ff57e3e7bdb Mon Sep 17 00:00:00 2001 From: Ronja Date: Sat, 19 Sep 2020 09:17:15 +0200 Subject: [PATCH] always tick tooltip :/ also get the resources stuff back into a each after understanding what happened --- Luxe/blocks/resources.wren | 9 +++++++-- Luxe/blocks/tooltip.wren | 2 +- Luxe/game.wren | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Luxe/blocks/resources.wren b/Luxe/blocks/resources.wren index d2bda09..3342ee8 100644 --- a/Luxe/blocks/resources.wren +++ b/Luxe/blocks/resources.wren @@ -17,9 +17,14 @@ class Resources is Observable{ var list = _nameList.map{ |res| {"name": res, "amount": _resources[res["name"]]}}.//<-- butt dot! //filter out the ones without an amount where{ |res| res["amount"] }. + toList //toList makes the each work ^^ otherwise the result sequence runs map twice //get correct name and respect plural rules //also this is its own line because each returns void >.> - map{ |res| {"name": res["amount"] != 1 && !res["name"]["alwaysSingular"] ? StringUtil.plural(res["name"]["name"]) : res["name"]["name"], - "amount": res["amount"] }} + list.each{ |res| + var name = res["name"]["name"] + var singular = res["amount"] == 1 || res["name"]["alwaysSingular"] + res["name"] = singular ? name : StringUtil.plural(name) + } + return list } diff --git a/Luxe/blocks/tooltip.wren b/Luxe/blocks/tooltip.wren index 55991de..e7c157d 100644 --- a/Luxe/blocks/tooltip.wren +++ b/Luxe/blocks/tooltip.wren @@ -35,7 +35,7 @@ class Tooltip{ tick(){ var pos = Vector.new(Globals["UiMouse"]) - if(_active && pos){ + if(pos){ if(_x){ pos.x = _x } diff --git a/Luxe/game.wren b/Luxe/game.wren index c6d76fd..ecca897 100644 --- a/Luxe/game.wren +++ b/Luxe/game.wren @@ -58,9 +58,9 @@ class Game is Ready { } DrawDebug.commit() + _tooltip.tick() app.tick(delta) - _tooltip.tick() //important to tick after systems to not have a 1 frame lag after setting text } //tick destroy() {