Jump to content

Cleaning Up Modlet


Recommended Posts

I've had a personal modlet with some "water" features I prefer and I've used it on a number of play throughs. But I'm now using it on a Tradeless play through and I'm seeing some bugs that either escaped my notice or weren't worth messing with at the time.

 

(1) Unflitered Dew Collector -- Doesn't show an inventory.

 

I feel embarrassed to admit that I've done a number of playthroughs and never noticed my Unfiltered Dew Collector didn't work. I think that's because when I've played with a Trader, I was always able to buy a Filter when I wanted to make a Dew Collector, or that I used my recipe to make a filter, so that I always crafted a regular Dew Collector. Now, without Traders, I made an Unfiltered one. I could have sworn I tested this when I made the modlet, but perhaps not. I suspect what I tested at the time was just changing a Dew Collector to produce murky water.

 

In any event, this block can be placed and all, but doesn't give me the "Dew Collector is Empty" message or the ability to open up the inventory. I've missed something. I'm not sure what. I'm starting to suspect I've not connected something to the UI?

 

    <append xpath="/blocks">
        <block name="zzUnfilteredDewCollector">
            <property name="Extends" value="cntDewCollector" param1="Class"/>
            <property name="ConvertToItem" value="drinkJarRiverWater"/>
            <property name="CustomIcon" value="cntDewCollector"/>
            <property name="Model" value="Entities/Furniture/collectorDewPrefab"/>
            <property name="HeatMapStrength" value="0.5"/>
            <property name="HeatMapTime" value="4000"/>
            <property name="HeatMapFrequency" value="1000"/>
        </block>
    </append>

 

(2) Taking Water from a Water Source still says "Drink" instead of "Take" and the Delay in-game doesn't look right.

 

If I'm not mistaken, this change should make the game say "Press E to Take" instead of "Press E to Drink", but the change appears to have no effect. I'm wondering if I've missed something. lblContextActionTake says "Take" in the Localization.txt file, but I still see "Drink" in-game.

 

Also, the delay of 6 seconds works fine, though the action appears to only take 1 second. That is, you can only perform the action once every 6 seconds, but you get the jar of water after 1 second and are otherwise free to move.

 

<setattribute xpath="/items/item[@name='meleeHandPlayer']/property[@class='Action2']/property[@name='Delay']" name="value">6</setattribute>

<setattribute xpath="/items/item[@name='meleeHandPlayer']/property[@class='Action2']/property[@name='Sound_start']" name="value">bucketfill_water</setattribute>

<setattribute xpath="/items/item[@name='meleeHandPlayer']/property[@class='Action2']/property[@name='Description']" name="value">lblContextActionTake</setattribute>

<append xpath="/items/item[@name='meleeHandPlayer']/property[@class='Action2']">
    <property name="Create_item" value="drinkJarRiverWater"/>
    <property name="Create_item_count" value="1"/>
</append>

<remove xpath="/items/item[@name='meleeHandPlayer']/effect_group[@name='Drink']" />

 

Link to comment
Share on other sites

2 hours ago, zztong said:

I've had a personal modlet with some "water" features I prefer and I've used it on a number of play throughs. But I'm now using it on a Tradeless play through and I'm seeing some bugs that either escaped my notice or weren't worth messing with at the time.

 

(1) Unflitered Dew Collector -- Doesn't show an inventory.

 

I feel embarrassed to admit that I've done a number of playthroughs and never noticed my Unfiltered Dew Collector didn't work. I think that's because when I've played with a Trader, I was always able to buy a Filter when I wanted to make a Dew Collector, or that I used my recipe to make a filter, so that I always crafted a regular Dew Collector. Now, without Traders, I made an Unfiltered one. I could have sworn I tested this when I made the modlet, but perhaps not. I suspect what I tested at the time was just changing a Dew Collector to produce murky water.

 

