This repository has been archived by the owner on Nov 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
196 additions
and
7 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
Source/VFECore/Memes/DefModExtensions/ExtendedMemeProperties.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using Verse; | ||
using RimWorld; | ||
using System.Reflection; | ||
using System.Reflection.Emit; | ||
|
||
|
||
namespace VanillaMemesExpanded | ||
{ | ||
|
||
public class ExtendedMemeProperties : DefModExtension | ||
{ | ||
|
||
public string neededMeme; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using RimWorld; | ||
using Verse; | ||
|
||
namespace VanillaMemesExpanded | ||
{ | ||
public class StartingItemsByIdeologyDef : Def | ||
{ | ||
|
||
public MemeDef associatedMeme; | ||
public ThingSetMakerDef thingSetMaker; | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
Source/VFECore/Memes/GameComponent/GameComponent_IdeologicalGoodies.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using RimWorld; | ||
using Verse; | ||
using UnityEngine; | ||
using RimWorld.Planet; | ||
|
||
namespace VanillaMemesExpanded | ||
{ | ||
public class GameComponent_IdeologicalGoodies : GameComponent | ||
{ | ||
|
||
public bool sentOncePerGame = false; | ||
|
||
public GameComponent_IdeologicalGoodies(Game game) | ||
{ | ||
|
||
} | ||
|
||
public override void ExposeData() | ||
{ | ||
base.ExposeData(); | ||
|
||
Scribe_Values.Look<bool>(ref this.sentOncePerGame, "sentOncePerGame", false, true); | ||
|
||
|
||
} | ||
|
||
|
||
|
||
|
||
} | ||
|
||
|
||
} | ||
|
53 changes: 53 additions & 0 deletions
53
Source/VFECore/Memes/Harmony/Dialog_ChooseMemes_GetFirstIncompatibleMemePair_Patch.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using HarmonyLib; | ||
using RimWorld; | ||
using System.Reflection; | ||
using Verse; | ||
using System.Reflection.Emit; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using System.Linq; | ||
using System; | ||
using Verse.AI; | ||
|
||
namespace VanillaMemesExpanded | ||
{ | ||
|
||
[HarmonyPatch(typeof(Dialog_ChooseMemes))] | ||
[HarmonyPatch("GetFirstIncompatibleMemePair")] | ||
public static class VanillaMemesExpanded_Dialog_ChooseMemes_GetFirstIncompatibleMemePair_Patch | ||
{ | ||
[HarmonyPostfix] | ||
public static void DetectIfRequiredMeme(ref List<MemeDef> ___newMemes, ref Pair<MemeDef, MemeDef> __result) | ||
|
||
{ | ||
List<MemeDef> memesTemp = ___newMemes; | ||
for (int i = 0; i < ___newMemes.Count; i++) | ||
{ | ||
ExtendedMemeProperties extendedMemeProps = ___newMemes[i].GetModExtension<ExtendedMemeProperties>(); | ||
if (extendedMemeProps != null) | ||
{ | ||
|
||
List<MemeDef> structureMemeDefs = (from k in DefDatabase<MemeDef>.AllDefsListForReading | ||
where k.category == MemeCategory.Structure && memesTemp.Contains(k) | ||
select k).ToList(); | ||
|
||
foreach (MemeDef memeDef in structureMemeDefs) | ||
{ | ||
if (___newMemes[i].GetModExtension<ExtendedMemeProperties>().neededMeme != memeDef.defName) | ||
{ | ||
|
||
__result = new Pair<MemeDef, MemeDef>(___newMemes[i], memeDef); | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
} | ||
|
||
|
||
} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
Source/VFECore/Memes/MapComponent/MapComponent_IdeologicalGoodies.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using RimWorld; | ||
using Verse; | ||
using UnityEngine; | ||
using RimWorld.Planet; | ||
|
||
namespace VanillaMemesExpanded | ||
{ | ||
public class MapComponent_IdeologicalGoodies : MapComponent | ||
{ | ||
|
||
|
||
|
||
public MapComponent_IdeologicalGoodies(Map map) : base(map) | ||
{ | ||
|
||
} | ||
|
||
|
||
|
||
public override void FinalizeInit() | ||
{ | ||
base.FinalizeInit(); | ||
if (!Current.Game.GetComponent<GameComponent_IdeologicalGoodies>().sentOncePerGame) | ||
{ | ||
|
||
List<Thing> things = new List<Thing>(); | ||
|
||
foreach (StartingItemsByIdeologyDef startingItems in DefDatabase<StartingItemsByIdeologyDef>.AllDefsListForReading) | ||
{ | ||
if (Current.Game.World.factionManager.OfPlayer.ideos.PrimaryIdeo.HasMeme(startingItems.associatedMeme)) | ||
{ | ||
things = startingItems.thingSetMaker.root.Generate(); | ||
} | ||
|
||
} | ||
if (things.Count > 0) { DropPodUtility.DropThingsNear(MapGenerator.PlayerStartSpot, map, things, 110); } | ||
|
||
|
||
Current.Game.GetComponent<GameComponent_IdeologicalGoodies>().sentOncePerGame = true; | ||
} | ||
|
||
|
||
} | ||
|
||
|
||
} | ||
|
||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters