Allow specific custom achievements to be disabled by mod scripts

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
Solinya
Long Handed Inserter
Long Handed Inserter
Posts: 79
Joined: Sun Mar 17, 2019 10:39 pm
Contact:

Allow specific custom achievements to be disabled by mod scripts

Post by Solinya »

We're able to implement our own custom achievements with conditions beyond the built-in types through the player.unlock_achievement() method, which lets us use scripting to craft reward conditions. However, we can't [easily] implement scriptable achievements with restrictions. Or rather, while script logic can check against failure conditions and not unlock the achievement, there's not a simple way to reflect an achievement has been failed in the UI the way that "don't use solar" or "lazy bastard" update to show a game is no longer eligible to earn them.

The closest hack I've figured out is to derive from DontUseEntityInEnergyProductionAchievement, build a hidden power source, power sink, and power pole when the failure condition is met, and use that energy generation to trip the achievement failure condition. But this isn't ideal because it might mess with the electricity graph. And I'm not sure if it can be restricted to the player level, it might just impact the whole team.

It would be nice if there was an optional property either on the achievement prototype or a new subclass that had a flag we could set via script to indicate an achievement should be marked as no longer obtainable for that game. Then it'd be a simple matter of just setting that boolean whenever players fail the achievement's constraints, and we could have missable achievements beyond simply restricting what can be built in the base.

Post Reply

Return to “Modding interface requests”