| 723 | } |
| 724 | |
| 725 | Json Object::writeStoredData() const { |
| 726 | JsonArray inputNodes; |
| 727 | for (size_t i = 0; i < m_inputNodes.size(); ++i) { |
| 728 | auto const& in = m_inputNodes[i]; |
| 729 | JsonArray connections; |
| 730 | for (auto const& node : in.connections.get()) |
| 731 | connections.append(JsonArray{jsonFromVec2I(node.entityLocation), node.nodeIndex}); |
| 732 | |
| 733 | inputNodes.append(JsonObject{ |
| 734 | {"connections", std::move(connections)}, |
| 735 | {"state", in.state.get()} |
| 736 | }); |
| 737 | } |
| 738 | |
| 739 | JsonArray outputNodes; |
| 740 | for (size_t i = 0; i < m_outputNodes.size(); ++i) { |
| 741 | auto const& in = m_outputNodes[i]; |
| 742 | JsonArray connections; |
| 743 | for (auto const& node : in.connections.get()) |
| 744 | connections.append(JsonArray{jsonFromVec2I(node.entityLocation), node.nodeIndex}); |
| 745 | |
| 746 | outputNodes.append(JsonObject{ |
| 747 | {"connections", std::move(connections)}, |
| 748 | {"state", in.state.get()} |
| 749 | }); |
| 750 | } |
| 751 | |
| 752 | return JsonObject{ |
| 753 | {"uniqueId", jsonFromMaybe(uniqueId())}, |
| 754 | {"tilePosition", jsonFromVec2I(tilePosition())}, |
| 755 | {"orientationIndex", jsonFromSize(m_orientationIndex)}, |
| 756 | {"direction", DirectionNames.getRight(m_direction.get())}, |
| 757 | {"scriptStorage", m_scriptComponent.getScriptStorage()}, |
| 758 | {"interactive", m_interactive.get()}, |
| 759 | {"inputWireNodes", std::move(inputNodes)}, |
| 760 | {"outputWireNodes", std::move(outputNodes)} |
| 761 | }; |
| 762 | } |
| 763 | |
| 764 | void Object::breakObject(bool smash) { |
| 765 | m_broken = true; |
nothing calls this directly
no test coverage detected