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

Method update

source/game/objects/StarFarmableObject.cpp:36–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36void FarmableObject::update(float dt, uint64_t currentStep) {
37 Object::update(dt, currentStep);
38
39 if (isMaster()) {
40 if (m_nextStageTime == 0) {
41 m_nextStageTime = world()->epochTime();
42 enterStage(m_stage);
43 }
44
45
46 while (!m_finalStage && world()->epochTime() >= m_nextStageTime) {
47 int lastStage = m_stage;
48 enterStage(m_stage + 1);
49 if (m_stage == lastStage)
50 break;
51 }
52
53 // update immersion and check whether farmable should break
54 m_immersion.update(bind(&Object::liquidFillLevel, this));
55 if (m_immersion.average() > m_maxImmersion || m_immersion.average() < m_minImmersion)
56 breakObject(false);
57 }
58}
59
60bool FarmableObject::damageTiles(List<Vec2I> const& position, Vec2F const& sourcePosition, TileDamage const& tileDamage) {
61 if ((tileDamage.type != TileDamageType::Beamish && tileDamage.type != TileDamageType::Blockish && tileDamage.type != TileDamageType::Plantish) || !harvest())

Callers

nothing calls this directly

Calls 2

averageMethod · 0.80
epochTimeMethod · 0.45

Tested by

no test coverage detected