In any event, this block can be placed and all, but doesn't give me the "Dew Collector is Empty" message or the ability to open up the inventory. I've missed something. I'm not sure what. I'm starting to suspect I've not connected something to the UI?

 

    <append xpath="/blocks">
        <block name="zzUnfilteredDewCollector">
            <property name="Extends" value="cntDewCollector" param1="Class"/>
            <property name="ConvertToItem" value="drinkJarRiverWater"/>
            <property name="CustomIcon" value="cntDewCollector"/>
            <property name="Model" value="Entities/Furniture/collectorDewPrefab"/>
            <property name="HeatMapStrength" value="0.5"/>
            <property name="HeatMapTime" value="4000"/>
            <property name="HeatMapFrequency" value="1000"/>
        </block>
    </append>

 

(2) Taking Water from a Water Source still says "Drink" instead of "Take" and the Delay in-game doesn't look right.

 

If I'm not mistaken, this change should make the game say "Press E to Take" instead of "Press E to Drink", but the change appears to have no effect. I'm wondering if I've missed something. lblContextActionTake says "Take" in the Localization.txt file, but I still see "Drink" in-game.

 

Also, the delay of 6 seconds works fine, though the action appears to only take 1 second. That is, you can only perform the action once every 6 seconds, but you get the jar of water after 1 second and are otherwise free to move.

 

<setattribute xpath="/items/item[@name='meleeHandPlayer']/property[@class='Action2']/property[@name='Delay']" name="value">6</setattribute>

<setattribute xpath="/items/item[@name='meleeHandPlayer']/property[@class='Action2']/property[@name='Sound_start']" name="value">bucketfill_water</setattribute>

<setattribute xpath="/items/item[@name='meleeHandPlayer']/property[@class='Action2']/property[@name='Description']" name="value">lblContextActionTake</setattribute>

<append xpath="/items/item[@name='meleeHandPlayer']/property[@class='Action2']">
    <property name="Create_item" value="drinkJarRiverWater"/>
    <property name="Create_item_count" value="1"/>
</append>

<remove xpath="/items/item[@name='meleeHandPlayer']/effect_group[@name='Drink']" />

 

 

Hi Zztong

 

For the first question, you need to add the UI for the new block, that's why you get an error.
Second question, I think the action is fine that way, but that is a matter of taste.

It should work as you have it, but it may be hardcode, I don't know.
Another option that you can use instead of setattribute, use set, just an opinion, I may be wrong.

 

Regards
Gouki

Link to comment
Share on other sites

3 hours ago, Gouki said:

For the first question, you need to add the UI for the new block, that's why you get an error.

 

I'm not getting an error. I don't get any interaction.

 

I started to look through the XUi configurations for the first time. I kind of see how XUi/xui.xml connects to XUi/windows.xml to XUi/controls.xml. What I have not found is how anything in blocks.xml connects to XUi/xui.xml.

 

Perhaps things are connecting based on the block's name? I tried defining a window_group with the same name as my custom block, but that had no effect.

 

I found an old conversation talking about this property for a block definition, which I adapted to try to connect the the existing "dewcollector" window_group. That property only appears on the "tableSaw" block, and it's value perfectly matches the XUi/xui.xml window_group name, so I tried the same but for a dew collector.

 

<property name="WorkstationWindow" value="dewcollector"/>

 

No such luck. I feel like I'm overlooking something obvious.

Link to comment
Share on other sites

37 minutes ago, zztong said:

 

I'm not getting an error. I don't get any interaction.

 

I started to look through the XUi configurations for the first time. I kind of see how XUi/xui.xml connects to XUi/windows.xml to XUi/controls.xml. What I have not found is how anything in blocks.xml connects to XUi/xui.xml.

 

Perhaps things are connecting based on the block's name? I tried defining a window_group with the same name as my custom block, but that had no effect.

 

