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

Method tileIsOccupied

source/game/StarEntityMap.cpp:327–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325}
326
327bool EntityMap::tileIsOccupied(Vec2I const& pos, bool includeEphemeral) const {
328 RectF rect(Vec2F(pos[0], pos[1]), Vec2F(pos[0] + 1, pos[1] + 1));
329 return (bool)findEntity(rect, [&](EntityPtr const& entity) {
330 if (auto tileEntity = as<TileEntity>(entity)) {
331 if (includeEphemeral || !tileEntity->ephemeral()) {
332 for (Vec2I space : tileEntity->spaces()) {
333 if (m_geometry.equal(pos, space + tileEntity->tilePosition())) {
334 return true;
335 }
336 }
337 }
338 }
339 return false;
340 });
341}
342
343bool EntityMap::spaceIsOccupied(RectF const& rect, bool includesEphemeral) const {
344 for (auto const& entity : entityQuery(rect)) {

Callers 6

blockTypeMethod · 0.45
isOutsideMethod · 0.45
tileIsOccupiedFunction · 0.45
canPlaceMaterialFunction · 0.45
perhapsCanPlaceMaterialFunction · 0.45
placementValidMethod · 0.45

Calls 4

ephemeralMethod · 0.45
spacesMethod · 0.45
equalMethod · 0.45
tilePositionMethod · 0.45

Tested by

no test coverage detected