Adding items to vanilla

Everything related to modding

Adding items to vanilla

Postby HâpPçheñ » Fri Jul 12, 2019 6:15 pm

Hey,
I am working on the Mod "Mountain Expedition" (btw. Check it out, v0.32 is up at this point [https://steamcommunity.com/sharedfiles/filedetails/?id=1799587819]).

I implemented a new Pocket to the game with some stuff. I implemented it by overwriting the wd-world-4 , wd-world-5 and wd-world-6 Pocket attributes.

Code: Select all
   
   {
      targetId: *wd-world-4
      pockets: [pck-grass, pck-dry, pck-desert, pck-arctic, pck-mountain-high]
   }



The question is, if there is a way in Hjson to, instead of overwriting the attribute, appending an Object/String. In Json itself it would be possible to write something like

Code: Select all
    {
         targetId: *wd-world-4
         pockets.push(pck-mountain-high)
   }


The hope is to make my mod compatible to other mods which overwrite world objects. So a code snippet would be nice if there is a way to append.

Thx, HâpPçheñ
HâpPçheñ
 
Posts: 2
Joined: Fri Jul 12, 2019 5:59 pm

Re: Adding items to vanilla

Postby Isaac_mm » Mon Jul 15, 2019 2:36 pm

Hi,

Try this:

Code: Select all
   
   {
      targetId: +wd-world-4::pockets
      data: [pck-mountain-high]
   }


This is the add operator, which adds things to arrays, combined with the special data tag: https://curious-expedition.fandom.com/w ... l_data_tag
Isaac_mm
 
Posts: 8
Joined: Mon Apr 09, 2018 11:32 am

Re: Adding items to vanilla

Postby HâpPçheñ » Tue Jul 16, 2019 7:40 am

Thx,
the data Tag was the part I was missing.

It works ( without the [] brackets).

Now I can make my mod compatible with "Extended Exp", "Endless Mode" etc.
HâpPçheñ
 
Posts: 2
Joined: Fri Jul 12, 2019 5:59 pm

Re: Adding items to vanilla

Postby riadd » Tue Jul 16, 2019 9:45 am

Nice! :D
User avatar
riadd
Curious Dev
Curious Dev
 
Posts: 855
Joined: Thu May 22, 2014 11:36 am
Location: Berlin


Return to Modding

Who is online

Users browsing this forum: No registered users and 1 guest
cron