Skip to content

Commit

Permalink
Fix: Gripper can be used again (#1362)
Browse files Browse the repository at this point in the history
## Что этот PR делает
Удалил большую часть модуля пупса по грипперам, так как на оффах был
рефактор, и разница от несущественной до нулевой.
Оставил только то что некоторые грипперы могут держать то что не могли

## Почему это хорошо для игры
GRIPPER?

## Тестирование
Засунул бикер в хим. диспенсер на мед. борге

## Changelog

:cl:
fix: Грипперы теперь должны работать, однако они теперь такие же как на
оффах, что значит функционала может быть меньше.
del: Удалён гриппер борга нюки, который мог тащить ядерный диск.
del: Удалена большая часть модуля Gripper, осталось только расширение
возможных к удержанию вещей для некоторых грипперов.
/:cl:
  • Loading branch information
AyIong authored Jul 7, 2024
1 parent 59c4471 commit 5c7fa88
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 199 deletions.
190 changes: 2 additions & 188 deletions modular_ss220/silicons/code/items/gripper.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* Different Grippers */
/obj/item/gripper/engineering/Initialize(mapload)
. = ..()
can_hold |= list(
Expand All @@ -14,13 +13,12 @@
)

/obj/item/gripper/medical
name = "medical gripper"
desc = "A grasping tool used to hold organs and help patients up once surgery is complete."
actions_types = list(/datum/action/item_action/drop_gripped_item)
can_hold = list(
/obj/item/organ,
/obj/item/reagent_containers/iv_bag,
/obj/item/robot_parts,
/obj/item/stack/sheet/mineral/plasma, // for repair plasmamans
/obj/item/stack/sheet/mineral/plasma, // For repair plasmemes
/obj/item/mmi,
/obj/item/reagent_containers/pill,
/obj/item/reagent_containers/patch,
Expand All @@ -42,190 +40,6 @@
/obj/item/disk/plantgene,
)

/obj/item/gripper/nuclear
name = "Nuclear gripper"
desc = "Designed for all your nuclear needs."
icon = 'modular_ss220/silicons/icons/robot_tools.dmi'
icon_state = "diskgripper"
can_hold = list(/obj/item/disk/nuclear)

/* Procs */
/obj/item/gripper/Initialize(mapload)
. = ..()
can_hold = typecacheof(can_hold)

/obj/item/gripper/ui_action_click(mob/user)
drop_gripped_item()

/obj/item/gripper/verb/drop_item_gripped()
set name = "Drop Gripped Item"
set desc = "Release an item from your magnetic gripper."
set category = "Robot Commands"
drop_gripped_item()

/obj/item/gripper/attack_self(mob/user)
if(!gripped_item)
to_chat(user, span_warning("[src] is empty."))
return
gripped_item.attack_self(user)

/obj/item/gripper/tool_act(mob/living/user, obj/item/tool, tool_type)
if(!gripped_item)
return
gripped_item.tool_act(user, tool, tool_type)
if(QDELETED(gripped_item)) // if item was dissasembled we need to clear the pointer
drop_gripped_item(TRUE) // silent = TRUE to prevent "You drop X" message from appearing without actually dropping anything

/obj/item/gripper/attackby(obj/item/weapon, mob/user, params)
if(!gripped_item)
return FALSE
gripped_item.attackby(weapon, user, params)
if(QDELETED(gripped_item)) // if item was dissasembled we need to clear the pointer
drop_gripped_item(TRUE) // silent = TRUE to prevent "You drop X" message from appearing without actually dropping anything

/obj/item/gripper/attack(mob/living/carbon/M, mob/living/carbon/user)
return

/// Grippers are snowflakey so this is needed to to prevent forceMoving grippers after `if(!user.drop_from_active_hand())` checks done in certain attackby's.
/obj/item/gripper/forceMove(atom/destination)
return

/obj/item/gripper/proc/isEmpty()
return isnull(gripped_item)

/obj/item/gripper/afterattack(atom/target, mob/living/user, proximity, params)
if(!target || !proximity) // Target is invalid or we are not adjacent.
return FALSE

if(gripped_item) // Already have an item.

// Pass the attack on to the target. This might delete/relocate gripped_item.
if(!target.attackby(gripped_item, user, params))
// If the attackby didn't resolve or delete the target or gripped_item, afterattack
// (Certain things, such as mountable frames, rely on afterattack)
gripped_item?.afterattack(target, user, 1, params)

// If gripped_item either didn't get deleted, or it failed to be transfered to its target
if(!gripped_item && contents.len)
gripped_item = contents[1]
return FALSE
else if(gripped_item && !contents.len)
gripped_item = null

else if(istype(target, /obj/item)) // Check that we're not pocketing a mob.
var/obj/item/I = target
if(is_type_in_typecache(I, can_hold)) // Make sure the item is something the gripper can hold
to_chat(user, span_notice("You collect [I]."))
I.forceMove(src)
gripped_item = I
else
to_chat(user, span_warning("Your gripper cannot hold [target]."))
return FALSE

else if(istype(target, /obj/machinery/power/apc))
var/obj/machinery/power/apc/A = target
if(A.opened)
if(A.cell && is_type_in_typecache(A.cell, can_hold))

gripped_item = A.cell

A.cell.add_fingerprint(user)
A.cell.update_icon()
A.cell.forceMove(src)
A.cell = null

A.charging = APC_NOT_CHARGING
A.update_icon()

user.visible_message(span_warning("[user] removes the power cell from [A]!"), "You remove the power cell.")

else if(istype(target, /obj/machinery/cell_charger))
var/obj/machinery/cell_charger/cell_charger = target
if(cell_charger.charging)
gripped_item = cell_charger.charging
cell_charger.charging.add_fingerprint(user)
cell_charger.charging.forceMove(src)
cell_charger.removecell()

else if(ishuman(target))
var/mob/living/carbon/human/pickup_target = target
if(!IS_HORIZONTAL(pickup_target))
return FALSE
pickup_target.AdjustSleeping(-10 SECONDS)
pickup_target.AdjustParalysis(-6 SECONDS)
pickup_target.AdjustStunned(-6 SECONDS)
pickup_target.AdjustWeakened(-6 SECONDS)
pickup_target.AdjustKnockDown(-6 SECONDS)
pickup_target.stand_up()
playsound(user.loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1)
user.visible_message( \
span_notice("[user] shakes [pickup_target] trying to wake [pickup_target.p_them()] up!"),\
span_notice("You shake [pickup_target] trying to wake [pickup_target.p_them()] up!"),\
)

return TRUE

/* Interactions */
/turf/simulated/wall/attackby(obj/item/I, mob/user, params)
// The magnetic gripper does a separate attackby, so bail from this one
if(istype(I, /obj/item/gripper))
return

. = ..()

/datum/surgery_step/is_valid_tool(mob/living/user, obj/item/tool)
if(..())
return TRUE

var/success = FALSE
if(accept_hand)
if(isrobot(user) && istype(tool, /obj/item/gripper/medical))
success = TRUE
return success


// Returns the thing in our gripper
/mob/living/silicon/robot/get_active_hand()
if(istype(module_active, /obj/item/gripper))
var/obj/item/gripper/M = module_active
if(M.gripped_item)
return M.gripped_item
return M
. = ..()

// Перезаписанные проки
/mob/living/silicon/robot/proc/module_gripper_drop()
var/obj/item/gripper/G = locate(/obj/item/gripper) in module.modules
if(G?.drop_gripped_item(silent = TRUE))
return TRUE
return FALSE

/obj/item/robot_module/handle_death(mob/living/silicon/robot/R, gibbed)
R.module_gripper_drop()

/obj/item/robot_module/drone/handle_death(mob/living/silicon/robot/R, gibbed)
R.module_gripper_drop()

/// Used in `robot.dm` when the user presses "Q" by default.
/mob/living/silicon/robot/on_drop_hotkey_press()
. = module_gripper_drop()
if(!.) // if the active module is a gripper, try to drop its held item.
uneq_active() // else unequip the module and put it back into the robot's inventory.
return FALSE
return TRUE

/datum/keybinding/mob/drop_held_object/can_use(client/C, mob/M)
return !isrobot(M) && ..() // robots on 'q' have their own proc for drop, in keybindinds/robot.dm

/mob/living/silicon/robot/drop_item()
// The gripper is special because it has a normal item inside that we can drop.
// All robot inventory items have NODROP, so they should return FALSE.
return module_gripper_drop()

/obj/machinery/reagentgrinder/attack_ai(mob/user)
add_hiddenprint(user)
return attack_hand(user)

/obj/structure/morgue/attack_ai(mob/user)
add_hiddenprint(user)
return attack_hand(user)
11 changes: 0 additions & 11 deletions modular_ss220/silicons/code/robot_modules.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,17 @@
)

