Base class to use when creating a new Part.
These can be created using:
Part new_part = new Part(args);
or by inheriting like so:
class NewPart : Part
{
public NewPart() : base(args)
{
// Your code here
}
}
More...
|
| Part (ulong part_uid, string display_name, string category, float mass=1f, string bundle_path=null, string asset_name=null, string asset_path=null, string asset=null, bool is_paintable=false, bool is_swappable_material=false, bool mesh_collider=false) |
| Creates a new Part within the game. No attachment points will be available unless specified.
|
|
T | AddBehaviour< T > () |
| Adds a Behaviour to your Part. Behaviours are logic that runs on your part. A part can have multiple Behaviours.
|
|
void | AddLinkPoint (string name, string link_type, Vector3 position, bool can_send=true, bool can_receive=true) |
| Adds a Link Point to your Part. This allows players to connect Parts together for logic.
|
|
void | AddAttachmentPoint (string attachment_name, AttachmentTypeFlags attachment_flags, AlignmentFlags alignment_flags, Vector3 position, Vector3 orientation, Vector3Int size, bool pivot=false) |
| Adds an Attachment Point to your Part. This allows players to attach it to things or things to it.
|
|
void | SetAttachmentSize (string attachment_name, Vector3Int size) |
| Allows you to alter the unit size of your attachments on the Part.
|
|
void | AddCalculatedPointGrid (AttachmentTypeFlags attachment_flags) |
|
|
GameObject | game_object |
|
PartDescriptor | descriptor |
|
|
static GameObject | loading_object = LoaderUtil.LoadObject("GearLib/gearlib", "Cube") |
|
Base class to use when creating a new Part.
These can be created using:
Part new_part = new Part(args);
or by inheriting like so:
class NewPart : Part
{
public NewPart() : base(args)
{
// Your code here
}
}
◆ Part()
GearLib.API.Part.Part |
( |
ulong | part_uid, |
|
|
string | display_name, |
|
|
string | category, |
|
|
float | mass = 1f, |
|
|
string | bundle_path = null, |
|
|
string | asset_name = null, |
|
|
string | asset_path = null, |
|
|
string | asset = null, |
|
|
bool | is_paintable = false, |
|
|
bool | is_swappable_material = false, |
|
|
bool | mesh_collider = false ) |
Creates a new Part within the game. No attachment points will be available unless specified.
- Parameters
-
bundle_path | Path to the bundle within your mod folder. For example "CombustionMotors/assets/my_asset_bundle" |
asset_name | The name of your asset within the bundle. |
part_uid | Unique ID for your part. This must be unique even across other mods, so randomize a big number! |
display_name | The name that will be used when players interact with it in game. |
category | String ID representation of the category you want it listed in. Default categories in game are: (Area, Blocks, Bodies, Brakes & Clutches, Checkpoints, Connectors, Control Wheels, Electronics, Gears, Lights, Linear Actuators, Motors, Power, Props, Pulleys, Seats, Suspension, Wheels) |
mass | Weight of your part |
is_paintable | Determines if the part is paintable. Default is false |
is_swappable_material | Determines if the part material can be changed. Default is false |
- Returns
- Returns your new Part object. Further methods can be called for adding attachments, links, etc.
◆ AddAttachmentPoint()
void GearLib.API.Part.AddAttachmentPoint |
( |
string | attachment_name, |
|
|
AttachmentTypeFlags | attachment_flags, |
|
|
AlignmentFlags | alignment_flags, |
|
|
Vector3 | position, |
|
|
Vector3 | orientation, |
|
|
Vector3Int | size, |
|
|
bool | pivot = false ) |
Adds an Attachment Point to your Part. This allows players to attach it to things or things to it.
- Parameters
-
attachment_name | The name of your Attachment Point. This is just a unique name for you to utilize in your Behaviours. |
attachment_flags | Class from the base game. This determines what style attachment you'll have, for example, knuckle joints, spherical, fixed, etc. |
alignment_flags | Class from the base game. This determines the alignment required for your attachment, for example, bi-directional, only 90 degrees, only 180, etc. |
position | Unit position on your part this attachment will be added. |
orientation | The unit direction your attachment will face, so to speak. |
size | The size in units your attachment will be. |
pivot | Determines if other parts can attach to your part, or only your part can attach to them. Default is false |
◆ AddBehaviour< T >()
T GearLib.API.Part.AddBehaviour< T > |
( |
| ) |
|
Adds a Behaviour to your Part. Behaviours are logic that runs on your part. A part can have multiple Behaviours.
- Parameters
-
T | T Represents your Behaviour class with all it's logic. |
- Returns
- Returns your instanced Behaviour object on the Part.
◆ AddLinkPoint()
void GearLib.API.Part.AddLinkPoint |
( |
string | name, |
|
|
string | link_type, |
|
|
Vector3 | position, |
|
|
bool | can_send = true, |
|
|
bool | can_receive = true ) |
Adds a Link Point to your Part. This allows players to connect Parts together for logic.
- Parameters
-
name | The name of your Link Point. This is just a unique name for you to utilize in your Behaviours. |
link_type | Unique string ID of the link type you'll be using. |
position | The position in 3D space to place your link point. |
can_send | Determines if you can send data from this link. Default is true |
can_receive | Determines if you can receive data from this link. Default is true |
◆ SetAttachmentSize()
void GearLib.API.Part.SetAttachmentSize |
( |
string | attachment_name, |
|
|
Vector3Int | size ) |
Allows you to alter the unit size of your attachments on the Part.
- Parameters
-
attachment_name | The name of your Attachment Point. |
size | The size in units your attachment will be. |
The documentation for this class was generated from the following file: