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

Method removeCentralStructure

source/game/StarWorldServer.cpp:166–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166void WorldServer::removeCentralStructure() {
167 for (auto const& structureObject : m_centralStructure.objects()) {
168 if (!structureObject.residual) {
169 generateRegion(RectI::withSize(structureObject.position, {1, 1}));
170 for (auto const& objectEntity : atTile<Object>(structureObject.position)) {
171 if (objectEntity->tilePosition() == structureObject.position && objectEntity->name() == structureObject.name)
172 removeEntity(objectEntity->entityId(), false);
173 }
174 }
175 }
176
177 for (auto const& backgroundBlock : m_centralStructure.backgroundBlocks()) {
178 if (!backgroundBlock.residual) {
179 generateRegion(RectI::withSize(backgroundBlock.position, {1, 1}));
180 if (auto tile = m_tileArray->modifyTile(backgroundBlock.position)) {
181 if (tile->background == backgroundBlock.materialId) {
182 tile->background = EmptyMaterialId;
183 tile->backgroundMod = NoModId;
184 queueTileUpdates(backgroundBlock.position);
185 }
186 }
187 }
188 }
189
190 for (auto const& foregroundBlock : m_centralStructure.foregroundBlocks()) {
191 if (!foregroundBlock.residual) {
192 generateRegion(RectI::withSize(foregroundBlock.position, {1, 1}));
193 if (auto tile = m_tileArray->modifyTile(foregroundBlock.position)) {
194 if (tile->foreground == foregroundBlock.materialId) {
195 tile->foreground = EmptyMaterialId;
196 tile->foregroundMod = NoModId;
197 tile->updateCollision(CollisionKind::None);
198 dirtyCollision(RectI::withSize(foregroundBlock.position, {1, 1}));
199 queueTileUpdates(foregroundBlock.position);
200 }
201 }
202 }
203 }
204}
205
206bool WorldServer::spawnTargetValid(SpawnTarget const& spawnTarget) const {
207 if (spawnTarget.is<SpawnTargetUniqueEntity>())

Callers

nothing calls this directly

Calls 8

entityIdMethod · 0.80
backgroundBlocksMethod · 0.80
foregroundBlocksMethod · 0.80
updateCollisionMethod · 0.80
objectsMethod · 0.45
tilePositionMethod · 0.45
nameMethod · 0.45
modifyTileMethod · 0.45

Tested by

no test coverage detected