LuaDocs/MovableObject

From Data Realms Wiki

(Difference between revisions)
Jump to: navigation, search
m (A little less hyphen- ation.)
m (Stop repeating yourself! Stop repeating yourself!)
Line 59: Line 59:
===Sharpness===
===Sharpness===
The sharpness factor of this MO.
The sharpness factor of this MO.
-
The sharpness factor of this MO. 1.0 means normal sharpness, no alteration to any of the impulses.
+
1.0 means normal sharpness, no alteration to any of the impulses.
===AboveHUDPos===
===AboveHUDPos===

Revision as of 04:06, 10 February 2013

Contents

Parent: SceneObject

Abstract Class. A movable object with mass.

Go back to Class Index


Properties

ClassName

The class name of this Entity. A string with the friendly-formatted type name of this object.

Mass

The mass value of this MovableObject. A float describing the mass value in Kilograms (kg).

Vel

The velocity vector of this MovableObject. A Vector describing the current velocity vector.

AngularVel

The current angular velocity of this MovableObject. Positive is a counter-clockwise rotation. The angular velocity in radians per second.

Radius

Read-only property. The largest radius of this in pixels. The radius from its center to the edge of its graphical representation.

Diameter

Read-only property. The largest diameter of this in pixels. The largest diameter across its graphical representation.

Scale

The current scale of this MOSRotating. This is mostly for fun. The normalized scale.

Age

Gets real time age of this MovableObject. A unsigned long describing the current age in ms.

Lifetime

The amount of time this MovableObject will exist from creation. A unsigned long describing the current lifetime in ms. 0 means unlimited.

ID

Read-only property. The MOID of this MovableObject for this frame. An unsigned char specifying the MOID that this MovableObject is assigned for the current frame only.

RootID

Read-only property. The MOID of the MovableObject which is the root MO of this MO for this frame. If same as what GetID returns, then this is owned by MovableMan. An unsigned char specifying the MOID of the MO that this MovableObject is owned by for the current frame only.

MOIDFootprint

Read-only property. Gets how many total (subsequent) MOID's this MO and all its children are taking up this frame. ie if this MO has no children, this will likely be 1. Note this is only valid for this frame! The number of MOID indices this MO and all its children are taking up.

Sharpness

The sharpness factor of this MO. 1.0 means normal sharpness, no alteration to any of the impulses.

AboveHUDPos

Read-only property. The absolute position of the top of this MO's HUD stack. A Vector with the absolute position of this MO's HUD stack top point.

HitsMOs

Gets whether this MovableObject is set to collide with other MovableObject:s during its travel. Whether this hits other MOs during its travel, or not.

GetsHitByMOs

Gets whether this MovableObject is set to be able to get hit by other MovableObject:s during their travel. Whether this can get hit by MOs, or not.

IgnoresTeamHits

Tells whether this will collide with any other MO of the same team. Whether this can hit or get hit by other MOs of the same team.

IgnoresWhichTeam

Read-only property. Tells which team this would be ignoring hits with, if we're ignoring hits at all. Which team this ignores hits with, if any.

ToSettle

Indicates whether this MO is marked for settling at the end of the MovableMan update. Whether this MO is marked for settling onto the terrain (i.e. become dirt) or not.

ToDelete

Indicates whether this MO is marked for deletion at the end of the MovableMan update. Whether this MO is marked for deletion or not.

HUDVisible

Tells whether this Actor's HUD is drawn or not.

PinStrength

The impulse force threshold which has to be exceeded to "shake loose" this MO from a "pinned" state. Pinned MOs don't get moved by travel algorithms. If 0, this isn't pinned. The impulse threshold in kg * (m/s).

Functions

ReloadScripts

Reloads the preset scripts of this object, from the same script file path as was originally defined. This will also update the original preset in the PresetMan with the updated scripts so future objects spawned will use the new scripts.

Arguments:

  • None.

Return value:

An error return value signaling sucess or any particular failure. Anything below 0 is an error signal.


GetAltitude

Gets the altitude of this MO's position (or appropriate low point) over the terrain, in pixels.

Arguments:

  • The max altitude you care to check for. 0 Means check the whole scene's height.
  • The accuracy within which measurement is acceptable. Higher number here means less calculation.

Return value:

The rough altitude over the terrain, in pixels.


SetWhichMOToNotHit

Sets this MO to not hit a specific other MO and all its children even though MO hitting is enabled on this MovableObject

Arguments:

  • A pointer to the MO to not be hitting. 0 means don't ignore anyhting.
  • Ownership is not transferred!
  • For how long, in S, to ignore the above. Negative number means forever.

Return value:

None.


IsSetToDelete

Tells if this MovableObject is marked for deletion at the end of the update.

