TS3PR/SimIFace/Sims3.SimIFace

From SimsWiki
< TS3PR‎ | SimIFace
Revision as of 13:24, 26 January 2021 by Lyralei (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contains everything in a functional matter, and a 'easier-to-use' way, for the functions and classes ScriptCore provides us.

Contents

Class: AdditionalSlotPlacementCheckResults

A helper class that checks slots and See if they're valid. This goes from Lots to objects, so is broadly used.

Used primarily by:

  • Sims3.Gameplay.Abstracts.GameObject (Especially the handtool)
public class AdditionalSlotPlacementCheckResults
{
	public SlotPlacementCheckResults mResults;

	public bool IsCompatibleUpgrade
	{
		get
		{
			return SlotPlacementCheckResults.Invalid != (mResults & SlotPlacementCheckResults.CompatibleUpgrade);
		}
		set
		{
			if (value)
			{
				mResults |= SlotPlacementCheckResults.CompatibleUpgrade;
			}
			else
			{
				mResults &= ~SlotPlacementCheckResults.CompatibleUpgrade;
			}
		}
	}

	public bool IgnoreSlotPlacementFlags
	{
		get
		{
			return SlotPlacementCheckResults.Invalid != (mResults & SlotPlacementCheckResults.OverrideSlotPlacementFlags);
		}
		set
		{
			if (value)
			{
				mResults |= SlotPlacementCheckResults.OverrideSlotPlacementFlags;
			}
			else
			{
				mResults &= ~SlotPlacementCheckResults.OverrideSlotPlacementFlags;
			}
		}
	}

	public bool IgnoreIntersectionCheck
	{
		get
		{
			return SlotPlacementCheckResults.Invalid != (mResults & SlotPlacementCheckResults.OverrideIntersectionCheck);
		}
		set
		{
			if (value)
			{
				mResults |= SlotPlacementCheckResults.OverrideIntersectionCheck;
			}
			else
			{
				mResults &= ~SlotPlacementCheckResults.OverrideIntersectionCheck;
			}
		}
	}

	public bool CacheResult
	{
		get
		{
			return SlotPlacementCheckResults.Invalid == (mResults & SlotPlacementCheckResults.DoNotCacheResult);
		}
		set
		{
			if (!value)
			{
				mResults |= SlotPlacementCheckResults.DoNotCacheResult;
			}
			else
			{
				mResults &= ~SlotPlacementCheckResults.DoNotCacheResult;
			}
		}
	}

	public SlotPlacementCheckResults GetResults()
	{
		return mResults;
	}
}

Enum: AlertResult

I assume this is being used for the alarms? or the alert notifications or something? If someone can clarify, that would be lovely! - Lyralei


public enum AlertResult
{
	kNone,
	kBreak,
	kDisable
}

Class: ALookAtEventHandler

Seemingly a debug method, however, this no longer works in the Release build version of the game.

Used primarily by:

  • Sims3.Gameplay.Objects.DebugEngine.LookAtEventHandler

Class: Animation

Also seems more of a debug method than anything. Could also just be that this was the old class that supported GrannyRig which is now unsupported by the game with EA's own Rig. You can still use the functions inside this class, but there's a big chance the animations won't play.

Enum: AnimationAge

Unused and was probably part of the Animation class to start Clips and telling through the C# script whether the animation is for a particular age or not.

Enum: AnimationAgeMask

Same as AnimationAge, but was probably used as a way to set something inside the CLIp resource.

Enum: AnimationPriority

Pre-set enum with the priority id that can be used inside a Jazz script. This is handled with helper functions inside the Statemachine class (See 'Aquire() function) so we don't really need to use this in regular coding. This also makes it possible to 'blend' animations together, like the 'talk' animation. This animation can be done by holding a toddler/pet and even sitting down. This enum also seemingly was used back before the big Pets switch where the rigs were replaced with a new system, but is reused in the current system.

Used primarily by:

  • Sims3.SimIFace.AnimationUtil
  • Sims3.SimIFace.ClipInfo
  • Sims3.SimIFace.ClipInfoNative
  • Sims3.SimIFace.StateMachineClient
  • Sims3.SimIFace.StateMachineClient
public enum AnimationPriority
{
	kAPLow = 6000,
	kAPLowPlus = 8000,
	kAPNormal = 10000,
	kAPNormalPlus = 15000,
	kAPFacialIdle = 17500,
	kAPHigh = 20000,
	kAPHighPlus = 25000,
	kAPCarryRight = 30000,
	kAPCarryRightPlus = 35000,
	kAPCarryLeft = 40000,
	kAPCarryLeftPlus = 45000,
	kAPUltra = 50000,
	kAPUltraPlus = 55000,
	kAPLookAt = 60000,
	kAPUnset = 0,
	kAPBroadcast = -1,
	kAPDefault = -2
}

Enum: AnimationSpecies

Unused and was probably part of the Animation class to start Clips and telling through the C# script whether the animation is for a particular Species or not. (this being pets or humans)

Class: AnimationUtil

Seems also unused and possibly used to be used before they switched away from GrannyRig.

Class: Audio

Not to be confused with 'Sound' which can be found in the same namespace path. Audio takes some of the ScriptCore functions and makes them usable to eventually be used by other 'sound' classes. It also seems to come with some debug functions.

Used primarily by:

  • Sims3.SimIFace.Sound
  • Sims3.SimIFace.ObjectSound

Useful Debug functions that can be found inside this class:

	public static uint StartSoundMP3(string name)
	{
		return gAudio.StartSoundMP3(name);
	}

Example usage:

//OnStartup() or inside Run() or anything that can fire it.
Audio.StartSoundMP3("sound_name_a");

(NOTE: Do make sure to 'stopSound()' if you ever were to use this for non-debug reasons.)

Enum: BlockedStatus

A helper enum that gives us the ability to determine what blocked the sim/object from routing. This is really only used inside the Route class to return the reason, but there's plenty of code in there that can serve as a debug function for routing. So there's no need to make your own ;)

Used primarily by:

  • Sims3.SimIFace.Route
  • Sims3.SimIFace.IRouteManager
public enum BlockedStatus
{
	Unobstructed,
	BlockedBySim,
	BlockedByVehicle,
	BlockedByObject,
	BlockedByWall,
	BlockedByOther,
	BlockedForOtherReason
}

Struct: BoundingBox

Is a struct that makes it possible to save and set the Bounding box if ever possible. This is however a 'helper' struct and most of the code that gets the bounding box or sets it can be found inside the Objects class instead.

Used primarily by:

  • Sims3.SimIFace.Objects
  • Sims3.SimIFace.DebugDraw
public struct BoundingBox
{
	public Vector3 min;

	public Vector3 max;
        
        // Great to use for debugging if you ever need to get the value of the boundary box!
	public override string ToString()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.Append("[(");
		stringBuilder.Append(min.ToString());
		stringBuilder.Append("),(");
		stringBuilder.Append(max.ToString());
		stringBuilder.Append(")]");
		return stringBuilder.ToString();
	}
}


Class: BridgeOrigin

I assume it checks the slot that needs to be interacted with (and eventually animated on)? Or even checks the Jazz script's priority flags and stuff, But then it also comes with a binary reader if we check what the driver stuff actually does so I have no idea :p - Lyralei

Class: Cache

Clearly Is a dictionary so it probably stores cached information. but I can't track down where and what... CacheManager also doesn't use it. - Lyralei

Class: CacheManager

Saves and loads the ITUN's Tuningdata (and assumingly the XML tuning data) but also caches the information where necessary.


public class CacheManager
{
	public static object PersistGroup;

	public static ICacheManager sInstance;

	public static bool IsCachingEnabled
	{
		get
		{
			return sInstance.IsCachingEnabled;
		}
	}

	static CacheManager()
	{
		PersistGroup = "CacheGroup";
		sInstance = (ICacheManager)AppDomain.CurrentDomain.GetData("CacheManager");
	}

	public static object LoadTuningData(string tag)
	{
		return sInstance.LoadTuningData(tag);
	}

	public static void SaveTuningData(string tag, object baseObject)
	{
		sInstance.SaveTuningData(tag, baseObject, PersistGroup);
	}

	public static byte[] LoadRawTuningData(string tag)
	{
		return sInstance.LoadRawTuningData(tag);
	}

