X2CommunityCore / X2WOTCCommunityHighlander

https://steamcommunity.com/workshop/filedetails/?id=1134256495
MIT License
60 stars 68 forks source link

Allow mods to control whether to grant the achievement for winning without extra squadsize #994

Closed cannonfodder1 closed 3 years ago

cannonfodder1 commented 3 years ago

The achievement "The Few and the Proud" requires the player to defeat the aliens on Commander or Legend difficulty without increasing their squad size. The evaluation logic in X2AchievementTracker checks specifically for the SquadSizeIUnlock and SquadSizeIIUnlock GTS upgrades. This can present a bit of a problem if mods remove these upgrades or add alternate methods to increase squad size. An event trigger with passed tuple should be added to X2AchievementTracker, so mods can override the default behaviour.

Iridar commented 3 years ago

I don't think this a concern, arguably attachments shouldn't even be allowed with mods.

Xymanek commented 3 years ago

arguably attachments shouldn't even be allowed with mods

I assume you meant achievements and IMO since FXS didn't introduce any such restriction it's not up to us to do so. Besides, I think that as long as the game isn't different to the point where it's unrecognizable, it's fine to keep the achievements

Iridar commented 3 years ago

Derp, achievements, yes. I don't really care about achievements either way, but I don't see a reason to bloat the codebase with features just for their sake, particularly when it's seemingly an "all or nothing" issue, seems like a slippery slope.

Xymanek commented 3 years ago

To be blunt - I do not share your concerns. Let's view it from a bit of a different angle: how should we handle the situation? Options:

Iridar commented 3 years ago

Fair enough, just wanted to say my piece.

robojumper commented 3 years ago

Is one event for a single achievement the right approach? One event could cover all achievement triggers here:

function UnlockAchievement(EAchievementType Type)
{
    DevOnlineMsg("UnlockAchievement: " $ AreAchievementsEnabled() $ ": " $ Type);

    if (AreAchievementsEnabled())
    {       
        OnlineSub.PlayerInterface.UnlockAchievement(LocalUserIndex, Type);
    }

    CheckGameProgress(Type);
}
Xymanek commented 3 years ago

I would be cautious against adding an event to XComOnlineEventMgr::UnlockAchievement due to register in strategy/tactical/etc situation - it would need to be a DLCInfo hook or a delegate in CHHelpers

cannonfodder1 commented 3 years ago

I could expand the event hook to cover everything in the FinalMissionOnSuccess() function. There are some others here that would be good to have control over, like “Who Needs Tygan?”

Xymanek commented 3 years ago

@cannonfodder1 robo's suggestion is about inserting a hook into the global "trigger achievement" function so that mods could filter each achievement trigger individually, to avoid the need to patch each trigger site individually

cannonfodder1 commented 3 years ago

@cannonfodder1 robo's suggestion is about inserting a hook into the global "trigger achievement" function so that mods could filter each achievement trigger individually, to avoid the need to patch each trigger site individually

I thought you said that was a bad idea but after reading your earlier comment more carefully I see you were just giving suggestions on how to do it better. I’ll get to to work on that

Xymanek commented 3 years ago

Yeah, I just meant that a hook like that would need to be either a DLCInfo or a CHHelpers delegate (see EHLDelegateReturn and onwards in CHHelpers)

Xymanek commented 3 years ago

So I thought about this for a while and I think it's best to leave the current implementation as-is. XComOnlineEventMgr::UnlockAchievement is a great idea in theory but in practice it has several issues:

As such, I think it's best to leave it at a specific trigger override, at least until we have an actionable use case for a wider implementation