边缘世界 RimWorld

边缘世界 RimWorld

Knick Knacks - Let your colonists decorate!
 此主题已被置顶,因此可能具有重要性
turkler  [开发者] 11 月 1 日 上午 7:34
Knick Knacks and You - A guide to making your own knick knacks
Patching buildings to be eligible/ineligible surfaces for knick knacks
Knick Knacks' eligible surface search works based on building tags. You can have the mod recognize any surface as eligible for clutter by patching the SEX_ClutterableSurface tag onto it. For example:

<Operation Class="PatchOperationAdd"> <xpath>Defs/ThingDef[@Name="TableBase"]/building</xpath> <value> <buildingTags> <li>SEX_ClutterableSurface</li> </buildingTags> </value> </Operation>

That's it, the code will automatically pick up any such buildings in rooms as eligible surfaces for knick knacks.
Alternatively, if you want to blacklist a building, you can patch the SEX_InvalidSurfaceForClutter onto it.

<?xml version="1.0" encoding="utf-8"?> <Patch> <Operation Class="PatchOperationFindMod"> <mods> <li>Vanilla Furniture Expanded</li> </mods> <match Class="PatchOperationSequence"> <operations> <li Class="PatchOperationAdd"> <xpath>Defs/ThingDef[defName="Table_Counter"]/building</xpath> <value> <buildingTags> <li>SEX_InvalidSurfaceForClutter</li> </buildingTags> </value> </li> </operations> </match> </Operation> </Patch>

Making new knick knacks
There are a few requirements for knick knack buildings, like having the BuildingOnTop altitude layer so they can actually be on top of buildings, so I recommend just inheriting from the SEX_ClutterBase base. Afterwards, you can define a new knick knack like such:

<ThingDef ParentName="SEX_ClutterBase"> <defName>SEX_PictureFrame</defName> <label>picture frame</label> <graphicData> <texPath>Things/Building/Clutter/SEX_PictureFrame</texPath> <graphicClass>Graphic_Random</graphicClass> <drawSize>(1,2)</drawSize> </graphicData> <building> <buildingTags> <li>SEX_Clutter</li> <li>SEX_BedroomClutter</li> </buildingTags> </building> </ThingDef>

Once again, Knick Knacks' systems use building tags to determine what type of clutter is allowed in a certain room.
This will be expanded in the future, but for now:
  • SEX_DiningRoomClutter is used to mark knick knacks for dining rooms.
  • SEX_BedroomClutteris used to mark knick knacks for bedrooms.
最后由 turkler 编辑于; 11 月 1 日 上午 7:36