| 773 | } |
| 774 | |
| 775 | void 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 | |
| 801 | void Agent::updateSpeed() |
| 802 | { |
no test coverage detected