| 115 | } |
| 116 | |
| 117 | void GameObject::customSetup() |
| 118 | { |
| 119 | static nlohmann::json childJson; |
| 120 | |
| 121 | if (childJson.empty()) |
| 122 | { |
| 123 | childJson = nlohmann::json::parse(FileUtils::getInstance()->getStringFromFile("Custom/object.json")); |
| 124 | } |
| 125 | |
| 126 | auto objJson = childJson[std::to_string(getID())]; |
| 127 | |
| 128 | if (objJson.contains("default_z_order")) |
| 129 | setGlobalZOrder((int)objJson["default_z_order"]); |
| 130 | if (objJson.contains("default_z_layer")) |
| 131 | _zLayer = (int)objJson["default_z_layer"]; |
| 132 | if (objJson.contains("default_primary_channel")) |
| 133 | _mainColorChannel = (int)objJson["default_primary_channel"]; |
| 134 | if (objJson.contains("default_secondary_channel")) |
| 135 | _secColorChannel = (int)objJson["default_secondary_channel"]; |
| 136 | |
| 137 | if (objJson.contains("color_channel")) |
| 138 | { |
| 139 | if (objJson["color_channel"] == "base") |
| 140 | _childSpritesChannel.push_back(0); |
| 141 | else if (objJson["color_channel"] == "detail") |
| 142 | _childSpritesChannel.push_back(1); |
| 143 | else if (objJson["color_channel"] == "black") |
| 144 | _childSpritesChannel.push_back(2); |
| 145 | } |
| 146 | else |
| 147 | _childSpritesChannel.push_back(404); |
| 148 | |
| 149 | if (objJson.contains("object_type")) |
| 150 | setGameObjectType((GameObjectType)objJson["object_type"]); |
| 151 | |
| 152 | if (objJson.contains("children")) |
| 153 | addCustomSprites(objJson["children"], this); |
| 154 | |
| 155 | for (auto obj : _childSprites) |
| 156 | obj->setAdditionalTransform(&_parentMatrix); |
| 157 | |
| 158 | _isOnlyDetail = true; |
| 159 | |
| 160 | for (size_t type : _childSpritesChannel) |
| 161 | { |
| 162 | if (type == 0) |
| 163 | _isOnlyDetail = false; |
| 164 | } |
| 165 | |
| 166 | _primaryInvisible = false; |
| 167 | |
| 168 | // robtop made 3d parts have lines by default but then decided to make them invisible instead of removing them for |
| 169 | // whatever reason |
| 170 | if (getID() >= 515 && getID() <= 640) |
| 171 | { |
| 172 | _primaryInvisible = true; |
| 173 | setOpacity(0); |
| 174 | } |
no test coverage detected