Equipment - photonle/Photon-v2 GitHub Wiki
The Equipment
table is a fundamental part of Photon 2 profiles (vehicles). It is used to configure what objects should be added to a profile on spawn and offers native selection support based on a "Component -> Option -> Variant" hierarchy.
COMPONENT.Equipment = {
{
Category = "Equipment Category",
Options = {
{
Option = "Category Option",
Variants = {
{
Variant = "Option Variant 1",
-- Components are an equipment type
Components = {
Component = "component_id"
}
}
}
}
}
}
}
Simplified Syntax
Using the verbose Equipment syntax hierarchy is not required. If you are making a basic vehicle (or still learning Photon 2), you can omit the full VEHICLE.Equipment = {}
block and do VEHICLE.EQUIPMENT_TYPE = {}
directly.
For example:
VEHICLE.Components = {
{
Component = "component_1",
Position = Vector( 0, -10, 0 )
},
{
Component = "component_2",
Position = Vector( 0, 10, 0 )
}
}
VEHICLE.BodyGroups = {
{ BodyGroup = "bg_name_1", Value = 1 },
{ BodyGroup = "bg_name_2", Value = 3 }
}
Note that equipment cannot be swappable or selectable with the simplified syntax.
Equipment Types
Components
Components = {
{
Component = "my_component_id"
}
}
Components are Photon entities built on Photon's component platform and are directly managed by a photon_controller
entity.
[!NOTE]
VirtualComponents
andUIComponents
were removed in favor of a unified Components table. All component types should be placed inComponents
from now on.
Props
Props = {
{
Model = "path/to/model.mdl"
}
}
Props are client-side models. They should be used only as decorations and they have no underlying entity logic.
Properties
Properties = {
-- Sets the vehicle skin to slot #1
Skin = 1,
-- Changes the vehicle color to fuchsia
Color = Color( 255, 0, 255 )
}
Body Groups
BodyGroups = {
{ BodyGroup = "bodyGroupName", Value = 1 }
}
Sub-Materials
SubMaterials = {
{ Id = 0, Material = "materials/my_material" }
}
Bones
Bone positioning and sizing of a controller's parent entity can be manipulated through in equipment entries as well.
VEHICLE.Equipment = {
{
Category = "Bone Category",
Options = {
{
Option = "Big Wheel",
Bones = {
{
Bone = "fl_wheel",
Position = Vector(0, 0, 0),
Angles = Angle(0, 0, 0),
-- Makes the front-left wheel 2x normal size
Scale = 2
}
}
}
}
}
}
Interaction Sounds
Changes the user input sound effects when buttons are pressed.
InteractionSounds = {
{ Class = "Controller", Profile = "whelen_cencom" }
}
Inheritance
Profile equipment entries can inherent from each other. To enable inheritance, an entry must have have a Name
parameter defined with a unique name. To inherit the entry, add the Inherit
parameter and set it to the name.
Inheritance is component-wide and distinguished by type. Entries that inherit from another entry will adopt all its values by default, by any value can be overridden. For components and props.
Components = {
-- Master entry defined as "@pushbar_mpf4"
{
Name = "@pushbar_mpf4",
Component = "photon_sos_mpf4",
Angles = Angle( 0, 90, 0 ),
Position = Vector( -11, 120.5, 50.1 ),
Scale = 1
},
-- Inherited entry copies all values from the master, but has the position overridden
{
Inherit = "@pushbar_mpf4",
Position = Vector( 11, 120.5, 50.1 ),
}
}
Advanced
Internally, component types (normal, virtual, UI) defined in the Equipment table create new components that inherit from the component they're configured to be. This is what allows inheritance and overriding functionality to work consistently in different contexts.
The resulting component is assigned a new, unique readable, name in the format of component_name<vehicle_name:equipment_index>
. This is done to make tracing the component easier for developers.