From 8fe45263c589a2c1394fed00662fbc9be867df7e Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Mon, 26 Apr 2021 22:58:30 -0700 Subject: [PATCH] whew --- code/_onclick/drag_drop.dm | 6 ++-- code/datums/status_effects/debuffs.dm | 7 +++++ .../objects/items/devices/traitordevices.dm | 2 +- .../modules/mob/living/living_active_parry.dm | 29 +++++++++++++++---- .../mob/living/living_blocking_parrying.dm | 2 -- 5 files changed, 34 insertions(+), 12 deletions(-) diff --git a/code/_onclick/drag_drop.dm b/code/_onclick/drag_drop.dm index 43f2581de8..43451bd056 100644 --- a/code/_onclick/drag_drop.dm +++ b/code/_onclick/drag_drop.dm @@ -95,9 +95,9 @@ if(mob) SEND_SIGNAL(mob, COMSIG_MOB_CLIENT_MOUSEMOVE, object, location, control, params) // god forgive me for i have sinned - used for autoparry. currently at 5 objects. - mousedOverObjects[object] = world.time - if(mousedOverObjects.len > 7) - mousedOverObjects.Cut(1, 2) + moused_over_objects[object] = world.time + if(moused_over_objects.len > 7) + moused_over_objects.Cut(1, 2) ..() /client/MouseDrag(src_object,atom/over_object,src_location,over_location,src_control,over_control,params) diff --git a/code/datums/status_effects/debuffs.dm b/code/datums/status_effects/debuffs.dm index d01d3a1454..7fc7da2ef7 100644 --- a/code/datums/status_effects/debuffs.dm +++ b/code/datums/status_effects/debuffs.dm @@ -127,6 +127,13 @@ desc = "You've fallen asleep. Wait a bit and you should wake up. Unless you don't, considering how helpless you are." icon_state = "asleep" + +/datum/status_effect/grouped/stasis + id = "stasis" + duration = -1 + tick_interval = 10 + var/last_dead_time + /datum/status_effect/robotic_emp id = "emp_no_combat_mode" diff --git a/code/game/objects/items/devices/traitordevices.dm b/code/game/objects/items/devices/traitordevices.dm index 6e06a87ac3..ac79b3b887 100644 --- a/code/game/objects/items/devices/traitordevices.dm +++ b/code/game/objects/items/devices/traitordevices.dm @@ -85,7 +85,7 @@ effective or pretty fucking useless. /obj/item/healthanalyzer/rad_laser/attack(mob/living/M, mob/living/user) if(!stealth || !irradiate) return ..() - var/knowledge = SEND_SIGNAL(COMSIG_IDENTIFICATION_KNOWLEDGE_CHECK, user) == ID_COMPONENT_KNOWLEDGE_FULL + var/knowledge = SEND_SIGNAL(src, COMSIG_IDENTIFICATION_KNOWLEDGE_CHECK, user) == ID_COMPONENT_KNOWLEDGE_FULL if(!irradiate) return if(!used) diff --git a/code/modules/mob/living/living_active_parry.dm b/code/modules/mob/living/living_active_parry.dm index bdd6174314..e062a60aa8 100644 --- a/code/modules/mob/living/living_active_parry.dm +++ b/code/modules/mob/living/living_active_parry.dm @@ -35,6 +35,7 @@ return FALSE var/method = determined[1] data = return_block_parry_datum(determined[2]) + var/datum/tool = determined[3] var/full_parry_duration = data.parry_time_windup + data.parry_time_active + data.parry_time_spindown // no system in place to "fallback" if out of the 3 the top priority one can't parry due to constraints but something else can. // can always implement it later, whatever. @@ -224,7 +225,7 @@ /** * Attempts to automatically parry an attacker. */ -/mob/living/proc/attempt_auto_parry() +/mob/living/proc/attempt_auto_parry(atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, list/return_list = list()) // determine how we'll parry var/list/determined = determine_parry_method(TRUE, TRUE) if(!islist(determined)) @@ -234,6 +235,16 @@ if(!data.parry_automatic_enabled) return FALSE // before doing anything, check if the user moused over them properly + if(!client) + return FALSE + var/found = FALSE + for(var/i in client.moused_over_objects) + if(i == object) + if((client.moused_over_objects[i] + (data.autoparry_mouse_delay_maximum SECONDS)) >= world.time) + found = TRUE + break + if(!found) + return FALSE // if that works, try to start parry // first, check cooldowns @@ -246,9 +257,11 @@ parry_start_time = world.time - data.parry_time_windup else parry_start_time = world.time - data.autoparry_sequence_start_time + return TRUE else // for single attack block - + #warn single attack block + return FALSE /** * Gets the stage of our parry sequence we're currently in. @@ -282,13 +295,17 @@ /// same return values as normal blocking, called with absolute highest priority in the block "chain". /mob/living/proc/run_parry(atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, list/return_list = list(), allow_auto = TRUE) var/stage = get_parry_stage() + if(attack_type & ATTACK_TYPE_PARRY_COUNTERATTACK) + return BLOCK_NONE // don't infinite loop if(stage != PARRY_ACTIVE) // If they're not currently parrying, attempt auto parry - if((stage == NOT_PARRYING) && allow_auto && !SEND_SIGNAL(src, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_INACTIVE)) - return attempt_auto_parry() - return BLOCK_NONE + if(stage == NOT_PARRYING) + if(!allow_auto || SEND_SIGNAL(src, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_INACTIVE) || !attempt_auto_parry(object, damage, attack_text, attack_type, armour_penetration, attacker, def_zone, return_list)) + return BLOCK_NONE + else + return BLOCK_NONE var/datum/block_parry_data/data = get_parry_data() - if(attack_type && (!(attack_type & data.parry_attack_types) || (attack_type & ATTACK_TYPE_PARRY_COUNTERATTACK))) // if this attack is from a parry do not parry it lest we infinite loop. + if(attack_type && !(attack_type & data.parry_attack_types)) return BLOCK_NONE var/efficiency = data.get_parry_efficiency(attack_type, get_parry_time()) switch(parrying) diff --git a/code/modules/mob/living/living_blocking_parrying.dm b/code/modules/mob/living/living_blocking_parrying.dm index 36fb160e0f..453f521575 100644 --- a/code/modules/mob/living/living_blocking_parrying.dm +++ b/code/modules/mob/living/living_blocking_parrying.dm @@ -97,7 +97,6 @@ GLOBAL_LIST_EMPTY(block_parry_data) // Other than for overrides, this mostly just reads from the above vars /// Can this item automatically block? var/block_automatic_enabled = TRUE -#warn have autoblock items warn user on pickup /// Directions that you can autoblock in. Null to default to normal directions. var/block_automatic_directions = null /// Effectiveness multiplier for automated block. Only applies to efficiency, absorption and limits stay the same! @@ -185,7 +184,6 @@ GLOBAL_LIST_EMPTY(block_parry_data) // Anything not specified like cooldowns/clickdelay respecting is pulled from above. /// Can this data automatically parry? This is off by default because this is something that requires thought to balance. var/parry_automatic_enabled = FALSE -#warn have autoparry items warn user on pickup /// Hard autoparry cooldown var/autoparry_cooldown_absolute = 3 SECONDS /// Autoparry : Simulate a parry sequence starting at a certain tick, or simply simulate a single attack parry?