Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Commit

Permalink
Added PlaceWorker_DisabledByMeme
Browse files Browse the repository at this point in the history
  • Loading branch information
juanosarg committed May 14, 2022
1 parent d2710bd commit 82386ad
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
Binary file modified 1.3/Assemblies/VFECore.dll
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public class ExtendedMemeProperties : DefModExtension

//Used to make all members of the Ideoligion acquire a given ability
public List<AbilityDef> abilitiesGiven;

//Used to remove designators if meme is part of the primary ideo
public List<ThingDef> removedDesignators;
}

}
40 changes: 40 additions & 0 deletions Source/VFECore/Memes/PlaceWorkers/PlaceWorker_DisabledByMeme.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System.Collections.Generic;
using RimWorld;
using Verse;
namespace VanillaMemesExpanded
{
public class PlaceWorker_DisabledByMeme : PlaceWorker
{

public override bool IsBuildDesignatorVisible(BuildableDef def)
{
List<MemeDef> list = Current.Game?.World?.factionManager?.OfPlayer?.ideos?.PrimaryIdeo?.memes;
if (list != null)
{
foreach (MemeDef meme in list)
{
ExtendedMemeProperties extendedMemeProps = meme.GetModExtension<ExtendedMemeProperties>();
if (extendedMemeProps != null)
{
if (extendedMemeProps.removedDesignators != null)
{
foreach (ThingDef thing in extendedMemeProps.removedDesignators)
{
if (thing == def)
{
return false;
}
}

}
}


}

}
return true;
}

}
}
1 change: 1 addition & 0 deletions Source/VFECore/VFECore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@
<Compile Include="Apparel\Harmony\SkillRecord_Learn_Patch.cs" />
<Compile Include="Apparel\Harmony\ThingSelectionUtility_SelectableByMapClick_Patch.cs" />
<Compile Include="Apparel\ModExtensions\ApparelExtension.cs" />
<Compile Include="Memes\PlaceWorkers\PlaceWorker_DisabledByMeme.cs" />
<Compile Include="VFECore\Comps\HediffComps\HediffComp_Targeting.cs" />
<Compile Include="VFECore\HarmonyPatches\Stat_Patches.cs" />
<Compile Include="VFECore\HarmonyPatches\MapGenerator_GenerateContentsIntoMap_Patch.cs" />
Expand Down

0 comments on commit 82386ad

Please sign in to comment.