Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#1, #2) Upgraded to A16!! #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions ED-Stargate/About/About.xml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<ModMetaData>
<name>ED-Stargate</name>
<targetVersion>0.14.1249</targetVersion>
<author>Jaxxa</author>
<targetVersion>0.16.1393</targetVersion>
<author>Jaxxa + HopeSeekr</author>
<url>https://ludeon.com/forums/index.php?topic=18995.0</url>
<description>Version: 02.00.02
<description>Version: 02.00.03
Discussion, Non Steam Downloads and GitHub Repositories of this mod is available at: https://ludeon.com/forums/index.php?topic=18995
Please Use that Thread for Discussion / Feedback that would like me to reply to.
Ideally Bugs should be logged on GitHub although in the discussion thread is also fine.

WARNING: This mod uses the Rimworld Base Save Functionality in ways that it was never designed to support, mainly saving specific things into a separate file instead of saving everything on the map to one file at once. Because of this there may be adverse effects. The main one that I have found is that after traveling through the Stargate Social opinions relating to that colonist will be lost, they will effectively be meeting everyone for the first time again. At this time I do not know of a practical way to resolve this issue.

The Stargate system allows you to transport materials over the great distances between colonies.
ED-Autoloader is supported to more easily load resources.

WARNING: This mod uses the Rimworld Base Save Functionality in ways that it was never designed to support, mainly saving specific things into a separate file instead of saving everything on the map to one file at once. Because of this there may be adverse effects. The main one that I have found is that after traveling through the Stargate Social opinions relating to that colonist will be lost, they will effectively be meeting everyone for the first time again. At this time I do not know of a practical way to resolve this issue.
</description>
</ModMetaData>
</ModMetaData>
8 changes: 7 additions & 1 deletion README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,10 @@ ED-Autoloader is supported to more easily load resources.
*Fix for potentially not loading Graphical Resources on loading a saved game.

02.00.02
* Building against 1249
* Building against 1249

02.00.03
* Alpha 15 Update (only had to change the supported version number)

02.00.04
* Alpha 16 Update (lots of small compatibility changes, esp regarding multiple maps).
6 changes: 3 additions & 3 deletions Source/ED-Stargate/ED-Stargate.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand Down Expand Up @@ -32,7 +32,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp, Version=0.14.6054.28678, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\..\lib\A14.1249\Assembly-CSharp.dll</HintPath>
<HintPath>..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin_Data\Managed\Assembly-CSharp.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
Expand All @@ -43,7 +43,7 @@
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>..\..\..\..\lib\A14.1249\UnityEngine.dll</HintPath>
<HintPath>..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin_Data\Managed\UnityEngine.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Source/ED-Stargate/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

Expand Down Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
12 changes: 7 additions & 5 deletions Source/ED-Stargate/Stargate/Building_OffWorldStargate.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class Building_OffWorldStargate : Building

public int warned = 0;

private Map currentMap;

#endregion

static Building_OffWorldStargate()
Expand All @@ -28,10 +30,10 @@ static Building_OffWorldStargate()

#region Override

public override void SpawnSetup()
public override void SpawnSetup(Map map)
{
base.SpawnSetup();

this.currentMap = map;
base.SpawnSetup(map);
}

//Saving game
Expand Down Expand Up @@ -120,9 +122,9 @@ public void ActivateGate()
Messages.Message("Ok Fine.", MessageSound.SeriousAlert);

this.Destroy(DestroyMode.Vanish);
GenSpawn.Spawn(ThingDef.Named("Stargate"), this.Position);
GenSpawn.Spawn(ThingDef.Named("Stargate"), this.Position, this.currentMap);

foreach (Pawn currentPawn in Find.MapPawns.FreeColonistsAndPrisoners.ToList())
foreach (Pawn currentPawn in Find.VisibleMap.mapPawns.FreeColonistsAndPrisoners.ToList())
{
currentPawn.Destroy(DestroyMode.Vanish);
}
Expand Down
21 changes: 12 additions & 9 deletions Source/ED-Stargate/Stargate/Building_Stargate.cs
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down Expand Up @@ -48,6 +48,8 @@ class Building_Stargate : Building
int requiredCapacitorCharge = 1000;
int chargeSpeed = 1;

private Map currentMap;

#endregion

static Building_Stargate()
Expand Down Expand Up @@ -83,9 +85,10 @@ static Building_Stargate()

#region Override

