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

Method take

source/game/StarItem.cpp:127–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127ItemPtr Item::take(uint64_t max) {
128 uint64_t takeCount = std::min(m_count, max);
129 if (takeCount != 0) {
130 if (auto newItems = clone()) {
131 m_count -= takeCount;
132 newItems->setCount(takeCount);
133 return newItems;
134 } else {
135 Logger::warn(strf("Could not clone {}, not moving {} items as requested.", friendlyName(), takeCount).c_str());
136 }
137 }
138
139 return {};
140}
141
142bool Item::empty() const {
143 return m_count == 0;

Callers 15

HumanoidIdentityMethod · 0.45
radioMessageMethod · 0.45
spawnTypeMethod · 0.45
WorldTemplateMethod · 0.45
pollInvitationMethod · 0.45
removeEntityMethod · 0.45
setFlowMethod · 0.45
liquidCollisionMethod · 0.45
disconnectClientMethod · 0.45
resendEntityMethod · 0.45
handleIncomingPacketsMethod · 0.45

Calls 3

strfFunction · 0.85
setCountMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected