Fixes the runtimes caused in human_resources.dm

needs more sanity checks
This commit is contained in:
d3athrow
2014-03-05 12:48:18 -06:00
parent 576be307fa
commit c31f50155b

View File

@@ -47,89 +47,100 @@
desc = desc + " Stamped by:"
user << "\blue The demotion microchip for [src.target_name] is now ready to be stamped."
/obj/item/demote_chip/attackby(obj/item/weapon/stamp/S as obj, mob/user as mob)
if(target_name != null)//Stamper must be able to see who he is banning
if(istype(S, /obj/item/weapon/stamp/captain))
if(cap == 0)
desc = desc + "/Captain"
cap = 1
user << "\blue You stamp the demotion microchip of [target_name]."
if(istype(S, /obj/item/weapon/stamp/hop))
if(hop == 0)
desc = desc + "/HoP"
hop = 1
user << "\blue You stamp the demotion microchip of [target_name]."
if(istype(S, /obj/item/weapon/stamp/hos))
if(hos == 0)
desc = desc + "/HoS"
hos = 1
user << "\blue You stamp the demotion microchip of [target_name]."
if(istype(S, /obj/item/weapon/stamp/ce))
if(ce == 0)
desc = desc + "/CE"
ce = 1
user << "\blue You stamp the demotion microchip of [target_name]."
if(istype(S, /obj/item/weapon/stamp/rd))
if(rd == 0)
desc = desc + "/RD"
rd = 1
user << "\blue You stamp the demotion microchip of [target_name]."
if(istype(S, /obj/item/weapon/stamp/cmo))
if(cmo == 0)
desc = desc + "/CMO"
cmo = 1
user << "\blue You stamp the demotion microchip of [target_name]."
if(istype(S, /obj/item/weapon/stamp/clown))
if(clown == 0)
desc = desc + "/HONK"
clown = 1
user << "\blue You stamp the demotion microchip of [target_name]."
/obj/item/demote_chip/attackby(obj/item/I as obj, mob/user as mob)
if(istype(I, /obj/item/weapon/stamp))
var/obj/item/weapon/stamp/S = I
if(target_name != null)//Stamper must be able to see who he is banning
if(istype(S, /obj/item/weapon/stamp/captain))
if(cap == 0)
desc = desc + "/Captain"
cap = 1
user << "\blue You stamp the demotion microchip of [target_name]."
if(istype(S, /obj/item/weapon/stamp/hop))
if(hop == 0)
desc = desc + "/HoP"
hop = 1
user << "\blue You stamp the demotion microchip of [target_name]."
if(istype(S, /obj/item/weapon/stamp/hos))
if(hos == 0)
desc = desc + "/HoS"
hos = 1
user << "\blue You stamp the demotion microchip of [target_name]."
if(istype(S, /obj/item/weapon/stamp/ce))
if(ce == 0)
desc = desc + "/CE"
ce = 1
user << "\blue You stamp the demotion microchip of [target_name]."
if(istype(S, /obj/item/weapon/stamp/rd))
if(rd == 0)
desc = desc + "/RD"
rd = 1
user << "\blue You stamp the demotion microchip of [target_name]."
if(istype(S, /obj/item/weapon/stamp/cmo))
if(cmo == 0)
desc = desc + "/CMO"
cmo = 1
user << "\blue You stamp the demotion microchip of [target_name]."
if(istype(S, /obj/item/weapon/stamp/clown))
if(clown == 0)
desc = desc + "/HONK"
clown = 1
user << "\blue You stamp the demotion microchip of [target_name]."
else
user << "\blue The chip has not been initialized."
else
user << "\blue The chip has not been initialized."
return ..()
/obj/item/weapon/card/id/syndicate/attackby(var/obj/item/demote_chip/DE as obj, mob/user as mob)
/obj/item/weapon/card/id/syndicate/attackby(var/obj/item/I as obj, mob/user as mob)
//placebo, does not affect access on syndie agent card
if(registered_name != DE.target_name)
user << "\blue Failed to apply, names do not match."
else if(bans != null)
user << "\blue This card already has a microchip applied"
if(istype(I, /obj/item/demote_chip/))
var/obj/item/demote_chip/DE = I
if(registered_name != DE.target_name)
user << "\blue Failed to apply, names do not match."
else if(bans != null)
user << "\blue This card already has a microchip applied"
else
icon_state = "centcom_old"
bans = "9" //if get_region_accesses ever uses 9 we're fucked
del(DE)
else
icon_state = "centcom_old"
bans = "9" //if get_region_accesses ever uses 9 we're fucked
del(DE)
return ..()
/obj/item/weapon/card/id/attackby(var/obj/item/demote_chip/D as obj, mob/user as mob)
/obj/item/weapon/card/id/attackby(var/obj/item/I as obj, mob/user as mob)
//Check for if names match, card already has a chip, and its not a captains ID.
if(registered_name != D.target_name)
user << "\blue Failed to apply, names do not match."
else if(bans != null)
user << "\blue This card already has a microchip applied"
else if(icon_state == "gold")
user << "\blue This microchip cannot apply to this card type."
else
if(istype(I, /obj/item/demote_chip))
var/obj/item/demote_chip/D = I
if(registered_name != D.target_name)
user << "\blue Failed to apply, names do not match."
else if(bans != null)
user << "\blue This card already has a microchip applied"
else if(icon_state == "gold")
user << "\blue This microchip cannot apply to this card type."
else
if(D.cap == 1)
access -= get_region_accesses(5)
bans = bans + "5"
if(D.hop == 1)
access -= get_region_accesses(6)
access -= get_region_accesses(7)
bans = bans + "67"
if(D.hos == 1)
access -= get_region_accesses(1)
bans = bans + "1"
if(D.ce == 1)
access -= get_region_accesses(4)
bans = bans + "4"
if(D.rd == 1)
access -= get_region_accesses(3)
bans = bans + "3"
if(D.cmo == 1)
access -= get_region_accesses(2)
bans = bans + "2"
if(bans == null)
user << "\blue You require at least one stamp."
return
icon_state = "centcom_old"
del(D)
if(D.cap == 1)
access -= get_region_accesses(5)
bans = bans + "5"
if(D.hop == 1)
access -= get_region_accesses(6)
access -= get_region_accesses(7)
bans = bans + "67"
if(D.hos == 1)
access -= get_region_accesses(1)
bans = bans + "1"
if(D.ce == 1)
access -= get_region_accesses(4)
bans = bans + "4"
if(D.rd == 1)
access -= get_region_accesses(3)
bans = bans + "3"
if(D.cmo == 1)
access -= get_region_accesses(2)
bans = bans + "2"
if(bans == null)
user << "\blue You require at least one stamp."
return
icon_state = "centcom_old"
del(D)
else
return ..()