This repository has been archived by the owner on Nov 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from mxashlynn/extend-item-parquets
Extend Collectable Parquets
- Loading branch information
Showing
24 changed files
with
411 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
ID,Name,AddsToBiome | ||
-40000,4 Collectable Test Parquet,None | ||
40000,Flower,None | ||
40001,Pinecone,Forested | ||
40002,Seeds,Swamp | ||
40003,Bones,Desert | ||
40004,Ice Crystal,Tundra | ||
40005,Copper Ore,Cavern | ||
ID,Name,AddsToBiome,Effect,EffectAmount,ItemID | ||
-40000,4 Collectable Test Parquet,None,None,0,-50000 | ||
40000,Flower,None,Item,0,50000 | ||
40001,Pinecone,Forested,Item,0,50001 | ||
40002,Seeds,Swamp,Item,0,50002 | ||
40003,Bones,Desert,Item,0,50003 | ||
40004,Ice Crystal,Tundra,Item,0,50004 | ||
40005,Copper Ore,Cavern,Item,0,50005 | ||
40006,Heart,None,Health,10,0 | ||
40007,Star,None,Mana,10,0 | ||
40008,Coin,None,Money,1,0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace ParquetClassLibrary.Sandbox.ID | ||
{ | ||
/// <summary> | ||
/// IDs for effects that can happen when a character encounters a Collectable. | ||
/// </summary> | ||
public enum CollectionEffect | ||
{ | ||
None, | ||
Item, | ||
Health, | ||
Mana, | ||
Money, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
using System; | ||
using Newtonsoft.Json; | ||
using ParquetClassLibrary.Utilities; | ||
|
||
namespace ParquetClassLibrary.Sandbox.ID | ||
{ | ||
/// <summary> | ||
/// Uniquely identifies every defined game entity. | ||
/// | ||
/// <see cref="ParquetClassLibrary.Sandbox.Parquets.ParquetParent"/> | ||
/// | ||
/// To be clear: there are multiple parquet and item subtypes, | ||
/// and each of these subtypes has multiple definitions. | ||
/// The definitions are purely data-driven, read in from | ||
/// JSON or CSV files, and not type-checked by the compiler. | ||
/// | ||
/// Multiple identicle parquet IDs may be assigned to MapChunks | ||
/// or MapRegions, and multiple duplicate item IDs may be spawned. | ||
/// The IDs provide a means for the library to look up | ||
/// the game entity definition when other game elements interact | ||
/// with it. | ||
/// | ||
/// Although the compiler does not provide type-checking for | ||
/// IDs, within the scope of their usage the library defines | ||
/// valid ranges for their use and these are checked by | ||
/// library code. <see cref="ParquetClassLibrary.Assembly"/> | ||
/// | ||
/// TODO: Move this explanation into the Wiki and expand it. | ||
/// </summary> | ||
public struct EntityID : IComparable<EntityID> | ||
{ | ||
/// <summary>Indicates the lack of a game entity associated with this identifier (e.g., parquet).</summary> | ||
public static readonly EntityID None = 0; | ||
|
||
/// <summary>Backing type for the identifier.</summary> | ||
// Currently this is implemented as an int rather than a GUID in order | ||
// to aid in range validation and human-readability of design documents. | ||
[JsonProperty] | ||
private int _id; | ||
|
||
#region IComparable Methods | ||
/// <summary> | ||
/// Enables identifiers to be treated as their backing type. | ||
/// </summary> | ||
/// <param name="in_value">Any valid identifier value.</param> | ||
/// <returns>The given identifier value.</returns> | ||
public static implicit operator EntityID(int in_value) | ||
{ | ||
return new EntityID { _id = in_value }; | ||
} | ||
|
||
/// <summary> | ||
/// Enables identifiers to be treated as their backing type. | ||
/// </summary> | ||
/// <param name="in_identifier">Any valid identifier value.</param> | ||
/// <returns>The given identifier value.</returns> | ||
public static implicit operator int(EntityID in_identifier) | ||
{ | ||
return in_identifier._id; | ||
} | ||
|
||
/// <summary> | ||
/// Enables identifiers to be compared with other identifiers. | ||
/// </summary> | ||
/// <param name="in_identifier">Any valid identifier value.</param> | ||
/// <returns> | ||
/// A value indicating the relative ordering of the objects being compared. | ||
/// The return value has these meanings: | ||
/// Less than zero indicates that the current instance precedes the given identifier in the sort order. | ||
/// Zero indicates that the current instance occurs in the same position in the sort order as the given identifier. | ||
/// Greater than zero indicates that the current instance follows the given identifier in the sort order. | ||
/// </returns> | ||
public int CompareTo(EntityID in_identifier) | ||
{ | ||
return _id.CompareTo(in_identifier._id); | ||
} | ||
#endregion | ||
|
||
#region Utility Methods | ||
/// <summary> | ||
/// Validates the current ID. An ID is valid if: | ||
/// 1) it is <see cref="ParquetClassLibrary.Sandbox.ID.EntityID.None"/> | ||
/// 2) it is defined within the given range, regardless of sign. | ||
/// </summary> | ||
/// <returns><c>true</c>, if the identifier is valid given the range, <c>false</c> otherwise.</returns> | ||
/// <param name="in_range">The range within which the absolute value of the ID must fall.</param> | ||
public bool IsValidForRange(Range<EntityID> in_range) | ||
{ | ||
return _id == None || in_range.ContainsValue(Math.Abs(_id)); | ||
} | ||
|
||
/// <summary> | ||
/// Returns a <see cref="T:System.String"/> that represents the current | ||
/// <see cref="T:ParquetClassLibrary.Sandbox.ID.EntityID"/>. | ||
/// </summary> | ||
/// <returns>The representation.</returns> | ||
public override string ToString() | ||
{ | ||
return _id.ToString(); | ||
} | ||
#endregion | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.