	public static void SaveRawTuningData(string tag, byte[] data)
	{
		sInstance.SaveRawTuningData(tag, data);
	}

	public static byte[] Serialize(object baseObject, object basePersistGroup)
	{
		return sInstance.Serialize(baseObject, basePersistGroup);
	}

	public static object Deserialize(byte[] data)
	{
		return sInstance.Deserialize(data);
	}
}

Class: CameraController

The main class that does all the camera-related stuff! Think, cameraman mode (tab), camera following a sim and all the basic camera things like rotating and zooming in/out.

public class CameraController
{
	public delegate void CameraFollowEnabledHandler(object sender, CameraFollowEnabledEventArgs eventArgs);

	public class CameraFollowEnabledEventArgs : EventArgs
	{
		public ObjectGuid mObjectId;

		public bool mbEnabled;

		public ObjectGuid ObjectId
		{
			get
			{
				return mObjectId;
			}
		}

		public bool Enabled
		{
			get
			{
				return mbEnabled;
			}
		}

		public CameraFollowEnabledEventArgs(ulong objectId, bool enabled)
		{
			mObjectId = new ObjectGuid(objectId);
			mbEnabled = enabled;
		}
	}

	public delegate void CameraFlyThroughFinishedHandler(uint pathIndex);

	public delegate void CameraControllerSwitchHandler(CameraControllerType mode);

	public delegate void CameraMapViewEnabledHandler(bool enabled);

	public delegate void CameraAtMaxZoomHandler(bool atMaxZoom);

	public const string kTypeName = "Sims3.SimIFace.CameraController, SimIFace";

	public const float kUseCurrentCameraValue = -100f;

	public const float kToggleMapViewTime = 1f;

	public static ICameraController Instance;

	public static CameraFollowEnabledHandler OnCameraFollowEnabledCallback;

	public static CameraFlyThroughFinishedHandler OnCameraFlyThroughFinishedCallback;

	private static event CameraControllerSwitchHandler OnCameraControllerSwitchCallback;

	private static event CameraMapViewEnabledHandler OnCameraMapViewEnabledCallback;

	private static event CameraAtMaxZoomHandler OnCameraAtMaxZoomCallback;

	static CameraController()
	{
		Instance = (AppDomain.CurrentDomain.GetData("CameraController") as ICameraController);
	}

	public static void RegisterCallbackMethod(CameraEvent cameraEvent)
	{
		Instance.RegisterCallbackMethod(cameraEvent, "Sims3.SimIFace.CameraController, SimIFace", cameraEvent.ToString());
	}

	public static void RegisterAllCallbacks()
	{
		RegisterCallbackMethod(CameraEvent.OnCameraFollowEnabled);
		RegisterCallbackMethod(CameraEvent.OnCameraFlyThroughFinished);
		RegisterCallbackMethod(CameraEvent.OnCameraControllerSwitch);
		RegisterCallbackMethod(CameraEvent.OnCameraMapViewEnabled);
		RegisterCallbackMethod(CameraEvent.OnCameraAtMaxZoom);
	}

	public static void EnableCameraMapView(bool enabled)
	{
		if (CameraController.OnCameraMapViewEnabledCallback != null)
		{
			CameraController.OnCameraMapViewEnabledCallback(enabled);
		}
	}

	public static void OnCameraFollowEnabled(ulong objectId, bool enabled)
	{
		if (OnCameraFollowEnabledCallback != null)
		{
			OnCameraFollowEnabledCallback(null, new CameraFollowEnabledEventArgs(objectId, enabled));
		}
	}

	public static void OnCameraFlyThroughFinished(uint pathIndex)
	{
		if (OnCameraFlyThroughFinishedCallback != null)
		{
			OnCameraFlyThroughFinishedCallback(pathIndex);
		}
	}

