Difference between revisions of "Modding Tutorials/ThingDef"

From RimWorld Wiki
Jump to navigation Jump to search
(Added link. Set TOC right.)
m (Typo fix.)
Line 431: Line 431:
 
|----
 
|----
 
! scope="row"| pathCost
 
! scope="row"| pathCost
|How much speed is lost when pawn works over it.
+
|How much speed is lost when pawn walks over it.
 
|Integer
 
|Integer
 
|----
 
|----

Revision as of 17:54, 31 August 2018

Modding Tutorials

ThingDef is a def type for making entities, such as buildings and pawns (NPCs).
This has been updated for Alpha 9.

Buildings

Buildings are static entities. They usually require construction and perform a special function.

Elements

Tags Description Values
wantsHopperAdjacent Whether the building needs adjacent hoppers or not. Boolean
ignoreNeedsPower When has CompTrader: Whether this building requires power or not. Boolean
soundAmbient Sound to play whenever its working. SoundDefs
shipPart Designates the building as one of the ship parts or not. Boolean
canPlaceOverImpassablePlant Whether the building can be placed over tree or not. Boolean
isEdifice Whether to register this as a building internally or not. Boolean
canBuildNonEdificeUnder Whether non-edifice buildings can be built under it or not. Boolean
canPlaceOverWall Whether the building can be placed over wall. Boolean
preventDeterioration Whether the building can prevent deterioration of items it is holding. Boolean
isNaturalRock Designates the building as a natural rock or not. Boolean
isResourceRock Designates the building as a natural, resource containing rock or not. Boolean
bed_healTickInterval How much ticks are needed for a patient’s body to heal on the bed. Integer over 0
bed_medicalBonusFactor How much bonus is provided when a patient is on the bed. Float value
bed_defaultMedical Whether the bed is set to medical from the spawn. Boolean
bed_showSleeperBody Whether to hide a person’s body when the person is sleeping on the bed. Boolean
turretGunDef What weapon the turret will use. ThingDefs (weapon)
turretShellDef What item it will take as a shell. ThingDefs
turretBurstWarmupTicks How long the turret will take to aim. Integer from 0
turretBurstCooldownTicks How much the turret will take between a shot when burst firing. Integer from 0
turretTopGraphicPath What texture turret’s gun will use. File path
soundDoorOpenPowered What sound to play when the door is opening and powered. SoundDefs
soundDoorClosePowered What sound to play when the door is closing and powered. SoundDefs
soundDoorOpenManual What sound to play when the door is opening and unpowered. SoundDefs
soundDoorCloseManual What sound to play when the door is closing and unpowered. SoundDefs
sowTag Plants with same sowTag can be planted on it. String
defaultPlantToGrow What plants should be default to grow. ThingDefs
soundMined What sound to play when it is destroyed by mining. SoundDefs
mineableThing What to spawn when mined. ThingDefs
mineableYield How much to spawn when mined. Integer over 0
mineableNonMinedEfficiency Influences how much to spawn when damage source is not mining. Float value from 0
mineableDropChance How much chance to spawn when mined. Float value from 0.0 to 1.0
mineableScatterCommonality How common it will be when generating map. Float value over 0
mineableScatterBlotchSize How big a vein of the rock will be when generating map. Two integers: <min>x</min> and <max>y</max>
fixedStorageSettings What it can store. See grave and weapons rack as references.
defaultStorageSettings What settings to store it has. See grave and weapons rack as references.

Pawns

All characters in RimWorld are 'pawns' (including colonists and NPCs).

Items

Items are anything that can be hauled, such as weapons, debris, or resources.

Plants

Plants grow in growing areas, in the landscape, in a hydroponics table, or in a plant pot.

Elements

