Give wallets merged access of all IDs inside.

This commit is contained in:
octareenroon91
2015-12-04 03:16:43 -06:00
parent c1ad583a30
commit f3f61367da
@@ -30,20 +30,34 @@
slot_flags = SLOT_ID
var/obj/item/weapon/card/id/front_id = null
var/obj/item/weapon/card/id/net_id = null
/obj/item/weapon/storage/wallet/remove_from_storage(obj/item/W, atom/new_location)
/obj/item/weapon/storage/wallet/New()
..()
net_id = new /obj/item/weapon/card/id(src)
/obj/item/weapon/storage/wallet/remove_from_storage(obj/item/W as obj, atom/new_location)
. = ..(W, new_location)
if(.)
if(W == front_id)
front_id = null
if(istype(W, /obj/item/weapon/card/id))
refreshID()
update_icon()
/obj/item/weapon/storage/wallet/handle_item_insertion(obj/item/W, prevent_warning = 0)
/obj/item/weapon/storage/wallet/refreshID()
net_id.access.Cut()
for(var/obj/item/weapon/card/id/I in contents)
if(!front_id)
front_id = I
net_id.access |= I.access // Merge access from any and all cards in wallet
/obj/item/weapon/storage/wallet/handle_item_insertion(obj/item/W as obj, prevent_warning = 0)
. = ..(W, prevent_warning)
if(.)
if(!front_id && istype(W, /obj/item/weapon/card/id))
front_id = W
if(istype(W, /obj/item/weapon/card/id))
refreshID()
update_icon()
/obj/item/weapon/storage/wallet/update_icon()
@@ -66,12 +80,12 @@
/obj/item/weapon/storage/wallet/GetID()
return front_id
return front_id // net_id is only a holder for accesses.
/obj/item/weapon/storage/wallet/GetAccess()
var/obj/item/I = GetID()
if(I)
return I.GetAccess()
var/list/myaccess = net_id.GetAccess() // favor OOP by not using net_id.access directly.
if(myaccess.len) // is there any access to be had this way?
return myaccess
else
return ..()
@@ -89,4 +103,4 @@
if(item2_type)
new item2_type(src)
if(item3_type)
new item3_type(src)
new item3_type(src)