The right side of a
var/static/varname =
Numbered Steps to Reproduce Problem:
Run the following project, zipped here: https://github.com/DamianX/byondbugs/raw/main/statics1/ statics1.zip
Code Snippet (if applicable) to Reproduce Problem:
/obj/canister
icon_state = "canister"
/obj/canister/proc/get_overlay()
var/static/a = icon_state
return a
//
/obj/tank/proc/get_overlay_icon_state()
return "this is never called"
/obj/tank/proc/get_overlay()
var/static/a = get_overlay_icon_state()
return a
/world/proc/get_overlay_icon_state()
return "world was here"
//
/world/New()
..()
var/obj/canister/C = new
world.log << json_encode(C.get_overlay()) // Outputs null
var/obj/tank/T = new
world.log << json_encode(T.get_overlay()) // Outputs "world was here"
Expected Results:
It should output "canister" and "this is never called", respectively.
Actual Results:
It outputs null and "world was here", respectively.
Does the problem occur:
Every time? Or how often? Every time.
In other games? Yes.
In other user accounts? Yes.
On other computers? Yes.
When does the problem NOT occur?
Don't know.
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.)
Don't know.
Workarounds:
Don't reference src in the initialization of a proc-local static var.