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

Method queryShieldHit

source/game/StarToolUser.cpp:351–364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349}
350
351bool ToolUser::queryShieldHit(DamageSource const& source) const {
352 if (m_suppress.get() || !m_user)
353 return false;
354
355 for (auto item : {m_primaryHandItem.get(), m_altHandItem.get()}) {
356 if (auto tool = as<ToolUserItem>(item))
357 for (auto poly : tool->shieldPolys()) {
358 poly.translate(m_user->position());
359 if (source.intersectsWithPoly(m_user->world()->geometry(), poly))
360 return true;
361 }
362 }
363 return false;
364}
365
366void ToolUser::tick(float dt, bool shifting, HashSet<MoveControlType> const& moves) {
367 if (auto toolUserItem = as<ToolUserItem>(m_primaryHandItem.get())) {

Callers 2

queryHitMethod · 0.80
queryHitMethod · 0.80

Calls 7

intersectsWithPolyMethod · 0.80
getMethod · 0.45
shieldPolysMethod · 0.45
translateMethod · 0.45
positionMethod · 0.45
geometryMethod · 0.45
worldMethod · 0.45

Tested by

no test coverage detected