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

Method damageSources

source/game/StarNpc.cpp:1110–1131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1108}
1109
1110List<DamageSource> Npc::damageSources() const {
1111 auto damageSources = m_tools->damageSources();
1112
1113 if (m_damageOnTouch.get() && !m_npcVariant.touchDamageConfig.isNull()) {
1114 Json config = m_npcVariant.touchDamageConfig;
1115 if (!config.contains("poly") && !config.contains("line")) {
1116 config = config.set("poly", jsonFromPolyF(m_movementController->collisionPoly()));
1117 }
1118 DamageSource damageSource(config);
1119 if (auto damagePoly = damageSource.damageArea.ptr<PolyF>())
1120 damagePoly->rotate(m_movementController->rotation());
1121 damageSource.damage *= m_statusController->stat("powerMultiplier");
1122 damageSources.append(damageSource);
1123 }
1124
1125 for (auto& damageSource : damageSources) {
1126 damageSource.sourceEntityId = entityId();
1127 damageSource.team = getTeam();
1128 }
1129
1130 return damageSources;
1131}
1132
1133List<PhysicsForceRegion> Npc::forceRegions() const {
1134 return m_tools->forceRegions();

Callers 1

updateMethod · 0.45

Calls 9

jsonFromPolyFFunction · 0.85
getMethod · 0.45
isNullMethod · 0.45
containsMethod · 0.45
setMethod · 0.45
rotateMethod · 0.45
rotationMethod · 0.45
statMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected