Skip to content

Commit 427df93

Browse files
committed
edit dreamworld debug action
1 parent 5d09c9b commit 427df93

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

QSB/Utility/DebugActions.cs

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,34 @@ public void Update()
160160

161161
if (Keyboard.current[Key.Numpad2].wasPressedThisFrame)
162162
{
163+
var location = DreamArrivalPoint.Location.Undefined;
164+
if (Keyboard.current[Key.Digit1].isPressed)
165+
{
166+
location = DreamArrivalPoint.Location.Zone1;
167+
}
168+
else if (Keyboard.current[Key.Digit2].isPressed)
169+
{
170+
location = DreamArrivalPoint.Location.Zone2;
171+
}
172+
else if (Keyboard.current[Key.Digit3].isPressed)
173+
{
174+
location = DreamArrivalPoint.Location.Zone3;
175+
}
176+
else if (Keyboard.current[Key.Digit4].isPressed)
177+
{
178+
location = DreamArrivalPoint.Location.Zone4;
179+
}
180+
163181
if (!QSBPlayerManager.LocalPlayer.InDreamWorld)
164182
{
183+
if (location == DreamArrivalPoint.Location.Undefined)
184+
{
185+
return;
186+
}
187+
165188
// modified from DayDream debug thing
166189
var relativeLocation = new RelativeLocationData(Vector3.up * 2 + Vector3.forward * 2, Quaternion.identity, Vector3.zero);
167190

168-
var location = Keyboard.current[Key.LeftShift].isPressed ? DreamArrivalPoint.Location.Zone4 : DreamArrivalPoint.Location.Zone3;
169191
var arrivalPoint = Locator.GetDreamArrivalPoint(location);
170192
var dreamCampfire = Locator.GetDreamCampfire(location);
171193
if (Locator.GetToolModeSwapper().GetItemCarryTool().GetHeldItemType() != ItemType.DreamLantern)
@@ -187,6 +209,35 @@ public void Update()
187209
var dreamLanternItem = QSBPlayerManager.LocalPlayer.AssignedSimulationLantern.AttachedObject;
188210
Locator.GetToolModeSwapper().GetItemCarryTool().PickUpItemInstantly(dreamLanternItem);
189211
}
212+
213+
if (location == DreamArrivalPoint.Location.Undefined)
214+
{
215+
return;
216+
}
217+
218+
// copied from DreamWorldController.FixedUpdate
219+
220+
var relativeLocation = new RelativeLocationData(Vector3.up * 2 + Vector3.forward * 2, Quaternion.identity, Vector3.zero);
221+
var arrivalPoint = Locator.GetDreamArrivalPoint(location);
222+
var controller = Locator.GetDreamWorldController();
223+
224+
Locator.GetPlayerBody().MoveToRelativeLocation(relativeLocation, controller._dreamBody, arrivalPoint.transform);
225+
GlobalMessenger.FireEvent("WarpPlayer");
226+
if (!Physics.autoSyncTransforms)
227+
{
228+
Physics.SyncTransforms();
229+
}
230+
231+
var playerSectorDetector = Locator.GetPlayerSectorDetector();
232+
playerSectorDetector.RemoveFromAllSectors();
233+
var sector = arrivalPoint.GetSector();
234+
while (sector != null)
235+
{
236+
sector.GetTriggerVolume().AddObjectToVolume(playerSectorDetector.gameObject);
237+
sector = sector.GetParentSector();
238+
}
239+
240+
arrivalPoint.OnEnterDreamWorld(QSBPlayerManager.LocalPlayer.AssignedSimulationLantern.AttachedObject);
190241
}
191242
}
192243

0 commit comments

Comments
 (0)