Jump to content

Can a block have multiple upgrade paths?


Recommended Posts

I'm curious if a single block could have multiple upgrade paths depending on upgrade materials used.

 

For instance, can I make a frame shape that you can upgrade with a mallet (and 8 wood) to a wood block or can upgrade with a hammer (and 6 cobblestone) to a cobblestone block?

 

I'm specifically interested in whether we can send planted crops down different paths depending on player choice and action.  This allows us to have events happen to the crops, and players can decide if they want to do anything, and whether it's worth using certain resources to maximize harvest and optimize growth time, or whether they're okay using a less valuable resource for a medium harvest and growth speed.

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

I've done some unsuccessful testing on this, mostly with having two "UpgradeBlock" properties within a given block.

 

Here is an example using H7SB Farming as a base, though I've tried many variations of this:

 

   	<block name="seedYuccaFert">
      	...
        <property class="UpgradeBlock">
         	<property name="ToBlock" value="seedYuccaWater" />
         	<property name="Item" value="compost" />
         	<property name="ItemCount" value="1" />
         	<property name="UpgradeHitCount" value="1" />
      	</property>
      	<property class="UpgradeBlock">
         	<property name="ToBlock" value="plantedYucca1" />
         	<property name="Item" value="resourceSnowBall" />
         	<property name="ItemCount" value="1" />
         	<property name="UpgradeHitCount" value="1" />
      	</property>
   	</block>

 

Trying to use an item that repairs using compost just gives a "missing snowball" error.  While using an item that repairs with snowballs works to move the plant to stage "plantedYucca1".  So it appears that the second upgradeBlock property just overwrites the first.

 

Link to comment
Share on other sites

Have you looked at the blocks.xml circa A17 or possibly A16? I seem to remember the wood frame upgrade path branching from reinforced wood to either iron reinforced or cobblestone, but as I wasn't poking around in the code back then, I'm not sure how it would've been accomplished. I'm wondering if it might be possible to give multiple values for "ToBlock", "Item", etc by stringing them together with commas, with all the first entries corresponding to one upgrade path, the second to a different path, and so on.

Link to comment
Share on other sites

18 hours ago, Cranberry Monster said:

Have you looked at the blocks.xml circa A17 or possibly A16? I seem to remember the wood frame upgrade path branching from reinforced wood to either iron reinforced or cobblestone, but as I wasn't poking around in the code back then, I'm not sure how it would've been accomplished. I'm wondering if it might be possible to give multiple values for "ToBlock", "Item", etc by stringing them together with commas, with all the first entries corresponding to one upgrade path, the second to a different path, and so on.

 

Thanks for the suggestion.  I started playing in A20.1, so I don't have any historical experience.  I'm downloading A16.4 and A17.4 now to get access to those files.  I'll see what I can find.  Any more information you can remember about what block I might be looking for would be really helpful.

Link to comment
Share on other sites

Actually, I only started playing with A17, and in those days, I wasn't doing the building (it was co-op, and everyone else was a seasoned player). I looked at the A17.4 blocks.xml last night, and couldn't find anything resembling multiple paths, so it's entirely possible I mis-remembered what was going on back then.

I suppose if you wanted to put plants on different growing paths, you could require an additional crafting step with the seed that makes a copy with slightly altered functionality (faster/slower growing, higher yield, etc), but that's not really the kind of increased farmer interaction you were talking about.

A possible alternative would be to have each stage of plant growth produce a block that needs to be upgraded, and randomize that block with the kind of code Telric gave you in the other, related thread. That's more reactive farming than proactive farming, but it would give you the chance to introduce mechanics like plants that needed more water (upgrade with a jar or water), have insect problems (upgrade with nitrate or whatever), need more fertilizer (rotting flesh), or more support (upgrade with wood).

Link to comment
Share on other sites

In theory it is possible to reward players who perk into farming by allowing different tools to give different items (harvest).

In the same way that the vanilla game makes farming without having perked into LOTL pretty much useless, giving more harvest based on perk level.

 

You could completely change the items a player receives based on what level they are, or even depending on what item they use to harvest with.

 

I might have to test out a few variables as this is something I would like to see in a mod!

Link to comment
Share on other sites

16 hours ago, poly said:

In theory it is possible to reward players who perk into farming by allowing different tools to give different items (harvest).

In the same way that the vanilla game makes farming without having perked into LOTL pretty much useless, giving more harvest based on perk level.

 

You could completely change the items a player receives based on what level they are, or even depending on what item they use to harvest with.

 

I might have to test out a few variables as this is something I would like to see in a mod!

 

That's an interesting thought, but I don't think I want to go down that path with mine.  I'd be interested in seeing what you come up with though!  :)

I've realized a way to make this happen.  Unfortunately, it's too expensive for my use case, especially for a public server where there may be 1000s of these blocks.  It's also extremely clunky for the user.  But maybe someone else can get some use out of this idea, especially for single player games.

 

To do this, create two identical blocks.  Give them the PlantGrowing properties.  For block1, set the "Next" property to block2, and for block2, set it's next to block1.  Then set a small "GrowthRate".  The XML says you should keep this 2 or above, but it appears to work fine on 1.  My guess is that even smaller numbers will work, but will just become CPU intensive for the server.

 

    <property name="PlantGrowing.Next"        value="block2"/>
    <property name="PlantGrowing.GrowthRate"    value="1"/>

 

Now give both blocks the same name, except with an appended note.  Maybe something like:

 

    block1,block,desc,"Frame Shape (Upgrade: wood)"
    block2,block,desc,"Frame Shape (Upgrade: steel)"

 

And set each block's upgrade property to the material and target you want that path to take.

 

Now when the user places that block or gets to that block some other way, they'll see a block that switches back and forth between needing wood or steel to upgrade.  They simply wait for the one they want to pop up, and then do the upgrade.  I'm guessing you could even set the GrowthRate to something like 0.15 so it switches every 10 seconds or so.

 

You may want to pair this with a placeholders.xml block that has a very tiny chance of moving to a stable state.  That will prevent this block from cycling forever eventually crashing the game.

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