[ Help ] Adding new facility

Started by Flammable, July 16, 2018, 04:14:12 AM

Previous topic - Next topic

Flammable

Hi everyone. I'm trying to make a mod that adds a new facility to the game. It is supposed to increase the joy of using a tv etc. but i don't know why when I build it, it says 'inactive' next to entertainment strength factor.  :-\  Code below:
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
    <ThingDef Name="BuildingBase" Abstract="True">
        <category>Building</category>
        <thingClass>Building</thingClass>
        <soundImpactDefault>BulletImpactMetal</soundImpactDefault>
        <selectable>true</selectable>
        <drawerType>MapMeshAndRealTime</drawerType>
        <terrainAffordanceNeeded>Light</terrainAffordanceNeeded>
        <repairEffect>Repair</repairEffect>
        <leaveResourcesWhenKilled>true</leaveResourcesWhenKilled>
        <filthLeaving>BuildingRubble</filthLeaving>
        <statBases>
            <SellPriceFactor>0.70</SellPriceFactor>
        </statBases>
    </ThingDef>

    <ThingDef ParentName="BuildingBase">
        <defName>Console</defName>
        <label>games console</label>
        <graphicData>
            <texPath>Things/Building/Misc/Console</texPath>
            <graphicClass>Graphic_Multi</graphicClass>
            <drawSize>(2,1)</drawSize>
            <color>(96,114,95)</color>
            <damageData>
                <cornerTL>Damage/Corner</cornerTL>
                <cornerTR>Damage/Corner</cornerTR>
                <cornerBL>Damage/Corner</cornerBL>
                <cornerBR>Damage/Corner</cornerBR>
            </damageData>
        </graphicData>
        <altitudeLayer>Building</altitudeLayer>
        <passability>PassThroughOnly</passability>
        <castEdgeShadows>true</castEdgeShadows>
        <staticSunShadowHeight>0.35</staticSunShadowHeight>
        <fillPercent>0.5</fillPercent>
        <canOverlapZones>false</canOverlapZones>
        <statBases>
            <MaxHitPoints>100</MaxHitPoints>
            <WorkToBuild>1800</WorkToBuild>
            <Mass>40</Mass>
            <Flammability>1.0</Flammability>
        </statBases>
        <description>Increases work speed. Needs to be placed near workbench. One workbench can be simultaneously linked to only two tools cabinets.</description>
        <size>(2,1)</size>
        <costList>
            <Steel>200</Steel>
        </costList>
        <designationCategory>Misc</designationCategory>
        <minifiedDef>MinifiedFurniture</minifiedDef>
        <comps>
            <li Class="CompProperties_Facility">
                <statOffsets>
                    <EntertainmentStrengthFactor>0.5</EntertainmentStrengthFactor>
                </statOffsets>
                <linkableBuildings>
                    <li>PokerTable</li>
                    <li>TubeTelevision</li>
                </linkableBuildings>
            </li>
        </comps>
        <placeWorkers>
            <li>PlaceWorker_ShowFacilitiesConnections</li>
        </placeWorkers>
    </ThingDef>

</Defs>
I've also added screen in the attachment.

[attachment deleted due to age]

AileTheAlien

#1
The only two things I see that might be problems, are:
- You're overriding the BuildingBase definition that everything else in the game uses. You don't want to do that if you just want to add a new building.
- You've got the <linkableBuildings> defined in your game-console building, rather than in the TV / other buildings that will hook up to it. Maybe it's bi-directional, but the tool-cabinet you're copying off of has the stat bonus defined in the tool-cabinet, and the linkable defined in the benches. Maybe putting that into the TV will work?

Flammable

You're right. I've added it to linkable facilities in tv and everything seems to be working! Thank you.