When I include the line:
atom/icon_state=""
It still defaults to null at runtime. This would be fine if not for how the icon() proc interacts with icon_states. I want to extract only the objects current icon state, but icon(icon,null) seems to extract all the icon's states rather than just the specific one. (Which isn't the issue, the issue is that the icon_state is null in the first place)
Numbered Steps to Reproduce Problem:
1:Set icon_state=""
2:Start the game
3:Test icon_state on an object.
4:Discover that it reads null.
5:Discover also that it doesn't like the icon() proc.
Code Snippet (if applicable) to Reproduce Problem:
atom/icon='TestIcon.dmi'
//Test icon is an icon with "","Other", and "Other2" for icon_states, so we can see the difference.
mob
icon_state=""
verb/test_null()
if(icon_state==null) src<<"Null"
else src<<"Not Null"
verb/get_file() src<<ftp(icon(icon,icon_state))
Expected Results:
get_file() would send an icon with just the "" state, and get_state() would return "Not Null".
Actual Results:
get_file() sends an icon with all the icon states of the file, and get_state() returns "Null".
Does the problem occur:
Every time? Or how often?
Always
In other games?
I encountered the error in my own game, and then tested in a separate library to repeat see if I could repeat the issue, and did.
In other user accounts?
I didn't see a reason to test.
On other computers?
I also failed to see a reason to test, though also didn't have access to one.
When does the problem NOT occur?
Always seems to.
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Never tested.
Workarounds:
When I change icon_state="" during run-time rather than directly applying to an object's type in the code it works perfectly, but I don't care to have to do this.
From what I'm seeing, the fact that icon_state="" is changed to icon_state=null at compile-time appears to be a deliberate choice made in the compiler. I'm not sure if there's a reason for this that might negatively impact any games if changed; my gut says probably not, but it warrants further study.
Because the behavior in question is deliberate, I'm not sure this strictly qualifies as a bug, but I'll leave it open regardless while I investigate.