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

Method setWearableFromHead

source/game/StarHumanoid.cpp:393–408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391}
392
393void Humanoid::setWearableFromHead(uint8_t slot, HeadArmor const& head, Gender gender) {
394 auto& fashion = *m_fashion;
395 Wearable& current = fashion.wearables.at(slot);
396 if (auto currentHead = current.ptr<WornHead>())
397 fashion.helmetMasksChanged |= currentHead->maskDirectives != head.maskDirectives();
398 else {
399 wearableRemoved(current);
400 fashion.wornHeadsChanged = true;
401 fashion.helmetMasksChanged |= !head.maskDirectives().empty();
402 }
403 current.makeType(current.typeIndexOf<WornHead>());
404 auto& wornHead = current.get<WornHead>();
405 wornHead.directives = head.directives(m_facingDirection == Direction::Left);
406 wornHead.frameset = head.frameset(gender);
407 wornHead.maskDirectives = head.maskDirectives();
408}
409
410void Humanoid::setWearableFromChest(uint8_t slot, ChestArmor const& chest, Gender gender) {
411 auto& fashion = *m_fashion;

Callers 1

setupHumanoidMethod · 0.80

Calls 3

makeTypeMethod · 0.80
atMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected