First time posting here, I have been playing A17 (also some earlier alphas) with a couple of friends and so far we've been enjoying it.
I love all the new POI lights that were added to the game for decoration but I've been struggling trying to find a way to allow the player to toggle them on or off. I would be very grateful if anyone could help me with this. This is what I tried so far:
First, I added the light I wanted to mod as a new block that inherits most of the properties from the original block and renamed it to e.g. lanternDecorLightPlayer. So in game there would be two blocks; lanternDecorLight which would be the POI lantern and lanternDecorLightPlayer which would be a craftable lantern for the player. Sample XPath code:
Code:
<configs>
<append xpath="/blocks">
<block name="lanternDecorLightPlayer">
<property name="Class" value="Light"/>
<property name="Extends" value="porchLight01"/>
<property name="CustomIcon" value="lanternDecorLight"/>
<property name="CreativeMode" value="Player"/>
<property name="RuntimeSwitch" value="true"/>
<property name="TakeDelay" value="5"/>
<property name="Model" value="Entities/Lighting/lanternDecorPrefab"/>
</block>
</append>
</configs>
Now if I set the
Class property to
PoweredLight it all works fine I can hook up a generator and allow the lights to be toggled by the player on or off. This is great for most of the light like the ceiling fan lamps etc...
BUT I would also like to have the ability to toggle the lantern/torch block on or off without it being hooked up to a generator.
I've tried to set the
Class to
Light, but even with the
RuntimeSwitch property set to
true I get no option to toggle the lights. I've dug deeper into the .dll and found that the class BlockLight has several checks for _world.IsEditor() (which I think is the prefab editor mode?). I've modified the dll to disable these checks and that worked well. I was able to get the lights to toggle using the Light class without being in the prefab editor mode. Which btw brings up this cool customisation menu:
View attachment 25673
However, this workaround is not optimal since it allows me to toggle every POI light even those not owned by the player. What I was wondering is; is there a way to set the class to PoweredLight and have it turn on without any generators/battery banks being hooked up to it. If that is not possible, would it be possible to use the dedicated ModAPI to somehow load a custom block class into the game? Say BlockPlayerLight, I know its possible with SDX but I would ideally prefer to not use it.
If anyone is interested in using it, I've uploaded the modified Assembly-CSharp.dll that removes the _world.IsEditor() check so you can use the menu in the normal game mode:
Alpha 17 B208
Some more screenshots of the menu if anyone is interested:
View attachment 25674View attachment 25675View attachment 25676View attachment 25677
Download History:
Alpha 17 B208
Alpha 17 B199