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

Method resourcePercentage

source/game/StarStatSet.cpp:192–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190}
191
192Maybe<float> StatSet::resourcePercentage(String const& resourceName) const {
193 auto const& resource = getResource(resourceName);
194 if (!resource.maxValue)
195 return {};
196 return resource.value / *resource.maxValue;
197}
198
199float StatSet::setResourcePercentage(String const& resourceName, float resourcePercentage) {
200 auto& resource = getResource(resourceName);

Callers 6

updateMethod · 0.45
healthPercentageMethod · 0.45
energyPercentageMethod · 0.45
foodPercentageMethod · 0.45
fullEnergyMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected