interrupt funtion

This commit is contained in:
kevinz000
2020-04-11 05:59:11 -07:00
parent f8a7a68ac3
commit 8132db65b1
2 changed files with 11 additions and 2 deletions
+3
View File
@@ -23,6 +23,9 @@ GLOBAL_LIST_INIT(dir2blockdir, list(
#define DIR2BLOCKDIR(d) (GLOB.dir2blockdir["[d]"])
/// If this is the value of active_block_starting it signals we want to interrupt the start
#define ACTIVE_BLOCK_STARTING_INTERRUPT "INTERRUPT"
/// ""types"" of parry "items"
#define UNARMED_PARRY "unarmed"
#define MARTIAL_PARRY "martial"
@@ -54,6 +54,9 @@
visible_message("<span class='warning'>[src] lowers their [active_block_item].</span>")
animate(src, pixel_x = get_standard_pixel_x_offset(), pixel_y = get_standard_pixel_y_offset(), time = 2.5, FALSE, SINE_EASING | EASE_IN)
/mob/living/proc/continue_starting_active_block()
return active_block_starting != ACTIVE_BLOCK_STARTING_INTERRUPT
/mob/living/get_standard_pixel_x_offset()
. = ..()
if(active_blocking || active_block_starting)
@@ -74,7 +77,7 @@
* Proc called by keybindings to toggle active blocking.
*/
/mob/living/proc/keybind_toggle_active_blocking()
if(active_blocking)
if(active_blocking || active_block_starting)
return keybind_stop_active_blocking()
else
return keybind_start_active_blocking()
@@ -99,9 +102,10 @@
var/delay = data.block_start_delay
active_block_starting = TRUE
animate(src, pixel_x = get_standard_pixel_x_offset(), pixel_y = get_standard_pixel_y_offset(), time = delay, FALSE, SINE_EASING | EASE_IN)
if(!do_after_advanced(src, delay, src, DO_AFTER_REQUIRES_USER_ON_TURF|DO_AFTER_NO_COEFFICIENT|DO_AFTER_DISALLOW_ACTIVE_ITEM_CHANGE, null, MOBILITY_USE, COMBAT_FLAG_COMBAT_ACTIVE, null, I))
if(!do_after_advanced(src, delay, src, DO_AFTER_REQUIRES_USER_ON_TURF|DO_AFTER_NO_COEFFICIENT|DO_AFTER_DISALLOW_ACTIVE_ITEM_CHANGE, CALLBACK(src, .proc/continue_starting_active_block), MOBILITY_USE, COMBAT_FLAG_COMBAT_ACTIVE, null, I))
to_chat(src, "<span class='warning'>You fail to raise [src].</span>")
animate(src, pixel_x = get_standard_pixel_x_offset(), pixel_y = get_standard_pixel_y_offset(), time = 2.5, FALSE, SINE_EASING | EASE_IN, ANIMATION_END_NOW)
active_block_starting = FALSE
return
active_block_starting = FALSE
start_active_blocking(I)
@@ -110,6 +114,8 @@
* Proc called by keybindings to stop active blocking.
*/
/mob/living/proc/keybind_stop_active_blocking()
if(active_block_starting)
active_block_starting = ACTIVE_BLOCK_STARTING_INTERRUPT
stop_active_blocking(FALSE)
return TRUE