Unify controller type access.
Posted: Sat Nov 03, 2018 11:07 am
What?
Free mod(der)s of the burden of having to care too much about controller types for standard tasks.
Details
With the advent of defines.controllers.editor(?) in 0.17 and the possibility for any player to switch at a moments notice, i was wondering what this implies for mods. Does an editor still have an inventory? A character? Character bonusses? How many additional checks do i have to add just to not cause an error the second a player switches to being an editor?
Most mods are already written for freeplay, and it is quite easy to create bugs when missing some speciality of the god controller. The most common examples are probably character_x_y_bonus, which will instantly error. Other things like god.get_inventory(defines.inventory.player_quickbar) fail more subtly, as you still get an inventory back, just not the right one. The lack of character_x_y_bonus on the god controller also means that many mods simply can not work at all when force-wide bonuses would be inappropriate.
I know freeplay is the "recommended" mode of play, but i'd still like my mods to work in all modes without needing 4-way case-switches everywhere.
Free mod(der)s of the burden of having to care too much about controller types for standard tasks.
Details
With the advent of defines.controllers.editor(?) in 0.17 and the possibility for any player to switch at a moments notice, i was wondering what this implies for mods. Does an editor still have an inventory? A character? Character bonusses? How many additional checks do i have to add just to not cause an error the second a player switches to being an editor?
Most mods are already written for freeplay, and it is quite easy to create bugs when missing some speciality of the god controller. The most common examples are probably character_x_y_bonus, which will instantly error. Other things like god.get_inventory(defines.inventory.player_quickbar) fail more subtly, as you still get an inventory back, just not the right one. The lack of character_x_y_bonus on the god controller also means that many mods simply can not work at all when force-wide bonuses would be inappropriate.
I know freeplay is the "recommended" mode of play, but i'd still like my mods to work in all modes without needing 4-way case-switches everywhere.