From f5475afcc231f476bf31dc39b1db757eb8550011 Mon Sep 17 00:00:00 2001 From: Erthilo Date: Wed, 6 Jun 2012 23:56:43 +0100 Subject: [PATCH] TG: - You can now light your cigarette with an energy sword :) - Fixed the problem where suits appeared on the UI even with the inventory closed. The call to other_update() in update_clothing() must be done after all the icon slots get updated. Revision: r3725 Author: baloh.matevz --- .../objects/items/weapons/cigs_lighters.dm | 114 ++++++++++-------- code/modules/mob/living/carbon/human/human.dm | 16 +-- 2 files changed, 70 insertions(+), 60 deletions(-) diff --git a/code/game/objects/items/weapons/cigs_lighters.dm b/code/game/objects/items/weapons/cigs_lighters.dm index d0463e41d72..cec30461897 100644 --- a/code/game/objects/items/weapons/cigs_lighters.dm +++ b/code/game/objects/items/weapons/cigs_lighters.dm @@ -1,4 +1,4 @@ -//This file was auto-corrected by findeclaration.exe on 29/05/2012 15:03:05 +//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:32 /* CONTAINS: @@ -124,71 +124,80 @@ ZIPPO var/smoketime = 300 var/butt_count = 5 //count of butt sprite variations - proc - light(var/flavor_text = "[usr] lights the [name].") - put_out() - if (src.lit == -1) - return - src.lit = -1 - src.damtype = "brute" - src.icon_state = icon_butt + "[rand(0,butt_count)]" - src.item_state = icon_off - src.desc = "A [src.name] butt." - src.name = "[src.name] butt" - attackby(obj/item/weapon/W as obj, mob/user as mob) - ..() - if(istype(W, /obj/item/weapon/weldingtool) && W:welding) - light("\red [user] casually lights the [name] with [W], what a badass.") +/obj/item/clothing/mask/cigarette/attackby(obj/item/weapon/W as obj, mob/user as mob) + ..() + if(istype(W, /obj/item/weapon/weldingtool) && W:welding) + light("\red [user] casually lights the [name] with [W], what a badass.") - else if(istype(W, /obj/item/weapon/lighter/zippo) && (W:lit > 0)) + else if(istype(W, /obj/item/weapon/lighter/zippo)) + var/obj/item/weapon/lighter/zippo/Z = W + if(Z.lit > 0) light("\red With a single flick of their wrist, [user] smoothly lights their [name] with their [W]. Damn they're cool.") - else if(istype(W, /obj/item/weapon/lighter) && (W:lit > 0)) + else if(istype(W, /obj/item/weapon/lighter)) + var/obj/item/weapon/lighter/L = W + if(L.lit > 0) light("\red After some fiddling, [user] manages to light their [name] with [W].") - else if(istype(W, /obj/item/weapon/match) && (W:lit > 0)) + else if(istype(W, /obj/item/weapon/melee/energy/sword)) + var/obj/item/weapon/melee/energy/sword/S = W + if(S.active) + light("\red [user] swings their [W], barely missing their nose. They light their [name] in the process.") + + else if(istype(W, /obj/item/weapon/match)) + var/obj/item/weapon/match/M = W + if(M.lit > 0) light("\red [user] lights their [name] with their [W].") - return + return - light(var/flavor_text = "[usr] lights the [name].") - if(!src.lit) - src.lit = 1 - src.damtype = "fire" - src.icon_state = icon_on - src.item_state = icon_on - for(var/mob/O in viewers(usr, null)) - O.show_message(flavor_text, 1) - processing_objects.Add(src) +/obj/item/clothing/mask/cigarette/proc/light(var/flavor_text = "[usr] lights the [name].") + if(!src.lit) + src.lit = 1 + src.damtype = "fire" + src.icon_state = icon_on + src.item_state = icon_on + for(var/mob/O in viewers(usr, null)) + O.show_message(flavor_text, 1) + processing_objects.Add(src) - process() - var/turf/location = get_turf(src) - src.smoketime-- - if(src.smoketime < 1) - if(ismob(src.loc)) - var/mob/living/M = src.loc - M << "\red Your [src.name] goes out." - put_out() - M.update_clothing() - else - put_out() - processing_objects.Remove(src) - return - if(location) - location.hotspot_expose(700, 5) - return - - - dropped(mob/user as mob) - if(src.lit == 1) - src.visible_message("\red [user] calmly drops and treads on the lit [src], putting it out instantly.") +/obj/item/clothing/mask/cigarette/process() + var/turf/location = get_turf(src) + src.smoketime-- + if(src.smoketime < 1) + if(ismob(src.loc)) + var/mob/living/M = src.loc + M << "\red Your [src.name] goes out." put_out() - return ..() + M.update_clothing() + else + put_out() + processing_objects.Remove(src) + return + if(location) + location.hotspot_expose(700, 5) + return +/obj/item/clothing/mask/cigarette/dropped(mob/user as mob) + if(src.lit == 1) + src.visible_message("\red [user] calmly drops and treads on the lit [src], putting it out instantly.") + put_out() + return ..() + +/obj/item/clothing/mask/cigarette/proc/put_out() + if (src.lit == -1) + return + src.lit = -1 + src.damtype = "brute" + src.icon_state = icon_butt + "[rand(0,butt_count)]" + src.item_state = icon_off + src.desc = "A [src.name] butt." + src.name = "[src.name] butt" + //////////// // CIGARS // @@ -252,7 +261,6 @@ ZIPPO var/lastHolder = null var/smoketime = 100 var/maxsmoketime = 100 //make sure this is equal to your smoketime - proc light(var/flavor_text = "[usr] lights the [name].") @@ -475,4 +483,4 @@ ZIPPO if(lit) user.total_luminosity -= 2 src.sd_SetLuminosity(2) - return \ No newline at end of file + return diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 891d121971d..db5a619366a 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -935,10 +935,6 @@ client.screen -= hud_used.intents client.screen -= hud_used.mov_int - - //Screenlocs for these slots are handled by the huds other_update() - //because theyre located on the 'other' inventory bar. - // Gloves var/datum/organ/external/lo = organs["l_hand"] var/datum/organ/external/ro = organs["r_hand"] @@ -1060,9 +1056,10 @@ clothing_overlays += image("icon" = 'back.dmi', "icon_state" = text("[][]", t1, (!( lying ) ? null : "2")), "layer" = BACK_LAYER) back.screen_loc = ui_back - if(client) hud_used.other_update() //Update the screenloc of the items on the 'other' inventory bar - //to hide / show them. - // WHAT IS THIS DOING IN UPDATE_CLOTHING(), AHHHHHHHHHHHHH + if(client) + client.screen -= contents + client.screen += contents + //to hide / show them. if (handcuffed) pulling = null var/h1 = handcuffed.icon_state @@ -1121,6 +1118,11 @@ clothing_overlays += image("icon" = stain_icon, "layer" = B_SUIT_LAYER) wear_suit.screen_loc = ui_oclothing + //Update_other() MUST be called after all the storage slots get updated. This is because all the storage slots assign their + //respective items a screen_loc, which other_update() will then override if needed. + if(client) + hud_used.other_update() //Update the screenloc of the items on the 'other' inventory bar + switch(shielded) if(1) overlays += image("icon" = 'effects.dmi', "icon_state" = "shield", "layer" = SHIELD_LAYER)