Change drop_all_held_items to work with cyborgs (#70682)

* Cyborgs now use the same drop_all_held_items that humans do instead of their own snowflake code.
* Fixes Cyborgs not dropping all their modules at the same time,

Co-authored-by: Zephyr <12817816+ZephyrTFA@users.noreply.github.com>
Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
This commit is contained in:
Tim
2022-10-26 05:53:02 -04:00
committed by GitHub
co-authored by Zephyr MrMelbert
parent 5549162b01
commit 51b289d4c8
6 changed files with 14 additions and 15 deletions
+6 -5
View File
@@ -360,13 +360,14 @@
owner.drop_all_held_items()
chainsaw = new(get_turf(owner))
ADD_TRAIT(chainsaw, TRAIT_NODROP, CHAINSAW_FRENZY_TRAIT)
owner.put_in_hands(chainsaw, forced = TRUE)
chainsaw.attack_self(owner)
if(iscarbon(owner))
chainsaw = new(get_turf(owner))
ADD_TRAIT(chainsaw, TRAIT_NODROP, CHAINSAW_FRENZY_TRAIT)
owner.put_in_hands(chainsaw, forced = TRUE)
chainsaw.attack_self(owner)
owner.reagents.add_reagent(/datum/reagent/medicine/adminordrazine, 25)
owner.log_message("entered a blood frenzy", LOG_ATTACK)
owner.reagents.add_reagent(/datum/reagent/medicine/adminordrazine, 25)
to_chat(owner, span_warning("KILL, KILL, KILL! YOU HAVE NO ALLIES ANYMORE, KILL THEM ALL!"))
var/datum/client_colour/colour = owner.add_client_colour(/datum/client_colour/bloodlust)
@@ -27,7 +27,7 @@
builtInCamera.toggle_cam(src,0)
toggle_headlamp(TRUE) //So borg lights are disabled when killed.
uneq_all() // particularly to ensure sight modes are cleared
drop_all_held_items() // particularly to ensure sight modes are cleared
update_icons()
@@ -265,11 +265,9 @@
if(module_active)
unequip_module_from_slot(module_active, get_selected_module())
/**
* Unequips all held items.
*/
/mob/living/silicon/robot/proc/uneq_all()
for(var/cyborg_slot in 1 to 3)
// Technically none of the items are dropped, only unequipped
/mob/living/silicon/robot/drop_all_held_items()
for(var/cyborg_slot in 1 to length(held_items))
if(!held_items[cyborg_slot])
continue
unequip_module_from_slot(held_items[cyborg_slot], cyborg_slot)
@@ -19,11 +19,11 @@
/mob/living/silicon/robot/proc/use_power(delta_time, times_fired)
if(cell?.charge)
if(cell.charge <= 100)
uneq_all()
drop_all_held_items()
var/amt = clamp(lamp_enabled * lamp_intensity * delta_time, 0.5 * delta_time, cell.charge) //Lamp will use a max of 5 charge, depending on brightness of lamp. If lamp is off, borg systems consume 1 point of charge, or the rest of the cell if it's lower than that.
cell.use(amt) //Usage table: 0.5/second if off/lowest setting, 4 = 2/second, 6 = 4/second, 8 = 6/second, 10 = 8/second
else
uneq_all()
drop_all_held_items()
low_power_mode = TRUE
toggle_headlamp(TRUE)
diag_hud_set_borgcell()
@@ -708,7 +708,7 @@
/mob/living/silicon/robot/proc/ResetModel()
SEND_SIGNAL(src, COMSIG_BORG_SAFE_DECONSTRUCT)
uneq_all()
drop_all_held_items()
shown_robot_modules = FALSE
for(var/obj/item/storage/bag in model.contents) // drop all of the items that may be stored by the cyborg
@@ -124,7 +124,7 @@
return
var/list/held_modules = cyborg.held_items.Copy()
var/active_module = cyborg.module_active
cyborg.uneq_all()
cyborg.drop_all_held_items()
modules = list()
for(var/obj/item/module in basic_modules)
add_module(module, FALSE, FALSE)