public override void SpawnSetup()
public override void SpawnSetup(Map map)
{
base.SpawnSetup();
this.currentMap = map;
base.SpawnSetup(map);

this.power = base.GetComp<CompPowerTrader>();

Expand Down Expand Up @@ -397,7 +400,7 @@ public void AddResources()
{

//Thing foundThing = Enhanced_Development.Utilities.Utilities.FindItemThingsInAutoLoader(this);
Thing foundThing = Enhanced_Development.Utilities.Utilities.FindItemThingsNearBuilding(this, Building_Stargate.ADDITION_DISTANCE);
Thing foundThing = Enhanced_Development.Utilities.Utilities.FindItemThingsNearBuilding(this, Building_Stargate.ADDITION_DISTANCE, this.currentMap);

if (foundThing != null)
{
Expand All @@ -416,7 +419,7 @@ public void AddResources()
}

// Tell the MapDrawer that here is something thats changed
Find.MapDrawer.MapMeshDirty(Position, MapMeshFlag.Things, true, false);
Find.VisibleMap.mapDrawer.MapMeshDirty(Position, MapMeshFlag.Things, true, false);
}
else
{
Expand Down Expand Up @@ -450,7 +453,7 @@ public void AddColonist()
}

// Tell the MapDrawer that here is something thats changed
Find.MapDrawer.MapMeshDirty(Position, MapMeshFlag.Things, true, false);
Find.VisibleMap.mapDrawer.MapMeshDirty(Position, MapMeshFlag.Things, true, false);
}
else
{
Expand All @@ -474,7 +477,7 @@ public void StargateDialOut()
this.listOfBufferThings.Clear();

// Tell the MapDrawer that here is something thats changed
Find.MapDrawer.MapMeshDirty(Position, MapMeshFlag.Things, true, false);
Find.VisibleMap.mapDrawer.MapMeshDirty(Position, MapMeshFlag.Things, true, false);

this.currentCapacitorCharge -= this.requiredCapacitorCharge;
}
Expand Down Expand Up @@ -508,13 +511,13 @@ public void StargateRecall()

currentThing.SetFactionDirect(RimWorld.Faction.OfPlayer);

GenPlace.TryPlaceThing(currentThing, this.Position + new IntVec3(0, 0, -2), ThingPlaceMode.Near);
GenPlace.TryPlaceThing(currentThing, this.Position + new IntVec3(0, 0, -2), this.currentMap, ThingPlaceMode.Near);
}
//Log.Message("End of Placing");
inboundBuffer.Clear();

// Tell the MapDrawer that here is something thats changed
Find.MapDrawer.MapMeshDirty(Position, MapMeshFlag.Things, true, false);
Find.VisibleMap.mapDrawer.MapMeshDirty(Position, MapMeshFlag.Things, true, false);

this.MoveToBackup();

Expand Down
8 changes: 4 additions & 4 deletions Source/ED-Stargate/Utilities/FindingThings.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static IEnumerable<Pawn> findPawnsInColony(IntVec3 position, float radius
//IEnumerable<Pawn> pawns = Find.ListerPawns.FreeColonists;
//IEnumerable<Pawn> pawns = Find.ListerPawns.AllPawns.Where(item => item.IsColonistPlayerControlled || item.IsColonistPlayerControlled);

IEnumerable<Pawn> pawns = Find.MapPawns.PawnsInFaction(Faction.OfPlayer);
IEnumerable<Pawn> pawns = Find.VisibleMap.mapPawns.PawnsInFaction(Faction.OfPlayer);

IEnumerable<Pawn> closePawns;

Expand All @@ -38,7 +38,7 @@ static public Thing FindItemThingsInAutoLoader(Thing centerBuilding)
{
Thing thingAmmo = (Thing)null;
Thing thingContainer = (Thing)null;
foreach (Thing tempThing in Find.ThingGrid.ThingsAt(sq))
foreach (Thing tempThing in Find.VisibleMap.thingGrid.ThingsAt(sq))
{
//if (tempThing is ThingWithComponents)
//{
Expand All @@ -64,9 +64,9 @@ static public Thing FindItemThingsInAutoLoader(Thing centerBuilding)
return (Thing)null;
}

static public Thing FindItemThingsNearBuilding(Thing centerBuilding, int radius)
static public Thing FindItemThingsNearBuilding(Thing centerBuilding, int radius, Map map)
{
IEnumerable<Thing> closeThings = GenRadial.RadialDistinctThingsAround(centerBuilding.Position, radius, true);
IEnumerable<Thing> closeThings = GenRadial.RadialDistinctThingsAround(centerBuilding.Position, map, radius, true);

foreach (Thing tempThing in closeThings)
{
Expand Down