MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / removeEquipment

Method removeEquipment

game/state/shared/agent.cpp:775–799  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

773}
774
775void Agent::removeEquipment(GameState &state, sp<AEquipment> object)
776{
777 this->equipment.remove(object);
778 if (object->equippedSlotType == EquipmentSlotType::RightHand)
779 {
780 rightHandItem = nullptr;
781 }
782 if (object->equippedSlotType == EquipmentSlotType::LeftHand)
783 {
784 leftHandItem = nullptr;
785 }
786 if (unit)
787 {
788 // Stop flying if jetpack lost
789 if (object->type->provides_flight && unit->target_body_state == BodyState::Flying &&
790 !isBodyStateAllowed(BodyState::Flying))
791 {
792 unit->setBodyState(state, BodyState::Standing);
793 }
794 unit->updateDisplayedItem(state);
795 }
796 object->ownerAgent.clear();
797 updateSpeed();
798 updateIsBrainsucker();
799}
800
801void Agent::updateSpeed()
802{

Callers 4

destroyMethod · 0.95
loadAmmoMethod · 0.45
explodeMethod · 0.45
updateHirableAgentsMethod · 0.45

Calls 4

removeMethod · 0.80
setBodyStateMethod · 0.80
updateDisplayedItemMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected