From 5936ef8095c0bcab12f54958c2e8d5d6f0d9515a Mon Sep 17 00:00:00 2001 From: fallcon Date: Mon, 29 Apr 2024 11:05:29 -0500 Subject: [PATCH] I dont think we need to do it like this --- code/datums/components/attachment.dm | 32 ++++----------------- code/datums/components/attachment_holder.dm | 3 -- 2 files changed, 5 insertions(+), 30 deletions(-) diff --git a/code/datums/components/attachment.dm b/code/datums/components/attachment.dm index fa6c4c3e792d..de317339ee86 100644 --- a/code/datums/components/attachment.dm +++ b/code/datums/components/attachment.dm @@ -7,32 +7,10 @@ #define COMSIG_ATTACHMENT_UPDATE_OVERLAY "attach-overlay" #define COMSIG_ATTACHMENT_GET_SLOT "attach-slot-who" - #define ATTACHMENT_SLOT_MUZZLE "attach-slot-muzzle" - #define ATTACHMENT_SLOT_SCOPE "attach-slot-scope" - #define ATTACHMENT_SLOT_GRIP "attach-slot-grip" - #define ATTACHMENT_SLOT_RAIL "attach-slot-rail" - -/proc/attachment_slot_to_bflag(slot) - switch(slot) - if(ATTACHMENT_SLOT_MUZZLE) - return (1<<0) - if(ATTACHMENT_SLOT_SCOPE) - return (1<<1) - if(ATTACHMENT_SLOT_GRIP) - return (1<<2) - if(ATTACHMENT_SLOT_RAIL) - return (1<<3) - -/proc/attachment_slot_from_bflag(slot) - switch(slot) - if(1<<0) - return ATTACHMENT_SLOT_MUZZLE - if(1<<1) - return ATTACHMENT_SLOT_SCOPE - if(1<<2) - return ATTACHMENT_SLOT_GRIP - if(1<<3) - return ATTACHMENT_SLOT_RAIL +#define ATTACHMENT_SLOT_MUZZLE "attach-slot-muzzle" +#define ATTACHMENT_SLOT_SCOPE "attach-slot-scope" +#define ATTACHMENT_SLOT_GRIP "attach-slot-grip" +#define ATTACHMENT_SLOT_RAIL "attach-slot-rail" #define COMSIG_ATTACHMENT_TOGGLE "attach-toggle" @@ -150,4 +128,4 @@ /datum/component/attachment/proc/send_slot(obj/item/parent) SIGNAL_HANDLER - return attachment_slot_to_bflag(slot) + return slot diff --git a/code/datums/components/attachment_holder.dm b/code/datums/components/attachment_holder.dm index 175bb06f68a4..d18955fbe3cf 100644 --- a/code/datums/components/attachment_holder.dm +++ b/code/datums/components/attachment_holder.dm @@ -40,7 +40,6 @@ for(var/obj/item/attachment/attach as anything in attachments) var/slot = SEND_SIGNAL(attach, COMSIG_ATTACHMENT_GET_SLOT) - slot = attachment_slot_from_bflag(slot) var/list/attach_overlays = list() SEND_SIGNAL(attach, COMSIG_ATTACHMENT_UPDATE_OVERLAY, attach_overlays) for(var/mutable_appearance/overlay as anything in attach_overlays) @@ -101,7 +100,6 @@ /datum/component/attachment_holder/proc/do_attach(obj/item/attachment, mob/user) var/slot = SEND_SIGNAL(attachment, COMSIG_ATTACHMENT_GET_SLOT) - slot = attachment_slot_from_bflag(slot) if(!(attachment.type in valid_types)) to_chat(user, "[attachment] is not a valid attachment for this [parent]!") return @@ -117,7 +115,6 @@ /datum/component/attachment_holder/proc/do_detach(obj/item/attachment, mob/user) var/slot = SEND_SIGNAL(attachment, COMSIG_ATTACHMENT_GET_SLOT) - slot = attachment_slot_from_bflag(slot) if(slot in slot_room) slot_room[slot]++ . = SEND_SIGNAL(attachment, COMSIG_ATTACHMENT_DETACH, parent, user)