mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 16:18:01 +01:00
Replaces world.icon_size (and some magic numbers) with defines (#86819)
## About The Pull Request All usages of world.icon_size in code have been replaced with new `ICONSIZE_X`, `ICONSIZE_Y` and `ICONSIZE_ALL` defines depending on context Replaces some "32" magic numbers with the defines A few bits of code have been modified to split up x/y math as well ## Why It's Good For The Game Magic number bad, code more readable, code more flexible and I'm told there's an access cost to doing world.icon_size so minor performance gains ## Changelog 🆑 tonty code: made some code relating to the world's icon size more readable /🆑 --------- Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
@@ -348,7 +348,7 @@ Moving interrupts
|
||||
//How long whole process takes
|
||||
var/sculpting_time = 30 SECONDS
|
||||
//Single interruptible progress period
|
||||
var/sculpting_period = round(sculpting_time / world.icon_size) //this is just so it reveals pixels line by line for each.
|
||||
var/sculpting_period = round(sculpting_time / ICON_SIZE_Y) //this is just so it reveals pixels line by line for each.
|
||||
var/interrupted = FALSE
|
||||
var/remaining_time = sculpting_time - (prepared_block.completion * sculpting_time)
|
||||
|
||||
@@ -473,7 +473,7 @@ Moving interrupts
|
||||
return FALSE
|
||||
//No big icon things
|
||||
var/list/icon_dimensions = get_icon_dimensions(target.icon)
|
||||
if(icon_dimensions["width"] != world.icon_size || icon_dimensions["height"] != world.icon_size)
|
||||
if(icon_dimensions["width"] != ICON_SIZE_X || icon_dimensions["height"] != ICON_SIZE_Y)
|
||||
user.balloon_alert(user, "sculpt target is too big!")
|
||||
return FALSE
|
||||
return TRUE
|
||||
@@ -509,7 +509,7 @@ Moving interrupts
|
||||
remove_filter("partial_uncover")
|
||||
target_appearance_with_filters = null
|
||||
else
|
||||
var/mask_offset = min(world.icon_size,round(completion * world.icon_size))
|
||||
var/mask_offset = min(ICON_SIZE_Y,round(completion * ICON_SIZE_Y))
|
||||
remove_filter("partial_uncover")
|
||||
add_filter("partial_uncover", 1, alpha_mask_filter(icon = white, y = -mask_offset))
|
||||
target_appearance_with_filters.filters = filter(type="alpha",icon=white,y=-mask_offset,flags=MASK_INVERSE)
|
||||
|
||||
Reference in New Issue
Block a user