Skip to content

Commit

Permalink
Added 1.3 support
Browse files Browse the repository at this point in the history
removed deprecated ForcedExitTime and replaced it with TimedDetectionRaids, thats the system in place since 1.2 instead
I did not look into Multiplayer support, also Multiplayer is not 1.3 yet (21/07/22)
  • Loading branch information
Georodin committed Jul 22, 2021
1 parent 085219e commit 6121719
Show file tree
Hide file tree
Showing 18 changed files with 54 additions and 86 deletions.
Binary file added 1.3/Assemblies/0MultiplayerAPI.dll
Binary file not shown.
Binary file added 1.3/Assemblies/SetUpCamp.dll
Binary file not shown.
35 changes: 35 additions & 0 deletions 1.3/Defs/WorldObjects.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<Defs>

<WorldObjectDef>
<defName>CaravanCamp</defName>
<label>caravan camp</label>
<description>A camp.</description>
<worldObjectClass>Syrchalis_SetUpCamp.CaravanCamp</worldObjectClass>
<texture>World/WorldObjects/Camp</texture>
<expandingIcon>true</expandingIcon>
<expandingIconTexture>World/WorldObjects/Expanding/Camp</expandingIconTexture>
<expandingIconPriority>8</expandingIconPriority>
<isTempIncidentMapOwner>true</isTempIncidentMapOwner>
<comps>
<li Class="WorldObjectCompProperties_FormCaravan" />
<li Class="WorldObjectCompProperties_TimedDetectionRaids" />
</comps>
<IncidentTargetTags>
</IncidentTargetTags>
</WorldObjectDef>

<WorldObjectDef>
<defName>AbandonedCamp</defName>
<label>abandoned camp</label>
<description>An abandoned camp.</description>
<texture>World/WorldObjects/Camp</texture>
<expandingIcon>true</expandingIcon>
<expandingIconTexture>World/WorldObjects/Expanding/CampAbandoned</expandingIconTexture>
<expandingIconPriority>8</expandingIconPriority>
<comps>
<li Class="WorldObjectCompProperties_Timeout" />
</comps>
</WorldObjectDef>

</Defs>
5 changes: 4 additions & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
<supportedVersions>
<li>1.1</li>
<li>1.2</li>
<li>1.3</li>
</supportedVersions>
<description>Set up camp, once again! For all your caravan managing needs, you can now set up camp anywhere. You can customize the possible size of the map, the duration you are allowed to stay, the time the tile is blocked after abandoning a camp and turn events on the camp map on/off.
<description>NOTE: This is the unofficial Version from Georodin. I removed the forced exit timer and replaced it with the time detection raids that are in place for caravans since 1.2 . The pull request of this fork has already been submitted to the current OWNER Syrchalis at GITHUB. And I did not look into Multiplayer support, also Multiplayer is not 1.3 yet (21/07/22). NOTE END.

Set up camp, once again! For all your caravan managing needs, you can now set up camp anywhere. You can customize the possible size of the map, the duration you are allowed to stay, the time the tile is blocked after abandoning a camp and turn events on the camp map on/off.

It is recommended to use settings close to the default and not turn the map timer or the tile blocking off, as this makes the mod severely game-breaking in terms of balance. However, what you do is your choice - the option to turn these settings off is there for a reason.

Expand Down
Binary file modified Assemblies/SetUpCamp.dll
Binary file not shown.
1 change: 0 additions & 1 deletion Languages/English/Keyed/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@
<SetUpCampOccupied>You need to wait before setting up a camp at the same spot.</SetUpCampOccupied>

<SetUpCamp_GeneratingCamp>Generating camp site</SetUpCamp_GeneratingCamp>


</LanguageData>
Binary file added Source/SetupCamp/0Harmony.dll
Binary file not shown.
44 changes: 1 addition & 43 deletions Source/SetupCamp/CaravanCamp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@ public override void ExposeData()
Scribe_Values.Look<bool>(ref this.startedCountdown, "startedCountdown", false, false);
}

public override void Tick()
{
base.Tick();
if (HasMap)
{
CheckStartForceExitAndRemoveMapCountdown();
}
}

