Jump to content

[SOLVED] Resource Panel not showing change in Electricity


puzzler995

Recommended Posts

I've created a part that when active should pull electric charge. While the electric charge does pull, the resource panel still shows the change in electricity as "(0)", not .3 as it should. I know for a fact it does pull the electricity, as the amount goes down.

My code from the PartModule derived class:


[KSPField(isPersistant = false)]
public float PowerConsumption;
...
if (GetPower(part, PowerConsumption)) { //This is within the OnUpdate() method
...
}
...
private bool GetPower(Part part, float PowerConsumption)
{
if (TimeWarp.deltaTime != 0)
{
float amount = part.RequestResource("ElectricCharge", PowerConsumption * TimeWarp.deltaTime);
return amount != 0;
}
else
{
return true;
}
}

Thanks :)

Edited by puzzler995
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...