Skip to content

Commit

Permalink
Fix warp pads
Browse files Browse the repository at this point in the history
  • Loading branch information
xen-42 committed Mar 23, 2023
1 parent d847f13 commit 0c619e0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
5 changes: 0 additions & 5 deletions NewHorizons/Builder/Props/GeneralPropBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
using NewHorizons.External.Modules;
using NewHorizons.Utility;
using NewHorizons.Utility.OWUtilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using Logger = NewHorizons.Utility.Logger;

Expand Down
6 changes: 5 additions & 1 deletion NewHorizons/Builder/Props/WarpPadBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using NewHorizons.Utility.OWMLUtilities;
using OWML.Utils;
using UnityEngine;
using Logger = NewHorizons.Utility.Logger;

namespace NewHorizons.Builder.Props
{
Expand Down Expand Up @@ -84,7 +85,10 @@ public static void InitPrefabs()

public static void Make(GameObject planetGO, Sector sector, NomaiWarpReceiverInfo info)
{
var receiverObject = DetailBuilder.Make(planetGO, sector, info.detailed ? _detailedReceiverPrefab : _receiverPrefab, new PropModule.DetailInfo(info));
var detailInfo = new PropModule.DetailInfo(info);
var receiverObject = DetailBuilder.Make(planetGO, sector, info.detailed ? _detailedReceiverPrefab : _receiverPrefab, detailInfo);

Logger.Log($"Position is {detailInfo.position} was {info.position}");

var receiver = receiverObject.GetComponentInChildren<NomaiWarpReceiver>();

Expand Down
14 changes: 2 additions & 12 deletions NewHorizons/External/Modules/PropModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using NewHorizons.Utility;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
Expand Down Expand Up @@ -177,20 +178,9 @@ public class DetailInfo : GeneralPropInfo
{
public DetailInfo() { }

public DetailInfo(GeneralPropInfo info)
{
foreach (var prop in info.GetType().GetProperties())
{
GetType().GetProperty(prop.Name).SetValue(this, prop.GetValue(info, null), null);
}
}

public DetailInfo(GeneralPointPropInfo info)
{
foreach (var prop in info.GetType().GetProperties())
{
GetType().GetProperty(prop.Name).SetValue(this, prop.GetValue(info, null), null);
}
JsonConvert.PopulateObject(JsonConvert.SerializeObject(info), this);
}

/// <summary>
Expand Down

0 comments on commit 0c619e0

Please sign in to comment.