void cFurnaceEntity::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) { super::OnSlotChanged(a_ItemGrid, a_SlotNum); if (m_World == NULL) { // The furnace isn't initialized yet, do no processing return; } ASSERT(a_ItemGrid == &m_Contents); switch (a_SlotNum) { case fsInput: { UpdateInput(); break; } case fsFuel: { UpdateFuel(); break; } case fsOutput: { UpdateOutput(); break; } } }
void CTAAirMoveType::SlowUpdate() { UpdateFuel(); if (!reservedPad && aircraftState == AIRCRAFT_FLYING && owner->health < owner->maxHealth * repairBelowHealth) { CAirBaseHandler::LandingPad* lp = airBaseHandler->FindAirBase(owner, owner->unitDef->minAirBasePower); if (lp) { AddDeathDependence(lp); reservedPad = lp; padStatus = 0; oldGoalPos = goalPos; } } UpdateMoveRate(); // note: NOT AAirMoveType::SlowUpdate AMoveType::SlowUpdate(); }
void CHoverAirMoveType::SlowUpdate() { UpdateFuel(); // HoverAirMoveType aircraft are controlled by AirCAI's, // but only MobileCAI's reserve pads so we need to do // this for ourselves if (reservedPad == NULL && aircraftState == AIRCRAFT_FLYING && WantsRepair()) { CAirBaseHandler::LandingPad* lp = airBaseHandler->FindAirBase(owner, owner->unitDef->minAirBasePower, true); if (lp != NULL) { AAirMoveType::ReservePad(lp); } } UpdateMoveRate(); // note: NOT AAirMoveType::SlowUpdate AMoveType::SlowUpdate(); }
void Ship::TimeStepUpdate(const float timeStep) { // If docked, station is responsible for updating position/orient of ship // but we call this crap anyway and hope it doesn't do anything bad vector3d maxThrust = GetMaxThrust(m_thrusters); vector3d thrust = vector3d(maxThrust.x*m_thrusters.x, maxThrust.y*m_thrusters.y, maxThrust.z*m_thrusters.z); AddRelForce(thrust); AddRelTorque(GetShipType().angThrust * m_angThrusters); DynamicBody::TimeStepUpdate(timeStep); // fuel use decreases mass, so do this as the last thing in the frame UpdateFuel(timeStep, thrust); if (m_landingGearAnimation) static_cast<SceneGraph::Model*>(GetModel())->UpdateAnimations(); }
bool AAirMoveType::Update() { // NOTE: useHeading is never true by default for aircraft (AAirMoveType // forces it to false, TransportUnit::{Attach,Detach}Unit manipulate it // specifically for HoverAirMoveType's) if (useHeading) { SetState(AIRCRAFT_TAKEOFF); } if (owner->beingBuilt) { // while being built, MoveType::SlowUpdate is not // called so UpdateFuel will not be either --> do // it here to prevent a drop in fuel level as soon // as unit finishes construction UpdateFuel(false); } // this return value is never used return (useHeading = false); }
void Ship::TimeStepUpdate(const float timeStep) { // If docked, station is responsible for updating position/orient of ship // but we call this crap anyway and hope it doesn't do anything bad const vector3d thrust(m_thrusters * GetMaxThrust(m_thrusters)); AddRelForce(thrust); AddRelTorque(GetShipType()->angThrust * m_angThrusters); if (m_landingGearAnimation) m_landingGearAnimation->SetProgress(m_wheelState); m_dragCoeff = DynamicBody::DEFAULT_DRAG_COEFF * (1.0 + 0.25 * m_wheelState); DynamicBody::TimeStepUpdate(timeStep); // fuel use decreases mass, so do this as the last thing in the frame UpdateFuel(timeStep, thrust); m_navLights->SetEnabled(m_wheelState > 0.01f); m_navLights->Update(timeStep); if (m_sensors.get()) m_sensors->Update(timeStep); }
void cFurnaceEntity::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) { super::OnSlotChanged(a_ItemGrid, a_SlotNum); if (m_IsDestroyed) { return; } if (m_IsLoading) { return; } ASSERT(a_ItemGrid == &m_Contents); switch (a_SlotNum) { case fsInput: UpdateInput(); break; case fsFuel: UpdateFuel(); break; case fsOutput: UpdateOutput(); break; default: ASSERT(!"Invalid furnace slot update!"); break; } }
void CCar::PhDataUpdate(float step) { if(m_repairing)Revert(); LimitWheels(); UpdateFuel(step); //if(fwp) { UpdatePower(); if(b_engine_on&&!b_starting && m_current_rpm<m_min_rpm)Stall(); } if(bkp) { UpdateBack(); } if(brp) HandBreak(); ////////////////////////////////////////////////////////// for (int k=0; k<(int)m_doors_update.size(); ++k){ SDoor* D = m_doors_update[k]; if (!D->update) { m_doors_update.erase(m_doors_update.begin()+k); --k; } else { D->Update(); } } m_steer_angle=m_steering_wheels.begin()->GetSteerAngle()*0.1f+m_steer_angle*0.9f; VERIFY(_valid(m_steer_angle)); }
bool cFurnaceEntity::ContinueCooking(void) { UpdateInput(); UpdateFuel(); return m_IsCooking; }