Jump to content

Info-Block


Recommended Posts

Hello survivors,

 

in principle, I have something very simple in mind.

I want to create a block that you can open like a workstation, which then only opens a window where an image is displayed.
This image, then, contains something like information within the game, such as a certain event.
The images come from an external server, which I can then exchange depending on the date.

 

I have seen that with the images in this mod and tried to adapt this. (Snufkin-LootboxAddon)

https://github.com/arramus/Snufkin-Weapons-Xpansion-A19-2021November20/tree/main/Snufkin_Weapons_Xpansion_LootboxAddon_A19_2021November20

 

This is what I have so far:

blocks.xml

<append xpath="/blocks">
		<block name="orb-1">
			<property name="Extends" value="stainlessSteelPillar100Cap"/>
			<property name="CustomIcon" value="stainlessSteelPillar100Cap"/>
			<property name="DescriptionKey" value="orb-1-desc"/>
			<property name="Class" value="Workstation"/>
			<property name="Path" value="solid"/>
			<property name="ImposterExchange" value="imposterBlock" param1="143"/>
			<property name="Collide" value="sight,movement,melee,bullet,arrow,rocket"/>
			<property name="OpenSound" value="open_workbench"/>
			<property name="CloseSound" value="close_workbench"/>
		</block>
	</append>

windows.xml

<append xpath="/windows">
		<window name="orb-1" anchor="CenterCenter" depth="11">
			<texture depth="11" pivot="center" width="1842" height="1036" texture="@http://nw-2.de/orb-1.png"/>
		</window>
	</append>

xui.xml

<append xpath="/xui/ruleset">
		<window_group name="workstation_orb-1" controller="XUiC_WorkstationWindowGroup">
			<window name="orb-1"/>
		</window_group>
	</append>

 

The block also shows that I can use it, but it does not open.

 

At startup, the message in the attachment comes up.

 

Can you tell me what I am doing wrong or what is still missing?

I would be really happy about that.

errormessage_at_startup.png

Link to comment
Share on other sites

Just a guess…. I’m not at home to actually test/check anything…

 

lookong at Snufkins “block” xml, there are some properties of the block that I would think need to be present in your block xml, as you’re not inheriting from a workstation block, but a “normal” block (below).  You might want to try to just copy all of his block xml (and make changes you need) and maybe it will work?  I’m not sure what they all are but I believe certain block/item/object properties don’t “extend” when you make a new block so you have to declare them every time.  Might as well just copy his block and make changes to link it to your other xml and pray.  Also: Snufkins block is not extending from any other block, so maybe that’s part of it too?

 

these are the properties in Snufkins block I would believe you would need to have (at least) as they seem workstation related. You have the “class = workstation” one but not the other two…

 

<property class="Workstation">
  <property name="Modules" value="output"/>
  <property name="CraftingAreaRecipes" value="LootboxMachine"/></property>
Edited by doughphunghus (see edit history)
Link to comment
Share on other sites

Edit: just thinking about it.  The “extends” part of your block may be the issue because you’re extending from a block that’s not a “workstation” class/entity…. So trying to then change it to “workstation” class in the properties likely isn’t going to work as it’s already another class/type. You need to either extend from an existing workstation block or not extend from any block and then have the “class = workstation” property in it to set the class as a workstation
 

try removing the “extends” part, and to “skin” the block to a cylinder shape, you will have to choose that shape as the block model.  I can’t remember the xml to do that off the top of my head, but it’s how you can basically make any block look like another. A lot of blocks don’t declare this but some do (look in the xml). I think battery banks and some other things have this xml (to choose what model the block looks like)

Link to comment
Share on other sites

Thank you for your feedback.

 

I finally managed to solve it.

 

The problem is not that you are not allowed to extend blocks, but the class 'Workstation' needs a few more windows with an appropriate suffix.
If these windows are not present, the error shown above comes.

 

I'll also post the final working XML later for those interested, once I've cleaned everything up.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...