mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 08:37:43 +01:00
Afterattack fixes (#2350)
## About The Pull Request See name, I'm actually going through with it and doing it. ## Why It's Good For The Game Fixes broken item interactions closes #2253 closes #2204 ## Proof Of Testing Worked on my device (So far) ## Changelog 🆑 fix: Phystool and Physgun work correctly again fix: Clockcult slabs can examine again fix: Compostbin is now handled correctly fix: Robohand checks for robohand again /🆑
This commit is contained in:
@@ -8,13 +8,13 @@
|
||||
if(!istype(target, /obj/structure/destructible/clockwork/gear_base))
|
||||
return ELEMENT_INCOMPATIBLE
|
||||
|
||||
RegisterSignal(target, COMSIG_ATOM_AFTER_ATTACKEDBY, PROC_REF(print_info))
|
||||
RegisterSignal(target, COMSIG_ATOM_ITEM_INTERACTION, PROC_REF(print_info))
|
||||
RegisterSignal(target, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine))
|
||||
|
||||
|
||||
/datum/element/clockwork_structure_info/Detach(datum/target)
|
||||
. = ..()
|
||||
UnregisterSignal(target, COMSIG_ATOM_AFTER_ATTACKEDBY)
|
||||
UnregisterSignal(target, COMSIG_ATOM_ITEM_INTERACTION)
|
||||
UnregisterSignal(target, COMSIG_ATOM_EXAMINE)
|
||||
|
||||
/**
|
||||
@@ -26,7 +26,7 @@
|
||||
* * weapon - The item that attacked the structure
|
||||
* * user - The one who attacked the structure
|
||||
*/
|
||||
/datum/element/clockwork_structure_info/proc/print_info(obj/structure/destructible/clockwork/gear_base/source, obj/item/weapon, mob/user, proximity_flag, click_parameters)
|
||||
/datum/element/clockwork_structure_info/proc/print_info(obj/structure/destructible/clockwork/gear_base/source, mob/user, obj/item/weapon)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(!IS_CLOCK(user) || !istype(weapon, /obj/item/clockwork/clockwork_slab))
|
||||
@@ -44,6 +44,7 @@
|
||||
assembled_string += "This structure is connected to <b>[LAZYLEN(powered_source.transmission_sigils)]</b> transmission sigil[LAZYLEN(powered_source.transmission_sigils) == 1 ? "" : "s"]."
|
||||
|
||||
to_chat(user, span_brass(assembled_string))
|
||||
return ITEM_INTERACT_BLOCKING
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -105,16 +105,27 @@
|
||||
/obj/item/gun/ballistic/automatic/pistol/robohand/unrestricted
|
||||
unrestricted = TRUE
|
||||
|
||||
//The gun cannot shoot if you do not have a cyborg arm.
|
||||
/obj/item/gun/ballistic/automatic/pistol/robohand/afterattack(atom/target, mob/living/user, flag, params)
|
||||
//This is where we are checking if the user has a cybernetic arm to USE the gun. ROBOHAND HAS A ROBO HAND
|
||||
if(!unrestricted)
|
||||
var/mob/living/carbon/human/human_user = user
|
||||
var/obj/item/bodypart/selected_hand = human_user.get_active_hand()
|
||||
if(IS_ORGANIC_LIMB(selected_hand))
|
||||
to_chat(user, span_warning("You can't seem to figure out how to use [src], perhaps you need to check the manual?"))
|
||||
return
|
||||
. = ..()
|
||||
/obj/item/gun/ballistic/automatic/pistol/robohand/ranged_interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers)
|
||||
if(can_use(user) == ITEM_INTERACT_SUCCESS)
|
||||
return ..()
|
||||
return ITEM_INTERACT_BLOCKING
|
||||
|
||||
/obj/item/gun/ballistic/automatic/pistol/robohand/ranged_interact_with_atom_secondary(atom/interacting_with, mob/living/user, list/modifiers)
|
||||
if(can_use(user) == ITEM_INTERACT_SUCCESS)
|
||||
return ..()
|
||||
return ITEM_INTERACT_BLOCKING
|
||||
|
||||
/// Checks if we have the roboarm to use the robo gun. Well, unless it's unrestricted
|
||||
/obj/item/gun/ballistic/automatic/pistol/robohand/proc/can_use(mob/living/carbon/human/user)
|
||||
if(unrestricted)
|
||||
return ITEM_INTERACT_SUCCESS
|
||||
if(!istype(user))
|
||||
return ITEM_INTERACT_BLOCKING
|
||||
var/obj/item/bodypart/selected_hand = user.get_active_hand()
|
||||
if(IS_ORGANIC_LIMB(selected_hand))
|
||||
to_chat(user, span_warning("You can't seem to figure out how to use [src], perhaps you need to check the manual?"))
|
||||
return ITEM_INTERACT_BLOCKING
|
||||
return ITEM_INTERACT_SUCCESS
|
||||
|
||||
/obj/item/gun/ballistic/automatic/pistol/robohand/insert_magazine(mob/user, obj/item/ammo_box/magazine/inserted_mag, display_message)
|
||||
if(!istype(inserted_mag, accepted_magazine_type))
|
||||
|
||||
@@ -107,59 +107,63 @@
|
||||
/obj/machinery/compostbin/proc/visible_volume()
|
||||
return reagents.total_volume
|
||||
|
||||
/obj/machinery/compostbin/attacked_by(obj/item/weapon, mob/living/user)
|
||||
if(!machine_stat)
|
||||
if(user.combat_mode)
|
||||
return ..()
|
||||
/obj/machinery/compostbin/base_item_interaction(mob/living/user, obj/item/tool, list/modifiers)
|
||||
. = ..()
|
||||
if(. == ITEM_INTERACT_BLOCKING)
|
||||
return
|
||||
if(user.combat_mode)
|
||||
return ITEM_INTERACT_SKIP_TO_ATTACK
|
||||
|
||||
if(istype(weapon, /obj/item/storage/bag))
|
||||
if(reagents.total_volume >= reagents.maximum_volume)
|
||||
to_chat(user, span_warning("\The [src] is already full of compost."))
|
||||
return TRUE
|
||||
. = ITEM_INTERACT_BLOCKING
|
||||
if(istype(tool, /obj/item/storage/bag))
|
||||
if(reagents.total_volume >= reagents.maximum_volume)
|
||||
to_chat(user, span_warning("\The [src] is already full of compost."))
|
||||
return
|
||||
|
||||
if(current_item_count >= max_items)
|
||||
to_chat(user, span_warning("\The [src] is already full of produce! Wait for it to decompose."))
|
||||
return
|
||||
|
||||
var/obj/item/storage/bag/bag = tool
|
||||
|
||||
for(var/obj/item/food/item in bag.contents)
|
||||
if(current_item_count >= max_items)
|
||||
to_chat(user, span_warning("\The [src] is already full of produce! Wait for it to decompose."))
|
||||
return TRUE
|
||||
break
|
||||
|
||||
var/obj/item/storage/bag/bag = weapon
|
||||
if(bag.atom_storage.attempt_remove(item, src))
|
||||
current_item_count++
|
||||
|
||||
for(var/obj/item/food/item in bag.contents)
|
||||
if(current_item_count >= max_items)
|
||||
break
|
||||
if(bag.contents.len == 0)
|
||||
to_chat(user, span_info("You empty \the [bag] into \the [src]."))
|
||||
|
||||
if(bag.atom_storage.attempt_remove(item, src))
|
||||
current_item_count++
|
||||
|
||||
if(bag.contents.len == 0)
|
||||
to_chat(user, span_info("You empty \the [bag] into \the [src]."))
|
||||
|
||||
else if (current_item_count >= max_items)
|
||||
to_chat(user, span_info("You fill \the [src] from \the [bag] to its capacity."))
|
||||
|
||||
else
|
||||
to_chat(user, span_info("You fill \the [src] from \the [bag]."))
|
||||
|
||||
start_process()
|
||||
return TRUE //no afterattack
|
||||
|
||||
else if(istype(weapon, /obj/item/food))
|
||||
if(reagents.total_volume >= reagents.maximum_volume)
|
||||
to_chat(user, span_warning("\The [src] is already full of compost."))
|
||||
return TRUE
|
||||
|
||||
if(current_item_count >= max_items)
|
||||
to_chat(user, span_warning("\The [src] is already full of produce! Wait for it to decompose."))
|
||||
|
||||
else
|
||||
if(user.transferItemToLoc(weapon, src))
|
||||
current_item_count++
|
||||
to_chat(user, span_info("You insert \the [weapon] in \the [src]"))
|
||||
|
||||
start_process()
|
||||
return TRUE //no afterattack
|
||||
else if (current_item_count >= max_items)
|
||||
to_chat(user, span_info("You fill \the [src] from \the [bag] to its capacity."))
|
||||
|
||||
else
|
||||
to_chat(user, span_warning("You cannot put \the [weapon] in \the [src]!"))
|
||||
to_chat(user, span_info("You fill \the [src] from \the [bag]."))
|
||||
|
||||
start_process()
|
||||
return ITEM_INTERACT_SUCCESS
|
||||
|
||||
else if(istype(tool, /obj/item/food))
|
||||
if(reagents.total_volume >= reagents.maximum_volume)
|
||||
to_chat(user, span_warning("\The [src] is already full of compost."))
|
||||
return
|
||||
|
||||
if(current_item_count >= max_items)
|
||||
to_chat(user, span_warning("\The [src] is already full of produce! Wait for it to decompose."))
|
||||
|
||||
else
|
||||
if(user.transferItemToLoc(tool, src))
|
||||
current_item_count++
|
||||
to_chat(user, span_info("You insert \the [tool] in \the [src]"))
|
||||
|
||||
start_process()
|
||||
return ITEM_INTERACT_SUCCESS
|
||||
|
||||
else
|
||||
to_chat(user, span_warning("You cannot put \the [tool] in \the [src]!"))
|
||||
return
|
||||
|
||||
/obj/machinery/compostbin/proc/start_process()
|
||||
if(machine_stat != NONE)
|
||||
|
||||
@@ -38,12 +38,6 @@
|
||||
/obj/structure/reagent_crafting_bench
|
||||
)
|
||||
|
||||
/obj/item/forging/hammer/afterattack(atom/target, mob/user, click_parameters)
|
||||
. = ..()
|
||||
if(!is_type_in_list(target, fast_attacks))
|
||||
return
|
||||
user.changeNext_move(CLICK_CD_RAPID)
|
||||
|
||||
/obj/item/forging/hammer/primitive
|
||||
name = "primitive forging hammer"
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
/**
|
||||
* The control of the dragging.
|
||||
*/
|
||||
/obj/item/physic_manipulation_tool/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
|
||||
/obj/item/physic_manipulation_tool/ranged_interact_with_atom(atom/movable/target, mob/living/user, list/modifiers)
|
||||
. = ..()
|
||||
if(istype(target))
|
||||
if(!can_catch(target, user))
|
||||
@@ -163,12 +163,12 @@
|
||||
* Signal controller.
|
||||
*/
|
||||
|
||||
/obj/item/physic_manipulation_tool/proc/on_clicked(atom/source, location, control, params, user)
|
||||
/obj/item/physic_manipulation_tool/proc/on_clicked(atom/source, atom/clicked_on, modifiers)
|
||||
SIGNAL_HANDLER
|
||||
if(!handlet_atom || !physgun_user)
|
||||
stack_trace("Physgun tried to run its click signal with no linked atoms or users.")
|
||||
return
|
||||
|
||||
var/list/modifiers = params2list(params)
|
||||
. = COMSIG_MOB_CANCEL_CLICKON
|
||||
if(LAZYACCESS(modifiers, RIGHT_CLICK))
|
||||
if(!advanced)
|
||||
physgun_user.balloon_alert(physgun_user, "Not enjoy power!")
|
||||
@@ -216,7 +216,7 @@
|
||||
physgun_user = user
|
||||
loop_sound.start()
|
||||
|
||||
RegisterSignal(physgun_catcher, COMSIG_CLICK, PROC_REF(on_clicked), TRUE)
|
||||
RegisterSignal(user, COMSIG_MOB_CLICKON, PROC_REF(on_clicked), TRUE)
|
||||
START_PROCESSING(SSfastprocess, src)
|
||||
|
||||
/**
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
return
|
||||
selected_mode.use_act(user)
|
||||
|
||||
/obj/item/phystool/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
|
||||
/obj/item/phystool/ranged_interact_with_atom(atom/target, mob/user, list/modifiers)
|
||||
. = ..()
|
||||
if(!selected_mode)
|
||||
return
|
||||
@@ -75,7 +75,6 @@
|
||||
return
|
||||
do_work_effect(target, user)
|
||||
playsound(user, 'modular_zubbers/sound/phystools/toolgun_shot1.ogg', 100, TRUE)
|
||||
return SECONDARY_ATTACK_CONTINUE_CHAIN
|
||||
|
||||
/obj/item/phystool/proc/do_work_effect(atom/target, mob/user)
|
||||
if(!target)
|
||||
|
||||
Reference in New Issue
Block a user