Skip to content

Fixes #2495 body ikos targetable#2501

Merged
Dunbaratu merged 2 commits intoKSP-KOS:developfrom
Dunbaratu:fixes_2495_Body_IKOSTargetable
Apr 28, 2019
Merged

Fixes #2495 body ikos targetable#2501
Dunbaratu merged 2 commits intoKSP-KOS:developfrom
Dunbaratu:fixes_2495_Body_IKOSTargetable

Conversation

@Dunbaratu
Copy link
Member

Fixes #2495

The term "IKOSTargetable" was accidentally deleted from the declaration header of class BodyTarget by my PR #2460. This puts it back.

It caused the bug because of a place in VesselUtils.SetTarget() where it tries to cast the target value to IKOSTargetable, and with that term removed from the header, BodyTarget values no longer allowed themselves to be thusly casted.

The word "IKOSTargetable" was accidentally deleted from
the declaration header of class BodyTarget by my PR KSP-KOS#2460.

The SET TARGET command has a check to see if the value being
set is an actual target object or just a string name that
needs to be looked up.  That check was based on seeing if
the value could be cast to IKOSTargetable or not.  When
that was accidentally removed from BodyTarget's header,
it broke that check.
I had inserted a check to throw an exception if you
try to SET TARGET to an illegal body, one the game
won't allow because you currently orbit it.  In retrospect,
that removes a feature people might have been using, which
is that trying to set the target to your current SOI body is
a roundabout way to unset the target (the game will refuse the
attempt and deselect the target, but the kOS script would
be fine with it and wouldn't crash).

Changing that into an exception means previously working code
could break, so I removed the check again.
@Dunbaratu Dunbaratu merged commit ffc8757 into KSP-KOS:develop Apr 28, 2019
@Dunbaratu Dunbaratu added the bug Weird outcome is probably not what the mod programmer expected. label May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Weird outcome is probably not what the mod programmer expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kOS 1.1.7, KSP 1.6.1 or 1.7 : No longer being able to set the target to a BODY

1 participant