public override bool ShouldRemoveMapNow(out bool alsoRemoveWorldObject)
{
if (!Map.mapPawns.AnyPawnBlockingMapRemoval && !SetUpCampSettings.permanentCamps)
Expand Down Expand Up @@ -64,7 +55,7 @@ public override IEnumerable<Gizmo> GetGizmos()
"AcceptButton".Translate(), delegate ()
{
Messages.Message("SetUpCampAbandoned".Translate(), MessageTypeDefOf.TaskCompletion);
TimedForcedExit.ForceReform(this);

if (SetUpCampSettings.timeout != SetUpCampSettings.timeoutmin) //this would mean the setting is off
{
AddAbandonedCamp(this);
Expand All @@ -76,30 +67,6 @@ public override IEnumerable<Gizmo> GetGizmos()
}
}

private void CheckStartForceExitAndRemoveMapCountdown()
{
if (SetUpCampSettings.mapTimerDays != SetUpCampSettings.mapTimerDaysmin)
{
if (startedCountdown)
{
if (GenHostility.AnyHostileActiveThreatToPlayer(Map, false))
{
startedCountdown = false;
GetComponent<TimedForcedExit>().ResetForceExitAndRemoveMapCountdown();
}
}
else
{
if (!GenHostility.AnyHostileActiveThreatToPlayer(Map))
{
startedCountdown = true;
int ticksTillLeaving = Mathf.RoundToInt(SetUpCampSettings.mapTimerDays * 60000f);
Messages.Message("MessageSiteCountdownBecauseNoEnemiesInitially".Translate(TimedForcedExit.GetForceExitAndRemoveMapCountdownTimeLeftString(ticksTillLeaving)), this, MessageTypeDefOf.PositiveEvent, true);
GetComponent<TimedForcedExit>().StartForceExitAndRemoveMapCountdown(ticksTillLeaving);
}
}
}
}
public void AddAbandonedCamp(CaravanCamp Camp)
{
WorldObject worldObject = WorldObjectMaker.MakeWorldObject(SetUpCampDefOf.AbandonedCamp);
Expand All @@ -109,14 +76,5 @@ public void AddAbandonedCamp(CaravanCamp Camp)
Find.WorldObjects.Add(worldObject);
}

public void ChangeTimer(int delta)
{
if (startedCountdown)
{
TimedForcedExit forceExitComp = GetComponent<TimedForcedExit>();
int timeLeftTicks = (int)AccessTools.Field(typeof(TimedForcedExit), "ticksLeftToForceExitAndRemoveMap").GetValue(forceExitComp);
forceExitComp.StartForceExitAndRemoveMapCountdown(timeLeftTicks + delta);
}
}
}
}
40 changes: 0 additions & 40 deletions Source/SetupCamp/SetUpCampCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,10 @@ public override void DoSettingsWindowContents(Rect inRect)
{
checked
{
if (cachedMapTimerDays == -1)
{
cachedMapTimerDays = SetUpCampSettings.mapTimerDays;
}
Listing_Standard listing_Standard = new Listing_Standard();
listing_Standard.Begin(inRect);
listing_Standard.Label("SetUpCampSettingMapSize".Translate());
listing_Standard.IntRange(ref SetUpCampSettings.allowedSizeRange, 50, 300);
if (SetUpCampSettings.mapTimerDays == SetUpCampSettings.mapTimerDaysmin)
{
listing_Standard.Label("SetUpCampSettingsMapTimerDays".Translate() + ": OFF", -1, "SetUpCampSettingsMapTimerDaysTooltip".Translate());
}
else
{
listing_Standard.Label("SetUpCampSettingsMapTimerDays".Translate() + ": " + SetUpCampSettings.mapTimerDays +" " + "Days".Translate(), -1, "SetUpCampSettingsMapTimerDaysTooltip".Translate());
}
SetUpCampSettings.mapTimerDays = (int)listing_Standard.Slider(SetUpCampSettings.mapTimerDays, SetUpCampSettings.mapTimerDaysmin, SetUpCampSettings.mapTimerDaysmax);
if (SetUpCampSettings.timeout == SetUpCampSettings.timeoutmin)
{
listing_Standard.Label("SetUpCampSettingsTimeout".Translate() + ": OFF", -1, "SetUpCampSettingsTimeoutTooltip".Translate());
Expand All @@ -62,34 +49,9 @@ public override void DoSettingsWindowContents(Rect inRect)
}
}

public int cachedMapTimerDays = -1;

public override void WriteSettings()
{
base.WriteSettings();
if (SetUpCampSettings.mapTimerDays > 0)
{
int delta = (SetUpCampSettings.mapTimerDays - cachedMapTimerDays) * 60000;
if (Current.ProgramState == ProgramState.Playing && delta > 0)
{
foreach (CaravanCamp camp in Find.WorldObjects.AllWorldObjects.Where(wo => wo.def == SetUpCampDefOf.CaravanCamp))
{
camp.ChangeTimer(delta);
}
}
}
else
{
if (Current.ProgramState == ProgramState.Playing)
{
foreach (CaravanCamp camp in Find.WorldObjects.AllWorldObjects.Where(wo => wo.def == SetUpCampDefOf.CaravanCamp))
{
camp.GetComponent<TimedForcedExit>().ResetForceExitAndRemoveMapCountdown();
camp.startedCountdown = false;
}
}
}
cachedMapTimerDays = SetUpCampSettings.mapTimerDays;
if (SetUpCampSettings.homeEvents)
{
SetUpCampDefOf.CaravanCamp.IncidentTargetTags.Add(IncidentTargetTagDefOf.Map_PlayerHome);
Expand All @@ -114,7 +76,6 @@ public class SetUpCampSettings : ModSettings
{
private const int MinSizeDefault = 75;
private const int MaxSizeDefault = 125;
public static int mapTimerDays = 7;
public static int mapTimerDaysmin = 0;
public static int mapTimerDaysmax = 30;
public static int timeout = 60;
Expand All @@ -130,7 +91,6 @@ public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look<IntRange>(ref allowedSizeRange, "allowedSizeRange", new IntRange(75, 125), true);
Scribe_Values.Look<int>(ref mapTimerDays, "mapTimerDays", 7, true);
Scribe_Values.Look<int>(ref timeout, "Timeout", 60, true);
Scribe_Values.Look<bool>(ref customMapGenDef, "customMapGenDef", true, true);
Scribe_Values.Look<bool>(ref permanentCamps, "permanentCamps", false, true);
Expand Down
2 changes: 1 addition & 1 deletion Source/SetupCamp/SetUpCamp_Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static void Camp(Caravan caravan)
{
Map map = camp.Map;
Thing t = caravan.PawnsListForReading[0];
CaravanEnterMapUtility.Enter(caravan, map, CaravanEnterMode.Center, CaravanDropInventoryMode.DoNotDrop, false, (IntVec3 x) => x.GetRoom(map, RegionType.Set_Passable).CellCount >= 600);
CaravanEnterMapUtility.Enter(caravan, map, CaravanEnterMode.Center, CaravanDropInventoryMode.DoNotDrop, false, (IntVec3 x) => x.GetRoom(map).CellCount >= 600);
CameraJumper.TryJump(t);
Find.TickManager.CurTimeSpeed = 0;
Messages.Message("SetUpCampFormedCamp".Translate(), MessageTypeDefOf.PositiveEvent);
Expand Down
3 changes: 3 additions & 0 deletions Source/SetupCamp/SetupCamp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,8 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="0Harmony.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
Binary file not shown.
Binary file added Source/SetupCamp/obj/Debug/SetUpCamp.dll
Binary file not shown.
Binary file not shown.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bcb8d91a792539207d975990e31e5dc3897aa790
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
D:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\SetUpCamp-1.2\Assemblies\SetUpCamp.dll
D:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\SetUpCamp-1.2\Source\SetupCamp\obj\Debug\SetupCamp.csproj.AssemblyReference.cache
D:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\SetUpCamp-1.2\Source\SetupCamp\obj\Debug\SetupCamp.csproj.CoreCompileInputs.cache
D:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\SetUpCamp-1.2\Source\SetupCamp\obj\Debug\SetupCamp.csproj.CopyComplete
D:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\SetUpCamp-1.2\Source\SetupCamp\obj\Debug\SetUpCamp.dll

0 comments on commit 6121719

Please sign in to comment.