I found an old conversation talking about this property for a block definition, which I adapted to try to connect the the existing "dewcollector" window_group. That property only appears on the "tableSaw" block, and it's value perfectly matches the XUi/xui.xml window_group name, so I tried the same but for a dew collector.

 

<property name="WorkstationWindow" value="dewcollector"/>

 

No such luck. I feel like I'm overlooking something obvious.

 

You can try this, it should work for you, it's how I have it done.
Be sure to pick up and put the block back in case it doesn't work.

 

XUi.xml:

 

 <append xpath="/xui/ruleset">
    
        <window_group name="zzUnfilteredDewCollector" left_panel_valign_top="false" controller="XUiC_DewCollectorWindowGroup" close_compass_on_open="true">
            <window name="windowzzUnfilteredDewCollector"/>
            <window name="windowNonPagingHeader" />
        </window_group>
        
    </append>

 

Windows.xml:

 

<append xpath="/windows">

<window name="windowzzUnfilteredDewCollector" width="{windowWidth}" height="378" controller="DewCollectorWindow" panel="Left" anchor_side="bottomright" visible="false" cursor_area="true" >
    <panel name="header" height="43" depth="0" disableautobackground="true" anchor_left="queue,0,-3" anchor_right="queue,1,0" >
        <sprite depth="1" name="headerbackground" sprite="ui_game_panel_header" anchor_left="queue,0,-3" anchor_right="queue,1,0" />
        <sprite depth="3" name="windowIcon" style="icon32px" pivot="center" pos="21,-21" sprite="ui_game_symbol_loot_sack" />
        <label depth="2" name="lootName" pos="39,-6" width="180" height="32" text_key="xuiDewCollector" font_size="32" />
        
        <rect anchor_left="queue,1,-300" anchor_right="queue,1,0" pivot="topleft" pos="0,0" controller="ContainerStandardControls" createuiwidget="true" visible="false">
            <!-- <button   depth="3" name="btnSort"             sprite="ui_game_symbol_sort"          tooltip_key="lblSortContainer"        pos="194, -22" style="icon32px, press, hover" pivot="center" sound="[paging_click]" /> -->
            <!-- <button   depth="3" name="btnMoveAll"          sprite="ui_game_symbol_store_all_up"     tooltip="{take_all_tooltip}"          pos="274, -22" style="icon32px, press, hover" pivot="center" sound="[paging_click]" /> -->
            <!-- <button   depth="3" name="btnMoveFillAndSmart" sprite="ui_game_symbol_store_similar_up" tooltip_key="xuiLootTakeFillAndSmart" pos="234, -22" style="icon32px, press, hover" pivot="center" sound="[paging_click]" /> -->
        </rect>
        
    </panel>
    <rect name="content" pos="3,-49" >
        <sprite depth="0" name="bg" color="255,255,255,1" type="sliced" sprite="menu_empty" anchor_left="queue,0,-3" anchor_bottom="queue,0,0" anchor_right="queue,1,0" anchor_top="queue,1,49" on_press="true" />
        <grid depth="12" name="queue" rows="1" cols="3" cell_width="75" cell_height="75" repeat_content="true" controller="DewCollectorContainer" required_item="drinkJarEmpty">
            <dewcollector_stack controller="DewCollectorStack" override_stack_count="1" name="0"/>
        </grid>
    </rect>
</window>    
    
</append>

 

Regards

Gouki

Link to comment
Share on other sites

6 minutes ago, Gouki said:

You can try this, it should work for you, it's how I have it done.
Be sure to pick up and put the block back in case it doesn't work.

 

Thanks. I'll try that. I do see a difference. Our entries in XUi/xui.xml are the same, except that I tried to call on the existing dewcollector window, instead of making another entry in XUi/windows.xml as you are showing.

 

So is the connection between blocks.xml and xui.xml the block name? If so, I don't get how "cntDewCollector" matches up with "dewcollector" in the Vanilla files. Maybe I'm looking at it wrong. Maybe the block's name is matching up with what is in windows.xml?

 

