Jump to content

[MOD?] [ASSISTANCE NEEDED] POI Lights


P_E_T_E

Recommended Posts

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:

 

<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:

 

20181125152428_1.thumb.jpg.ac7af62f50c3fa4a228a0818f539060a.jpg

 

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:

20181125152448_1.thumb.jpg.b48776c94472d05f071d172bb39c44cf.jpg

 

Download History:

Alpha 17 B208

Alpha 17 B199

20181125152401_1.thumb.jpg.ee9d5bbbc809f82f82f3bf03d0344f4d.jpg

20181125152357_1.thumb.jpg.d0ba11620714330b9c6801f1c562260b.jpg

20181125152325_1.thumb.jpg.0f6d99cddc42058de68bc48e7fd6f5d4.jpg

Link to comment
Share on other sites

Great work. I hope you can put it in a package

 

Thanks, what do you mean by package? Do you mean the xml files containing the blocks/recipes? I didn't spend a lot of time working on that mostly tried 1 or 2 blocks to do some tests but once I do the rest I can make it available as well. If you mean the menu you can just replace the Assembly-CSharp.dll in 7DaysToDie_Data\Managed with the one in the download link (make a backup of the original just in case you want to revert back)

 

Beautiful! I hope you keep it updated for future ex builds, and the final stable build! You know that feeling when you got something you never knew you needed? :)

 

I was just trying to do the same thing you were. Didn't have luck with RuntimeSwitch etc. You got further than I did though. Not really able to help but thanks for the modded .dll. Keeping an eye on this.

 

 

Yeah felt great, never went into the prefab editor so I never saw the menu before was surprised when I tried to turn on the light and saw all those customisable options. Its pretty cool, it lets you change the light to any color, set to constant, flicker or strobe, it even lets you change the angle, cant wait to use it to customise some of our future bases. Wasn't planning on keeping it updated, but if anyone is still interested in it I don't mind updating the dll.

 

Curious, why not use sdx? It's made for exactly this.

I like to keep the server with as few mods as possible and simple for my friends to use/install. Mostly xml changes like recipes etc... that get pushed to them automatically without them having to install any files. I also think it would be a bit overkill to use SDX for just 1 item class. I was maybe hoping to find a workaround like setting the power requirement to 0 of a PoweredBlock (doesnt work just an example). We did use it before on other alphas to play the starvation mod which was fun but that included a lot of changes and additions so I didn't mind using it.

Link to comment
Share on other sites

Can you download the Assembly-CSharp. DLL and use it? No Code:?

 

Yes, if you download Assembly-CSharp.dll and copy it to 7DaysToDie_Data\Managed you can use the menu. The menu will show up if you press 'e' on any block/light that uses the 'Light' Class, so most POI lights. It wont show up on player made lights since they use the PoweredLight Class. For now you can spawn POI lights using the creative menu as I did not have time yet to continue the recipes and block xmls.

Link to comment
Share on other sites

Nice mod. Good work. I tried this few days ago and worked. Today start A17 but game cant load,black screen upon a start. Maybe beacuse of a new A17 build? Remove that file and game works again...very strange

 

Yes, as Batman! said there was an update today and unlike the modlets this needs to be updated with every release. I've updated the main post with links that should work with the new update (A17B208).

Link to comment
Share on other sites

Ah, thanks again. I've never really messed with .dll editing or C Sharp before but I found a guide specifically for modding the 7d2d Assembly dll so I can do this myself if need be in the future, and maybe be able to do a few other things I seem to be unable to with just the XMLs. Is it just a matter of removing the entire _world.IsEditor() check lines? I think it'd be cool if they just changed the checks to world is editor 'or' cheat mode enabled, I mean if you're cheating and using the creative menu anyway why not.

Link to comment
Share on other sites

You can create new dll project and add new class use your code.

 

build it and copy to you game directory.

 

the directory should be like "E:\SteamLibrary\steamapps\common\7 Days To Die\7DaysToDie_Data\Managed".

 

if The dll name is "mods.dll" and the class name is "Light"

 

you can use xml add item like :

 

<configs>

<append xpath="/blocks">

	<block name="lanternDecorLightPlayer">
		<property name="Class" value="Light,mods"/>
		<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 the lanternDecorLightPlayer can edit and no need power.:smile-new:

 

I didn't try, I think EAC maybe friendly.

Link to comment
Share on other sites

You can create new dll project and add new class use your code.

 

build it and copy to you game directory.

 

the directory should be like "E:\SteamLibrary\steamapps\common\7 Days To Die\7DaysToDie_Data\Managed".

 

if The dll name is "mods.dll" and the class name is "Light"

 

you can use xml add item like :

 

<configs>

<append xpath="/blocks">

	<block name="lanternDecorLightPlayer">
		<property name="Class" value="Light,mods"/>
		<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 the lanternDecorLightPlayer can edit and no need power.:smile-new:

 

I didn't try, I think EAC maybe friendly.

 

Exactly what I needed thanks! I created a dll called mods.dll with a new class BlockPlayerLight, for the class code I simply copy pasted the decompiled BlockLight class and removed the editor world checks and used this xml code for the block:

 

<configs>

<append xpath="/blocks">

	<block name="lanternDecorLightPlayer">
		<property name="Class" value="PlayerLight,mods"/>
		<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>

 

For the class name I removed Block because the game adds that automatically when looking for the class and it works great I can access the menu and toggle lights without modifying Assembly-CSharp.dll

 

I will try to create the recipies and the block xmls and put it up for download if anyone wants to use it. Thanks for your help!

Link to comment
Share on other sites

I hope someone will make it and integrate it into a zip package.

 

Made a seperate thread for a packaged zip: https://7daystodie.com/forums/showthread.php?97453-MOD-Portable-Lights

It does not use a modified Assembly-CSharp.dll so it should be ok between most updates however, it disables the ability to custimise POI lights only the player made lantern and flashlight are custimisable.

Link to comment
Share on other sites

  • 2 weeks later...
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:

 

<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:

 

[ATTACH=CONFIG]25673[/ATTACH]

 

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:

[ATTACH=CONFIG]25674[/ATTACH][ATTACH=CONFIG]25675[/ATTACH][ATTACH=CONFIG]25676[/ATTACH][ATTACH=CONFIG]25677[/ATTACH]

 

Download History:

Alpha 17 B208

Alpha 17 B199

 

Can we get one for B221 - Use this ALOT!! Thanks in advance

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...