| 40 | } |
| 41 | |
| 42 | ItemDropPtr ItemDrop::throwDrop(ItemPtr const& item, Vec2F const& position, Vec2F const& velocity, Vec2F const& direction, bool eternal) { |
| 43 | if (!item) |
| 44 | return {}; |
| 45 | |
| 46 | auto idconfig = Root::singleton().assets()->json("/itemdrop.config"); |
| 47 | |
| 48 | ItemDropPtr itemDrop = make_shared<ItemDrop>(item); |
| 49 | itemDrop->setPosition(position); |
| 50 | if (direction != Vec2F()) |
| 51 | itemDrop->setVelocity(velocity + vnorm(direction) * idconfig.getFloat("throwSpeed")); |
| 52 | |
| 53 | itemDrop->setEternal(eternal); |
| 54 | itemDrop->setIntangibleTime(idconfig.getFloat("throwIntangibleTime")); |
| 55 | |
| 56 | return itemDrop; |
| 57 | } |
| 58 | |
| 59 | ItemDropPtr ItemDrop::throwDrop(ItemDescriptor const& itemDescriptor, Vec2F const& position, Vec2F const& velocity, Vec2F const& direction, bool eternal) { |
| 60 | if (!itemDescriptor || itemDescriptor.isEmpty()) |
nothing calls this directly
no test coverage detected