Skip to content

Commit 97188cb

Browse files
author
Jannify
authored
Fixed StoryTimingData and Seed from resetting (SubnauticaNitrox#1402)
1 parent c7dc535 commit 97188cb

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

NitroxServer/GameLogic/GameData.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,15 @@ public class GameData
1717

1818
[JsonProperty, ProtoMember(3)]
1919
public StoryTimingData StoryTiming { get; set; }
20+
21+
public static GameData From(PDAStateData pdaState, StoryGoalData storyGoals, EventTriggerer eventTriggerer)
22+
{
23+
return new GameData
24+
{
25+
PDAState = pdaState,
26+
StoryGoals = storyGoals,
27+
StoryTiming = StoryTimingData.From(eventTriggerer)
28+
};
29+
}
2030
}
2131
}

NitroxServer/GameLogic/StoryTimingData.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ public class StoryTimingData
1616

1717
public static StoryTimingData From(EventTriggerer eventTriggerer)
1818
{
19-
StoryTimingData inst = new StoryTimingData();
20-
inst.ElapsedTime = eventTriggerer.GetRealElapsedTime();
21-
inst.AuroraExplosionTime = eventTriggerer.AuroraExplosionTime;
22-
return inst;
19+
return new StoryTimingData
20+
{
21+
ElapsedTime = eventTriggerer.GetRealElapsedTime(),
22+
AuroraExplosionTime = eventTriggerer.AuroraExplosionTime
23+
};
2324
}
2425
}
2526
}

NitroxServer/Serialization/World/PersistedWorldData.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ public static PersistedWorldData From(World world)
3737
ServerStartTime = world.TimeKeeper.ServerStartTime,
3838
VehicleData = VehicleData.From(world.VehicleManager.GetVehicles()),
3939
InventoryData = InventoryData.From(world.InventoryManager.GetAllInventoryItems(), world.InventoryManager.GetAllStorageSlotItems()),
40-
GameData = world.GameData,
41-
EscapePodData = EscapePodData.From(world.EscapePodManager.GetEscapePods())
40+
GameData = GameData.From(world.GameData.PDAState, world.GameData.StoryGoals, world.EventTriggerer),
41+
EscapePodData = EscapePodData.From(world.EscapePodManager.GetEscapePods()),
42+
Seed = world.Seed
4243
}
4344
};
4445
}

0 commit comments

Comments
 (0)