Jump to content

Can't seem to get crew member status


Recommended Posts

I've got code that checks for what status the crewmember is in when it runs, but it doesn't seem to actually seem to query the status correctly. Relevant code:


void Update()
{
if (crewMember.rosterStatus.Equals(ProtoCrewMember.RosterStatus.Assigned)){
paycheck = wage * multiplier;
message.AppendLine(", level" + crewMember.experienceLevel + ", is on mission. Wages paid = " + paycheck);
Funding.Instance.AddFunds(-paycheck, 0);
}
else if (crewMember.rosterStatus.Equals(ProtoCrewMember.RosterStatus.Available))
{
paycheck = standbyWage * multiplier;
message.AppendLine(", level" + crewMember.experienceLevel + ", is available. Wages paid = " + paycheck);
Funding.Instance.AddFunds(-paycheck, 0);
}
}

Some runs it seems to get stuck on "Assigned", and others it never seems to see that a crewmember is Assigned out.

Link to comment
Share on other sites

I did some testing, it looks like a larger issue than just my code. I wrote a short plugin that just dumps ProtoCrewMember.RosterStatus for each crew member to the debug log and it's showing the same issue. Once it runs once while a Kerbal is assigned, it will show assigned until the game is reset.

Link to comment
Share on other sites

In case anyone else runs into this, I found the problem. I had a line in Awake() I was working off of for HighLogic, instead of accessing it directly. This is why it would update status properly when the game started but not while it was running.

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...