{"action":"created","issue":{"url":"https://api.github.com/repos/FAForever/fa/issues/1462","repository_url":"https://api.github.com/repos/FAForever/fa","labels_url":"https://api.github.com/repos/FAForever/fa/issues/1462/labels{/name}","comments_url":"https://api.github.com/repos/FAForever/fa/issues/1462/comments","events_url":"https://api.github.com/repos/FAForever/fa/issues/1462/events","html_url":"https://github.com/FAForever/fa/issues/1462","id":174160761,"number":1462,"title":"New approach to Selens","user":{"login":"aeoncleanse","id":8494967,"avatar_url":"https://avatars.githubusercontent.com/u/8494967?v=3","gravatar_id":"","url":"https://api.github.com/users/aeoncleanse","html_url":"https://github.com/aeoncleanse","followers_url":"https://api.github.com/users/aeoncleanse/followers","following_url":"https://api.github.com/users/aeoncleanse/following{/other_user}","gists_url":"https://api.github.com/users/aeoncleanse/gists{/gist_id}","starred_url":"https://api.github.com/users/aeoncleanse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aeoncleanse/subscriptions","organizations_url":"https://api.github.com/users/aeoncleanse/orgs","repos_url":"https://api.github.com/users/aeoncleanse/repos","events_url":"https://api.github.com/users/aeoncleanse/events{/privacy}","received_events_url":"https://api.github.com/users/aeoncleanse/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-08-31T00:59:02Z","updated_at":"2016-09-05T11:16:29Z","closed_at":null,"body":"Needing to rethink some approach, I find myself re-visiting a wall I ran into a month ago. So my question is this:\r\n\r\nHow can I get self.HiddenSelen set inside a unit script to show up as non-nil in gamemain.lua, and accessible as part of the following function:\r\n\r\n`-- Function to remove hidden selens from a selection which includes units other than hidden selens\r\nfunction DeselectSelens(selection)\r\n    local hiddenSelens = false\r\n    local otherUnits = false\r\n\r\n    -- Find any selens with the hidden flag\r\n    for id, unit in selection do\r\n        -- Stupid-ass UnitData table uses string numbers as keys. Because reasons?\r\n        if unit:IsInCategory(\"xsl0101\") and unit:IsIdle() and GetFireState({unit}) == 1 then -- Is Unit an activated Selen?\r\n            WARN('Selected a selen')\r\n            WARN(unit.HiddenSelen)\r\n            hiddenSelens = true\r\n        else\r\n            if not otherUnits then otherUnits = {} end -- Ugly hack to make later logic easier\r\n            table.insert(otherUnits, unit)\r\n        end\r\n    end\r\n\r\n    -- Return original selection with no-change key if nothing has changed\r\n    if (otherUnits and not hiddenSelens) or (not otherUnits and hiddenSelens) then\r\n        return selection, false\r\n    end\r\n\r\n    return otherUnits, true\r\nend`\r\n\r\nI know there's some way to do some things and make this value sync from sim into user, but what. @Crotalus @duk3luk3 @Uveso any ideas?"},"comment":{"url":"https://api.github.com/repos/FAForever/fa/issues/comments/244722820","html_url":"https://github.com/FAForever/fa/issues/1462#issuecomment-244722820","issue_url":"https://api.github.com/repos/FAForever/fa/issues/1462","id":244722820,"user":{"login":"Crotalus","id":254972,"avatar_url":"https://avatars.githubusercontent.com/u/254972?v=3","gravatar_id":"","url":"https://api.github.com/users/Crotalus","html_url":"https://github.com/Crotalus","followers_url":"https://api.github.com/users/Crotalus/followers","following_url":"https://api.github.com/users/Crotalus/following{/other_user}","gists_url":"https://api.github.com/users/Crotalus/gists{/gist_id}","starred_url":"https://api.github.com/users/Crotalus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Crotalus/subscriptions","organizations_url":"https://api.github.com/users/Crotalus/orgs","repos_url":"https://api.github.com/users/Crotalus/repos","events_url":"https://api.github.com/users/Crotalus/events{/privacy}","received_events_url":"https://api.github.com/users/Crotalus/received_events","type":"User","site_admin":false},"created_at":"2016-09-05T11:16:29Z","updated_at":"2016-09-05T11:16:29Z","body":"Try:\r\n```\r\nWARN(UnitData[unit:GetEntityId()].HiddenSelen)\r\n```\r\n\r\nGetUnitId() returns the bp-id white GetEntityId() gets the unique id for the unit"}}
{"actor":{"display_login":"Crotalus"}}