Template:Infobox main/doc

From RimWorld Wiki
< Template:Infobox main
Revision as of 05:06, 2 May 2020 by FixSomeBugs (talk | contribs) (Fix param names in docs)
Jump to navigation Jump to search

Intro

Template:Infobox main Is the core of what powers the SemanticMediaWiki database of rimworld objects. Since the template is so complex, it's worth taking a step back and summarizing what this template does:

  • Takes in facts: On each page which describes an in-game object, we call {{infobox main | ...}}, where ... is a very long list of parameters describing the object in question, including its name, type, the cost to make it, and a bunch of other things
  • Rendering an infobox: This template takes those parameters and presents them in a nice looking infobox on the right side of the page. If you add a param |marketvalue = 200, this template will add a line to the infobox showing the market value annotated with a silver icon. Cool!
  • Setting SMW properties: The real magic comes from this templates ability to also set SMW properties. If the |marketvalue = 200 param is present, this template will also set a SMW property 'Market Value Base' equal to 200 for whatever page the infobox was called on.

As an example, say there was an Page called "Foo" for an in-game object with the same name. In-game, a foo has a market value of 200. When you invoke {{infobox main | ... | marketvalue = 200 | ..., this template will set the 'Market Value Base' property of the 'Foo' page to 200.

These properties can then be retrieved using a snippet like {{#show:Foo|?Market Value Base}}. You can browse the properties for a given page by clicking the "Browse properties" link on the left side of the page. For an example, see Special:Browse/:Duster

Positional parameters

This template also takes 4 positional parameters, though I need to spend more time confirming what they do:

  1. Changes the color of the box depending on the category of thing
  2. ???
  3. ???
  4. Overly clever use of the size parameter. The usual format is |size = X|Y. This then gets transformed into x * y. BUT it only works if you have 3 positional parameters prior to the first param. This is way overly clever and should be cleaned up.

Usage

  • Everything is optional for the template to function; however, relevant sections should be filled in for the sake of completeness. The information displayed is dependent on which category is used, and will not be displayed unless a value is provided.
  • You can add a "name" and "image". Fill these values if the PAGENAME macro is not adequate (if the page name has a disambig qualifier for example)
{{infobox main
|animal/plant/weapon/area/structure/production/security/furniture (used to set color theme)
|additional styles (optional)

|name = Title of the infobox. Defaults to current page name if not specified.
|image = Picture name.(jpg/png)| variables such as size, alt text (optional)
|description = Short description of the item. Recommended to use the description from the in-game info page.
|type = use for main category 
|type2 = use for subcategory (optional)
|placeable = Yes/No
|rotatable = Yes/No
|size = two values, separated by | - (1|2)
|beauty = use for beauty
|flammability = how quickly it burns. format: in decimals(vb:0.8) , displayed as % vb(80%)
|market value = the amount of currency the item is worth
|mass base = mass in kilograms - DO NOT USE FOR ANIMALS
|hp = the amount of damage an object can take; use for objects with hit points

<!-- All pawns (animals, humanoids, mechanoids) -->
|movespeed = base movement speed
|attack1dmg = base damage of first attack <meleeDamageBaseAmount>
|attack1type = damage type of first attack <meleeDamageDef>
|attack1part = body part of first attack <linkedBodyPartsGroup>
|attack1cool = cooldown of first attack (in ticks) <defaultCooldownTicks>
|attack1stun = stun applied with first attack, if any (in stun damage, 20 ticks per point) <extraMeleeDamages>
|attack2dmg = as above for second attack
|attack2type = as above for second attack
|attack2part = as above for second attack
|attack2cool = as above for second attack
|attack2stun = as above for second attack
|attack3dmg = as above for third attack
|attack3type = as above for third attack
|attack3part = as above for third attack
|attack3cool = as above for third attack
|attack3stun = as above for third attack
|attack4dmg = as above for fourth attack
|attack4type = as above for fourth attack
|attack4part = as above for fourth attack
|attack4cool = as above for fourth attack
|attack4stun = as above for fourth attack
|bodysize = required in order to calculate meat yield, leather yields, and carrying capacity
|leathername = use only if leather, skin, or fur is dropped when butchered
|massyoung = the mass of an animal when young
|massjuvenile = the mass of an animal when juvenile
|massadult = the mass of an animal when adult

<!--Apparel and Armor-->
|armorblunt = blunt armor rating for non-material dependent Apparel and Armor
|armorsharp = sharp armor rating for non-material dependent Apparel and Armor
|armorheat = heat armor rating for non-material dependent Apparel and Armor
|armorbluntfactor = blunt armor multiplier for material dependent Apparel and Armor
|armorsharpfactor = sharp armor multiplier for material dependent Apparel and Armor
|armorheatfactor = heat armor multiplier for material dependent Apparel and Armor
|painshockthreshold = increase in pain shock threshold
|insulationheat = base heat tolerance modifier
|insulationcold = base cold tolerance modifier
|insulationheatfactor = base heat tolerance for material dependent Apparel and Armor
|insulationcoldfactor = base cold tolerance for material dependent Apparel and Armor
|coverage = coverage provided by the item

<!-- Animals only -->
|manhunter = chance to turn manhunter when attacked (0.00 - 1.00)
|manhuntertame = chance to turn manhunter on a failed taming attempt (0.00 - 1.00)
|hungerrate = base hunger rate
|diet = carnivorous/herbivorous/omnivorous/dendrovorous/carnivorous and ovivorous/omnivorous and ovivorous
|lifespan = life expectancy
|trainable = none/simple/intermediate/advanced
|handleskill = minimum handling skill
|wildness = wildness level of creature
|milk = amount of milk produced
|milktime = milking interval (days)
|wool = wool amount
|sheartime = shearing interval
|eggsmin = eggs per clutch minimum
|eggsmax = eggs per clutch maximum
|eggtime = egg laying interval
|eggs_avg = eggs per clutch average
|gestation = gestation period (days) (must either be a number or N/A)
|offspring = offspring per birth (Do not use for egg-laying animals)
|maturityage = age of maturity
|livesin_aridshrubland = true or <omit>
|livesin_borealforest = true or <omit>
|livesin_desert = true or <omit>
|livesin_extremedesert = true or <omit>
|livesin_icesheet = true or <omit>
|livesin_temperateforest = true or <omit>
|livesin_tropicalrainforest = true or <omit>
|livesin_tundra = true or <omit>
|predator = true or <omit>
|meatyield = amount of meat yielded when butchered. ONLY specify this parameter for animal defs that explicitly specify a MeatAmount property in the XML (currently Thrumbo, Centipede, and Scyther)!
|meatname = name of meat given when butchered. Defaults to "x meat" when not defined.
|woolname = name of wool given when sheared. Defaults to "x wool" when not defined.

<!-- Plants -->
|time = number of days to grow
|yield = how much food given when harvested
|wood = how much wood given when harvested

<!-- Buildings-->
|power = power generated. Format: + 3600 or - 150
|facility = multi-analyzer/tool cabinet/vitals monitor (name of facility that this production station links to for improved efficiency)
|work to build = the base amount of work it takes to build a structure, once all materials are gathered.
|work to deconstuct = the amount of work it takes to break down a structure.
|material amount = amount of materials needed to build it, has to be the one that varies
|material name= only needed if not [steel,stone,wood,plasteel...];
|material 2 amount = amount of second material
|material 2 name= name of second material (for icon)
|material 3 amount = amount of third material
|material 3 name= name of third material (for icon)
|material 4 amount = amount of fourth material
|material 4 name= name of fourth material (for icon)

<!-- Furniture -->
|comfort = how much comfort it gives when using
|cover effectiveness = how effective the object is when used for cover.  
|sell price multiplier = a multiplier on the price at which you can sell items.
|terrain requirement = light, medium or heavy terrain requirements to place object.
|work to build = the base amount of work it takes to build a structure, once all materials are gathered.
|work to uninstall = the amount of work it takes to uninstall a structure.
|immunity gain speed factor = how fast a pawn acquires immunity while using object
|rest effectiveness = how quickly rest gets restored

<!-- All Weapons -->
|class = neolithic/modern/advanced/mechanoid
|damage = Base weapon damage
|cooldown = use for cooldown time of weapon (in ticks)
|mode = Melee/Single-Shot/Burst
|warmup = How long it takes to aim (in ticks). Set to 0 if melee weapon.
|damage type= The type of damage: Blunt - Scharp - Heat - Electric - Toxic ,if it has damage it wil get Sharp automaticly


<!-- Ranged Weapons Only -->
|burst = Shots per burst. Set to 1 for single-shot weapons.
|burstticks = Time between bursts (in ticks)
|range = Weapon range
|minrange = Minimum weapon range AKA forced-miss range
|missRadius = Missed shots are forced to land within this radius of the target
|area = Explosive area (in squares)
|velocity = use for projectile velocity
|accuracyTouch = use for touch accuracy 
|accuracyShort = use for short range accuracy 
|accuracyMedium = use for medium range accuracy 
|accuracyLong = use for long range accuracy
|accuracyAvg = use for average accuracy: note that this value has to be calculated and cannot be obtained simply by taking the mean of the above accuracies
|blastRadius = use for blast radius of explosive weapons

<!-- Melee Weapons Only -->
|meleeattack1dmg = base damage of first attack <meleeDamageBaseAmount>
|meleeattack1type = damage type of first attack <meleeDamageDef>
|meleeattack1part = body part of first attack <linkedBodyPartsGroup>
|meleeattack1cool = cooldown of first attack (in seconds) <defaultCooldownTicks>
|meleeattack1ap = armor penetration of first attack
|meleeattack2dmg = as above for second attack
|meleeattack2type = as above for second attack
|meleeattack2part = as above for second attack
|meleeattack2cool = as above for second attack
|meleeattack2ap = as above for second attack
|meleeattack3dmg = as above for third attack
|meleeattack3type = as above for third attack
|meleeattack3part = as above for third attack
|meleeattack3cool = as above for third attack
|meleeattack3ap = as above for fourth attack
|meleeattack4dmg = as above for fourth attack
|meleeattack4type = as above for fourth attack
|meleeattack4part = as above for fourth attack
|meleeattack4cool = as above for fourth attack
|meleeattack4ap = as above for fourth attack
|MeleeWeaponAverageDPS = average melee DPS of the weapon
|MeleeWeaponAverageAP = average melee armor penetration of the weapon


<!-- Miscellaneous -->
|resources to make = amount of resources to build or craft this item.  Format using {{icon|metal|75}} or similar (more info at Template:Icon)
|deconstruct yield = amount of resources returned when this item is deconstructed or smelted.  Format using {{icon|metal|75}} or similar (more info at Template:Icon)

<!-- Deprecated parameters -->
|minimum skill = minimum skill level required to build or craft something -- was never consistently applied
|buy = Amount of resource to buy or build this item. Format: {{icon|metal|75}} (More info at Template:Icon) -- replaced with resources to make
|sell = Amount of resource to sell or deconstruct this item. Format: {{icon|cloth|18}} (More info at Template:Icon) -- replaced with deconstruct yield
|info = Removed and replaced with description =.
|walkSpeed = Superseded by moveSpeed
|speed = Superseded by moveSpeed
|accuracy = Superseded by accuracyTouch, accuracyShort, accuracyMedium, and accuracyLong.
|DPS = Removed. Now calculated automatically.
|healthscale = Unused. Would determine hit points for each body part.
|armorelectric = Not currently used.
|armorpoison = Not currently used.
|eggs_avg10 = Previously average per month. Game now uses seasons and template automatically calculates value.
|mobdamage = Superseded by attack1dmg
|mobdamagetype = Superseded by attack1type
|mobdamage2 = As above, for second attack
|mobdamagetype2 = As above, for second attack
|mobdamage3 = As above for, third attack
|mobdamagetype3 = As above, for third attack
}}


Example #1

Muffalo

"A large herding herbivore descended from buffalo and adapted for some exotic environment. Peaceful unless disturbed."

Base Stats

Type
AnimalsWild
Market Value
500 Silver

Pawn Stats

Move Speed
3.6 c/s
Health Scale
175% HP
Body Size
2.0
Mass - Baby
24 kg
Mass - Juvenile
60 kg
Mass - Adult
120 kg
Carrying Capacity
150 kg
Filth Rate
1
Diet
herbivorous
Life Expectancy
15 years
Manhunter Chance
1.25%
Trainable Intelligence
Intermediate
Wildness
50%
Minimum Handling Skill
4
Maturity Age
Expression error: Unexpected round operator. years Expression error: Unexpected < operator.

Production

Leather Yield
80 Muffalo leather muffalo leather
Milk Amount
6 Milk milk
Milking Interval
4 days
Wool Amount
100 Muffalo wool muffalo wool
Shearing Interval
60 days
Gestation Period
60 days
Offspring Per Birth
1

{{infobox main|animal|
|name = Muffalo
|image = Animal Muffalo side.png|200px{{!}}Muffalo
|description = "A large herding herbivore descended from buffalo and adapted for some exotic environment. Peaceful unless disturbed."
|type = Animals
|type2 = Wild
|bodysize = 2.0
|healthscale = 1.75
|movespeed = 3.6
|mobdamage = 10
|mobdamagetype = blunt
|mobdamageaverage = 10
|leathername = muffalo leather
|woolname = muffalo wool
|wool = 100
|sheartime = 60
|milk = 6
|milktime = 4
|manhunter = 0.0125
|hungerrate =
|diet = herbivorous
|trainable = intermediate
|wildness = 0.5
|handleskill = 3
|gestation = 60
|lifespan = 15
|offspring = 1
|maturityage = 3+
|marketvalue  = 500
|livesin_aridshrubland = true
|livesin_borealforest = true
|livesin_icesheet = true
|livesin_temperateforest = true
|livesin_tundra = true
}}

Example #2

Pistol

Pistol

"Ancient pattern automatic pistol. Weak and short range, but quick."

Base Stats

Type
EquipmentWeapons
Weapon Class
Modern
Market Value
200 Silver

Ranged Combat

Mode
Single-Shot
Damage
9 dmg
Warm-Up
54 ticks (0.9 secs)
Cooldown
40 ticks (0.67 secs)
Range
25.9 tile(s)
Accuracy
80% - 70% - 40% - 30%
Velocity
55 (m/s)
Burst Count
1 (per burst)
DPS
5.74

{{infobox main|weapon|pull-left
|name = Pistol
|image = Pistol.png|Pistol
|type = Equipment{{!}}Equipment
|type2 = Weapons{{!}}Weapons
|description = "Ancient pattern automatic pistol. Weak and short range, but quick."
|class = Modern
|damage = 9
|range = 24
|accuracyTouch = 91
|accuracyShort = 71
|accuracyMedium = 50
|accuracyLong = 32
|mode = Single-Shot
|warmup = 54
|cooldown = 40
|burst = 1
|DPS = DPS
|velocity = 55
|marketvalue = 200
}}