NickWildish / Mas-NSFW-Submod

A submod dedicated to bring you and Monika THAT much closer. How close you ask? Like, THIS close 🤏
51 stars 90 forks source link

Bug - Double time check for Monika sexting inits? #139

Open SaltyMelonLord opened 1 year ago

SaltyMelonLord commented 1 year ago

While looking for the error that prevents Monika from initiating a sexting session, I noticed something else in nsfw_sexting_inits.rpy:

You have in your conditions that the event cannot trigger unless the time determined by persistent._nsfw_monika_sexting_frequency has passed:

conditional=(
                "mas_nsfw.can_monika_init_sext('nsfw_monika_sextingsession') "
                "and mas_timePastSince(persistent._nsfw_sexting_last_sexted, datetime.timedelta(hours=persistent._nsfw_monika_sexting_frequency * 12)) "
                "and mas_timePastSince(mas_getEVL_last_seen('nsfw_monika_sextingsession'), datetime.timedelta(hours=persistent._nsfw_monika_sexting_frequency * 12))"
                ),

However, a few lines below, there is another check if she has waited:

python:
        has_waited = ( # Checks if Monika has waited the correct amount of time to attempt to sext with the player
            persistent._nsfw_sexting_attempts >= persistent._nsfw_monika_sexting_frequency
            and persistent._nsfw_sexting_attempts % persistent._nsfw_monika_sexting_frequency == 0
            )

Obviously this serves to determine whether she will actually attempt to start a sexting session or just announce it. The problem I see here however is that if you set the cooldown to 24 hours (frequency = 2), she cannot actually start a sexting session every 24 hours but only every 48 hours because the event can still trigger only at least 24 hours after the player has seen it for the last time, but every time the attempt counter has an odd value, she will just make the announcement rather than trying to start a session. This somehow defies both the description and the player’s expectations.

One possible solution for this would be to remove the persistent._nsfw_monika_sexting_frequency from the third event condition and just use the base value to determine the time that must have passed after the event was triggered last time:

conditional=(
                "mas_nsfw.can_monika_init_sext('nsfw_monika_sextingsession') "
                "and mas_timePastSince(persistent._nsfw_sexting_last_sexted, datetime.timedelta(hours=persistent._nsfw_monika_sexting_frequency * 12)) "
                "and mas_timePastSince(mas_getEVL_last_seen('nsfw_monika_sextingsession'), datetime.timedelta(hours=12))"
                ),

With that, the event can trigger every 12 hours (if at least 12 or 24 hours have passed since the last sexting session) but Monika can only attempt to start a session once in 24 hours if the cooldown has been set to that value.

NickWildish commented 1 year ago

Now that I'm looking closer at it, I'm thinking that two of the three conditionals in the event are identical, and only one is needed, I may as well remove one and see if it still functions.

Legit, one checks if it has been (12 frequency) hours since the sexting event occurred, and the other checks if it has been (12 frequency) hours since the player last saw the sexting event. Almost no point in having both.

Thanks for bringing this to my attention.

SaltyMelonLord commented 1 year ago

The two conditionals are not identical. The second is referring to the last time the player and Monika successfully sexted, the third is referring to the last time this event occured (Monika either asked if the player wants to sext or announced she might be in the mood later).

NickWildish commented 1 year ago

Ohhh, I misread 'monika_sexting' as 'player_sexting' and assumed it was referring to the same event as the second condition. I'll add that back.

SaltyMelonLord commented 1 year ago

Check out my updated pull request, I found the bug that made Monika never initiate sexting.