Skip to content

Commit

Permalink
Отработка оп багам, рефактор хватов. На очереди - перенастройка спрайтов
Browse files Browse the repository at this point in the history
  • Loading branch information
msw7007 committed Oct 20, 2024
1 parent 70e6513 commit d3f9b1b
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 29 deletions.
7 changes: 6 additions & 1 deletion modular_ss220/species/_components/attacking/double_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@
SIGNAL_HANDLER
var/hand_item = user.get_active_hand()
state_attack = TRUE
if(hand_item)
if(hand_item && state_attack)
addtimer(CALLBACK(src, PROC_REF(hand_attack), target, user, def_zone, hand_item), (user.next_move_modifier / 5) SECONDS)

/datum/component/double_attack/proc/hand_attack(mob/living/target, mob/living/user, def_zone, obj/item/hand_item)
if(QDELETED(src) || QDELETED(target) || user != hand_item.loc || !user.Adjacent(target))
return
hand_item.attack(target, user, def_zone)
state_attack = FALSE

//Расширение базового прока атаки для запуска сигнала
/obj/item/attack(mob/living/M, mob/living/user, def_zone)
. = .. ()
SEND_SIGNAL(src, COMSIG_MOB_ITEM_ATTACK, M, user, def_zone)
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#define GADOM_BASIC_LOAD_TIMER_CRATE 2 SECONDS

#define COMSIG_GADOM_UNMOB_CAN_GRAB "block_operation"
#define GADOM_UNMOB_ALLOW_TO_GRAB (1<<0)

//Для отслеживания кто несет объект
/atom/movable
Expand Down Expand Up @@ -69,7 +68,7 @@

/datum/component/gadom_cargo/proc/block_operation()
SIGNAL_HANDLER
var/signal_result = (carrier.a_intent != "grab" ? FALSE : GADOM_MOB_ALLOW_TO_GRAB)
var/signal_result = carrier.a_intent == "grab"
return signal_result

/datum/component/gadom_cargo/proc/try_load_cargo(datum/component_holder, mob/user, atom/movable/AM)
Expand All @@ -83,7 +82,7 @@
load(AM)

/datum/component/gadom_cargo/proc/load(atom/movable/AM)
if(carrier.loaded || AM.anchored || get_dist(carrier, AM) > 1)
if(carrier.loaded || carrier.passenger || AM.anchored || get_dist(carrier, AM) > 1)
return

if(!isitem(AM) && !ismachinery(AM) && !isstructure(AM) && !ismob(AM))
Expand Down Expand Up @@ -131,13 +130,13 @@
//Расширение прока для переноса ящика на моба
/mob/living/carbon/human/MouseDrop_T(atom/movable/AM, mob/user)
var/signal_call = SEND_SIGNAL(usr, COMSIG_GADOM_UNMOB_CAN_GRAB)
if(signal_call & GADOM_UNMOB_ALLOW_TO_GRAB)
if(signal_call)
SEND_SIGNAL(usr, COMSIG_GADOM_UNMOB_LOAD, usr, AM)
. = .. ()

//Расширение прока на отстегивание ящика
/datum/species/spec_attack_hand(mob/living/carbon/human/M, mob/living/carbon/human/H, datum/martial_art/attacker_style)
var/signal_call = SEND_SIGNAL(usr, COMSIG_GADOM_UNMOB_CAN_GRAB)
if((signal_call & GADOM_UNMOB_ALLOW_TO_GRAB) && H.loaded)
var/signal_call = SEND_SIGNAL(H, COMSIG_GADOM_UNMOB_CAN_GRAB)
if(signal_call && H.loaded)
SEND_SIGNAL(H, COMSIG_GADOM_UNMOB_UNLOAD)
. = .. ()
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#define COMSIG_GADOM_MOB_UNLOAD "try_unload_mob"
#define GADOM_BASIC_LOAD_TIMER_MOB 2 SECONDS
#define COMSIG_GADOM_MOB_CAN_GRAB "block_operation"
#define GADOM_MOB_ALLOW_TO_GRAB (1<<0)

/mob/living/carbon/human
var/atom/movable/loaded = null
Expand All @@ -31,45 +30,43 @@

/datum/component/gadom_living/proc/block_operation(datum/component_holder)
SIGNAL_HANDLER
var/signal_result = (carrier.a_intent != "grab" ? FALSE : GADOM_MOB_ALLOW_TO_GRAB)
var/signal_result = carrier.a_intent == "grab"
return signal_result

