| 509 | bool AEquipScreen::isTransition() { return false; } |
| 510 | |
| 511 | void AEquipScreen::handleItemPickup(Vec2<int> mousePos) |
| 512 | { |
| 513 | // Expecting to have an agent |
| 514 | auto currentAgent = selectedAgents.front(); |
| 515 | |
| 516 | // Check if we're over any equipment in the paper doll |
| 517 | auto slotPos = paperDoll->getSlotPositionFromScreenPosition(mousePos); |
| 518 | bool alienArtifact = false; |
| 519 | if (tryPickUpItem(currentAgent, slotPos, modifierLCtrl || modifierRCtrl, &alienArtifact)) |
| 520 | { |
| 521 | draggedEquipmentOffset = paperDoll->getScreenPositionFromSlotPosition(slotPos) - mousePos; |
| 522 | paperDoll->updateEquipment(); |
| 523 | displayAgent(currentAgent); |
| 524 | updateAgentControl(currentAgent); |
| 525 | |
| 526 | // Immediate action: put at the ground |
| 527 | if ((modifierLShift || modifierRShift) && |
| 528 | config().getBool("OpenApoc.NewFeature.AdvancedInventoryControls")) |
| 529 | { |
| 530 | handleItemPlacement(false); |
| 531 | } |
| 532 | } |
| 533 | else if (alienArtifact) |
| 534 | { |
| 535 | auto message_box = mksp<MessageBox>( |
| 536 | tr("Alien Artifact"), tr("You must research Alien technology before you can use it."), |
| 537 | MessageBox::ButtonOptions::Ok); |
| 538 | fw().stageQueueCommand({StageCmd::Command::PUSH, message_box}); |
| 539 | } |
| 540 | else // no doll equipment under cursor |
| 541 | { |
| 542 | // Check if we're over any equipment in the list at the bottom |
| 543 | auto posWithinInventory = mousePos; |
| 544 | posWithinInventory.x += inventoryPage * inventoryControl->Size.x; |
| 545 | if (tryPickUpItem(posWithinInventory, &alienArtifact)) |
| 546 | { |
| 547 | refreshInventoryItems(); |
| 548 | |
| 549 | // Immediate action: try put in the agent |
| 550 | if ((modifierLShift || modifierRShift) && |
| 551 | config().getBool("OpenApoc.NewFeature.AdvancedInventoryControls")) |
| 552 | { |
| 553 | handleItemPlacement(true); |
| 554 | } |
| 555 | } |
| 556 | else if (alienArtifact) |
| 557 | { |
| 558 | auto message_box = |
| 559 | mksp<MessageBox>(tr("Alien Artifact"), |
| 560 | tr("You must research Alien technology before you can use it."), |
| 561 | MessageBox::ButtonOptions::Ok); |
| 562 | fw().stageQueueCommand({StageCmd::Command::PUSH, message_box}); |
| 563 | } |
| 564 | } |
| 565 | } |
| 566 | |
| 567 | void AEquipScreen::handleItemPlacement(Vec2<int> mousePos) |
| 568 | { |
nothing calls this directly
no test coverage detected