[MIRROR] More gripper fixes v2.0 (#11143)

Co-authored-by: Cameron Lennox <killer65311@gmail.com>
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-07-05 13:07:01 -07:00
committed by GitHub
parent 98303f3dd1
commit f34807d34e
6 changed files with 55 additions and 16 deletions

View File

@@ -419,7 +419,11 @@
return return
/obj/item/stack/attackby(obj/item/W as obj, mob/user as mob) /obj/item/stack/attackby(obj/item/W as obj, mob/user as mob)
if (istype(W, /obj/item/stack)) if(istype(W, /obj/item/gripper))
var/obj/item/gripper/G = W
G.consolidate_stacks(src)
else if(istype(W, /obj/item/stack))
var/obj/item/stack/S = W var/obj/item/stack/S = W
src.transfer_to(S) src.transfer_to(S)

View File

@@ -53,7 +53,14 @@
if(!T.AdjacentQuick(user)) // So people aren't messing with these from across the room if(!T.AdjacentQuick(user)) // So people aren't messing with these from across the room
return FALSE return FALSE
var/obj/item/I = user.get_active_hand() // ctrl-shift-click doesn't give us the item, we have to fetch it var/obj/item/I = user.get_active_hand() // ctrl-shift-click doesn't give us the item, we have to fetch it
if(!I)
if(isrobot(user)) //snowflake gripper BS because it can't be done in get_active_hand without breaking everything
var/mob/living/silicon/robot/robot = user
if(istype(robot.module_active, /obj/item/gripper))
var/obj/item/gripper/gripper = robot.module_active
I = gripper.get_current_pocket()
else if(!I)
return FALSE return FALSE
return IC.attackby(I, user) return IC.attackby(I, user)

View File

@@ -1450,7 +1450,7 @@
/datum/trait/neutral/gargoyle/apply(var/datum/species/S,var/mob/living/carbon/human/H, var/list/trait_prefs) /datum/trait/neutral/gargoyle/apply(var/datum/species/S,var/mob/living/carbon/human/H, var/list/trait_prefs)
..() ..()
var/datum/component/gargoyle/G = H.GetComponent(added_component_path) var/datum/component/gargoyle/G = H.GetComponent(added_component_path)
if (trait_prefs) if(trait_prefs)
G.tint = trait_prefs["tint"] G.tint = trait_prefs["tint"]
G.material = lowertext(trait_prefs["material"]) G.material = lowertext(trait_prefs["material"])
G.identifier = lowertext(trait_prefs["identifier"]) G.identifier = lowertext(trait_prefs["identifier"])

View File

@@ -220,8 +220,9 @@
if(S.get_bodytype() == SPECIES_VASILISSAN) if(S.get_bodytype() == SPECIES_VASILISSAN)
W.silk_reserve = 500 W.silk_reserve = 500
W.silk_max_reserve = 1000 W.silk_max_reserve = 1000
W.silk_production = trait_prefs["silk_production"] if(trait_prefs)
W.silk_color = lowertext(trait_prefs["silk_color"]) W.silk_production = trait_prefs["silk_production"]
W.silk_color = lowertext(trait_prefs["silk_color"])
/datum/trait/positive/aquatic /datum/trait/positive/aquatic
name = "Aquatic" name = "Aquatic"
@@ -358,7 +359,7 @@
/datum/trait/positive/table_passer/apply(var/datum/species/S,var/mob/living/carbon/human/H, var/list/trait_prefs) /datum/trait/positive/table_passer/apply(var/datum/species/S,var/mob/living/carbon/human/H, var/list/trait_prefs)
..() ..()
if (trait_prefs?["pass_table"] || !trait_prefs) if(trait_prefs?["pass_table"] || !trait_prefs)
H.pass_flags |= PASSTABLE H.pass_flags |= PASSTABLE
add_verb(H,/mob/living/proc/toggle_pass_table) add_verb(H,/mob/living/proc/toggle_pass_table)

View File

@@ -157,6 +157,9 @@
for(var/obj/item/robotic_multibelt/materials/material_belt in contents) for(var/obj/item/robotic_multibelt/materials/material_belt in contents)
if(material_belt.selected_item == O) if(material_belt.selected_item == O)
return TRUE return TRUE
for(var/obj/item/gripper/gripper in contents)
if(gripper.current_pocket == O)
return TRUE
return FALSE return FALSE
/mob/living/silicon/robot/proc/get_active_modules() /mob/living/silicon/robot/proc/get_active_modules()

View File

@@ -209,7 +209,7 @@
/obj/item/robotic_multibelt/medical /obj/item/robotic_multibelt/medical
name = "Robotic surgical multitool" name = "Robotic surgical multitool"
desc = "An integrated surgical toolbelt." desc = "An integrated surgical toolbelt."
icon_state = "toolkit_medborg" icon_state = "toolkit_engiborg"
cyborg_integrated_tools = list( cyborg_integrated_tools = list(
/obj/item/surgical/retractor/cyborg = null, /obj/item/surgical/retractor/cyborg = null,
@@ -292,7 +292,7 @@
/obj/item/robotic_multibelt/botanical /obj/item/robotic_multibelt/botanical
name = "Botanical multitool" name = "Botanical multitool"
desc = "An integrated botanical toolbelt." desc = "An integrated botanical toolbelt."
icon_state = "toolkit_medborg" icon_state = "toolkit_engiborg"
cyborg_integrated_tools = list( cyborg_integrated_tools = list(
/obj/item/material/minihoe/cyborg = null, /obj/item/material/minihoe/cyborg = null,
@@ -488,7 +488,7 @@
//Has a list of items that it can hold. //Has a list of items that it can hold.
var/list/can_hold = list(BASIC_GRIPPER) var/list/can_hold = list(BASIC_GRIPPER)
var/obj/item/wrapped = null // Item currently being held. var/obj/item/wrapped = null // Item currently being held. //Convert to weak-ref?
var/total_pockets = 5 //How many total inventory slots we want to have in the gripper var/total_pockets = 5 //How many total inventory slots we want to have in the gripper
@@ -657,7 +657,6 @@
return 0 return 0
/obj/item/gripper/afterattack(var/atom/target, var/mob/living/user, proximity, params) /obj/item/gripper/afterattack(var/atom/target, var/mob/living/user, proximity, params)
if(!proximity) if(!proximity)
return // This will prevent them using guns at range but adminbuse can add them directly to modules, so eh. return // This will prevent them using guns at range but adminbuse can add them directly to modules, so eh.
var/current_pocket_full = FALSE var/current_pocket_full = FALSE
@@ -688,7 +687,9 @@
if(wrapped) //Already have an item. if(wrapped) //Already have an item.
//Temporary put wrapped into user so target's attackby() checks pass. //Temporary put wrapped into user so target's attackby() checks pass.
var/obj/previous_pocket = wrapped.loc var/obj/previous_pocket
if(istype(wrapped.loc, /obj/item/storage/internal/gripper))
previous_pocket = wrapped.loc
wrapped.loc = user wrapped.loc = user
//Pass the attack on to the target. This might delete/relocate wrapped. //Pass the attack on to the target. This might delete/relocate wrapped.
@@ -696,13 +697,14 @@
if(!resolved && wrapped && target) if(!resolved && wrapped && target)
wrapped.afterattack(target,user,1) wrapped.afterattack(target,user,1)
//If wrapped was neither deleted nor put into target, put it back into the gripper. if((QDELETED(wrapped))) //We put our wrapped thing INTO something!
if(wrapped && user && ((wrapped.loc == user) || wrapped.loc == previous_pocket)) wrapped = null
current_pocket = pick(pockets)
return
//If we had a previous pocket and the wrapped isn't put into something, put it back in our pocket.
else if((previous_pocket && wrapped.loc == user))
wrapped.loc = previous_pocket wrapped.loc = previous_pocket
else else
wrapped = null
return
if((QDELETED(wrapped) || (wrapped.loc != current_pocket))) //We put our wrapped thing INTO something!
wrapped = null wrapped = null
current_pocket = pick(pockets) current_pocket = pick(pockets)
return return
@@ -770,6 +772,28 @@
user.visible_message(span_danger("[user] removes the power cell from [A]!"), "You remove the power cell.") user.visible_message(span_danger("[user] removes the power cell from [A]!"), "You remove the power cell.")
//HELPER PROCS
/obj/item/gripper/proc/get_current_pocket() //done as a proc so snowflake code can be found later down the line and consolidated.
return wrapped
/// Consolidates material stacks by searching our pockets to see if we currently have any stacks. Done in /obj/item/stack/attackby
/obj/item/gripper/proc/consolidate_stacks(var/obj/item/stack/stack_to_consolidate)
if(!stack_to_consolidate || !istype(stack_to_consolidate, /obj/item/stack))
return
var/stacked = FALSE //So we can break the for loop 2 forloops deep.
for(var/obj/item/storage/internal/gripper/pocket in pockets)
if(stacked) //We've stacked our item, break!
break
if(LAZYLEN(pocket.contents))
for(var/obj/item/stack/stack in pocket.contents)
if(istype(stack_to_consolidate, stack))
stack_to_consolidate.transfer_to(stack)
stacked = TRUE
break
//Different types of grippers! //Different types of grippers!
/obj/item/gripper/engineering /obj/item/gripper/engineering