SoundDefs, trigger Ambience_stop when power loss, is it possible ?

Started by aRandomKiwi, November 12, 2018, 12:21:44 AM

Previous topic - Next topic

aRandomKiwi

Hi,

For a mod i do, i use a copy (properly renamed) of the SoundDefs of the geothermal generator (GeothermalPlant_Ambience_Start, GeothermalPlant_Ambience_Stop, GeothermalPlant_Ambience), it's fine but the building which i assign this soundDef is not a generator, so when there is a power loss it should not continue play the ambiance but instead play GeothermalPlant_Ambience_Stop, and then when power come back GeothermalPlant_Ambience_Start again.

Is it possible with XML only or it need some C# stuff (just give me functions needed) ? i dont see any way of doing this.

Thanks !

aRandomKiwi

Solved by avoiding using the "soundAmbient" building subtag of the building ThinDef and by handling manualy with custom CompThing and "ReceiveCompSignal" method ( play sound with  SoundDef.Named( <soundNameHere> ).startSustainer() ....).