	public static void OnCameraControllerSwitch(uint type)
	{
		if (CameraController.OnCameraControllerSwitchCallback != null)
		{
			CameraController.OnCameraControllerSwitchCallback((CameraControllerType)type);
		}
	}

	public static void OnCameraMapViewEnabled(bool enabled)
	{
		if (CameraController.OnCameraMapViewEnabledCallback != null)
		{
			CameraController.OnCameraMapViewEnabledCallback(enabled);
		}
	}

	public static void OnCameraAtMaxZoom(bool atMaxZoom)
	{
		if (CameraController.OnCameraAtMaxZoomCallback != null)
		{
			CameraController.OnCameraAtMaxZoomCallback(atMaxZoom);
		}
	}

	public static CameraControllerType GetControllerType()
	{
		return Instance.GetControllerType();
	}

	public static bool SetControllerType(CameraControllerType type)
	{
		return Instance.SetControllerType(type);
	}

	public static Vector3 GetPosition()
	{
		return Instance.GetPosition();
	}

	public static Vector3 GetTarget()
	{
		return Instance.GetTarget();
	}

	public static Vector3 GetLODInterestPosition()
	{
		return Instance.GetLODInterestPosition();
	}

	public static void SetPositionAndTarget(Vector3 pos, Vector3 target)
	{
		Instance.SetPositionAndTarget(pos, target);
	}

	public static float GetZoom()
	{
		return Instance.GetZoom();
	}

	public static void GetRegularZoomLimits(out float minZoom, out float maxZoom)
	{
		Instance.GetRegularZoomLimits(out minZoom, out maxZoom);
	}

	public static float GetPitchDegrees()
	{
		return Instance.GetPitchDegrees();
	}

	public static float GetYawDegrees()
	{
		return Instance.GetYawDegrees();
	}

	public static void LoadTuning(uint type, float[] vars, bool b)
	{
		Instance.LoadTuning(type, vars, b);
	}

	public static void Shake()
	{
		Shake(1f, 4f);
	}

	public static void Shake(float intensity)
	{
		Shake(intensity, 4f);
	}

	public static void Shake(float intensity, float duration)
	{
		float[] array = new float[5]
		{
			40f,
			40f,
			60f,
			40f,
			40f
		};
		float[] array2 = new float[5]
		{
			25f,
			25f,
			50f,
			25f,
			25f
		};
		float[] array3 = new float[5]
		{
			0.01f,
			0.01f,
			0.05f,
			0.01f,
			0.01f
		};
		float[] array4 = new float[5]
		{
			0.005f,
			0.01f,
			0.01f,
			0.01f,
			0.005f
		};
		for (int i = 0; i < 5; i++)
		{
			array[i] *= intensity;
			array2[i] *= intensity;
			array3[i] *= intensity;
			array4[i] *= intensity;
		}
		Instance.Shake(duration, array, array2, array3, array4);
	}

	public static void RequestLerpToTarget(Vector3 target, float timeDuration, bool swingToTarget)
	{
		Instance.RequestLerpToTarget(target, timeDuration, swingToTarget);
	}

	public static void RequestLerpToPositionAndTarget(Vector3 position, Vector3 target, float timeDuration, bool swingToTarget)
	{
		Instance.RequestLerpToPositionAndTarget(position, target, timeDuration, swingToTarget);
	}

	public static void RequestLerpToZoomAndRotation(float zoom, float pitchDegrees, float yawDegrees, float timeDuration)
	{
		Instance.RequestLerpToZoomAndRotation(zoom, pitchDegrees, yawDegrees, timeDuration);
	}

	public static void FocusOnLot(ulong lotId, float zoom, float pitchDegrees, float lerpDuration)
	{
		Instance.FocusOnLot(lotId, zoom, pitchDegrees, lerpDuration);
	}

	public static void FocusOnLotForBuildBuy(ulong lotId, float zoom, float pitchDegrees, float lerpDuration, float boundaryTolerance)
	{
		Instance.FocusOnLotForBuildBuy(lotId, zoom, pitchDegrees, lerpDuration, boundaryTolerance);
	}

