Element Properties
Revision as of 17:41, 16 July 2020 by ReallyJustDont (talk | contribs) (linked materials and some other minor changes)
Each element in TPT has properties associated with it that apply to all particles of that type on the screen. This is a list of all those properties (for use in both C++ and Lua)
Properties
Identifier | Identifier string, used for lua and internal stuff. Formatted like DEFAULT_PT_XXXX. |
Name | Name, it is recommended to use 4 letters or less. 5 or more will probably not fit on the buttons. (SPWN2 previously showed as "S..." but now the name just overflows outside of the button) |
Color | Default color, in hexadecimal (RRGGBB). In the deco editor, it will tell you the color in hex, ignore the initial FF, and use the 6 digits after for this. The initial FF is the alpha or transparency part of 32-bit color. |
MenuVisible | If it's visible in the menu, if 0 then it is hidden. By default is 0. |
MenuSection | The menu section it's in. See below for a list of possible values. |
Enabled | If 0, it cannot be created or seen in any way, not even lua. It will just disappear if somehow created. Used for removed elements, you should leave this 1. |
Advection | How much the particle is accelerated by moving air. Normally 0 for solids, and up to 1 for other elements. It can be negative, and do this so they go towards pressure. |
AirDrag | How much air the particle generates in the direction of travel. Generally is very small, 0.04f creates a lot of positive air (- creates negative pressure).. |
AirLoss | How much the particle slows down moving air (although not as big an effect as a wall). 1 = no effect, 0 = maximum effect. Solids are generally above 0.90f, along with most other elements too. |
Loss | How much velocity the particle loses each frame. 1 = no loss, .5 = half loss. Solids have it at 0. Only a few have it at 1, like energy particles, and old moving sponge. |
Collision | Velocity is multiplied by this when the particle collides with something. Energy particles have it at -0.99f, everything else is -0.01f or 0.0f. This property does not do much at all. |
Gravity | How fast the particle falls. A negative number means it floats. Generally very small, most gasses are negative, everything else is usually less than 0.04f. |
Diffusion | How much the particle "wiggles" around (think or ). Set at 0, except for gasses, which is a positive number. Up to 3 (or higher) for a large amount of wiggle, GAS is 0.75f, HYGN is 3.00f. |
HotAir | How much the particle increases the pressure by. Mostly used by gasses, but / have theirs at (-)0.010f, and certain cold/hot materials (e.g. ) have a slight negative value. Usually it's an extremely small number, sometimes as small as 0.000001f. |
Falldown | How does the particle move? 0 = solid, gas, or energy particle, 1 = powder, 2 = liquid. |
Flammable | Does it burn? 0 = no, higher numbers = higher "burnage". Something like 20 is WOOD, while C-4 is 1000. Some are a few thousand for almost instant burning. |
Explosive | Does it explode? 0 = no, 1 = when touching fire, 2 = when touching fire or when pressure > 2.5. Yes, those are the only options, see FIRE.cpp or somewhere in Simulation.cpp to modify how they work. You MUST set the Flammable property also for this to have any effect. |
Meltable | Does it melt? 1 or higher = yes, 0 = no. This is actually only used when heat sim is off, to make it actually melt use element transitions. |
Hardness | How much does acid affect it? 0 = no effect, higher numbers = higher effect. Generally goes up to about 50. |
Weight | Heavier elements sink beneath lighter ones. 1 = Gas. 2 = Light, 98 = Heavy (liquids 0-49, powder 50-99). 100 = Solid. -1 is energy (, etc). |
Temperature | What temperature does it have when spawned? Temperature is in Kelvin (Kelvin = degrees C + 273.15). R_TEMP+273.15f gives room temperature. |
HeatConduct | 0 - no heat transfer, 255 - maximum heat transfer speed. |
Description | A short one-two sentence description of the element, shown when you mouse over it in-game. |
Properties | Does this element have special properties? At the minimum you need to put the state here too, see below for possible properties (add them together with +). |
LowPressure | If the element drops below this pressure it will transition (set to IPL to never transition). |
LowPressureTransition | The element to transition into when pressure is below the threshold (set to NT to never transition). |
HighPressure | If the element goes above this pressure it will transition (set to IPH to never transision). |
HighPressureTransition | The element to transition into when pressure is above the threshold (set to NT to never transition). |
LowTemperature | If the element drops below this temperature it will transition (set to ITL to never transition). |
LowTemperatureTransition | The element to transition into when temperature is below the threshold (set to NT to never transition). |
HighTemperature | If the element goes above this temperature it will transition (set to ITH to never transition). |
HighTemperatureTransition | The element to transition into when temperature is above the threshold (set to NT to never transition). |
Update | The update function. This is what controls how your element reacts with other elements. |
Graphics | The graphics function, This controls any fancy effects. If your element is only one solid color, you don't need this. |
Menu sections
These are used for the MenuSection property.
- SC_WALL
- SC_ELEC
- SC_POWERED
- SC_SENSOR
- SC_FORCE
- SC_EXPLOSIVE
- SC_GAS
- SC_LIQUID
- SC_POWDERS
- SC_SOLIDS
- SC_NUCLEAR
- SC_SPECIAL
- SC_LIFE
- SC_TOOL
- SC_DECO
.Property Constants
These are used for the Properties property.
- TYPE_PART
- Used in powders.
- TYPE_LIQUID
- Used in liquids.
- TYPE_SOLID
- Used in solids / misc elements.
- TYPE_GAS
- Used in gases.
- TYPE_ENERGY
- Used in energy particles.
- PROP_CONDUCTS
- Allows an element to automatically conduct SPRK, requires PROP_LIFE_DEC.
- PROP_BLACK
- Elements with this property absorb photons of any color.
- PROP_NEUTPENETRATE
- Elements can be displaced by neutrons (observe behavior of wood with neutrons to see).
- PROP_NEUTABSORB
- Element will absorb neutrons.
- PROP_NEUTPASS
- Element will allow neutrons to pass through it.
- PROP_DEADLY
- Element will kill stickmen and fighters.
- PROP_HOT_GLOW
- Element will glow red when it approaches it's melting point.
- PROP_LIFE
- Unused.
- PROP_RADIOACTIVE
- Element will have a radioactive glow, like URAN or PLUT. Also, deadly to stickmen.
- PROP_LIFE_DEC
- The "life" property of particles will be reduced by 1 every frame.
- PROP_LIFE_KILL
- Particles will be destroyed when the "life" property is less than or equal to zero.
- PROP_LIFE_KILL_DEC
- When used with PROP_LIFE_DEC, particles will be destroyed when the "life" property is decremented to 0. If already at 0 it will be fine.
- PROP_SPARKSETTLE
- Allows sparks/embers to contact without being destroyed.
- PROP_NOAMBHEAT
- Prevents particles from exchanging heat with the air when ambient heat is enabled.
- PROP_DRAWONCTYPE
- Set its ctype to another element if the element is drawn upon it (like what CLNE does).
- PROP_NOCTYPEDRAW
- When this element is drawn upon other elements, do not set ctype (like STKM for CLNE).