Zero-K icon indicating copy to clipboard operation
Zero-K copied to clipboard

Some gadgets contain hardcoded unitnames or weaponnames, which is an issue for moddability

Open CarabusX opened this issue 5 years ago • 16 comments

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 :)

CarabusX avatar Oct 06 '21 01:10 CarabusX

Points 1, 2, 3, 4, 5, 7 fixed in PR #4536.

CarabusX avatar Oct 06 '21 19:10 CarabusX

Point 6 fixed in PR #4542.

CarabusX avatar Oct 16 '21 23:10 CarabusX

Point 13 fixed by Sprung in commit https://github.com/ZeroK-RTS/Zero-K/commit/065dbc94e796ce3caad52b4517adc0dfbebaca74

CarabusX avatar Oct 17 '21 01:10 CarabusX

Point 8 fixed in PR #4543.

CarabusX avatar Oct 17 '21 02:10 CarabusX

I think the ticks should be for pulled PRs rather than open ones.

GoogleFrog avatar Oct 17 '21 02:10 GoogleFrog

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.

CarabusX avatar Oct 17 '21 04:10 CarabusX

Points 10 and 12 fixed in PR #4546.

CarabusX avatar Oct 17 '21 23:10 CarabusX

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

sprunk avatar Oct 18 '21 10:10 sprunk

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)

CarabusX avatar Oct 18 '21 12:10 CarabusX

Would anything be missed by grepping for UnitDefNames?

sprunk avatar Oct 18 '21 12:10 sprunk

Or better, UnitDefNames[".

GoogleFrog avatar Oct 18 '21 15:10 GoogleFrog

That doesn't find things like

local udn = UnitDefNames
local rockoDefID = udn.rocko.id

sprunk avatar Oct 18 '21 15:10 sprunk

Because things like these are too evil to find. Once I get through the current batch I may try finding some more.

CarabusX avatar Oct 18 '21 16:10 CarabusX

Points 14, 15, 18, 19, 22, 23 fixed in PR #4549.

CarabusX avatar Oct 18 '21 18:10 CarabusX

Point 17 fixed in PR #4557. Point 20 fixed in PR #4558.

CarabusX avatar Oct 23 '21 17:10 CarabusX

Point 11 fixed in PR #4930.

Mach565 avatar Jun 15 '23 01:06 Mach565