1. Hey Guest! We've announced our new game Wargroove, check out the new forums!
    Dismiss Notice

Modding Help Adding items to an existing treasurepool

Discussion in 'Starbound Modding' started by Aegonian, Feb 15, 2017.

  1. Aegonian

    Aegonian Scruffy Nerf-Herder

    I'm having some issues trying to add items to an existing treasurepool, and I don't understand why I'm getting these errors, so I hope someone here knows more about this than me. This is the situation:

    I'm trying to add a new type of microformer to the treasurepool for microformer drops, which is defined in common.treasurepools. I could simply overwrite the treasurepool with an updated one, which includes my custom microformer, but that way the mod becomes incompatible with any other mods adding microformers.

    The relevant piece of the common.treasurepools file is this:
    Code:
    {
    "microformerTreasure" : [
        [0, {
          "pool" : [
            {"weight" : 1.00, "item" : "microformeralpine"},
            {"weight" : 1.00, "item" : "microformerbioluminescence"},
            {"weight" : 1.00, "item" : "microformerbones"},
            {"weight" : 1.00, "item" : "microformereyepatch"},
            {"weight" : 1.00, "item" : "microformerflesh"},
            {"weight" : 1.00, "item" : "microformergeode"},
            {"weight" : 1.00, "item" : "microformergiantflowers"},
            {"weight" : 1.00, "item" : "microformerhive"},
            {"weight" : 1.00, "item" : "microformerluminouscaves"},
            {"weight" : 1.00, "item" : "microformermushrooms"},
            {"weight" : 1.00, "item" : "microformerrust"},
            {"weight" : 1.00, "item" : "microformerslimecaves"},
            {"weight" : 1.00, "item" : "microformersteamspring"},
            {"weight" : 1.00, "item" : "microformertar"},
            {"weight" : 1.00, "item" : "microformerwilderness"}
          ]
        }]
      ]
    }
    My patch file, called common.treasurepools.patch, looks like this:
    Code:
    [   
      {"op" : "add",
        "path" : "/microformerTreasure/0/1/pool/-",
        "value" : [
          {"weight" : 1.00, "item" : "microformertheawetlands"}
        ]
      }
    ]
    I got the code needed to patch items into an existing treasurepool from this thread, for reference.

    The error code the game generates when trying to launch the game is as follows:
    Code:
    [18:07:59.436] [Error] Application: exception thrown, shutting down: (JsonException) contains() called on improper json type
    [0] 13fa83763 Star::captureStack
    [1] 13fa824ee Star::StarException::StarException
    [2] 13fa245a4 Star::Json::contains
    [3] 13fed36a3 Star::TreasureDatabase::TreasureDatabase
    [4] 13fdff415 std::make_shared<Star::TreasureDatabase>
    [5] 13fe03679 <lambda_98d6a6b2615bb1a3f8a0688d25420309>::operator()
    [6] 13fdf4f9f std::_Invoker_functor::_Call<<lambda_98d6a6b2615bb1a3f8a0688d25420309> & __ptr64>
    [7] 13fdf9076 std::invoke<<lambda_98d6a6b2615bb1a3f8a0688d25420309> & __ptr64>
    [8] 13fdf6d59 std::_Invoke_ret<std::shared_ptr<Star::TreasureDatabase>,<lambda_98d6a6b2615bb1a3f8a0688d25420309> & __ptr64>
    [9] 13fe05c86 std::_Func_impl<<lambda_98d6a6b2615bb1a3f8a0688d25420309>,std::allocator<int>,std::shared_ptr<Star::TreasureDatabase> >::_Do_call
    [10] 13fa21eb7 std::_Func_class<Star::Json,Star::Json const & __ptr64,Star::String const & __ptr64>::operator()
    [11] 13fdfcfe3 Star::Root::loadMemberFunction<Star::TreasureDatabase>
    [12] 13fdf9e29 Star::Root::loadMember<Star::TreasureDatabase>
    [13] 13fe0de62 Star::Root::treasureDatabase
    [14] 13fdf5270 std::_Invoker_pmf_pointer::_Call<std::shared_ptr<Star::CodexDatabase const > (__cdecl Star::Root::*)(void) __ptr64,Star::Root * __ptr64 & __ptr64>
    [15] 13fdf8d29 std::invoke<std::shared_ptr<Star::LiquidsDatabase const > (__cdecl Star::Root::*& __ptr64)(void) __ptr64,Star::Root * __ptr64 & __ptr64>
    [16] 13fdf663c std::_Invoke_ret<std::shared_ptr<Star::LiquidsDatabase const > (__cdecl Star::Root::*& __ptr64)(void) __ptr64,Star::Root * __ptr64 & __ptr64>
    [17] 13fdf52fe std::_Call_binder<std::_Unforced,0,std::shared_ptr<Star::VersioningDatabase const > (__cdecl Star::Root::*)(void) __ptr64,std::tuple<Star::Root * __ptr64>,std::tuple<> >
    [18] 13fdf49be std::_Binder<std::_Unforced,std::shared_ptr<Star::MaterialDatabase const > (__cdecl Star::Root::*)(void) __ptr64,Star::Root * __ptr64 const>::operator()<>
    [19] 13fe05752 std::_Func_impl<Star::SwallowReturn<std::_Binder<std::_Unforced,std::shared_ptr<Star::VehicleDatabase const > (__cdecl Star::Root::*)(void) __ptr64,Star::Root * __ptr64 const> >,std::allocator<int>,void>::_Do_call
    [20] 13fa7a1cb <lambda_7b083dc4bdd496712d99e51bb49515b5>::operator()
    [21] 13fa7af72 Star::WorkerPool::WorkerThread::run
    [22] 13fa8028e Star::ThreadImpl::runThread
    [23] 76d859cd BaseThreadInitThunk
    [24] 76eba561 RtlUserThreadStart
    [18:07:59.436] [Info] Application: shutdown...
    [18:07:59.558] [Info] Root: Shutting down Root
    [18:08:00.002] [Info] Application: Destroying SDL Window
    [18:08:00.014] [Info] Application: stopped gracefully
    The thing is, according to the online JSON patch validator found here, the patch is perfectly functional, so I'm incredibly confused as to why the game is crashing... I am certain, however, that it is this patch which causes the crash, as removing the patch file from my mod allows the game to run without any issues.
     
  2. IHart

    IHart Sandwich Man

    Code:
    [   
      {"op" : "add",
        "path" : "/microformerTreasure/0/1/pool/-",
        "value" : 
          {"weight" : 1.00, "item" : "microformertheawetlands"}
      }
    ]
    
     
  3. Aegonian

    Aegonian Scruffy Nerf-Herder

    I thought I was missing something obvious, thank you! This works perfectly :nuruhappy:
     
    IHart likes this.

Share This Page