Synths update: The ID reckoning (#26332)

* blep

* a

* I have never been more in pain

* cleanup
This commit is contained in:
Waterpig
2024-02-09 00:10:43 +01:00
committed by GitHub
parent cfbf440f9b
commit 0628190da2
5 changed files with 52 additions and 50 deletions
@@ -0,0 +1,2 @@
/// A mob has just unequipped an item.
#define COMSIG_HUMAN_UNEQUIPPED_ITEM "human_unequipped_item"
@@ -0,0 +1,6 @@
/mob/living/carbon/human/doUnEquip(obj/item/I, force, newloc, no_move, invdrop, silent)
. = ..()
if(!. || !I)
return
SEND_SIGNAL(src, COMSIG_HUMAN_UNEQUIPPED_ITEM, I, force, newloc, no_move, invdrop, silent)
@@ -9,3 +9,26 @@
/obj/item/organ/internal/brain/synth/Destroy()
QDEL_NULL(internal_computer)
return ..()
/obj/item/organ/internal/brain/synth/on_mob_insert(mob/living/carbon/brain_owner, special, movement_flags)
. = ..()
RegisterSignal(brain_owner, COMSIG_MOB_EQUIPPED_ITEM, PROC_REF(on_equip_signal))
RegisterSignal(brain_owner, COMSIG_HUMAN_UNEQUIPPED_ITEM, PROC_REF(on_unequip_signal))
/obj/item/organ/internal/brain/synth/on_mob_remove(mob/living/carbon/brain_owner, special)
. = ..()
UnregisterSignal(brain_owner, COMSIG_MOB_EQUIPPED_ITEM)
UnregisterSignal(brain_owner, COMSIG_HUMAN_UNEQUIPPED_ITEM)
/obj/item/organ/internal/brain/synth/proc/on_equip_signal(datum/source, obj/item/item, slot)
SIGNAL_HANDLER
if(isnull(internal_computer))
return
if(slot == ITEM_SLOT_ID)
internal_computer.handle_id_slot(owner)
/obj/item/organ/internal/brain/synth/proc/on_unequip_signal(datum/source, obj/item/dropped_item, force, new_location)
SIGNAL_HANDLER
if(isnull(internal_computer))
return
internal_computer.handle_id_slot(owner)
@@ -44,60 +44,29 @@
)
return ..()
/obj/item/modular_computer/pda/synth/RemoveID(mob/user)
var/obj/item/organ/internal/brain/synth/brain_loc = loc
if(!istype(brain_loc))
return ..()
if(!computer_id_slot)
return ..()
if(crew_manifest_update)
GLOB.manifest.modify(computer_id_slot.registered_name, computer_id_slot.assignment, computer_id_slot.get_trim_assignment())
if(user && !issilicon(user) && in_range(brain_loc.owner || brain_loc, user))
user.put_in_hands(computer_id_slot)
/obj/item/modular_computer/pda/synth/proc/handle_id_slot(mob/living/carbon/human/synth)
if(!istype(synth))
return
var/obj/item = synth.wear_id
if(item)
if(istype(item, /obj/item/card/id))
computer_id_slot = item
else if(istype(item, /obj/item/modular_computer))
var/obj/item/modular_computer/pda = item
computer_id_slot = pda.computer_id_slot
else
computer_id_slot = null
else
computer_id_slot.forceMove(brain_loc.owner ? brain_loc.owner.drop_location() : brain_loc.drop_location()) //We actually update the physical on brain removal/insert
computer_id_slot = null
computer_id_slot = null
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, FALSE)
balloon_alert(user, "removed ID")
/obj/item/modular_computer/pda/synth/RemoveID(mob/user)
return
/obj/item/modular_computer/pda/synth/get_ntnet_status()
. = NTNET_NO_SIGNAL
// NTNet is down and we are not connected via wired connection. The synth is no more
var/obj/item/organ/internal/brain/synth/brain_loc = loc
if(!istype(brain_loc))
return
if(!find_functional_ntnet_relay() || isnull(brain_loc.owner))
return
var/turf/current_turf = get_turf(brain_loc.owner || brain_loc)
if(is_station_level(current_turf.z))
return NTNET_GOOD_SIGNAL
else if(long_ranged && !is_centcom_level(current_turf.z)) // Centcom is excluded because cafe
return NTNET_LOW_SIGNAL
/*
So, I am not snowflaking more code.. except this
Attacking a synth with an id loads it into its slot.. pain and probably shitcode
*/
/obj/item/card/id/attack(mob/living/target_mob, mob/living/user, params)
var/mob/living/carbon/human/targetmachine = target_mob
if(!istype(targetmachine))
return ..()
var/obj/item/organ/internal/brain/synth/robotbrain = targetmachine.get_organ_slot(ORGAN_SLOT_BRAIN)
if(istype(robotbrain))
if(user.zone_selected == BODY_ZONE_PRECISE_EYES)
balloon_alert(user, "Inserting ID into persocom slot...")
if(do_after(user, 5 SECONDS))
balloon_alert(user, "ID slot interface registered!")
to_chat(targetmachine, span_notice("[user] inserts [src] into your persocom's card slot."))
robotbrain.internal_computer.InsertID(src, user)
return
return ..()
. = ..()
if(is_centcom_level(loc.z)) // Centcom is excluded because cafe
. = NTNET_NO_SIGNAL
return .
/obj/item/modular_computer/pda/attack(mob/living/target_mob, mob/living/user, params)
var/mob/living/carbon/human/targetmachine = target_mob
+2
View File
@@ -469,6 +469,7 @@
#include "code\__DEFINES\~skyrat_defines\_HELPERS\atmos_mapping_helpers.dm"
#include "code\__DEFINES\~skyrat_defines\_HELPERS\lighting.dm"
#include "code\__DEFINES\~skyrat_defines\_HELPERS\offset_index.dm"
#include "code\__DEFINES\~skyrat_defines\signals\signals_human.dm"
#include "code\__DEFINES\~skyrat_defines\traits\declarations.dm"
#include "code\__HELPERS\_auxtools_api.dm"
#include "code\__HELPERS\_lists.dm"
@@ -6447,6 +6448,7 @@
#include "modular_skyrat\master_files\code\modules\mob\living\carbon\death.dm"
#include "modular_skyrat\master_files\code\modules\mob\living\carbon\human_helpers.dm"
#include "modular_skyrat\master_files\code\modules\mob\living\carbon\human\death.dm"
#include "modular_skyrat\master_files\code\modules\mob\living\carbon\human\inventory.dm"
#include "modular_skyrat\master_files\code\modules\mob\living\carbon\human\species.dm"
#include "modular_skyrat\master_files\code\modules\mob\living\carbon\human\species_type\lizardpeople.dm"
#include "modular_skyrat\master_files\code\modules\mob\living\carbon\human\species_type\podpeople.dm"