MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / baseDamagePosition

Method baseDamagePosition

source/game/StarPlant.cpp:1049–1069  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1047}
1048
1049Vec2I Plant::baseDamagePosition(List<Vec2I> const& positions) const {
1050 starAssert(positions.size());
1051 auto res = positions.at(0);
1052
1053 for (auto const& piece : m_pieces) {
1054 if (piece.structuralSegment) {
1055 for (auto space : piece.spaces) {
1056 for (auto position : positions) {
1057 if (world()->geometry().equal(m_tilePosition + space, position)) {
1058 // if this space is a "better match" for the root of the plant
1059 if ((res[1] < position[1]) == m_ceiling) {
1060 res = position;
1061 }
1062 }
1063 }
1064 }
1065 }
1066 }
1067
1068 return res;
1069}
1070
1071bool Plant::damagable() const {
1072 if (m_stemDropConfig.type() != Json::Type::Object)

Callers

nothing calls this directly

Calls 4

sizeMethod · 0.45
atMethod · 0.45
equalMethod · 0.45
geometryMethod · 0.45

Tested by

no test coverage detected