81 _log(MINING__WARNING,
"Activate() - Invalid target: m_targetSE == nullptr");
87 bool canActivate(
false);
189 float oreVolume(roidRef->GetAttribute(
AttrVolume).get_float());
191 if ((cycleVol < oreVolume) or (cycleVol <= 0) or (oreVolume <= 0)) {
198 float oreAmount((cycleVol /oreVolume));
205 oreAmount = floor(oreAmount);
206 _log(MINING__DEBUG,
"ProcessCycle(abort) - cycleVol:%.2f, oreAmount:%.2f, delta:%.5f", cycleVol, oreAmount, delta);
209 float roidQuantity(roidRef->GetAttribute(
AttrQuantity).get_float());
210 if (oreAmount > roidQuantity)
211 oreAmount = roidQuantity;
214 if (remainingCargoVolume < cycleVol) {
216 if (remainingCargoVolume > oreVolume) {
217 oreAmount = remainingCargoVolume /oreVolume;
232 _log(MINING__DEBUG,
"ProcessCycle(%s) - cycleVol:%.2f, roidQuantity:%.2f, remainingCargoVolume:%.2f/%.2f, oreAmount:%.2f", \
233 (abort?
"true":
"false"), cycleVol, roidQuantity, remainingCargoVolume, (remainingCargoVolume -cycleVol), oreAmount);
238 roidQuantity -= oreAmount;
239 _log(MINING__TRACE,
"new roidQuantity %.3f", roidQuantity);
241 if (roidQuantity > 0.0f) {
246 double radius = exp((roidQuantity + 112404.8) /25000);
265 if (oRef.get() ==
nullptr) {
279 if (oreError and !abort) {
312 for (
auto cur : mMap)
318 float oreVolume(roidRef->GetAttribute(
AttrVolume).get_float());
319 if (oreVolume <= 0) {
323 for (
auto cur : mMap) {
324 cur.second->GetShipRef()->GetPilot()->SendNotifyMsg(
"Your %s deactivates because there was a processing error. Ref: ServerError 03123.", \
325 cur.second->GetSelf()->name());
326 cur.second->CancelOnError();
331 float roidQuantity(roidRef->GetAttribute(
AttrQuantity).get_float());
334 for (
auto cur : mMap) {
335 if ((cur.first < oreVolume) or (cur.first < 0.1)) {
336 _log(MINING__ERROR,
"%s(%u) - Depleted() - Mining Laser could not extract ore from %s(%u)", \
337 cur.second->GetSelf()->name(), cur.second->GetSelf()->itemID(), roidRef->name(),
m_targetSE->
GetID() );
338 cur.second->GetShipRef()->GetPilot()->SendNotifyMsg(
"Your %s deactivates because there was an error in it's processing. Ref: ServerError 06428.",\
339 cur.second->GetSelf()->name());
340 cur.second->CancelOnError();
345 percent = cur.first /total;
346 oreAmount = roidQuantity * percent;
349 cur.second->AddOreAndDeactivate(roidRef->typeID(), oreAmount);
357 cur.second->GetShipRef()->GetPilot()->QueueDestinyUpdate(&tuple);
370 if (oRef.get() ==
nullptr) {
399 if (pShip !=
nullptr)
400 if (pShip->IsBoosted())
401 cycleVol *= (1 + (0.03f * pShip->GetMiningBoostAmount()));
#define _log(type, fmt,...)
bool HasAttribute(const uint16 attrID) const
void Depleted(MiningLaser *pMod)
bool HasAvailableSpace(EVEItemFlags flag, InventoryItemRef iRef) const
SystemBubble * SysBubble()
virtual void RemoveTarget(SystemEntity *pSE)
double MakeRandomFloat(double low, double high)
Generates random real from interval [low; high].
virtual bool CanActivate()
uint32 GetRemainingCycleTimeMS()
virtual void UnloadCharge()
MiningLaser(ModuleItemRef mRef, ShipItemRef sRef)
void SendNotifyMsg(const char *fmt,...)
TargetManager * TargetMgr()
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
SystemEntity * m_targetSE
SystemManager * SystemMgr()
InventoryItemRef GetSelf()
void SetItem(size_t index, PyRep *object)
Stores Python object.
virtual void UnloadCharge()
InventoryItemRef m_chargeRef
void AddOreAndDeactivate(uint16 typeID, float amt, bool slave=true)
void ShowEffect(bool active=false, bool abort=false)
void SetAttribute(uint16 attrID, int num, bool notify=true)
virtual void LoadCharge(InventoryItemRef charge)
const char * GetName() const
void Depleted(std::multimap< float, MiningLaser * > &mMap)
virtual bool CanActivate()
virtual void DeactivateCycle(bool abort=false)
void ApplyEffect(int8 state, bool active=false)
void SetActive(uint16 bubbleID, bool active=true)
virtual Client * GetPilot()
void ProcessCycle(bool abort=false)
EvilNumber GetAttribute(const uint16 attrID) const
virtual void RemoveItem(InventoryItemRef iRef)
virtual void LoadCharge(InventoryItemRef charge)
uint32 AddItemByFlag(EVEItemFlags flag, InventoryItemRef iRef, Client *pClient=nullptr)
float GetRemainingVolumeByFlag(EVEItemFlags flag) const
Inventory * GetMyInventory()
EvilNumber GetAttribute(uint32 attrID)
virtual void DeactivateCycle(bool abort=false)
void SetModuleState(int8 state)
void SetItemString(const char *key, PyRep *value)
SetItemString adds or sets a database entry.