-
Notifications
You must be signed in to change notification settings - Fork 37
CompProperties_ItemProcessor class
Robin Chang edited this page Dec 10, 2022
·
16 revisions
The CompProperties_ItemProcessor class is the heart of the Item Processor code. You add it in XML to a Building, and you can define all its variables there. A lot of possible machine combinations are possible, and it is all well commented in the code. We copy here all this code so it can serve as a reference.
Note that all the values shown here are the defaults, and they are overriden by anything fed through XML, for example <numberOfInputs>
2</numberOfInputs>
would override the 1.
For an example of how to use all this, you can take a look at our Vanilla Cooking Expanded mod here
//Buildings can be set to a number between 1 and 4. The code ignores values outside this.
//The process also needs a CombinationDef in XML
//In both cases, there is a ItemAcceptedDef to define what ingredients are accepted by what building
public int numberOfInputs = 1;
//This makes sense for 2 or 3 inputs, so one or two of them can be empty in CombinationDefs
public bool acceptsNoneAsInput = false;
//Does the resulting product use quality levels?
public bool qualitySelector = false;
//Can this building automatically grab ingredients from nearby hoppers (aka auto mode)?
public bool isAutoMachine = false;
//Is this building 100% automated, and pawns can't even bring things to it?
public bool isCompletelyAutoMachine = false;
//Semi automatic machines don't auto grab ingredients, but ingredient only needs to be set once, and pawns will instantly bring them in without
//a "bring ingredients" order. The machine also won't "forget" the set ingredient.
public bool isSemiAutomaticMachine = false;
//Can this building only be loaded/unloaded from its interaction spot?
//Separate fields for loading/unloading offers flexibility
//(e.g. a giant funnel-like building that can be loaded from any nearby cell, but only unloaded from a specific cell)
public bool mustLoadFromInteractionSpot = false;
public bool mustUnloadFromInteractionSpot = false;
//Can this building automatically drop products on its interaction spot?
public bool isAutoDropper = false;
//Does this building ignore its ingredients? (this has no effect if the resulting product doesn't have ingredients anyway)
public bool ignoresIngredientLists = false;
//Does this building accept category recipes?
public bool isCategoryBuilding = false;
//Does this building have the player specify output instead of input?
public bool isMachineSpecifiesOutput = false;
//Can this processor be "paused"
public bool isMachinePausable = false;
//Transfer ingredients: instead of adding the inputs as ingredients, it adds the inputs' ingredients as ingredients. Yeah, confusing...
//Example, if false, and input = Milk and output = Cheese, Cheese will have Milk as an ingredient
//If true, and input = Uncooked Soup and output = Cooked Soup, Cooked Soup will have the same ingredients list as Uncooked Soup (for example human meat and corn)
public bool transfersIngredientLists = false;
//Custom descriptions for ingredient insertion buttons
public string InsertFirstItemDesc = "IP_InsertFirstItemDesc";
public string InsertSecondItemDesc = "IP_InsertSecondItemDesc";
public string InsertThirdItemDesc = "IP_InsertThirdItemDesc";
public string InsertFourthItemDesc = "IP_InsertFourthItemDesc";
//Custom image for choosing a new ingredient
public string chooseIngredientsIcon = "UI/IP_NoIngredient";
//Custom descriptions and button image for bringing ingredients to the building
public string bringIngredientsText = "IP_BringIngredients";
public string bringIngredientsDesc = "IP_BringIngredientsDesc";
public string bringIngredientsIcon = "UI/IP_InsertIngredients";
//Custom descriptions and button image for cancelling bringing ingredients to the building
public string cancelIngredientsText = "IP_CancelIngredients";
public string cancelIngredientsDesc = "IP_CancelIngredientsDesc";
public string cancelIngredientsIcon = "UI/IP_CancelIngredients";
//Custom descriptions and button image for resetting auto in semiautomatic machines
public string resetSemiautomaticText = "IP_ResetSemiautomatic";
public string resetSemiautomaticDesc = "IP_ResetSemiautomaticDesc";
public string resetSemiautomaticIcon = "UI/IP_SemiautomaticReset";
//Does lack of power or fuel destroy the production progress?
public bool noPowerDestroysProgress = false;
//If yes, on how many rare ticks (1 rare tick = aprox 4 seconds)?
public int rareTicksToDestroy = 10;
//Custom warning to pop up once if power/fuel is interrupted
public string noPowerDestroysInitialWarning = "IP_NoPowerDestroysInitialWarning";
//Custom message to pop up if production is interrupted
public string noPowerDestroysMessage = "IP_NoPowerDestroysMessage";
//Custom descriptions and button image for colonist removing the product from the building
public string removeProductText = "IP_RemoveProduct";
public string removeProductDesc = "IP_RemoveProductDesc";
public string removeProductIcon = "UI/IP_ExtractProduct";
//Does the building destroy its internally stored ingredients at the very start of the process,
//or only when the product has reached awful quality?
//This mainly affects what happens when the building is destroyed, since it will pop up its
//ingredients if they haven't been destroyed
public bool destroyIngredientsAtStartOfProcess = false;
public bool destroyIngredientsAtAwfulQuality = false;
//Graphic of the building when it is working.
public string buildingOnGraphic ="";
//Graphic of the building when it is finished.
public string buildingFinishedGraphic ="";
//Shader to be used for working image
public ShaderTypeDef shaderForBuildingOnGraphic = null;
//Shader to be used for finished image
public ShaderTypeDef shaderForBuildingFinishedGraphic = null;
//This defines whether the building is affected by bright light or lack of light
public bool isLightDependingMachine = false;
public float maxLight = 1f;
public float minLight = 0f;
public string messageIfOutsideLightRangesWarning = "IP_OutsideLightRange";
public string messageIfOutsideLightRanges = "IP_SpoiledDueToLight";
public int rareTicksToDestroyDueToLight = 30;
//This defines whether the building is affected by rain
public bool isRainDependingMachine = false;
public string messageIfRainWarning = "IP_ItRains";
public string messageIfRain = "IP_SpoiledDueToRain";
public int rareTicksToDestroyDueToRain = 30;
//This defines whether the building is affected by temperature
public bool isTemperatureDependingMachine = false;
public float maxTemp = 1f;
public float minTemp = 0f;
public string messageIfWrongTempWarning = "IP_WrongTemp";
public string messageIfWrongTemp = "IP_SpoiledDueToWrongTemp";
public int rareTicksToDestroyDueToWrongTemp = 30;
//This defines whether the building shows a fermenting progress bar like base game's
public bool showProgressBar = false;
//This defines whether the building shows a simple progress bar that goes from red to green
public bool showFactoryProgressBar = false;
//Full auto machines specify input slots for their hoppers
public List<IntVec3> inputSlots = null;
- QuestNode_GetFaction
- Expandable projectiles
- Faction Def Extension
- Toggable patches
- Recipes Inheritance
- Adding new backstories
- Spawning things on new generated maps
- ThoughtExtensions
- WeatherLetterExtensions
- WeatherOverlayExtension
- WeatherEffectsExtension
- ThingDefExtension
- Stuff commonality extension
- Biome extension
- PipeSystem basics
- Resource
- Resource storage
- Resource processor
- Resource to thing
- Resource to power
- Thing to resource
- Resource trader
- Refill building with pipes
- Pipe valve
- Update to KCSG 2.0
- Exporting buildings
- Customizing symbols
- Debug helpers options
- Custom faction settlement
- Custom structure and scenarios
- Custom structure in quests
- Custom structure in WorldObjects
- Biome based structures
- Spawning world object(s) at world generation
- Prevent settlement spawning for nomadic factions
- Animal Behaviours Basics
-
Animal Behaviours Comp Classes
- Acid Attacks and Acid Immunity
- Animal Resources
- Animal Resources On Caravan
- Apply Hediff When Bound
- Asexual Reproduction
- Auto Nutrition
- Blink
- Build Periodically
- Cause Incident
- Change Def if Not Unique
- Change Weather
- Corpse Decayer
- Destroy This Item
- Die After Period
- Die And Change Into Another Def
- Dig Periodically
- Dig When Hungry
- Disease Event Immunity
- Disease Immunity
- Diseases After Period
- Doesn't flee
- Draftability
- Drop on Death
- Eat Weird Food
- Electrified
- Enrage Other Pawns
- Exploding Hatcher
- Extreme Xenophobia
- Fertilizer
- Filth Producer
- Fixed Gender
- Floating
- Gas Producer
- Give Thoughts On Caravan
- Graphic by Style
- Graphic by Terrain
- Hediff Effecter
- Hediff When Fleeing
- Highly Flammable
- Infecter
- Initial Ability
- Initial Hediff
- Initial Mental State
- Last Stand
- Light Sustenance
- Metamorphosis
- Mind Effecter
- Nearby Effecter
- No Taming Decay
- Passive Regenerator
- Pawn Overlay
- Produces no filth
- Refueling
- Regeneration
- State After Health Loss
- Summon On Spawn
- Swallow Whole
- Thought Effecter
- Untameable
- Animal Behaviours Hediff Comp Classes
- Animal Behaviours Damage Workers
- Animal Behaviours Def Extensions
- Animal Behaviours Extra Defs
- Animal Behaviours Misc