Tags Description Values
wildCommonalityMaxFraction Affects how common this plant will be in wild. Float value over 0 (Default: 1.25)
wildClusterRadius How big its "cluster" group will be. Two integers:<min>x</min> <max>y</max> (Default: 1, 1)
wildClusterRadius How far its "cluster" group can reach. Float value over 0 (Default: -1 (=Disabled))
sowTags Affects where this plant can be sown. Any string
sowWork How much work it needs to be sown. Float value over 0 (Default: 200)
blockAdjacentSow Whether this plant blocks neighboring cells for sowing. Boolean
harvestWork How much work it needs to be harvested. Float value over 0 (Default: 150)
harvestYieldRange How much product it will yield when harvested. Two float values: <min>x</min> <max>y</max> (Default: 0, 0)
harvestDestroys Whether this plant should be destroyed when harvested or not. Boolean (e.g. Agave)
harvestedThingDef What Thing it will yield when harvested. ThingDefs
harvestTag ? Any string (Following vanilla value is recommended.)
harvestMinGrowth When it can be harvested, in minimum. Float value from 0.0 to 1.0 (Default: 0.65)
soundHarvesting Sound to play when a pawn is harvesting this plant. SoundDefs
soundHarvestingFinish Sound to play when a pawn has finished harvesting this plant SoundDefs
growthPer20kTicks How much it will grow in every 20,000 ticks (333.33 secs). Float value over 0 (Default: 0.25)
growMinGlow How much light it needs to grow. Dark, Lit, Overlit (Default: Overlit)
lifespanDays How long it can survive. Float value over 0 (Default: -1 (=Disabled))
dieIfLeafless Whether this plant should die in winter or not. Boolean
fertilityMin Fertility requirement for this plant. Float value from? (Default: 0.9)
fertilityFactorGrowthRate How much fertility affects to this plant’s growth rate. Float value from? 0 (Default: 0.5)
shootsSeeds Whether this plant can shoot its seeds, in order to spread into wilderness. Boolean (Default: true)
seedShootRadius How far it can shoot its seeds Float value over 0 (Default: 9)
topWindExposure How much it dwindles when wind is blowing. Float value from? 0 (Default: 0.25)
maxMeshCount Use it when you need to make a plant consisting lots of small plants. Integer from 1 (Default: 1) (e.g. Dandeliion, astragalus, grass…)
visualSizeRange Minimum means when growth is 0. Maximum means when fully grown. Two float values: <min>x</min> <max>y</max> (Default: 0.9, 1.1)
leaflessGraphicPath Texture to use when it is winter, or "leafless." File path


Filth

Filth is just an image that is overlaid above the floor. It contributes to the "ugly environment" thought in pawns.

Global elements