I've got both your xui.xml and windows.xml code in place and have verified they are being applied to the game.

 

The zzUnfilteredDewCollector is completely unresponsive. Maybe I cannot "Extend" cntDewCollector to define my own? I'm still lost as to how to connect a block to a UI. There's no obvious tag.

 

The DewCollector doesn't seem to follow the other workstations in its definition, so following the examples of other workstations doesn't seem right.

Link to comment
Share on other sites

And so I have it in blocks.

 

Blocks:

 

<append xpath="/blocks">
    <block name="zzUnfilteredDewCollector">
        <property name="Extends" value="cntDewCollector"/>
        <property name="ConvertToItem" value="drinkJarRiverWater"/>
        <property name="CustomIcon" value="cntDewCollector"/>
        <property name="HeatMapStrength" value="0.5"/>
        <property name="HeatMapTime" value="4000"/>
        <property name="HeatMapFrequency" value="1000"/>
        <property name="SortOrder1" value="B281"/>
        <property name="SortOrder2" value="0100"/>
    </block>
</append>

 

I just checked it and it works perfect.

 

Regards

Gouki

 

 

Link to comment
Share on other sites

For clarity:

 

blocks.xml

    <append xpath="/blocks">
        <block name="zzUnfilteredDewCollector">
            <property name="Extends" value="cntDewCollector" param1="Class"/>
            <property name="ConvertToItem" value="drinkJarRiverWater"/>
            <property name="CustomIcon" value="cntDewCollector"/>
            <property name="Model" value="Entities/Furniture/collectorDewPrefab"/>
            <property name="HeatMapStrength" value="0.5"/>
            <property name="HeatMapTime" value="4000"/>
            <property name="HeatMapFrequency" value="1000"/>
            <!-- property name="WorkstationWindow" value="dewcollector"/ -->
        </block>
    </append>

 

XUi/xui.xml

    <append xpath="/xui/ruleset">

        <window_group name="zzUnfilteredDewCollector" left_panel_valign_top="false" controller="XUiC_DewCollectorWindowGroup" close_compass_on_open="true">
            <window name="windowzzUnfilteredDewCollector"/>
            <window name="windowNonPagingHeader" />
        </window_group>

    </append>

 

XUi/windows.xml

    <append xpath="/windows">

        <window name="windowzzUnfilteredDewCollector" width="{windowWidth}" height="378" controller="DewCollectorWindow" panel="Left" anchor_side="bottomright" visible="false" cursor_area="true" >
            <panel name="header" height="43" depth="0" disableautobackground="true" anchor_left="queue,0,-3" anchor_right="queue,1,0" >
                <sprite depth="1" name="headerbackground" sprite="ui_game_panel_header" anchor_left="queue,0,-3" anchor_right="queue,1,0" />
                <sprite depth="3" name="windowIcon" style="icon32px" pivot="center" pos="21,-21" sprite="ui_game_symbol_loot_sack" />
                <label depth="2" name="lootName" pos="39,-6" width="180" height="32" text_key="xuiDewCollector" font_size="32" />

                <rect anchor_left="queue,1,-300" anchor_right="queue,1,0" pivot="topleft" pos="0,0" controller="ContainerStandardControls" createuiwidget="true" visible="false">
                </rect>

            </panel>
            <rect name="content" pos="3,-49" >
                <sprite depth="0" name="bg" color="255,255,255,1" type="sliced" sprite="menu_empty" anchor_left="queue,0,-3" anchor_bottom="queue,0,0" anchor_right="queue,1,0" anchor_top="queue,1,49" on_press="true" />
                <grid depth="12" name="queue" rows="1" cols="3" cell_width="75" cell_height="75" repeat_content="true" controller="DewCollectorContainer" required_item="drinkJarEmpty">
                    <dewcollector_stack controller="DewCollectorStack" override_stack_count="1" name="0"/>
                </grid>
            </rect>
        </window>

    </append>

 

