Originally this started as a "deduplicate a bunch of duplicated code in script commands" PR, but as I was working on that, I discovered there's a lot more that needs to be done than just deduplication. Anything which needs a crewmate entity now calls getcrewmanfromname(name), and anything which just needs the crewmate's color calls getcolorfromname(name). This was done to make sure that everything works consistently and no copy/pasting is required. Next is the fallback; instead of giving up and doing various things when it can't find a specific color, it now attempts to treat the color name as an ID, and if it can't then it returns -1, where each individual command handles that return value. This means we can keep around AEM -- a bug used in custom levels -- by not doing anything with the return value if it's -1.
Also, for some reason, there were two crewcolour functions, so I stripped out the one in entityclass and left (and modified) the one in the graphics class, since the graphics class also has the crewcolourreal function.
Legal Stuff:
By submitting this pull request, I confirm that...
[x] My changes may be used in a future commercial release of VVVVVV
[x] I will be credited in a CONTRIBUTORS file and the "GitHub Friends"
section of the credits for all of said releases, but will NOT be compensated
for these changes
Changes:
Originally this started as a "deduplicate a bunch of duplicated code in script commands" PR, but as I was working on that, I discovered there's a lot more that needs to be done than just deduplication. Anything which needs a crewmate entity now calls
getcrewmanfromname(name)
, and anything which just needs the crewmate's color callsgetcolorfromname(name)
. This was done to make sure that everything works consistently and no copy/pasting is required. Next is the fallback; instead of giving up and doing various things when it can't find a specific color, it now attempts to treat the color name as an ID, and if it can't then it returns -1, where each individual command handles that return value. This means we can keep around AEM -- a bug used in custom levels -- by not doing anything with the return value if it's -1.Also, for some reason, there were two
crewcolour
functions, so I stripped out the one in entityclass and left (and modified) the one in the graphics class, since the graphics class also has thecrewcolourreal
function.Legal Stuff:
By submitting this pull request, I confirm that...
CONTRIBUTORS
file and the "GitHub Friends" section of the credits for all of said releases, but will NOT be compensated for these changes