These elements can be used in all ThingDef types.
(For things listed with *'s look lower on the page)

Element Function Available options
defName Internal ID of the thing. Does not appear in-game. String (Can't end with number)
label In-game name of the Thing String
description In-game description of the Thing String
thingClass Provides an attachment to an internal class in the code. Class name
category Designates a category to be used internally. *
eType Provides a more specific description of an object. This may be equal to the category's name. *
selectable Specifies whether or not the item can be selected in the atlas. Boolean
graphicPath Texture the Thing will use File path
graphicClass How the texture will be drawn Class name
shaderType Defines shader it's drawer will use. *
blueprintgraphicPath What texture it will use when it is blueprint. File path
blueprintgraphicClass How the texture of the thing’s blueprint will be drawn. Class name
uiIconPath What texture it will use as its icon. File path
equippedTexturePath What texture this item will use when it is equipped by pawn. File path
equippedAngleOffset How much the equipped texture will be rotated. Float value
drawerType Unsure None, RealtimeOnly, MepMeshOnly, MapMeshAndRealTime
drawOffscreen Whether to draw the thing when its center is offscreen? Boolean
drawGUIOverlay Whether to draw GUI overlay on this or not. Boolean
linkDrawerType What drawer will be used when the building can be “linked” with adjacent buildings with same link flag. None, Basic, CornerFiller, Transmitter, TransmitterOverlay
drawGUIOverlay Whether to draw GUI overlay on this or not. Boolean
linkFlags What the building can be linked with. *
tickerType Decides the tick type. Never, Normal(1 per 1 tick), Rare(1 per 250 tick)
inspectorTabs What tabs it has. Class name
costList How much resources the building will take to be built. ThingDefs (item) with integer
costStuffCount How much stuff the building will need to be built. Integer
stuffCategories What kind of stuffs the building will use. StuffCategoryDefs
recipeMaker Defines recipe to make it in ThingDef directly. (Recipe)
terrainAffordanceNeeded Where the thing can be built. Any, Light, Heavy, GrowSoil, Diggable, SmoothHard, SmoothableStone
constructEffect Effect when the building is being constructed. EffectDefs
repairEffect Effect when the building is being repaired. EffectDefs
leaveResourceWhenKilled Whether it leaves part of its resource cost when killed. Boolean
filthLeaving What filth will be there when the thing gets destroyed. ThingDefs (filth)
stackLimit How much this item can be stacked. Integer over 0
onGroundRandomRotateAngle How much it can rotate when on gound. Integer
altitudeLayer The location of the layer on which the object will be placed. Terrain, TerrainScatter, Floor, FloorEmplacement, Filth, Zone, SmallWire, LowPlant, MoteLow, Shadows, DoorMoveable, Building, Item, ItemImportant, LayingPawn, Projectile, Pawn, PawnUnused, PawnState, Blueprint, MoteOverhead, FlyingItem, Weather, LightingOverlay, VisEffects, FogOfWar, WorldClipper, WorldDataOverlay, MetaOverlays
pathCost How much speed is lost when pawn walks over it. Integer
passability Whether it’s traversable or not. Standable, PassThroughOnly, Impassable
useStandardHealth Determines whether or not health will be calculated normally. (?) Boolean
fillPercent How much cover it will provide. Float value from 0.0 to 1.0
statBases The thing’s stats. StatDefs
size This building’s size. Two integers: (x,y)
hasInteractionCell Whether the building has a interaction cell or not. Boolean
interactionSquareOffset Where the interaction cell is located. Two integers: (x, 0, y)
surfaceType What kind of object can be placed on building? eType?Category?
recipes What recipes the building has. RecipeDefs
comps What ThingComps the building has. *
building This building’s properties. *
verbs This item’s verbs. *
fertility This building’s fertility. Float
designationCategory What category under architecture menu it should be in. DesignationCategoryDefs
designationHotKey What key to press when choosing this building at architecture menu. Key
holdsRoof Whether this building can hold room on top of it or not. Boolean
combatTargetBuilding Whether raiders will attack this building automatically or not. Boolean
blockLight Whether this building can block light or not. Boolean
coversFloor Whether this building covers whole floor it is on or not. Boolean
isBodyPart Whether this item is a body part or not. Boolean
researchPrerequisite What research should be finished to build this building. ResearchProjectDefs
tradeability How this item is treated by traders. Never, Sellable, Stockable
rotatable Whether the building can be rotated or not. Boolean
specialDisplayRadius How much radius it should display when selected. Float
placeWorkers Restrictor when placing the building. Class name
destroyable Whether it can be destroyed or not. Boolean
killedLeavings What to spawn when it is killed. ThingDefs (item) with integer
butcherProducts What to spawn when it is butchered. ThingDefs (item) with integer
smeltProducts What to spawn when it is smelted. ThingDefs (item) with integer
destroyOnDrop Whether destroy this when pawn dropped this or not. Boolean
targetHitChanceFactor Chance multiplier for being hit. Float value from? 0
weaponTags Defines tags of this weapon so that pawns or traders can spawn with this weapon. String
artificialBodyPartsTags Defines tags of this item so that pawns can spawn with this body part. String
canBeSpawningInventory Whether this item can be spawned in pawn’s inventory. Boolean
techLevel Defines tech level of this item so that pawns can spawn with this item. Undefined, Animal, Neolithic, Medieval, Midworld, Spacer, Ultra, Transcendent
flammability Influences how likely it is for the Thing to catch fire and take damage. 0 to 1.0
maxHealth Sets the maximum health of the Thing (if applicable). Any value above 0

List of <Category>

Undefined, Pawn, Item, Plant, Building, Mote, Attachment, Projectile, Ethereal, Filth, Terrain, Roof

List of <eType>

Undefined, Pawn, Item, Chunk, Apparel, Equipment, Filth, Fire, Corpse, Puddle, DropPod, Medicine, Plant, Floor, Roof, Mote, Blueprint, Projectile, ItemSkyFalling, Ethereal, Rock, SteamGeyser, BuildingComplex, BuildingInert, Frame, Wall, Door, Bed, Building_Table, Building_PowerPlantGeothermal, Building_PowerConduit, Building_Battery, Building_ResearchBench, Building_Turret, Building_Chair, Building_Cryptosleepcasket, Building_TempController

List of <shaderType>

None, Cutout, CutoutFlying, CutoutPlant, CutoutComplex, CutoutSkin, Transparent, TransparentPostLight, MetaOverlay, Mote, MoteGlow.

List of <linkFlags>

None, MapEdge, Rock, Wall, Sandbags, PowerConduit, Custom1, Custom2, … Custom10

List of <altitudeLayer>

Terrain, TerrainScatter, Floor, FloorEmplacement, Filth, Zone, SmallWire, LowPlant, MoteLow, Shadows, DoorMoveable, Building, BuildingOnTop, Item, ItemImportant, LayingPawn, Projectile, Pawn, PawnUnused, PawnState, Blueprint, MoteOverhead, FlyingItem, Gas, Weather, LightingOverlay, VisEffects, FogOfWar, WorldClipper, WorldDataOverlay, MetaOverlays

<comps>

Tags Description Values
compClass What ThingComp it is. Class name
explosiveRadius CompExplosive: How far it will explode. Float value over 0
explosiveExpandPerStackCount CompExplosive: How much further it’s explosion will reach with a stack. Float value
explosiveDamageType CompExplosive: What type of damage the explosion will deal DamageDefs
startWickHealthpercent CompExplosive: What health percent its explosion sequence will starts. Float value from 0.0 to 1.0
wickTicks CompExplosive: How long its explosion sequence will keep. Integer from 0
wickScale CompExplosive: Its wick sound’s scale? Float value from 0?
glowRadius CompGlower: Lit radius. Float value over 0
glowColor CompGlower: Color of light it will emit. RGBA: (r, g, b, 0)
storedEnergyMax CompPowerBattery: How much energy it can hold. Float value over 0
efficiency CompPowerBattery: How efficient the battery is. Float value from 0.0 to 1.0
transmitsPower CompPowerTrader/Transmitter: Whether it transmits electricity or not. Boolean
basePowerConsumption CompPowerTrader: How much power it requires to work. Float value
startElectricalFires CompPowerTransmitter?: Whether it will trigger short circuit incident or not? Boolean
shortCircuitInRain CompPowerTrader?: Whether it will trigger short circuit incident when raining or not? Boolean
powerToggleable CompPowerTrader: Whether it can be turned on and off. Boolean
soundPowerOn CompPowerTrader: Sound to play when turning on. SoundDefs
soundPowerOff CompPowerTrader: Sound to play when turning off. SoundDefs
soundAmbientPowered CompPowerTrader: Sound to play when running? SoundDefs
heatPerSecond CompHeatPusher: How much heat it will produce. Float value
heatPushMaxTemperature CompHeatPusher: How hot its heat is. Float value
nameMaker CompArt: What rule pack to use when naming. RulePackDefs
descriptionMaker CompArt: What rule pack to use when writing description. RulePackDefs
minQualityForArtistic CompArt: How good the item should be to get its unique name and/or description. Quality

<verbs>

Tags Description Values
verbClass What this verb is. Class name
minRange How much minimum range is required to fire. Float value from 0
range How many times this verb will fire in one attack. Integer from 1
ticksBetweenBurstShots How much it takes to fire another shot right after a shot in a burst. Integer from 1
hasStandardCommand ? Boolean
targetable Whether this verb can be manually? targeted/target or not. Boolean
requireLineOfSight Whether this verb requires line of sight to be used. Boolean
forceNormalTimeSpeed Whether this verb triggers time control to force normal speed. Boolean
onlyManualCast Whether this verb is not used automatically by pawns and must be ordered or not. Boolean
warmupTicks Time before this verb is actually used. Integer from 0
soundCast What sound to play when this verb is used. SoundDefs
soundCastTail What sound to play when this verb is used at long distance. SoundDefs
linkedBodyPartsGroup What body part group has this verb. BodyPartGroupDef
meleeDamageDef What kind of damage this verb will deal on melee. DamageDefs
meleeDamageBaseAmount How much damage this verb will deal when used on melee. Integer from? 1?
ai_IsBuildingDestroyer Defines this verb as a building destroyer so AI can use. Boolean
ai_IsWeapon Defines this verb as a weapon’s verb so AI can use. Boolean
ai_IsIncendiary Defines this verb as a fire-starter so AI can use. Boolean
projectileDef What projectile to fire when this verb is used. ThingDefs (projectile)
canMiss Whether this verb can be miss or not. Boolean
forceMissRadius How far this verb can miss. Float value

Credits

  • Latta's Alpha 9 reference sheet