And the zzUnfilteredDewCollector can be placed in the world but is unresponsive. It presents no interface, cannot be picked up, etc.

Link to comment
Share on other sites

1 minute ago, Gouki said:

 

If you want, I'll send you the already made mod and you can check it out, I just don't know how to send you a rar file through the forum.

 

I'll try your blocks.xml in mine and see if I get the same results. If not, I'll direct message you my email address.

Link to comment
Share on other sites

2 minutes ago, zztong said:

 

I'll try your blocks.xml in mine and see if I get the same results. If not, I'll direct message you my email address.

 

If you already have the block on the ground, pick it up and if it gives you an error, delete it, and put another one again and it will work.

Link to comment
Share on other sites

Just now, Gouki said:

 

If you already have the block on the ground, pick it up and if it gives you an error, delete it, and put another one again and it will work.

 

I can't pick it up, but I have been destroying the old blocks and placing new ones.

So this was the problem on the Extends line...

 

param1="Class"

 

... not sure what it really means, I guess.

Link to comment
Share on other sites

2 minutes ago, zztong said:

 

I can't pick it up, but I have been destroying the old blocks and placing new ones.

 

Well, it allowed me to pick it up halfway (even though I didn't see anything in the interface), when the count was almost finished it gave me an error, but when I deleted it and put a new one in, it worked.

Link to comment
Share on other sites

5 minutes ago, zztong said:

Thanks Gouki.

 

I'm still missing the connection between blocks.xml and xui.xml other than it must be the block name ... and the Vanilla dew collector doesn't match. :)

 

Sometimes all of this is confusing, but I'll keep an eye on it after you check it with my code.

The connection is between the block name in conjunction with the Xui file and Windows.

Edited by Gouki (see edit history)
Link to comment
Share on other sites

8 minutes ago, Gouki said:

Sometimes all of this is confusing, but I'll keep an eye on it after you check it with my code.

 

It's working. I had to remove the param1="Class" part of my Extends line in blocks.xml.

Link to comment
Share on other sites

3 minutes ago, zztong said:

 

It's working. I had to remove the param1="Class" part of my Extends line in blocks.xml.

 

I'm glad the code was useful to you.

Param1=Class: it means that you are giving it the same class that the dewcollector has, which is why I eliminated it, it was not necessary.

 

Regards
Gouki

Link to comment
Share on other sites

22 hours ago, zztong said:

 

I can't pick it up, but I have been destroying the old blocks and placing new ones.

So this was the problem on the Extends line...

 

param1="Class"

 

... not sure what it really means, I guess.

 

Sorry, I was going to reply earlier. I was pretty certain it was that line that was causing the problems.

 

The "param1" attribute value tells the game to exclude that property from the block you're extending. You're telling the game "my block extends 'cntDewCollector' but don't use its 'Class' property." Look at the "terrSand" block for an example.

 

The "Class" property specifies the C# class that controls the block's behavior, so without that property, the block has no behavior.

Edited by khzmusik (see edit history)
Link to comment
Share on other sites

2 hours ago, khzmusik said:

The "param1" attribute value tells the game to exclude that property from the block you're extending.

 

Oh! I never would have guessed an exclusion. That's what I get for blindly using it.

Link to comment
Share on other sites


FYI, I believe that the additions to the windows and xui files are unnecessary here. Only the new block should be needed - seems to work with only the block for me.

 

My understanding is that the dew collector ui cannot be modified as it is hard coded at this time.  Only the ConvertToItem and some of the other block properties can be changed.

Link to comment
Share on other sites

On 3/19/2024 at 9:06 PM, Numberz said:

FYI, I believe that the additions to the windows and xui files are unnecessary here. Only the new block should be needed - seems to work with only the block for me.

 

You're probably right now that I think about it. Since we narrowed down the issue to the param1 part, I'll bet the XUi stuff is unnecessary.

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