Jump to content

Making a status light for powered objects.


Hennimore

Recommended Posts

Hello,

 

I am looking to create an item that allows me to see whether an object is powered or not. I want to create a sort of control panel that will allow me to see if a certain generator has run out and needs refuelling without going all the way across my building.

 

My initial idea was to use a standard ceiling light as a template for this, but I was unable to find out how I modify the intensity of the lights and the colour (color for you Americans out there) and I really don't want a super bright white light if I'm honest because I don't want to light up the room, I just want a little LED type light so I can quickly and easily see if there's power.

 

Now, the power switch seems really appropriate for this use since it already has a red/green LED, but I'm trying to figure out if there is a way to modify the switch so that I can remove the switch part and set the LED to be green by default (red is also fine but I would prefer green if I'm honest).

 

So my questions are:

 

1)Is it possible to copy the switch block as a new object and remove the switch function and set the LED to be green by default when it has power?

 

2) If the answer to question 1 is "yes", how do I do it?

 

3) If the answer to question 1 is "no" then is there ANY way (no matter how lazy or shoddy) to achieve what I want to do. The lazier the better since I'm not really up to the task of spending ages modifying an item to have it not work or it being needed to be re-done for A17.

 

Thanks in advance guys.

Link to comment
Share on other sites

I think it may be possible - I'm not at a place I can test this out, however I think all you'd need to do is change the class of the switch block to powered and remove the switching function like this... In blocks.xml you will need to put this in and find a free ID number and change the {insert_free_id} as the number in there (if you have 2 same IDs the block will overwrite which you don't want)

 

<block id="{insert_free_id}" name="powerMonitor">
<property name="Class" value="Powered"/>
<property name="Material" value="Mmetal_weak"/>
<property name="StabilitySupport" value="false"/>
<property name="Shape" value="ModelEntity"/>
<property name="Mesh" value="models"/>
<property name="Model" value="Entities/Electrical/power_switchPrefab"/> <property name="HandleFace" value="South"/>
<property name="ImposterDontBlock" value="true"/>
<property name="RequiredPower" value="0"/>
<property name="Group" value="Science"/>
<property class="RepairItems"> <property name="forgedIron" value="2"/> </property>
<drop event="Destroy" name="scrapIron" count="5" prob="1"/>
<drop event="Fall" name="scrapMetalPile" count="1" prob="0.75" stick_chance="1"/>
<property name="TakeDelay" value="5"/>
<property name="EconomicValue" value="50"/>
</block>

 

Not 100% sure this will work but try this perhaps and see. Theoretically you can use this as a relay too, if it works as I think it would...

Link to comment
Share on other sites

I think it may be possible - I'm not at a place I can test this out, however I think all you'd need to do is change the class of the switch block to powered and remove the switching function like this... In blocks.xml you will need to put this in and find a free ID number and change the {insert_free_id} as the number in there (if you have 2 same IDs the block will overwrite which you don't want)

 

<block id="{insert_free_id}" name="powerMonitor">
<property name="Class" value="Powered"/>
<property name="Material" value="Mmetal_weak"/>
<property name="StabilitySupport" value="false"/>
<property name="Shape" value="ModelEntity"/>
<property name="Mesh" value="models"/>
<property name="Model" value="Entities/Electrical/power_switchPrefab"/> <property name="HandleFace" value="South"/>
<property name="ImposterDontBlock" value="true"/>
<property name="RequiredPower" value="0"/>
<property name="Group" value="Science"/>
<property class="RepairItems"> <property name="forgedIron" value="2"/> </property>
<drop event="Destroy" name="scrapIron" count="5" prob="1"/>
<drop event="Fall" name="scrapMetalPile" count="1" prob="0.75" stick_chance="1"/>
<property name="TakeDelay" value="5"/>
<property name="EconomicValue" value="50"/>
</block>

 

Not 100% sure this will work but try this perhaps and see. Theoretically you can use this as a relay too, if it works as I think it would...

 

The item itself works and indeed transmits power to other items if connected (although this functionality is not needed for my purpose), however, unfortunately the powerMonitor does not light up at all when connected to power. I've been trying to find where this code is held and what to change, but nothing seems to be jumping out at me right now.

 

The closest I can get is through browsing the xui files such as

 

xui.xml

 

XUi > controls/styles/windows.xml

 

But again, nothing jumps out at me. I'll keep looking though.

Link to comment
Share on other sites

The XUI is for things like the HUD and other such things so you probably won't find it in there. I think the light may then be part of the model and so maybe the Class line affects it. Hmm. Maybe there is a way to recolour a light...

Link to comment
Share on other sites

The XUI is for things like the HUD and other such things so you probably won't find it in there. I think the light may then be part of the model and so maybe the Class line affects it. Hmm. Maybe there is a way to recolour a light...

This is certainly a good thing that the possibility exists. I have a feeling that the classes are defined only within the Unity files, which for me, is a problem since despite following all instructions I can never get any of my modifications running. :/

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...