<commit_before>﻿using HamstarHelpers.Helpers.DebugHelpers;
using Microsoft.Xna.Framework;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
using System.Linq;
using Terraria;


namespace HamstarHelpers.Components.CustomEntity {
	class CustomEntityCoreContractResolver : DefaultContractResolver {
		protected override IList<JsonProperty> CreateProperties( Type type, MemberSerialization member_serialization ) {
			IList<JsonProperty> properties = base.CreateProperties( type, member_serialization );

			properties = properties.Where( ( p ) => {
				if( p.DeclaringType.Name != "Entity" ) { return true; }

				switch( p.PropertyName ) {
				//case "whoAmI":
				case "lavaWet":
				case "wetCount":
				case "wet":
				case "honeyWet":
				case "oldVelocity":
				case "oldPosition":
				case "velocity":
				case "active":
				case "oldDirection":
				case "BottomRight":
				case "BottomLeft":
				case "Bottom":
				case "TopRight":
				case "TopLeft":
				case "Top":
				case "Right":
				case "Left":
				case "Hitbox":
				case "Size":
				case "Center":
					return false;
				}

				return true;
			} ).ToList();

			return properties;
		}
	}



	public partial class CustomEntityCore : Entity {
		public string DisplayName = "";


		////////////////

		internal CustomEntityCore() { }

		internal CustomEntityCore( string name, int width, int height, Vector2 position, int direction ) {
			this.DisplayName = name;
			this.position = position;
			this.width = width;
			this.height = height;
			this.direction = direction;
		}

		internal void CopyFrom( CustomEntityCore copy ) {
			this.whoAmI = copy.whoAmI;
			this.DisplayName = copy.DisplayName;
			this.position = copy.position;
			this.velocity = copy.velocity;
			this.width = copy.width;
			this.height = copy.height;
			this.direction = copy.direction;
		}
	}
}
<commit_msg>v3.1.1 * Added common Entity fields-as-properties for CustomEntityCore (placeholder for maybe eventually abstracting away the core Entity)<commit_after>﻿using HamstarHelpers.Helpers.DebugHelpers;
using Microsoft.Xna.Framework;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
using System.Linq;
using Terraria;


namespace HamstarHelpers.Components.CustomEntity {
	class CustomEntityCoreContractResolver : DefaultContractResolver {
		protected override IList<JsonProperty> CreateProperties( Type type, MemberSerialization member_serialization ) {
			IList<JsonProperty> properties = base.CreateProperties( type, member_serialization );

			properties = properties.Where( ( p ) => {
				if( p.DeclaringType.Name != "Entity" ) { return true; }

				switch( p.PropertyName ) {
				//case "whoAmI":
				case "lavaWet":
				case "wetCount":
				case "wet":
				case "honeyWet":
				case "oldVelocity":
				case "oldPosition":
				case "velocity":
				case "active":
				case "oldDirection":
				case "BottomRight":
				case "BottomLeft":
				case "Bottom":
				case "TopRight":
				case "TopLeft":
				case "Top":
				case "Right":
				case "Left":
				case "Hitbox":
				case "Size":
				case "Center":
					return false;
				}

				return true;
			} ).ToList();

			return properties;
		}
	}



	public partial class CustomEntityCore : Entity {
		public string DisplayName = "";

		////////////////

		public int WhoAmI {
			get { return this.whoAmI; }
			private set { this.whoAmI = value; }
		}
		
		public Vector2 Position {
			get { return this.position; }
			set { this.position = value; }
		}

		public Vector2 Velocity {
			get { return this.velocity; }
			set { this.velocity = value; }
		}


		////////////////

		internal CustomEntityCore() { }

		internal CustomEntityCore( string name, int width, int height, Vector2 position, int direction ) {
			this.DisplayName = name;
			this.position = position;
			this.width = width;
			this.height = height;
			this.direction = direction;
		}

		internal void CopyFrom( CustomEntityCore copy ) {
			this.whoAmI = copy.whoAmI;
			this.DisplayName = copy.DisplayName;
			this.position = copy.position;
			this.velocity = copy.velocity;
			this.width = copy.width;
			this.height = copy.height;
			this.direction = copy.direction;
		}
	}
}

{'fraction_non_alphanumeric': 0.1186161449752883, 'fraction_numerical': 0.0016474464579901153, 'mean_word_length': 3.228855721393035, 'pattern_counts': {'":': 42, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2755385', 'n_tokens_mistral': 1548, 'n_tokens_neox': 1262, 'n_words': 331}