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

Method throwDrop

source/game/StarItemDrop.cpp:42–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42ItemDropPtr 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
59ItemDropPtr ItemDrop::throwDrop(ItemDescriptor const& itemDescriptor, Vec2F const& position, Vec2F const& velocity, Vec2F const& direction, bool eternal) {
60 if (!itemDescriptor || itemDescriptor.isEmpty())

Callers

nothing calls this directly

Calls 12

singletonClass · 0.85
vnormFunction · 0.85
jsonMethod · 0.80
assetsMethod · 0.80
getFloatMethod · 0.80
setEternalMethod · 0.80
setIntangibleTimeMethod · 0.80
itemDatabaseMethod · 0.80
setPositionMethod · 0.45
setVelocityMethod · 0.45
isEmptyMethod · 0.45
itemMethod · 0.45

Tested by

no test coverage detected