private void Start() { // A tricky system to deal with the fact that I have to save/network variables, // but also deal with active development and updates // Either I keep overwriting values, throw errors in the log or just make useless actions // the isPlaced is a hack because the game doesn't track this itself appearantly. // Gotta poke Jotunn to use something similar and also a "isPlaced" call like Start but for when a Piece is placed and not a ghost anymore. if (m_piece.IsPlacedByPlayer()) { isPlaced = true; Jotunn.Logger.LogDebug("Doing stuff to object that was placed by a player"); m_nview.SetPersistent(true); // Rather ugly code, gotta do something about it later // fetch var, if var not there use default, then set fetched var or default. m_nview.GetZDO().Set("TestNumber", m_nview.GetZDO().GetInt("TestNumber", 0)); m_nview.GetZDO().Set("Happiness", m_nview.GetZDO().GetInt("Happiness", 100)); m_nview.GetZDO().Set("Villagers", m_nview.GetZDO().GetInt("Villagers", 0)); m_nview.GetZDO().Set("settlementName", m_nview.GetZDO().GetString("settlementName", "Elktown")); settlementName = m_nview.GetZDO().GetString("settlementName"); // Got to do this twice because of how makeActive is a toggle. makeActive(m_nview.GetZDO().GetBool("isActive", false)); isActive = m_nview.GetZDO().GetBool("isActive", false); m_nview.GetZDO().Set("isActive", isActive); m_tsManager.registerSMAI(this); // I'm so terrified of this ;_; } }
private void Start() { if (m_piece.IsPlacedByPlayer()) { // if ZDO.getbool wasPlaced == true // Skip over specific initializer stuff // else // ZDO.set wasPlaced == true; // do specific initializer stuffs Jotunn.Logger.LogDebug("Doing stuff to expander that was placed by a player"); m_nview.SetPersistent(true); m_nview.GetZDO().Set("isActive", m_nview.GetZDO().GetBool("isActive", false)); /* * // if this object was loaded from save, and it was active * // i */ } }