From 57c1a9a55633725dc2e31993e00dafe27c9b3af0 Mon Sep 17 00:00:00 2001 From: Segrain Date: Thu, 22 Aug 2013 10:11:49 +0300 Subject: [PATCH 1/3] Code cleanup. --- .../structures/crates_lockers/closets.dm | 23 ++--- .../closets/secure/secure_closets.dm | 87 ++++++------------- 2 files changed, 37 insertions(+), 73 deletions(-) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 48c13eb849..3e23be3bfe 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -119,10 +119,11 @@ density = 1 return 1 -/obj/structure/closet/proc/toggle() - if(src.opened) - return src.close() - return src.open() +/obj/structure/closet/proc/toggle(mob/user as mob) + . = src.opened ? src.close() : src.open() + if(!.) + user << "It won't budge!" + return // this should probably use dump_contents() /obj/structure/closet/ex_act(severity) @@ -180,7 +181,6 @@ if(src.opened) if(istype(W, /obj/item/weapon/grab)) src.MouseDrop_T(W:affecting, user) //act like they were dragged onto the closet - if(istype(W, /obj/item/weapon/weldingtool)) var/obj/item/weapon/weldingtool/WT = W if(!WT.remove_fuel(0,user)) @@ -191,15 +191,11 @@ M.show_message("\The [src] has been cut apart by [user] with \the [WT].", 3, "You hear welding.", 2) del(src) return - if(isrobot(user)) return - usr.drop_item() - if(W) W.loc = src.loc - else if(istype(W, /obj/item/weapon/packageWrap)) return else if(istype(W, /obj/item/weapon/weldingtool)) @@ -207,7 +203,7 @@ if(!WT.remove_fuel(0,user)) user << "You need more welding fuel to complete this task." return - src.welded =! src.welded + src.welded = !src.welded src.update_icon() for(var/mob/M in viewers(src)) M.show_message("[src] has been [welded?"welded shut":"unwelded"] by [user.name].", 3, "You hear welding.", 2) @@ -257,9 +253,7 @@ /obj/structure/closet/attack_hand(mob/user as mob) src.add_fingerprint(user) - - if(!src.toggle()) - usr << "It won't budge!" + src.toggle(user) /obj/structure/closet/verb/verb_toggleopen() set src in oview(1) @@ -270,7 +264,8 @@ return if(ishuman(usr)) - src.attack_hand(usr) + src.add_fingerprint(usr) + src.toggle(usr) else usr << "This mob type can't use this verb." diff --git a/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm b/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm index 74062c2775..f6ce5d6d81 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm @@ -17,16 +17,17 @@ health = 200 /obj/structure/closet/secure_closet/can_open() - ..() if(src.locked) return 0 - return 1 + return ..() /obj/structure/closet/secure_closet/close() - ..() - if(broken) - icon_state = src.icon_off - return 1 + if(..()) + if(broken) + icon_state = src.icon_off + return 1 + else + return 0 /obj/structure/closet/secure_closet/emp_act(severity) for(var/obj/O in src) @@ -44,15 +45,21 @@ ..() /obj/structure/closet/secure_closet/proc/togglelock(mob/user as mob) + if(src.opened) + user << "Close the locker first." + return + if(src.broken) + user << "The locker appears to be broken." + return + if(user.loc == src) + user << "You can't reach the lock from inside." + return if(src.allowed(user)) src.locked = !src.locked for(var/mob/O in viewers(user, 3)) if((O.client && !( O.blinded ))) O << "The locker has been [locked ? null : "un"]locked by [user]." - if(src.locked) - src.icon_state = src.icon_locked - else - src.icon_state = src.icon_closed + update_icon() else user << "Access Denied" @@ -62,15 +69,12 @@ if(src.large) src.MouseDrop_T(W:affecting, user) //act like they were dragged onto the closet else - user << "The locker is too small to stuff [W] into!" + user << "The locker is too small to stuff [W:affecting] into!" if(isrobot(user)) return user.drop_item() if(W) W.loc = src.loc - else if(src.broken) - user << "The locker appears to be broken." - return else if((istype(W, /obj/item/weapon/card/emag)||istype(W, /obj/item/weapon/melee/energy/blade)) && !src.broken) broken = 1 locked = 0 @@ -88,46 +92,17 @@ else for(var/mob/O in viewers(user, 3)) O.show_message("The locker has been broken by [user] with an electromagnetic card!", 1, "You hear a faint electrical spark.", 2) + else if(istype(W,/obj/item/weapon/packageWrap) || istype(W,/obj/item/weapon/weldingtool)) + return ..(W,user) else - if(istype(W, /obj/item/weapon/weldingtool)) - var/obj/item/weapon/weldingtool/WT = W - if(!WT.remove_fuel(0,user)) - user << "You need more welding fuel to complete this task." - return - src.welded =! src.welded - src.update_icon() - for(var/mob/M in viewers(src)) - M.show_message("[src] has been [welded?"welded shut":"unwelded"] by [user.name].", 3, "You hear welding.", 2) - else - togglelock(user) - -/obj/structure/closet/secure_closet/relaymove(mob/user as mob) - if(user.stat || !isturf(src.loc)) - return - - if(!(src.locked)) - for(var/obj/item/I in src) - I.loc = src.loc - for(var/mob/M in src) - M.loc = src.loc - if(M.client) - M.client.eye = M.client.mob - M.client.perspective = MOB_PERSPECTIVE - src.icon_state = src.icon_opened - src.opened = 1 - else - user << "The locker is locked!" - if(world.time > lastbang+5) - lastbang = world.time - for(var/mob/M in hearers(src, null)) - M << "BANG, bang!" - return + togglelock(user) /obj/structure/closet/secure_closet/attack_hand(mob/user as mob) src.add_fingerprint(user) - - if(!src.toggle()) - return src.attackby(null, user) + if(src.locked) + src.togglelock(user) + else + src.toggle(user) /obj/structure/closet/secure_closet/attack_paw(mob/user as mob) return src.attack_hand(user) @@ -140,15 +115,9 @@ if(!usr.canmove || usr.stat || usr.restrained()) // Don't use it if you're not able to! Checks for stuns, ghost and restrain return - if(get_dist(usr, src) != 1) - return - - if(src.broken) - return - - if (ishuman(usr)) - if (!opened) - togglelock(usr) + if(ishuman(usr)) + src.add_fingerprint(usr) + src.togglelock(usr) else usr << "This mob type can't use this verb." From e20f2e1409f21739d4e702872855105c35c6db37 Mon Sep 17 00:00:00 2001 From: Mloc Date: Thu, 22 Aug 2013 15:12:59 +0100 Subject: [PATCH 2/3] Small fixes to hair. Hair styles that aren't designed to have color shifts will no longer be affected. Balding virus symptom now only applies to humans. Signed-off-by: Mloc --- .../mob/living/carbon/human/update_icons.dm | 12 ++++--- .../mob/new_player/sprite_accessories.dm | 33 ++++++++++++++++++- code/modules/organs/organ_external.dm | 8 +++-- code/modules/virus2/effect.dm | 2 +- 4 files changed, 47 insertions(+), 8 deletions(-) diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 507f38723a..49242c64de 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -350,8 +350,10 @@ proc/get_damage_icon_part(damage_state, body_part) if(facial_hair_style && src.species.name in facial_hair_style.species_allowed) var/icon/facial_s = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_s") var/icon/facial_l = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_l") - facial_s.Blend(rgb(r_facial, g_facial, b_facial), ICON_ADD) - facial_l.Blend(rgb(r_facial, g_facial, b_facial), ICON_ADD) + if(facial_hair_style.do_colouration) + facial_s.Blend(rgb(r_facial, g_facial, b_facial), ICON_ADD) + facial_l.Blend(rgb(r_facial, g_facial, b_facial), ICON_ADD) + face_standing.Blend(facial_s, ICON_OVERLAY) face_lying.Blend(facial_l, ICON_OVERLAY) @@ -360,8 +362,10 @@ proc/get_damage_icon_part(damage_state, body_part) if(hair_style && src.species.name in hair_style.species_allowed) var/icon/hair_s = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_s") var/icon/hair_l = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_l") - hair_s.Blend(rgb(r_hair, g_hair, b_hair), ICON_ADD) - hair_l.Blend(rgb(r_hair, g_hair, b_hair), ICON_ADD) + if(hair_style.do_colouration) + hair_s.Blend(rgb(r_hair, g_hair, b_hair), ICON_ADD) + hair_l.Blend(rgb(r_hair, g_hair, b_hair), ICON_ADD) + face_standing.Blend(hair_s, ICON_OVERLAY) face_lying.Blend(hair_l, ICON_OVERLAY) diff --git a/code/modules/mob/new_player/sprite_accessories.dm b/code/modules/mob/new_player/sprite_accessories.dm index c983c3ba23..55e37a4a4f 100644 --- a/code/modules/mob/new_player/sprite_accessories.dm +++ b/code/modules/mob/new_player/sprite_accessories.dm @@ -28,9 +28,12 @@ // Determines if the accessory will be skipped or included in random hair generations var/gender = NEUTER - // Restrict some styles to specific races + // Restrict some styles to specific species var/list/species_allowed = list("Human") + // Whether or not the accessory can be affected by colouration + var/do_colouration = 1 + /* //////////////////////////// @@ -386,117 +389,139 @@ name = "Long Unathi Spines" icon_state = "soghun_longspines" species_allowed = list("Unathi") + do_colouration = 0 una_spines_short name = "Short Unathi Spines" icon_state = "soghun_shortspines" species_allowed = list("Unathi") + do_colouration = 0 una_frills_long name = "Long Unathi Frills" icon_state = "soghun_longfrills" species_allowed = list("Unathi") + do_colouration = 0 una_frills_short name = "Short Unathi Frills" icon_state = "soghun_shortfrill" species_allowed = list("Unathi") + do_colouration = 0 una_horns name = "Unathi Horns" icon_state = "soghun_horns" species_allowed = list("Unathi") + do_colouration = 0 skr_tentacle_m name = "Skrell Male Tentacles" icon_state = "skrell_hair_m" species_allowed = list("Skrell") gender = MALE + do_colouration = 0 skr_tentacle_f name = "Skrell Female Tentacles" icon_state = "skrell_hair_f" species_allowed = list("Skrell") gender = FEMALE + do_colouration = 0 skr_gold_m name = "Gold plated Skrell Male Tentacles" icon_state = "skrell_goldhair_m" species_allowed = list("Skrell") gender = MALE + do_colouration = 0 skr_gold_f name = "Gold chained Skrell Female Tentacles" icon_state = "skrell_goldhair_f" species_allowed = list("Skrell") gender = FEMALE + do_colouration = 0 skr_clothtentacle_m name = "Cloth draped Skrell Male Tentacles" icon_state = "skrell_clothhair_m" species_allowed = list("Skrell") gender = MALE + do_colouration = 0 skr_clothtentacle_f name = "Cloth draped Skrell Female Tentacles" icon_state = "skrell_clothhair_f" species_allowed = list("Skrell") gender = FEMALE + do_colouration = 0 taj_ears name = "Tajaran Ears" icon_state = "ears_plain" species_allowed = list("Tajaran") + do_colouration = 0 taj_ears_clean name = "Tajara Clean" icon_state = "hair_clean" species_allowed = list("Tajaran") + do_colouration = 0 taj_ears_shaggy name = "Tajara Shaggy" icon_state = "hair_shaggy" species_allowed = list("Tajaran") + do_colouration = 0 taj_ears_mohawk name = "Tajaran Mohawk" icon_state = "hair_mohawk" species_allowed = list("Tajaran") + do_colouration = 0 taj_ears_plait name = "Tajara Plait" icon_state = "hair_plait" species_allowed = list("Tajaran") + do_colouration = 0 taj_ears_straight name = "Tajara Straight" icon_state = "hair_straight" species_allowed = list("Tajaran") + do_colouration = 0 taj_ears_long name = "Tajara Long" icon_state = "hair_long" species_allowed = list("Tajaran") + do_colouration = 0 taj_ears_rattail name = "Tajara Rat Tail" icon_state = "hair_rattail" species_allowed = list("Tajaran") + do_colouration = 0 taj_ears_spiky name = "Tajara Spiky" icon_state = "hair_tajspiky" species_allowed = list("Tajaran") + do_colouration = 0 taj_ears_messy name = "Tajara Messy" icon_state = "hair_messy" species_allowed = list("Tajaran") + do_colouration = 0 vox_quills_short name = "Short Vox Quills" icon_state = "vox_shortquills" species_allowed = list("Vox") + do_colouration = 0 /datum/sprite_accessory/facial_hair @@ -504,31 +529,37 @@ name = "Tajara Sideburns" icon_state = "facial_mutton" species_allowed = list("Tajaran") + do_colouration = 0 taj_mutton name = "Tajara Mutton" icon_state = "facial_mutton" species_allowed = list("Tajaran") + do_colouration = 0 taj_pencilstache name = "Tajara Pencilstache" icon_state = "facial_pencilstache" species_allowed = list("Tajaran") + do_colouration = 0 taj_moustache name = "Tajara Moustache" icon_state = "facial_moustache" species_allowed = list("Tajaran") + do_colouration = 0 taj_goatee name = "Tajara Goatee" icon_state = "facial_goatee" species_allowed = list("Tajaran") + do_colouration = 0 taj_smallstache name = "Tajara Smallsatche" icon_state = "facial_smallstache" species_allowed = list("Tajaran") + do_colouration = 0 //skin styles - WIP //going to have to re-integrate this with surgery diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index 02d0e47512..de03750000 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -766,14 +766,18 @@ obj/item/weapon/organ/New(loc, mob/living/carbon/human/H) var/datum/sprite_accessory/facial_hair_style = facial_hair_styles_list[H.f_style] if(facial_hair_style) var/icon/facial = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_l") - facial.Blend(rgb(H.r_facial, H.g_facial, H.b_facial), ICON_ADD) + if(facial_hair_style.do_colouration) + facial.Blend(rgb(H.r_facial, H.g_facial, H.b_facial), ICON_ADD) + base.Blend(facial, ICON_OVERLAY) if(H.h_style && !(H.head && (H.head.flags & BLOCKHEADHAIR))) var/datum/sprite_accessory/hair_style = hair_styles_list[H.h_style] if(hair_style) var/icon/hair = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_l") - hair.Blend(rgb(H.r_hair, H.g_hair, H.b_hair), ICON_ADD) + if(hair_style.do_colouration) + hair.Blend(rgb(H.r_hair, H.g_hair, H.b_hair), ICON_ADD) + base.Blend(hair, ICON_OVERLAY) icon = base diff --git a/code/modules/virus2/effect.dm b/code/modules/virus2/effect.dm index b50943549c..86b69cc8c1 100644 --- a/code/modules/virus2/effect.dm +++ b/code/modules/virus2/effect.dm @@ -309,7 +309,7 @@ activate(var/mob/living/carbon/mob,var/multiplier) if(istype(mob, /mob/living/carbon/human)) var/mob/living/carbon/human/H = mob - if(!(H.h_style == "Bald") && !(H.h_style == "Balding Hair")) + if(H.species.name == "Human" && !(H.h_style == "Bald") && !(H.h_style == "Balding Hair")) H << "Your hair starts to fall out in clumps..." spawn(50) H.h_style = "Balding Hair" From 1106845cb6d9aab97f47dbf95396c8b2081cdaf2 Mon Sep 17 00:00:00 2001 From: Mloc-Argent Date: Thu, 22 Aug 2013 15:54:28 +0100 Subject: [PATCH 3/3] further checks against mobs being loaded by hydraulic clamps. Signed-off-by: Mloc-Argent --- code/game/mecha/equipment/tools/tools.dm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/game/mecha/equipment/tools/tools.dm b/code/game/mecha/equipment/tools/tools.dm index c877084339..69f88c9c93 100644 --- a/code/game/mecha/equipment/tools/tools.dm +++ b/code/game/mecha/equipment/tools/tools.dm @@ -21,6 +21,9 @@ if(!action_checks(target)) return if(!cargo_holder) return if(istype(target, /obj/structure/stool)) return + for(var/M in target.contents) + if(istype(M, /mob/living) + return if(istype(target,/obj)) var/obj/O = target