mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 21:48:39 +01:00
Rounds the displayed layer in Shift Layer Upwards/Downwards to the nearest integer (#23622)
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
#define MOB_LAYER_SHIFT_INCREMENT 0.01
|
||||
#define MOB_LAYER_SHIFT_MIN 3.95
|
||||
//#define MOB_LAYER 4 // This is a byond standard define
|
||||
#define MOB_LAYER_SHIFT_MAX 4.05
|
||||
#define MOB_LAYER_SHIFT_INCREMENT 1
|
||||
/// The amount by which layers are multiplied before being modified.
|
||||
/// Helps avoiding floating point errors.
|
||||
#define MOB_LAYER_MULTIPLIER 100
|
||||
#define MOB_LAYER_SHIFT_MIN 3.95
|
||||
//#define MOB_LAYER 4 // This is a byond standard define
|
||||
#define MOB_LAYER_SHIFT_MAX 4.05
|
||||
|
||||
/mob/living/verb/layershift_up()
|
||||
set name = "Shift Layer Upwards"
|
||||
@@ -15,8 +18,8 @@
|
||||
to_chat(src, span_warning("You cannot increase your layer priority any further."))
|
||||
return
|
||||
|
||||
layer += MOB_LAYER_SHIFT_INCREMENT
|
||||
var/layer_priority = (layer - MOB_LAYER) * 100 // Just for text feedback
|
||||
layer = min(((layer * MOB_LAYER_MULTIPLIER) + MOB_LAYER_SHIFT_INCREMENT) / MOB_LAYER_MULTIPLIER, MOB_LAYER_SHIFT_MAX)
|
||||
var/layer_priority = round(layer * MOB_LAYER_MULTIPLIER - MOB_LAYER * MOB_LAYER_MULTIPLIER, MOB_LAYER_SHIFT_INCREMENT) // Just for text feedback
|
||||
to_chat(src, span_notice("Your layer priority is now [layer_priority]."))
|
||||
|
||||
/mob/living/verb/layershift_down()
|
||||
@@ -31,6 +34,6 @@
|
||||
to_chat(src, span_warning("You cannot decrease your layer priority any further."))
|
||||
return
|
||||
|
||||
layer -= MOB_LAYER_SHIFT_INCREMENT
|
||||
var/layer_priority = (layer - MOB_LAYER) * 100 // Just for text feedback
|
||||
layer = max(((layer * MOB_LAYER_MULTIPLIER) - MOB_LAYER_SHIFT_INCREMENT) / MOB_LAYER_MULTIPLIER, MOB_LAYER_SHIFT_MIN)
|
||||
var/layer_priority = round(layer * MOB_LAYER_MULTIPLIER - MOB_LAYER * MOB_LAYER_MULTIPLIER, MOB_LAYER_SHIFT_INCREMENT) // Just for text feedback
|
||||
to_chat(src, span_notice("Your layer priority is now [layer_priority]."))
|
||||
|
||||
Reference in New Issue
Block a user