Prototype/Entity: Difference between revisions
(→Optional properties: added vehicle_impact_sound) |
(→Optional properties: added map_color, friendly_map_color and enemy_map_color) |
||
Line 239: | Line 239: | ||
=== vehicle_impact_sound === | === vehicle_impact_sound === | ||
'''Type''': [[Types/Sound]] | '''Type''': [[Types/Sound]] | ||
=== map_color === | |||
'''Type''': [[Types/color]] | |||
=== friendly_map_color === | |||
'''Type''': [[Types/color]] | |||
=== enemy_map_color === | |||
'''Type''': [[Types/color]] | |||
=== autoplace === | === autoplace === | ||
Line 247: | Line 256: | ||
Used to specify the rules for placing this entity during map generation. | Used to specify the rules for placing this entity during map generation. | ||
<syntaxhighlight lang="lua">autoplace = | |||
{ | { | ||
sharpness = 0.5, | sharpness = 0.5, | ||
Line 266: | Line 275: | ||
} | } | ||
} | } | ||
</syntaxhighlight> | |||
== Example == | == Example == |
Revision as of 15:21, 25 October 2017
Basics
The common properties of all entities in the game. Entity is basically everything that can be on the map (except tiles). For in game script access to entity, take a look at LuaEntity
Extensions
- Prototype/Arrow arrow
- Prototype/Beam beam
- Prototype/CharacterCorpse character-corpse
- Prototype/Corpse corpse
- Prototype/RailRemnants rail-remnants
- Prototype/DeconstructibleTileProxy deconstructible-tile-proxy
- Prototype/EntityGhost entity-ghost
- Prototype/EntityWithHealth <abstract>
- Prototype/Accumulator accumulator
- Prototype/Beacon beacon
- Prototype/Boiler boiler
- Prototype/Character player
- Prototype/Combinator <abstract>
- Prototype/ArithmeticCombinator arithmetic-combinator
- Prototype/DeciderCombinator decider-combinator
- Prototype/ConstantCombinator constant-combinator
- Prototype/Container container
- Prototype/LegacySmartContainer smart-container (unused in the base-game, but exists for migration)
- Prototype/LogisticContainer logistic-container
- Prototype/CraftingMachine <abstract>
- Prototype/AssemblingMachine assembling-machine
- Prototype/RocketSilo rocket-silo
- Prototype/Furnace furnace
- Prototype/AssemblingMachine assembling-machine
- Prototype/ElectricEnergyInterface electric-energy-interface
- Prototype/ElectricPole electric-pole
- Prototype/EnemySpawner unit-spawner
- Prototype/Fish fish
- Prototype/FlyingRobot <abstract>
- Prototype/CombatRobot combat-robot
- Prototype/RobotWithLogisticInterface <abstract>
- Prototype/ConstructionRobot construction-robot
- Prototype/LogisticRobot logistic-robot
- Prototype/Gate gate
- Prototype/Generator generator
- Prototype/HeatPipe heat-pipe
- Prototype/Inserter inserter
- Prototype/Lab lab
- Prototype/Lamp lamp
- Prototype/LandMine land-mine
- Prototype/LegacyRocketDefense rocket-defense (unused in the base-game, but exists for migration)
- Prototype/Market market
- Prototype/MiningDrill mining-drill
- Prototype/OffshorePump offshore-pump
- Prototype/Pipe pipe
- Prototype/PipeToGround pipe-to-ground
- Prototype/PlayerPort player-port
- Prototype/PowerSwitch power-switch
- Prototype/ProgrammableSpeaker programmable-speaker
- Prototype/Pump pump
- Prototype/Radar radar
- Prototype/Rail <abstract>
- Prototype/CurvedRail curved-rail
- Prototype/StraightRail straight-rail
- Prototype/RailSignalBase <abstract>
- Prototype/RailChainSignal rail-chain-signal
- Prototype/RailSignal rail-signal
- Prototype/Reactor reactor
- Prototype/Roboport roboport
- Prototype/SimpleEntity simple-entity
- Prototype/SimpleEntityWithOwner simple-entity-with-owner
- Prototype/SimpleEntityWtihForce simple-entity-with-force
- Prototype/SolarPanel solar-panel
- Prototype/StorageTank storage-tank
- Prototype/TrainStop train-stop
- Prototype/TransportBeltConnectable <abstract>
- Prototype/Loader loader
- Prototype/Splitter splitter
- Prototype/TransportBelt transport-belt
- Prototype/UndergroundBelt underground-belt
- Prototype/Tree tree
- Prototype/Turret turret
- Prototype/AmmoTurret ammo-turret
- Prototype/ElectricTurret electric-turret
- Prototype/FluidTurret fluid-turret
- Prototype/Unit unit
- Prototype/Vehicle <abstract>
- Prototype/Car car
- Prototype/RollingStock <abstract>
- Prototype/CargoWagon cargo-wagon
- Prototype/FluidWagon fluid-wagon
- Prototype/Locomotive locomotive
- Prototype/Wall wall
- Prototype/Explosion explosion
- Prototype/FlameThrowerExplosion flame-thrower-explosion
- Prototype/FireFlame fire
- Prototype/FluidStream stream
- Prototype/FlyingText flying-text
- Prototype/ItemEntity item-entity
- Prototype/ItemRequestProxy item-request-proxy
- Prototype/LegacyDecorative ??? probably exists for migration
- Prototype/Particle particle
- Prototype/LeafParticle leaf-particle
- Prototype/ParticleSource particle-source
- Prototype/Projectile projectile
- Prototype/ResourceEntity resource
- Prototype/RocketSiloRocket rocket-silo-rocket
- Prototype/RocketSiloRocketShadow rocket-silo-rocket-shadow
- Prototype/Smoke smoke
- Prototype/SimpleSmoke ??? seems to be unsused in base game
- Prototype/SmokeWithTrigger smoke-with-trigger
- Prototype/Sticker sticker
- Prototype/TileGhost tile-ghost
Mandatory properties
type
Type: Types/string
Specification of the type of the prototype.
name
Type: Types/string
Unique identification of the prototype.
flags
Type: Types/EntityPrototypeFlags
icon
Type: Types/FileName
Mandatory for entities that have at least one of these flags active placeable-neutral, placeable-player, placeable-neutral.
The icon will be used in the editor building selection.
icon = "__base__/graphics/icons/wooden-chest.png"
Optional properties
collision_box
Type: Types/AABBbox
Default: Empty={{0, 0}, {0, 0}} it means no collisions.
Specification of the entity collision boundaries.
Empty collision box is used for smoke, projectiles, particles, explosions etc.
collision_box = {{-0.4, -0.4}, {0.4, 0.4}}
The {0,0} coordinate in the collision box will match the entity position.
It should be near the center of the collision box, to keep correct entity drawing order.
Note, that for buildings, it is custom to leave 0.1 wide border between the edge of the tile and the edge of the building, this lets the player move between the building and electric poles/inserters etc. and prevents stucked items on transport belt in some special cases (curves around the corner etc).
collision_mask
type: Types/CollisionMask
Default: Depends on Entity type
Two entities can collide only if they share a layer from the collision mask.
selection_box
Type: Types/AABBbox
Default: Empty = {{0, 0}, {0, 0}}
Specification of the entity selection area. When empty the entity will have no selection area (and thus is not selectable).
selection_box = {{-0.5, -0.5}, {0.5, 0.5}}
The selection box is usualy little bit bigger than the collision box, for tilable entities (like buildings) it should match the tile size of the building.
drawing_box
Type: Types/AABBbox
Default: The value of selection_box
Specification of space needed to see the whole entity.
This is used to calculate the correct zoom and positioning in the entity info gui.
drawing_box = {{-0.5, -0.5}, {0.5, 0.5}}
sticker_box
Type: Types/AABBbox
Default: The value of collision box.
Used to set the area of the entity that can have stickers on it, currently only used for units to specify the area where the green slow down stickers can appear. It is optional and the collision box is used when not specified.
sticker_box = {{-0.5, -0.5}, {0.5, 0.5}}
weight
Type: Types/float
Default: 1
Weight of the entity used for physics calculation when car hits something.
weight = 5.7
minable
Type: Types/MinableProperties
emissions_per_tick
Type: Types/double
Amount of emissions created (positive number) or cleaned (negative number) every tick by the entity. This is passive, and it is independent concept of the emissions of machines, these are created actively depending on the power consumption. Currently used just for trees.
emissions_per_tick = -0.0005 -- cleaning effect of big tree
fast_replaceable_group
Type: Types/string
This allows you to replace an entity that's already placed, with a different one in your inventory. For example, replacing a burner drill with an electric drill.
The ones the game uses are:
"underground-belt" "loader" "splitter" "transport-belt" "assembling-machine" "container" "long-handed-inserter" "inserter" "wall" "rail-signal" "container" "pipe" "furnace" "steam-engine"
tile_width
Type: Types/unsigned
Default: calculated by the collision box width rounded up.
Used to determine how the center of the entity should be positioned when building (unless the offgrid flag is specified). When the tile width is odd, the center will be in the center of the tile, when it is even, the center is on the tile transition.
tile_height
Type: Types/unsigned
Default: calculated by the collision box height rounded up.
vehicle_impact_sound
Type: Types/Sound
map_color
Type: Types/color
friendly_map_color
Type: Types/color
enemy_map_color
Type: Types/color
autoplace
Type: Types/AutoplaceSpecification
Default: Entity is not autoplacable
Used to specify the rules for placing this entity during map generation.
autoplace =
{
sharpness = 0.5,
control = "forest",
peaks =
{
{
influence = 0.2,
water_optimal = 0.3,
water_range = 0.2,
water_max_range = 0.4
},
{
influence = 0.9,
noise_layer = "trees",
noise_persistence = 0.5,
}
}
}
Example
{ type = "container", name = "wooden-chest", icon = "__base__/graphics/icons/wooden-chest.png", flags = {"placeable-neutral", "player-creation"}, minable = {mining_time = 1, result = "wooden-chest"}, collision_box = {{-0.4, -0.4}, {0.4, 0.4}}, selection_box = {{-0.5, -0.5}, {0.5, 0.5}}, max_health = 50, corpse = "small-remnants", fast_replaceable_group = "container", inventory_size = 16, picture = { filename = "__base__/graphics/entity/wooden-chest/wooden-chest.png", priority = "extra-high", width = 46, height = 33, shift = {0.3, 0} } }