Some gadgets contain hardcoded unitnames or weaponnames, which is an issue for moddability
Here is the list of some gadgets that I found that contain hardcoded unitnames or weaponnames. The list is not complete, as I mostly looked at unit_ and weapon_ gadgets, and could miss some.
- weapon_projectile_hold.lua - L27-L34 - some hardcoded weaponnames. Could be turned to customParams. (can be skipped for now because gadget is not enabled)
- weapon_projectile_retarget.lua - L39-L90 - some configs for weapons. Could be moved to config file.
- game_over.lua - L86-L103 - list of units that do not count for game over condition. Could use existing dontcount customParam or add new customParam for units that should count only in campaign.
- factory_anti_slacker.lua - L26-L31 - the list of factories that don't eject produced units. Could be turned to customParam.
- awards.lua - L92-L121 - list of statics that are excluded from Turtle Shell award, or give Apocalyptic award. Could be turned to customParam or moved to config file.
- unit_start_state.lua hardcodes factories and their plate.
I may look into some, but also fell free to fix any of these :)
Points 1, 2, 3, 4, 5, 7 fixed in PR #4536.
Point 6 fixed in PR #4542.
Point 13 fixed by Sprung in commit https://github.com/ZeroK-RTS/Zero-K/commit/065dbc94e796ce3caad52b4517adc0dfbebaca74
Point 8 fixed in PR #4543.
I think the ticks should be for pulled PRs rather than open ones.
I think the ticks should be for pulled PRs rather than open ones.
They are. I am not ticking them until given PR is merged. Just posting links to PRs here so that someone doesn't accidentally start fixing something simultanously.
Points 10 and 12 fixed in PR #4546.
How did you perform the check? There are more, for example https://github.com/ZeroK-RTS/Zero-K/blob/master/LuaRules/Gadgets/unit_starlight_handler.lua#L29-L30
Yeah I didn't look for units with non-standard names. I mostly searched for strings prefixed with amph..., hover... (for all mobile unit types including stuff like bomber..., drone..., sub...), and then for statics (static..., energy..., plate..., turret... etc.). I skipped some I found not worth fixing or that don't need fixing for me. (like the hardcoded windgen in some OD places)
Would anything be missed by grepping for UnitDefNames?
Or better, UnitDefNames[".
That doesn't find things like
local udn = UnitDefNames
local rockoDefID = udn.rocko.id
Because things like these are too evil to find. Once I get through the current batch I may try finding some more.
Points 14, 15, 18, 19, 22, 23 fixed in PR #4549.
Point 17 fixed in PR #4557. Point 20 fixed in PR #4558.
Point 11 fixed in PR #4930.