/datum/component/gadom_living/proc/try_load_mob(datum/component_holder, mob/user, mob/target)
SIGNAL_HANDLER
INVOKE_ASYNC(src, PROC_REF(pre_load), component_holder, user, target)

/datum/component/gadom_living/proc/pre_load(datum/component_holder, mob/user, mob/target)
var/mob/living/carbon/human/puppet = component_holder
if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || get_dist(user, puppet) > 1)
var/mob/living/carbon/human/puppet = user
if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || get_dist(target, user) > 1)
return
if(!istype(target))
return
if((do_after(puppet, GADOM_BASIC_LOAD_TIMER_MOB * puppet.dna.species.action_mult, FALSE, target))) //Асинх не помогает (?!)
load(puppet, target)

/datum/component/gadom_living/proc/load(mob/living/carbon/human/puppet, atom/movable/AM)
if(carrier.loaded|| AM.anchored || get_dist(puppet, AM) > 1)
if(puppet.loaded || puppet.passenger || AM.anchored || get_dist(puppet, AM) > 1)
return

if(!isitem(AM) && !ismachinery(AM) && !isstructure(AM) && !ismob(AM))
return
if(!isturf(AM.loc))
return

if(isliving(AM))
if(!load_mob(AM))
return
if(!load_mob(puppet, AM))
return

carrier.loaded = AM
carrier.update_icon()
puppet.loaded = AM
puppet.update_icon()

/datum/component/gadom_living/proc/load_mob(mob/living/M)
carrier.can_buckle = TRUE
carrier.buckle_lying = FALSE
if(carrier.buckle_mob(M))
carrier.passenger = M
carrier.loaded = M
carrier.can_buckle = FALSE
/datum/component/gadom_living/proc/load_mob(mob/living/carbon/human/puppet, mob/living/M)
puppet.can_buckle = TRUE
puppet.buckle_lying = FALSE
if(puppet.buckle_mob(M))
puppet.passenger = M
puppet.can_buckle = FALSE

return TRUE
return FALSE
Expand Down Expand Up @@ -106,14 +103,14 @@
to_chat(usr, "<span class='boldannounceic'>Interacting with admin-frozen players is not permitted.</span>")
return
var/signal_call = SEND_SIGNAL(usr, COMSIG_GADOM_MOB_CAN_GRAB)
if(signal_call & GADOM_MOB_ALLOW_TO_GRAB)
if(signal_call)
SEND_SIGNAL(usr, COMSIG_GADOM_MOB_LOAD, usr, src)
return
. = .. ()

/datum/species/spec_attack_hand(mob/living/carbon/human/M, mob/living/carbon/human/H, datum/martial_art/attacker_style)
var/signal_call = SEND_SIGNAL(usr, COMSIG_GADOM_MOB_CAN_GRAB)
if((signal_call & GADOM_MOB_ALLOW_TO_GRAB) && H.loaded)
var/signal_call = SEND_SIGNAL(H, COMSIG_GADOM_MOB_CAN_GRAB)
if(signal_call && H.passenger)
SEND_SIGNAL(H, COMSIG_GADOM_MOB_UNLOAD, M)
. = .. ()

Expand Down
9 changes: 9 additions & 0 deletions modular_ss220/species/serpentids/_serpentids.dme
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,12 @@

#include "code/organs/internal/implants/unused/serpentid_mantis_hand.dm"
#include "code/organs/internal/implants/unused/serpentid_mantis_implant.dm"
// BEGIN_INTERNALS
// END_INTERNALS
// BEGIN_FILE_DIR
#define FILE_DIR .
// END_FILE_DIR
// BEGIN_PREFERENCES
// END_PREFERENCES
// BEGIN_INCLUDE
// END_INCLUDE
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// ============ Органы внешние ============
/obj/item/kitchen/knife/combat/serpentblade
name = "serpentid mantis blade"
icon = 'icons/obj/items_cyborg.dmi'
icon_state = "knife"
icon = 'modular_ss220/species/serpentids/icons/organs.dmi'
icon_state = "left_blade"
lefthand_file = null
righthand_file = null
desc = "Biological melee weapon. Sharp and durable. It can cut off some heads, or maybe not..."
Expand Down
Binary file modified modular_ss220/species/serpentids/icons/organs.dmi
Binary file not shown.

0 comments on commit d3f9b1b

Please sign in to comment.