Open InsanityPrelude opened 2 months ago
The problem lies in the ScenPart_AddStartingStructure.cs
file. The issue should be an easy fix with the below change. Just a simple matter of wrong coordinate usage. I've described how I'd fix the issue in the code block below but you could also easily just do center.z += offset.y;
. However, since the y
coordinate in Rimworld is most commonly used for and known to be used for layer rendering, I think it would be best to explicitly use the correct x
and z
coordinates in the XML and C# and update the wiki entry to let other modders using the framework know to leave the y
component at 0
. An example might be <li>10, 0, 10</li>
, instead of the current <li>0, 0</li>
example which is not standardized to the rest of Rimworlds' coordinate usage.
var center = map.Center; // map center is (Map.Size.x / 2, 0, Map.Size.z / 2)
var offset = layoutDef.spawnAt.RandomElement();
center.x += offset.x;
center.y += offset.z; // problem line, should be center.z += offset.z;
Debug.Message($"Spawning pawns and stuff at {center}");
DropThingGroupsAt(center, map, thingsGroups, instaDrop: (Find.GameInitData.QuickStarted || method != PlayerPawnsArriveMethod.DropPods), leaveSlag: true, allowFogged: false);
I'm a bit hesitant to touch this part of the code, as Kikohi is no longer modding... Is this offset actually a thing that people are using?
In a scenario (just using the Sealed Vaults from VFE:Ancients as an example), changing the StartAt offset from
<li>0,0</li>
to<li>60,60</li>
should move the starting coordinate from approximately 125, 125 (the center of a 250x250 map) to about 185, 185. It doesn't though. It moves the starting position to (185, 125).On the hunch it might be looking for a Vector3 coordinate, I checked values of
<li>60,60,60</li>
and<li>60,0,60</li>
to no difference. It only reads the first provided offset and then displaces the spawning pawn to the right.