finished the config setup for quantum objects, added todo for validation, and created file to handle building quantum groups

This commit is contained in:
FreezeDriedMangoes 2022-06-14 12:22:48 -04:00
parent c071d11446
commit ea4009a382
3 changed files with 83 additions and 13 deletions

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.Builder.Props
{
public static class QuantumBuilder
{
}
}

View File

@ -244,7 +244,14 @@ namespace NewHorizons.External.Configs
if (Props?.tornados != null)
foreach (var tornado in Props.tornados)
if (tornado.downwards)
tornado.type = PropModule.TornadoInfo.TornadoType.Downwards;
tornado.type = PropModule.TornadoInfo.TornadoType.Downwards;
// TODO: validate the following
// for each quantum group,
// if type == sockets, group.sockets should not be null or empty
// if type == sockets, count every prop that references this group. the number should be <= group.sockets.Count
// for each detail prop,
// if detail.quantumGroupID != null, there exists a quantum group with that id
}
}
}

View File

@ -17,17 +17,6 @@ namespace NewHorizons.External.Modules
/// </summary>
public DetailInfo[] details;
public QuantumGroupInfo[] quantumGroups;
public enum QuantumGroupType { sockets = 0, states = 1 }
public class QuantumGroupInfo { QuantumGroupType type; string id; QuantumSocketInfo[] sockets; } // QuantumSocketInfo is only used for type = "sockets"
class QuantumSocketInfo { MVector3 position; MVector3 rotation; float probability; }
/// <summary>
/// Add dialogue triggers to this planet
/// </summary>
@ -72,6 +61,11 @@ namespace NewHorizons.External.Modules
/// Add slideshows (from the DLC) to the planet
/// </summary>
public ProjectionInfo[] slideShows;
/// <summary>
/// A list of quantum groups that props can be added to. An example of a group would be a list of possible locations for a QuantumSocketedObject.
/// </summary>
public QuantumGroupInfo[] quantumGroups;
/// <summary>
/// Add tornadoes to this planet
@ -171,7 +165,9 @@ namespace NewHorizons.External.Modules
/// </summary>
[DefaultValue(1f)] public float scale = 1f;
/// <summary>
/// If this value is not null, this prop will be quantum. Assign this field to the id of the quantum group it should be a part of. The group it is assigned to determines what kind of quantum object it is
/// </summary>
public string quantumGroupID;
}
@ -626,5 +622,59 @@ namespace NewHorizons.External.Modules
/// </summary>
public float spotIntensityMod;
}
[JsonConverter(typeof(StringEnumConverter))]
public enum QuantumGroupType
{
[EnumMember(Value = @"sockets")] Sockets = 0,
[EnumMember(Value = @"states")] States = 1,
}
[JsonObject]
public class QuantumGroupInfo
{
/// <summary>
/// What type of group this is: does it define a list of states a single quantum object could take or a list of sockets one or more quantum objects could share?
/// </summary>
public QuantumGroupType type;
/// <summary>
/// A unique string used by props (that are marked as quantum) use to refer back to this group
/// </summary>
public string id;
/// <summary>
/// Only required if type is "sockets". This lists all the possible locations for any props assigned to this group.
/// </summary>
public QuantumSocketInfo[] sockets;
/// <summary>
/// Optional. Only used if type is "states". If this is true, then the first prop made part of this group will be used to construct a visibility box for an empty game object, which will be considered one of the states.
/// </summary>
public bool hasEmptyState;
}
[JsonObject]
public class QuantumSocketInfo
{
/// <summary>
/// The location of this socket
/// </summary>
MVector3 position;
/// <summary>
/// The rotation the quantum object will take if it's occupying this socket
/// </summary>
MVector3 rotation;
/// <summary>
/// The probability any props that are part of this group will occupy this socket
/// </summary>
float probability;
}
}
}