Arguments:

  • None.

Return value:

Whether this is marked for deletion or not.


IsMissionCritical

Shows whether this is mission critical and therefore should NEVER settle (become dirt) or otherwise be destroyed during the course of a mission.

Arguments:

  • None

Return value:

Whether this should be immune to settling and destruction.


IsGeneric

Indicates whether this MO is an Generic or not.

Arguments:

  • None.

Return value:

Whether this MovableObject is of Type Generic or not.


IsActor

Indicates whether this MO is an Actor or not.

Arguments:

  • None.

Return value:

Whether this MovableObject is of Type Actor or not.


IsDevice

Indicates whether this MO is a Device or not.

Arguments:

  • None.

Return value:

Whether this MovableObject is of Type Device (Held or Thrown) or not.


IsHeldDevice

Indicates whether this MO is a HeldDevice or not.

Arguments:

  • None.

Return value:

Whether this MovableObject is of Type HeldDevice or not.


IsThrownDevice

Indicates whether this MO is a ThrownDevice or not.

Arguments:

  • None.

Return value:

Whether this MovableObject is of Type ThrownDevice or not.


IsGold

Indicates whether this MO is made of Gold or not.

Arguments:

  • None.

Return value:

Whether this MovableObject is of Gold or not.


IsThrownDevice

Indicates whether this MO is a ThrownDevice or not.

Arguments:

  • None.

Return value:

Whether this MovableObject is of Type ThrownDevice or not.


HasObject

Shows whether this is or carries a specifically named object in its inventory. Also looks through the inventories of potential passengers, as applicable.

Arguments:

  • The Preset name of the object to look for.

Return value:

Whether the object was found carried by this.


HasObjectInGroup

Shows whether this is or carries a specifically grouped object in its inventory. Also looks through the inventories of potential passengers, as applicable.

Arguments:

  • The name of the group to look for.

Return value:

Whether the object in the group was found carried by this.


AddForce

Adds force to this MovableObject for the next time Update() is called.

Arguments:

  • An Vector with the external force vector that will be added to this
  • MovableObject and affect its path next Update(). In N or kg * m/s^2.
  • A Vector with the offset, in METERS, of where the force is being applied relative to the center of this MovableObject.

Return value:

None.


AddAbsForce

Adds force to this MovableObject for the next time Update() is called.

Arguments:

  • An Vector with the external force vector that will be added to this
  • MovableObject and affect its path next Update(). In N or kg * m/s^2.
  • A Vector with the absolute world coordinates, in PIXELS, of where the force is being applied to the center of this MovableObject.

Return value:

None.


AddImpulseForce

Adds impulse force (or instant momentum) to this MovableObject for the next time Update() is called.

Arguments:

  • An Vector with the impulse force vector that will directly be added to this MovableObject's momentum next Update(). In kg * m/s.
  • A Vector with the offset, in METERS, of where the impulse is being applied relative to the center of this MovableObject.

Return value:

None.


AddAbsImpulseForce

Adds impulse force (or instant momentum) to this MovableObject for the next time Update() is called.

Arguments:

  • An Vector with the impulse force vector that will directly be added to this MovableObject's momentum next Update(). In kg * m/s.
  • A Vector with the absolute world coordinates, in PIXELS, of where the force is being applied to the center of this MovableObject.

Return value:

None.


ClearForces

Clears out all the forces this MO has accumulated during this frame.

Arguments:

  • None.

Return value:

None.


ClearImpulseForces

Clears out all the impulses this MO has accumulated during this frame.

Arguments:

  • None.

Return value:

None.


RestDetection

Does the calculations necessary to detect whether this MO appears to have has settled in the world and is at rest or not. IsAtRest() retreves the answer.

Arguments:

  • None.

Return value:

None.


NotResting

Makes this MO reset its tiemr that keeps track of how long it's been at rest, effectively delaying it.

Arguments:

  • None.

Return value:

None.


IsAtRest

Indicates wheter the MovableObject has been at rest (no velocity) for more than one (1) second.

Arguments:

  • None.

Return value:

Wheter the MovableObject has been at rest for more than one full second.


MoveOutOfTerrain

Checks whether any of the Atom:s in this MovableObject are on top of terrain pixels, and if so, attempt to move this out so none of this' Atoms are on top of the terrain any more.

Arguments:

  • Only consider materials stronger than this in the terrain for intersections.

Return value:

Whether any intersection was successfully resolved. Will return true even if there wasn't any intersections to begin with.


RotateOffset

Rotates a vector offset from this MORotating's position according to the rotate angle and flipping.

Arguments:

  • A const reference the offset Vector to rotate.

Return value:

A new vector that is the result of the rotation.


Go back to Class Index

Personal tools