	public static void SetOnStairs(bool onStairs)
	{
		Instance.SetOnStairs(onStairs);
	}

	public static void EnableObjectFollow(ulong objId, Vector3 targetOffset)
	{
		Instance.EnableObjectFollow(objId, targetOffset);
	}

	public static void DisableObjectFollow()
	{
		Instance.DisableObjectFollow();
	}

	public static ulong GetObjectFollowId()
	{
		return Instance.GetObjectFollowId();
	}

	public static float GetDistanceFromTargetToObject(ObjectGuid scriptHandle)
	{
		return Instance.GetDistanceFromTargetToObject(scriptHandle);
	}

	public static void TetherToLot(ulong lotId)
	{
		Instance.TetherToLot(lotId, false);
	}

	public static void TetherToLot(ulong lotId, bool forceImmediate)
	{
		Instance.TetherToLot(lotId, forceImmediate);
	}

	public static void TetherToObject(ObjectGuid objId)
	{
		Instance.TetherToObject(objId);
	}

	public static void Untether()
	{
		Instance.Untether();
	}

	public static void FinishTimeLerp()
	{
		Instance.FinishTimeLerp();
	}

	public static void Lock(ObjectGuid objectId, Vector3 targetOffset, float defaultZoom, float defaultPitchDegrees, float defaultYawDegrees, float lerpToTargetDuration)
	{
		Instance.Lock(objectId, targetOffset, defaultZoom, defaultPitchDegrees, defaultYawDegrees, lerpToTargetDuration);
	}

	public static void Unlock()
	{
		Instance.Unlock();
	}

	public static void SetMotion(uint flags, bool bSet)
	{
		Instance.SetMotion(flags, bSet);
	}

	public static void SetRotating(bool bSet)
	{
		Instance.SetCameraRotating(bSet);
	}

	public static void EnableMapViewMode()
	{
		Instance.EnableMapViewMode(1f);
	}

	public static void DisableMapViewMode(float desiredZoom, float desiredPitchDegrees)
	{
		Instance.DisableMapViewMode(desiredZoom, desiredPitchDegrees, 1f);
	}

	public static void DisableMapViewMode()
	{
		Instance.DisableMapViewMode(-100f, -100f, 1f);
	}

	public static bool IsMapViewModeEnabled()
	{
		return Instance.IsMapViewModeEnabled();
	}

	public static void EnableNHoodPlopMode()
	{
		Instance.EnableNHoodPlopMode();
	}

	public static void DisableNHoodPlopMode()
	{
		Instance.DisableNHoodPlopMode();
	}

	public static bool IsHorizontalRotationInverted()
	{
		return Instance.IsHorizontalRotationInverted();
	}

	public static bool IsVerticalRotationInverted()
	{
		return Instance.IsVerticalRotationInverted();
	}

	public static void SetGameEntryMode(bool enable)
	{
		Instance.SetGameEntryMode(enable);
	}

	public static void SetTutorialMode(bool enable)
	{
		Instance.SetTutorialMode(enable);
	}

	public static void ActivatePhotographMode(ObjectGuid photographerId, bool activate)
	{
		ActivatePhotographMode(photographerId, activate, -1f, -1f, uint.MaxValue);
	}

	public static void ActivatePhotographMode(ObjectGuid photographerId, bool activate, float minZoom, float maxZoom, uint cameraQuality)
	{
		Instance.ActivatePhotographMode(photographerId, activate, minZoom, maxZoom, cameraQuality);
	}

	public static void StartFlyThrough(uint pathIndex, bool startFromCameraPosition)
	{
		Instance.StartFlyThrough(pathIndex, startFromCameraPosition);
	}

	public static uint GetCustomFlyThroughIndex()
	{
		return Instance.GetCustomFlyThroughIndex();
	}

	public static void EnableHouseboatFollow(ulong lotId)
	{
		Instance.EnableHouseboatFollow(lotId);
	}
}
Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox