Skip to content

Fix: Starting items not marked as forbidden#575

Merged
notfood merged 1 commit intorwmt:devfrom
SirrWilliam:dev-1.6-forbiddenFix
Jul 18, 2025
Merged

Fix: Starting items not marked as forbidden#575
notfood merged 1 commit intorwmt:devfrom
SirrWilliam:dev-1.6-forbiddenFix

Conversation

@SirrWilliam
Copy link

Fix for #574

I think I found the cause, but I don't know why it didn't cause this problem before. (RimWorld 1.5)
All Things were being added to the unforbidden list, whether they were forbidden or not.
Forbiddables.cs

    [HarmonyPatch(typeof(Thing), nameof(Thing.SpawnSetup))]
    static class ThingSpawnSetForbidden
    {
        static void Prefix(Thing __instance, Map map, bool respawningAfterLoad)
        {
            if (respawningAfterLoad) return;
            if (Multiplayer.Client == null) return;

            if (ThingContext.stack.Any(p => p.Item1?.def == ThingDefOf.ActiveDropPod)) return;

            if (__instance is ThingWithComps t && t.GetComp<CompForbiddable>() != null)
                map.MpComp().GetCurrentCustomFactionData().unforbidden.Add(__instance);
        }
    }

Adding !t.GetComp<CompForbiddable>().forbiddenInt to this if statement solved the problem.

 if (__instance is ThingWithComps t && t.GetComp<CompForbiddable>() != null)

I tested it on Reznal's fork because it's much more stable :D. I didn't encounter any issues.

@notfood notfood changed the title Fix for #574 Fix: Starting items not marked as forbidden Jul 18, 2025
@notfood notfood added fix Fixes for a bug or desync. 1.6 Fixes or bugs relating to 1.6 (Not Odyssey). labels Jul 18, 2025
@notfood notfood moved this to Ready in 1.6 and Odyssey Jul 18, 2025
@notfood notfood merged commit 041086a into rwmt:dev Jul 18, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from Ready to Done in 1.6 and Odyssey Jul 18, 2025
@SirrWilliam SirrWilliam deleted the dev-1.6-forbiddenFix branch July 18, 2025 06:34
Tick-git added a commit to Tick-git/Multiplayer that referenced this pull request Jul 20, 2025
Removing obsolete workaround because it is implemented correctly by rwmt#575
notfood pushed a commit that referenced this pull request Jul 20, 2025
Removing obsolete workaround because it is implemented correctly by #575
@notfood notfood moved this to In progress in Backports Jul 21, 2025
notfood pushed a commit that referenced this pull request Jul 21, 2025
All Things were being added to the unforbidden list, whether they were forbidden or not.
notfood pushed a commit that referenced this pull request Jul 21, 2025
Removing obsolete workaround because it is implemented correctly by #575
@notfood notfood moved this from In progress to Done in Backports Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.6 Fixes or bugs relating to 1.6 (Not Odyssey). fix Fixes for a bug or desync.

Projects

Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants