Ludeon Forums

Ludeon Forums

  • November 28, 2021, 09:45:54 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Changing textures in mod based on event  (Read 541 times)

amnesiak77

  • Muffalo
  • *
  • Posts: 10
  • Refugee
    • View Profile
Changing textures in mod based on event
« on: April 27, 2021, 08:51:40 AM »

Hi,
I would like to modify Outdoor lighting mod for personal use.
I would like to add another texture for flood lights when they are lit.
Can someone suggest the code. I know I have to edit Buildings_Furniture_Outdoor.xml
Here is the code for floodlights:
Code: [Select]
<ThingDef ParentName="BuildingBase">
<defName>OutdoorFloodLights</defName>
<label>outdoor floodlights</label>
<description>Large floodlights that can illuminate a significant area outside. Without light your colonists move and work at a slower speed.</description>
    <thingClass>Building</thingClass>
    <category>Building</category>
    <minifiedDef>MinifiedThing</minifiedDef>
    <!-- need this to display over the top of pawns -->
    <altitudeLayer>Skyfaller</altitudeLayer>
    <passability>PassThroughOnly</passability>
    <selectable>true</selectable>
    <fillPercent>0.75</fillPercent>
    <pathCost>8</pathCost>
    <leaveResourcesWhenKilled>true</leaveResourcesWhenKilled>
    <resourcesFractionWhenDeconstructed>0.5</resourcesFractionWhenDeconstructed>
    <soundImpactDefault>BulletImpact_Metal</soundImpactDefault>
    <designationCategory>Furniture</designationCategory>
    <rotatable>false</rotatable>
<size>(1,1)</size>
    <uiIconOffset>(0, 0.25)</uiIconOffset>
    <uiIconScale>0.3</uiIconScale>
    <thingCategories>
    <li>BuildingsFurniture</li>
    </thingCategories>
<costList>
<Steel>100</Steel>
<ComponentIndustrial>1</ComponentIndustrial>
</costList>
    <graphicData>
<texPath>Things/Building/Furniture/floodlights</texPath>
<graphicClass>Graphic_Single</graphicClass>
<drawSize>(5,5)</drawSize>
<damageData>
<cornerTL>Damage/Corner</cornerTL>
<cornerTR>Damage/Corner</cornerTR>
<cornerBL>Damage/Corner</cornerBL>
<cornerBR>Damage/Corner</cornerBR>
</damageData>
<!--
      <shadowData>
        <volume>(0.2, 0.35, 0.13)</volume>
<offset>(0,0,-0.42)</offset>
</shadowData>
-->
    </graphicData>
    <comps>
    <li Class="CompProperties_Flickable"/>
<li Class="CompProperties_Schedule">
<startTime>0.7</startTime>
<endTime>0.3</endTime>
<offMessage>Floodlights only function at night from 17:00 through to 07:00.</offMessage>
</li>
<li Class="CompProperties_Power">
<compClass>CompPowerTrader</compClass>
<basePowerConsumption>180</basePowerConsumption>
</li>
<li Class="CompProperties_Glower">
<glowRadius>30</glowRadius>
<glowColor>(228,228,228,0)</glowColor>
</li>
    </comps>
    <placeWorkers>
    <li>PlaceWorker_NotUnderRoof</li>    <!-- Can't be built under a roof -->
    </placeWorkers>
    <statBases>
<MaxHitPoints>150</MaxHitPoints>
<WorkToBuild>1200</WorkToBuild>
<Flammability>0.2</Flammability>
<Mass>120</Mass>
    </statBases>
    <researchPrerequisites>
    <li>Electricity</li>
    </researchPrerequisites>
    <blockWind>true</blockWind>
    <!-- Seems that the tickerType is needed to get the game to observe the schedule off/on -->
    <tickerType>Rare</tickerType>
    <!-- Hopefully this means it can't be built inside -->
    <terrainAffordanceNeeded>Medium</terrainAffordanceNeeded>
    <constructEffect>ConstructMetal</constructEffect>
    <!-- This should display a "lighting circle" around the lamp when placing or moving -->
    <specialDisplayRadius>15</specialDisplayRadius>
</ThingDef>

Logged

LWM

  • Planetologist
  • ****
  • Posts: 1083
  • Little White Mouse
    • View Profile
Re: Changing textures in mod based on event
« Reply #1 on: April 27, 2021, 05:29:17 PM »

There has to be some C# code that resets the graphic internally; it's not as simple as adding another line of XML code (unless someone has already done the C# work somewhere?)
Logged

amnesiak77

  • Muffalo
  • *
  • Posts: 10
  • Refugee
    • View Profile
Re: Changing textures in mod based on event
« Reply #2 on: April 28, 2021, 04:20:47 AM »

Ok. I thought it was more simple. I don`t know coding in C#.
The mod itself looks pure xml. Thanks anyway.
Logged

LWM

  • Planetologist
  • ****
  • Posts: 1083
  • Little White Mouse
    • View Profile
Re: Changing textures in mod based on event
« Reply #3 on: April 30, 2021, 01:06:05 AM »

If you can think of a vanilla (heck, or modded) item that does that, then you have a good chance of doing it by XML :)
Logged