// Syndicate
/obj/item/robot_module/syndicate/Initialize(mapload)
. = ..()
basic_modules |= list(
/obj/item/gripper/nuclear,
)

/obj/item/robot_module/syndicate_medical/Initialize(mapload)
. = ..()
basic_modules |= list(
/obj/item/gps/cyborg,
/obj/item/rlf,
/obj/item/gripper/nuclear,
)

/obj/item/robot_module/syndicate_saboteur/Initialize(mapload)
. = ..()
basic_modules |= list(
/obj/item/gripper/engineering,
/obj/item/gripper/nuclear,
/obj/item/holosign_creator/atmos,
)

Expand All @@ -71,15 +63,13 @@
/obj/item/robot_module/deathsquad/Initialize(mapload)
. = ..()
basic_modules |= list(
/obj/item/gripper/nuclear,
/obj/item/gps/cyborg,
/obj/item/pinpointer/operative/nad,
)

/obj/item/robot_module/destroyer/Initialize(mapload)
. = ..()
basic_modules |= list(
/obj/item/gripper/nuclear,
/obj/item/gps/cyborg,
/obj/item/pinpointer,
/obj/item/pinpointer/operative/nad,
Expand All @@ -88,7 +78,6 @@
/obj/item/robot_module/combat/Initialize(mapload)
. = ..()
basic_modules |= list(
/obj/item/gripper/nuclear,
/obj/item/gps/cyborg,
/obj/item/pinpointer/operative/nad,
)
Expand Down

0 comments on commit 5c7fa88

Please sign in to comment.