From b8a12b0b52d9fcdaa327950b954219fb0729b273 Mon Sep 17 00:00:00 2001 From: SweeperM Date: Thu, 29 Nov 2012 21:08:58 +0000 Subject: [PATCH 1/5] Fixes to lighting -Fixed #2005 (for sure!) -Fixed the stacking of brightness. Now the most bright item turned ON will be the one where the user gets its luminosity of. -Cleaned the code a bit. Now only one var controls the on/off switch of light, and another holds the value of brightness when on. --- code/controllers/_DynamicAreaLighting_TG.dm | 60 +++++++++++++++++++ code/game/objects/items/candle.dm | 45 ++++++++------ code/game/objects/items/devices/PDA/PDA.dm | 42 ++++++++----- code/game/objects/items/devices/flashlight.dm | 48 +++++++++------ .../objects/items/weapons/cigs_lighters.dm | 40 ++++++++----- code/modules/clothing/head/hardhat.dm | 37 ++++++++---- code/modules/clothing/head/misc_special.dm | 38 +++++++----- code/modules/clothing/spacesuits/rig.dm | 37 ++++++++---- code/modules/mob/living/carbon/carbon.dm | 12 ++-- .../mob/living/carbon/human/inventory.dm | 16 +++-- .../mob/living/carbon/monkey/inventory.dm | 8 ++- .../mob/living/silicon/robot/robot_modules.dm | 2 +- .../reagent_containers/food/snacks/grown.dm | 4 +- code/setup.dm | 2 +- maps/tgstation.2.0.9.1.dmm | 2 +- 15 files changed, 271 insertions(+), 122 deletions(-) diff --git a/code/controllers/_DynamicAreaLighting_TG.dm b/code/controllers/_DynamicAreaLighting_TG.dm index 2bc317aabb..3d9f66c9f3 100644 --- a/code/controllers/_DynamicAreaLighting_TG.dm +++ b/code/controllers/_DynamicAreaLighting_TG.dm @@ -294,6 +294,66 @@ area //show the dark overlay so areas, not yet in a lighting subarea, won't be bright as day and look silly. SetLightLevel(4) +atom + var/light_on = 0 //Am I emitting light? + var/brightness_on = 0 //Luminosity when the above: light_on = 1 + + //Called when turning off or dropping a flashlight for ex. + //It checks the users slots for another source of light, and return the appropriate brightness. 0 if no other source is found + proc/search_light(mob/M, obj/item/W as obj) + var/list/slots + var/obj/item/I + var brightness = 0 //the new brightness to be returned + + if (istype(M, /mob/living/carbon/human)) + var/mob/living/carbon/human/H = M + slots = list ( + "l_hand", + "r_hand", + "belt", + "head", + "l_pocket", + "r_pocket", + "s_store") + + for (var/slot in slots) + switch(slot) + if("belt") + I = H.belt + if("head") + I = H.head + if("l_hand") + I = H.l_hand + if("r_hand") + I = H.r_hand + if("l_pocket") + I = H.l_store + if("r_pocket") + I = H.r_store + if("s_store") + I = H.s_store + if (I) + if ((I.light_on) && (I != W)) //an item emitting light other than itself + if (I.brightness_on > brightness) + brightness = I.brightness_on + + else if (istype(M, /mob/living/carbon/monkey)) + slots = list ( + "l_hand", + "r_hand") + + for (var/slot in slots) + switch(slot) + if("l_hand") + I = M.l_hand + if("r_hand") + I = M.r_hand + if (I) + if ((I.light_on) && (I != W)) //an item emitting light other than itself + if (I.brightness_on > brightness) + brightness = I.brightness_on + + return brightness #undef LIGHTING_MAX_LUMINOSITY #undef LIGHTING_MAX_LUMINOSITY_MOB diff --git a/code/game/objects/items/candle.dm b/code/game/objects/items/candle.dm index b47a2a3068..0ea57a1256 100644 --- a/code/game/objects/items/candle.dm +++ b/code/game/objects/items/candle.dm @@ -5,9 +5,11 @@ icon_state = "candle1" item_state = "candle1" w_class = 1 + light_on = 0 + brightness_on = 3 //luminosity when on var/wax = 200 - var/lit = 0 + proc light(var/flavor_text = "\red [usr] lights the [name].") @@ -19,7 +21,7 @@ else if(wax>80) i = 2 else i = 3 - icon_state = "candle[i][lit ? "_lit" : ""]" + icon_state = "candle[i][light_on ? "_lit" : ""]" attackby(obj/item/weapon/W as obj, mob/user as mob) @@ -30,30 +32,30 @@ light("\red [user] casually lights the [name] with [W], what a badass.") else if(istype(W, /obj/item/weapon/lighter)) var/obj/item/weapon/lighter/L = W - if(L.lit) + if(L.light_on) light() else if(istype(W, /obj/item/weapon/match)) var/obj/item/weapon/match/M = W - if(M.lit) + if(M.light_on) light() else if(istype(W, /obj/item/candle)) var/obj/item/candle/C = W - if(C.lit) + if(C.light_on) light() light(var/flavor_text = "\red [usr] lights the [name].") - if(!src.lit) - src.lit = 1 + if(!src.light_on) + src.light_on = 1 //src.damtype = "fire" for(var/mob/O in viewers(usr, null)) O.show_message(flavor_text, 1) - SetLuminosity(CANDLE_LUM) + SetLuminosity(brightness_on) processing_objects.Add(src) process() - if(!lit) + if(!light_on) return wax-- if(!wax) @@ -68,20 +70,29 @@ attack_self(mob/user as mob) - if(lit) - lit = 0 + if(light_on) + light_on = 0 update_icon() SetLuminosity(0) - user.SetLuminosity(user.luminosity - CANDLE_LUM) + user.SetLuminosity(search_light(user, src)) pickup(mob/user) - if(lit) + if(light_on) + if (user.luminosity < brightness_on) + user.SetLuminosity(brightness_on) SetLuminosity(0) - user.SetLuminosity(user.luminosity + CANDLE_LUM) dropped(mob/user) - if(lit) - user.SetLuminosity(user.luminosity - CANDLE_LUM) - SetLuminosity(CANDLE_LUM) + if(light_on) + if ((layer <= 3) || (loc != user.loc)) + user.SetLuminosity(search_light(user, src)) + SetLuminosity(brightness_on) + + + equipped(mob/user, slot) + if(light_on) + if (user.luminosity < brightness_on) + user.SetLuminosity(brightness_on) + SetLuminosity(0) diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index 1207d01fad..f0edf67865 100755 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -13,6 +13,8 @@ var/global/list/obj/item/device/pda/PDAs = list() w_class = 1.0 flags = FPRINT | TABLEPASS slot_flags = SLOT_ID | SLOT_BELT + light_on = 0 //Is the flashlight function on? + brightness_on = 4 //Luminosity for the flashlight function //Main variables var/owner = null @@ -22,8 +24,6 @@ var/global/list/obj/item/device/pda/PDAs = list() //Secondary variables var/scanmode = 0 //1 is medical scanner, 2 is forensics, 3 is reagent scanner. - var/fon = 0 //Is the flashlight function on? - var/f_lum = 4 //Luminosity for the flashlight function var/silent = 0 //To beep or not to beep, that is the question var/toff = 0 //If 1, messenger disabled var/tnote = null //Current Texts @@ -192,14 +192,22 @@ var/global/list/obj/item/device/pda/PDAs = list() * The Actual PDA */ /obj/item/device/pda/pickup(mob/user) - if(fon) + if(light_on) + if(user.luminosity < brightness_on) + user.SetLuminosity(brightness_on) SetLuminosity(0) - user.SetLuminosity(user.luminosity + f_lum) /obj/item/device/pda/dropped(mob/user) - if(fon) - user.SetLuminosity(user.luminosity - f_lum) - SetLuminosity(f_lum) + if(light_on) + if ((layer <= 3) || (loc != user.loc)) + user.SetLuminosity(search_light(user, src)) + SetLuminosity(brightness_on) + +/obj/item/device/pda/equipped(mob/user, slot) + if(light_on) + if(user.luminosity < brightness_on) + user.SetLuminosity(brightness_on) + SetLuminosity(0) /obj/item/device/pda/New() ..() @@ -320,7 +328,7 @@ var/global/list/obj/item/device/pda/PDAs = list() if (cartridge.access_remote_door) dat += "
  • Toggle Remote Door
  • " dat += "
  • Atmospheric Scan
  • " - dat += "
  • [fon ? "Disable" : "Enable"] Flashlight
  • " + dat += "
  • [light_on ? "Disable" : "Enable"] Flashlight
  • " if (pai) if(pai.loc != src) pai = null @@ -495,14 +503,18 @@ var/global/list/obj/item/device/pda/PDAs = list() //MAIN FUNCTIONS=================================== if("Light") - if(fon) - fon = 0 - if(src in U.contents) U.SetLuminosity(U.luminosity - f_lum) - else SetLuminosity(0) + if(light_on) + light_on = 0 + if(src in U.contents) + U.SetLuminosity(search_light(U, src)) + else + SetLuminosity(0) else - fon = 1 - if(src in U.contents) U.SetLuminosity(U.luminosity + f_lum) - else SetLuminosity(f_lum) + light_on = 1 + if((src in U.contents) && (U.luminosity < brightness_on)) + U.SetLuminosity(brightness_on) + else + SetLuminosity(brightness_on) if("Medical Scan") if(scanmode == 1) scanmode = 0 diff --git a/code/game/objects/items/devices/flashlight.dm b/code/game/objects/items/devices/flashlight.dm index 40c8fcdc89..166b534bb7 100644 --- a/code/game/objects/items/devices/flashlight.dm +++ b/code/game/objects/items/devices/flashlight.dm @@ -10,12 +10,13 @@ m_amt = 50 g_amt = 20 icon_action_button = "action_flashlight" - var/on = 0 - var/brightness_on = 4 //luminosity when on + light_on = 0 + brightness_on = 4 //luminosity when on + var brightness = 0 /obj/item/device/flashlight/initialize() ..() - if(on) + if(light_on) icon_state = "[initial(icon_state)]-on" SetLuminosity(brightness_on) else @@ -23,16 +24,16 @@ SetLuminosity(0) /obj/item/device/flashlight/proc/update_brightness(var/mob/user = null) - if(on) + if(light_on) icon_state = "[initial(icon_state)]-on" - if(loc == user) - user.SetLuminosity(user.luminosity + brightness_on) + if((loc == user) && (user.luminosity < brightness_on)) + user.SetLuminosity(brightness_on) else if(isturf(loc)) SetLuminosity(brightness_on) else icon_state = initial(icon_state) if(loc == user) - user.SetLuminosity(user.luminosity - brightness_on) + user.SetLuminosity(search_light(user, src)) else if(isturf(loc)) SetLuminosity(0) @@ -40,14 +41,14 @@ if(!isturf(user.loc)) user << "You cannot turn the light on while in this [user.loc]." //To prevent some lighting anomalities. return - on = !on + light_on = !light_on update_brightness(user) return /obj/item/device/flashlight/attack(mob/living/M as mob, mob/living/user as mob) add_fingerprint(user) - if(on && user.zone_sel.selecting == "eyes") + if(light_on && user.zone_sel.selecting == "eyes") if(((CLUMSY in user.mutations) || user.getBrainLoss() >= 60) && prob(50)) //too dumb to use flashlight properly return ..() //just hit them in the head @@ -88,15 +89,24 @@ /obj/item/device/flashlight/pickup(mob/user) - if(on) - user.SetLuminosity(user.luminosity + brightness_on) + if(light_on) + if (user.luminosity < brightness_on) + user.SetLuminosity(brightness_on) SetLuminosity(0) /obj/item/device/flashlight/dropped(mob/user) - if(on) - user.SetLuminosity(user.luminosity - brightness_on) - SetLuminosity(brightness_on) + if(light_on) + if ((layer <= 3) || (loc != user.loc)) + user.SetLuminosity(search_light(user, src)) + SetLuminosity(brightness_on) + + +/obj/item/device/flashlight/equipped(mob/user, slot) + if(light_on) + if (user.luminosity < brightness_on) + user.SetLuminosity(brightness_on) + SetLuminosity(0) /obj/item/device/flashlight/pen @@ -119,7 +129,7 @@ flags = FPRINT | TABLEPASS | CONDUCT m_amt = 0 g_amt = 0 - on = 1 + light_on = 1 // green-shaded desk lamp @@ -159,14 +169,14 @@ var/turf/pos = get_turf(src) pos.hotspot_expose(produce_heat, 5) fuel = max(fuel - 1, 0) - if(!fuel || !on) + if(!fuel || !light_on) turn_off() if(!fuel) src.icon_state = "[initial(icon_state)]-empty" processing_objects -= src /obj/item/device/flashlight/flare/proc/turn_off() - on = 0 + light_on = 0 src.force = initial(src.force) src.damtype = initial(src.damtype) if(ismob(loc)) @@ -182,12 +192,12 @@ if(!fuel) user << "It's out of fuel." return - if(!on) + if(!light_on) user.visible_message("[user] activates the flare.", "You pull the cord on the flare, activating it!") else return // All good, turn it on. - on = 1 + light_on = 1 update_brightness(user) src.force = on_damage src.damtype = "fire" diff --git a/code/game/objects/items/weapons/cigs_lighters.dm b/code/game/objects/items/weapons/cigs_lighters.dm index 9499b40f61..5d5b6d6ea4 100644 --- a/code/game/objects/items/weapons/cigs_lighters.dm +++ b/code/game/objects/items/weapons/cigs_lighters.dm @@ -85,12 +85,12 @@ ZIPPO else if(istype(W, /obj/item/weapon/lighter/zippo)) var/obj/item/weapon/lighter/zippo/Z = W - if(Z.lit) + if(Z.light_on) light("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)) var/obj/item/weapon/lighter/L = W - if(L.lit) + if(L.light_on) light("After some fiddling, [user] manages to light their [name] with [W].") else if(istype(W, /obj/item/weapon/match)) @@ -375,7 +375,8 @@ ZIPPO flags = TABLEPASS | CONDUCT slot_flags = SLOT_BELT attack_verb = list("burnt", "singed") - var/lit = 0 + light_on = 0 + brightness_on = 2 //luminosity when on /obj/item/weapon/lighter/zippo name = "Zippo lighter" @@ -394,8 +395,8 @@ ZIPPO /obj/item/weapon/lighter/attack_self(mob/living/user) if(user.r_hand == src || user.l_hand == src) - if(!lit) - lit = 1 + if(!light_on) + light_on = 1 icon_state = icon_on item_state = icon_on if(istype(src, /obj/item/weapon/lighter/zippo) ) @@ -411,10 +412,11 @@ ZIPPO user.apply_damage(2,BURN,"r_hand") user.visible_message("After a few attempts, [user] manages to light the [src], they however burn their finger in the process.") - user.SetLuminosity(user.luminosity + 2) + if (user.luminosity < brightness_on) + user.SetLuminosity(brightness_on) processing_objects.Add(src) else - lit = 0 + light_on = 0 icon_state = icon_off item_state = icon_off if(istype(src, /obj/item/weapon/lighter/zippo) ) @@ -422,7 +424,7 @@ ZIPPO else user.visible_message("[user] quietly shuts off the [src].") - user.SetLuminosity(user.luminosity - 2) + user.SetLuminosity(search_light(user, src)) processing_objects.Remove(src) else return ..() @@ -433,7 +435,7 @@ ZIPPO if(!istype(M, /mob)) return - if(istype(M.wear_mask, /obj/item/clothing/mask/cigarette) && user.zone_sel.selecting == "mouth" && lit) + if(istype(M.wear_mask, /obj/item/clothing/mask/cigarette) && user.zone_sel.selecting == "mouth" && light_on) var/obj/item/clothing/mask/cigarette/cig = M.wear_mask if(M == user) cig.attackby(src, user) @@ -453,14 +455,24 @@ ZIPPO /obj/item/weapon/lighter/pickup(mob/user) - if(lit) + if(light_on) + if (user.luminosity < brightness_on) + user.SetLuminosity(brightness_on) SetLuminosity(0) - user.SetLuminosity(user.luminosity+2) return /obj/item/weapon/lighter/dropped(mob/user) - if(lit) - user.SetLuminosity(user.luminosity-2) - SetLuminosity(2) + if(light_on) + if ((layer <= 3) || (loc != user.loc)) + user.SetLuminosity(search_light(user, src)) + SetLuminosity(brightness_on) + return + + +/obj/item/weapon/lighter/equipped(mob/user, slot) + if(light_on) + if (user.luminosity < brightness_on) + user.SetLuminosity(brightness_on) + SetLuminosity(0) return diff --git a/code/modules/clothing/head/hardhat.dm b/code/modules/clothing/head/hardhat.dm index dfca62aa01..f35ddfb30c 100644 --- a/code/modules/clothing/head/hardhat.dm +++ b/code/modules/clothing/head/hardhat.dm @@ -4,8 +4,8 @@ icon_state = "hardhat0_yellow" flags = FPRINT | TABLEPASS item_state = "hardhat0_yellow" - var/brightness_on = 4 //luminosity when on - var/on = 0 + brightness_on = 4 //luminosity when on + light_on = 0 color = "yellow" //Determines used sprites: hardhat[on]_[color] and hardhat[on]_[color]2 (lying down sprite) armor = list(melee = 30, bullet = 5, laser = 20,energy = 10, bomb = 20, bio = 10, rad = 20) flags_inv = 0 @@ -15,24 +15,35 @@ if(!isturf(user.loc)) user << "You cannot turn the light on while in this [user.loc]" //To prevent some lighting anomalities. return - on = !on - icon_state = "hardhat[on]_[color]" - item_state = "hardhat[on]_[color]" + light_on = !light_on + icon_state = "hardhat[light_on]_[color]" + item_state = "hardhat[light_on]_[color]" - if(on) user.SetLuminosity(user.luminosity + brightness_on) - else user.SetLuminosity(user.luminosity - brightness_on) + if((light_on) && (user.luminosity < brightness_on)) + user.SetLuminosity(brightness_on) + else + user.SetLuminosity(search_light(user, src)) pickup(mob/user) - if(on) - user.SetLuminosity(user.luminosity + brightness_on) + if(light_on) + if (user.luminosity < brightness_on) + user.SetLuminosity(brightness_on) // user.UpdateLuminosity() //TODO: Carn SetLuminosity(0) dropped(mob/user) - if(on) - user.SetLuminosity(user.luminosity - brightness_on) -// user.UpdateLuminosity() - SetLuminosity(brightness_on) + if(light_on) + if ((layer <= 3) || (loc != user.loc)) + user.SetLuminosity(search_light(user, src)) + SetLuminosity(brightness_on) + // user.UpdateLuminosity() + + equipped(mob/user, slot) + if(light_on) + if (user.luminosity < brightness_on) + user.SetLuminosity(brightness_on) +// user.UpdateLuminosity() //TODO: Carn + SetLuminosity(0) /obj/item/clothing/head/hardhat/orange diff --git a/code/modules/clothing/head/misc_special.dm b/code/modules/clothing/head/misc_special.dm index 96d6ad8705..5a3a1a1833 100644 --- a/code/modules/clothing/head/misc_special.dm +++ b/code/modules/clothing/head/misc_special.dm @@ -122,32 +122,42 @@ color = "pumpkin" flags = FPRINT | TABLEPASS | HEADCOVERSEYES | HEADCOVERSMOUTH | BLOCKHAIR flags_inv = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE - var/brightness_on = 2 //luminosity when on - var/on = 0 + brightness_on = 2 //luminosity when on + light_on = 0 attack_self(mob/user) if(!isturf(user.loc)) user << "You cannot turn the light on while in this [user.loc]" //To prevent some lighting anomalities. return - on = !on - icon_state = "hardhat[on]_[color]" - item_state = "hardhat[on]_[color]" + light_on = !light_on + icon_state = "hardhat[light_on]_[color]" + item_state = "hardhat[light_on]_[color]" - if(on) user.SetLuminosity(user.luminosity + brightness_on) - else user.SetLuminosity(user.luminosity - brightness_on) + if((light_on) && (user.luminosity < brightness_on)) + user.SetLuminosity(brightness_on) + else + user.SetLuminosity(search_light(user, src)) pickup(mob/user) - if(on) - user.SetLuminosity(user.luminosity + brightness_on) -// user.UpdateLuminosity() + if(light_on) + if (user.luminosity < brightness_on) + user.SetLuminosity(brightness_on) +// user.UpdateLuminosity() //TODO: Carn SetLuminosity(0) dropped(mob/user) - if(on) - user.SetLuminosity(user.luminosity - brightness_on) -// user.UpdateLuminosity() - SetLuminosity(brightness_on) + if(light_on) + if ((layer <= 3) || (loc != user.loc)) + user.SetLuminosity(search_light(user, src)) + SetLuminosity(brightness_on) + // user.UpdateLuminosity() + equipped(mob/user, slot) + if(light_on) + if (user.luminosity < brightness_on) + user.SetLuminosity(brightness_on) +// user.UpdateLuminosity() //TODO: Carn + SetLuminosity(0) /* * Kitty ears */ diff --git a/code/modules/clothing/spacesuits/rig.dm b/code/modules/clothing/spacesuits/rig.dm index ab04e347fe..d90e9cee49 100644 --- a/code/modules/clothing/spacesuits/rig.dm +++ b/code/modules/clothing/spacesuits/rig.dm @@ -6,8 +6,8 @@ item_state = "eng_helm" armor = list(melee = 40, bullet = 5, laser = 20,energy = 5, bomb = 35, bio = 100, rad = 60) allowed = list(/obj/item/device/flashlight) - var/brightness_on = 4 //luminosity when on - var/on = 0 + brightness_on = 4 //luminosity when on + light_on = 0 color = "engineering" //Determines used sprites: rig[on]-[color] and rig[on]-[color]2 (lying down sprite) icon_action_button = "action_hardhat" heat_protection = HEAD @@ -17,24 +17,35 @@ if(!isturf(user.loc)) user << "You cannot turn the light on while in this [user.loc]" //To prevent some lighting anomalities. return - on = !on - icon_state = "rig[on]-[color]" + light_on = !light_on + icon_state = "rig[light_on]-[color]" // item_state = "rig[on]-[color]" - if(on) user.SetLuminosity(user.luminosity + brightness_on) - else user.SetLuminosity(user.luminosity - brightness_on) + if((light_on) && (user.luminosity < brightness_on)) + user.SetLuminosity(brightness_on) + else + user.SetLuminosity(search_light(user, src)) pickup(mob/user) - if(on) - user.SetLuminosity(user.luminosity + brightness_on) -// user.UpdateLuminosity() + if(light_on) + if (user.luminosity < brightness_on) + user.SetLuminosity(brightness_on) +// user.UpdateLuminosity() //TODO: Carn SetLuminosity(0) dropped(mob/user) - if(on) - user.SetLuminosity(user.luminosity - brightness_on) -// user.UpdateLuminosity() - SetLuminosity(brightness_on) + if(light_on) + if ((layer <= 3) || (loc != user.loc)) + user.SetLuminosity(search_light(user, src)) + SetLuminosity(brightness_on) + // user.UpdateLuminosity() + + equipped(mob/user, slot) + if(light_on) + if (user.luminosity < brightness_on) + user.SetLuminosity(brightness_on) +// user.UpdateLuminosity() //TODO: Carn + SetLuminosity(0) /obj/item/clothing/suit/space/rig name = "engineering hardsuit" diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 2024fefdbc..939d78b0d6 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -421,19 +421,19 @@ if(!item) return //Grab processing has a chance of returning null + item.layer = initial(item.layer) u_equip(item) update_icons() - if(src.client) - src.client.screen -= item + //if(src.client) + //src.client.screen -= item - item.loc = src.loc + //item.loc = src.loc - if(istype(item, /obj/item)) - item:dropped(src) // let it know it's been dropped + //if(istype(item, /obj/item)) + //item:dropped(src) // let it know it's been dropped //actually throw it! if (item) - item.layer = initial(item.layer) src.visible_message("\red [src] has thrown [item].") if(!src.lastarea) diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index 614715275e..db7342061c 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -159,9 +159,8 @@ client.screen -= W W.loc = loc W.dropped(src) - if(W) - W.layer = initial(W.layer) - + //if(W) + //W.layer = initial(W.layer) update_action_buttons() return 1 @@ -592,7 +591,15 @@ It can still be worn/put on as normal. target.internals.icon_state = "internal1" if(slot_to_process) if(strip_item) //Stripping an item from the mob - target.u_equip(strip_item) + var/obj/item/W = strip_item + target.u_equip(W) + if (target.client) + target.client.screen -= W + if (W) + W.loc = target.loc + W.layer = initial(W.layer) + W.dropped(target) + W.add_fingerprint(source) if(slot_to_process == slot_l_store) //pockets! Needs to process the other one too. Snowflake code, wooo! It's not like anyone will rewrite this anytime soon. If I'm wrong then... CONGRATULATIONS! ;) if(target.r_store) target.u_equip(target.r_store) //At this stage l_store is already processed by the code above, we only need to process r_store. @@ -601,6 +608,7 @@ It can still be worn/put on as normal. if(item.mob_can_equip(target, slot_to_process, 0)) source.u_equip(item) target.equip_to_slot_if_possible(item, slot_to_process, 0, 1, 1) + item.dropped(source) source.update_icons() target.update_icons() diff --git a/code/modules/mob/living/carbon/monkey/inventory.dm b/code/modules/mob/living/carbon/monkey/inventory.dm index b1060ad9a9..e9f5761162 100644 --- a/code/modules/mob/living/carbon/monkey/inventory.dm +++ b/code/modules/mob/living/carbon/monkey/inventory.dm @@ -102,8 +102,8 @@ target.client.screen -= W if (W) W.loc = target.loc - W.dropped(target) W.layer = initial(W.layer) + W.dropped(target) W.add_fingerprint(source) else if (istype(item, /obj/item)) @@ -112,6 +112,8 @@ item.layer = 20 target.l_hand = item item.loc = target + item.dropped(source) + item.equipped(target,target.l_hand) if("r_hand") if (target.r_hand) var/obj/item/W = target.r_hand @@ -120,8 +122,8 @@ target.client.screen -= W if (W) W.loc = target.loc - W.dropped(target) W.layer = initial(W.layer) + W.dropped(target) W.add_fingerprint(source) else if (istype(item, /obj/item)) @@ -130,6 +132,8 @@ item.layer = 20 target.r_hand = item item.loc = target + item.dropped(source) + item.equipped(target,target.r_hand) if("back") if (target.back) var/obj/item/W = target.back diff --git a/code/modules/mob/living/silicon/robot/robot_modules.dm b/code/modules/mob/living/silicon/robot/robot_modules.dm index 2817ab4957..c7a956bd0d 100644 --- a/code/modules/mob/living/silicon/robot/robot_modules.dm +++ b/code/modules/mob/living/silicon/robot/robot_modules.dm @@ -179,7 +179,7 @@ src.modules += new /obj/item/weapon/reagent_containers/robodropper(src) var/obj/item/weapon/lighter/zippo/L = new /obj/item/weapon/lighter/zippo(src) - L.lit = 1 + L.light_on = 1 src.modules += L src.modules += new /obj/item/weapon/tray(src) diff --git a/code/modules/reagents/reagent_containers/food/snacks/grown.dm b/code/modules/reagents/reagent_containers/food/snacks/grown.dm index 3d0cb1ee66..31d1536eb4 100644 --- a/code/modules/reagents/reagent_containers/food/snacks/grown.dm +++ b/code/modules/reagents/reagent_containers/food/snacks/grown.dm @@ -216,8 +216,8 @@ seed = "/obj/item/seeds/glowberryseed" name = "bunch of glow-berries" desc = "Nutritious!" - var/on = 1 - var/brightness_on = 2 //luminosity when on + light_on = 1 + brightness_on = 2 //luminosity when on icon_state = "glowberrypile" New() ..() diff --git a/code/setup.dm b/code/setup.dm index 0fe085d5a6..1abc93a19b 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -534,7 +534,7 @@ var/list/liftable_structures = list(\ #define INVISIBILITY_MAXIMUM 100 //Object specific defines -#define CANDLE_LUM 3 //For how bright candles are +//#define CANDLE_LUM 3 //For how bright candles are //Why is this here? Moved to candle.dm (brightness_on) -SweeperM //Some mob defines below diff --git a/maps/tgstation.2.0.9.1.dmm b/maps/tgstation.2.0.9.1.dmm index c6f444dd29..c1758f271e 100644 --- a/maps/tgstation.2.0.9.1.dmm +++ b/maps/tgstation.2.0.9.1.dmm @@ -784,7 +784,7 @@ "apd" = (/turf/simulated/floor/carpet,/area/security/detectives_office) "ape" = (/obj/structure/table/woodentable,/obj/item/weapon/cigpacket,/obj/structure/cable{d1 = 1; d2 = 2; icon_state = "1-2"; tag = ""},/obj/item/clothing/glasses/sunglasses,/turf/simulated/floor/carpet,/area/security/detectives_office) "apf" = (/obj/structure/table/woodentable,/obj/item/weapon/paper_bin{pixel_x = -3; pixel_y = 7},/obj/item/weapon/pen,/turf/simulated/floor/carpet,/area/security/detectives_office) -"apg" = (/obj/structure/table/woodentable,/obj/item/device/flashlight/lamp/green{on = 0; pixel_x = -3; pixel_y = 8},/obj/item/weapon/book/manual/security_space_law,/turf/simulated/floor{icon_state = "grimy"},/area/security/detectives_office) +"apg" = (/obj/structure/table/woodentable,/obj/item/device/flashlight/lamp/green{light_on = 0; pixel_x = -3; pixel_y = 8},/obj/item/weapon/book/manual/security_space_law,/turf/simulated/floor{icon_state = "grimy"},/area/security/detectives_office) "aph" = (/obj/machinery/light{icon_state = "tube1"; dir = 8},/obj/machinery/requests_console{department = "Law office"; pixel_x = -32; pixel_y = 0},/turf/simulated/floor/wood,/area/lawoffice) "api" = (/obj/structure/stool/bed/chair{dir = 4},/turf/simulated/floor/wood,/area/lawoffice) "apj" = (/obj/structure/table/woodentable,/obj/item/weapon/book/manual/security_space_law,/obj/item/weapon/book/manual/security_space_law,/obj/item/weapon/pen/red,/turf/simulated/floor/wood,/area/lawoffice) From 5c9738aab6007fddaa04f773875f7198cba07a3c Mon Sep 17 00:00:00 2001 From: SweeperM Date: Sat, 1 Dec 2012 03:49:41 +0000 Subject: [PATCH 2/5] added requested changes --- code/controllers/_DynamicAreaLighting_TG.dm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/controllers/_DynamicAreaLighting_TG.dm b/code/controllers/_DynamicAreaLighting_TG.dm index 3d9f66c9f3..c8f52ef936 100644 --- a/code/controllers/_DynamicAreaLighting_TG.dm +++ b/code/controllers/_DynamicAreaLighting_TG.dm @@ -353,6 +353,13 @@ atom if (I.brightness_on > brightness) brightness = I.brightness_on + else + for (I in M.contents) //Justin Case + if (I) + if ((I.light_on) && (I != W)) //an item emitting light other than itself + if (I.brightness_on > brightness) + brightness = I.brightness_on + return brightness #undef LIGHTING_MAX_LUMINOSITY From ab440fbf7d164a22db41d544fde6ee87d6cf33a6 Mon Sep 17 00:00:00 2001 From: Chinsky Date: Sat, 1 Dec 2012 18:35:27 +0400 Subject: [PATCH 3/5] Fixed compile error in custom items. Made rigs protect against radiation again. --- code/modules/clothing/spacesuits/rig.dm | 4 ++-- code/modules/customitems/item_defines.dm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/modules/clothing/spacesuits/rig.dm b/code/modules/clothing/spacesuits/rig.dm index ab04e347fe..9429e41cb3 100644 --- a/code/modules/clothing/spacesuits/rig.dm +++ b/code/modules/clothing/spacesuits/rig.dm @@ -4,7 +4,7 @@ desc = "A special helmet designed for work in a hazardous, low-pressure environment. Has radiation shielding." icon_state = "rig0-engineering" item_state = "eng_helm" - armor = list(melee = 40, bullet = 5, laser = 20,energy = 5, bomb = 35, bio = 100, rad = 60) + armor = list(melee = 40, bullet = 5, laser = 20,energy = 5, bomb = 35, bio = 100, rad = 100) allowed = list(/obj/item/device/flashlight) var/brightness_on = 4 //luminosity when on var/on = 0 @@ -42,7 +42,7 @@ icon_state = "rig-engineering" item_state = "eng_hardsuit" slowdown = 2 - armor = list(melee = 40, bullet = 5, laser = 20,energy = 5, bomb = 35, bio = 100, rad = 60) + armor = list(melee = 40, bullet = 5, laser = 20,energy = 5, bomb = 35, bio = 100, rad = 100) allowed = list(/obj/item/device/flashlight,/obj/item/weapon/tank,/obj/item/weapon/storage/satchel,/obj/item/device/t_scanner,/obj/item/weapon/pickaxe, /obj/item/weapon/rcd) heat_protection = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS max_heat_protection_temperature = SPACE_SUIT_MAX_HEAT_PROTECITON_TEMPERATURE diff --git a/code/modules/customitems/item_defines.dm b/code/modules/customitems/item_defines.dm index 6ee0502c88..8ddc7e68b1 100644 --- a/code/modules/customitems/item_defines.dm +++ b/code/modules/customitems/item_defines.dm @@ -529,7 +529,7 @@ desc = "A colorful pair of magboots with the name Susan Harris clearly written on the back." icon = 'custom_items.dmi' icon_state = "atmosmagboots0" - verb/toggle() + toggle() set name = "Toggle Magboots" set category = "Object" set src in usr From 0b614a488ccc8d685f6d8f91da2535f8f1a81d2d Mon Sep 17 00:00:00 2001 From: Chinsky Date: Sun, 2 Dec 2012 00:02:43 +0400 Subject: [PATCH 4/5] Made bandages stop bleeding when applied, not waiting until next 20-tick organ update cycle. --- code/datums/organs/organ_external.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/datums/organs/organ_external.dm b/code/datums/organs/organ_external.dm index 4a89aecf38..d59c2a7931 100644 --- a/code/datums/organs/organ_external.dm +++ b/code/datums/organs/organ_external.dm @@ -214,6 +214,7 @@ proc/bandage() var/rval = 0 + src.status &= ~ORGAN_BLEEDING for(var/datum/wound/W in wounds) if(W.internal) continue rval |= !W.bandaged From 0a9b6f6bbe9ae0f8fa6eebe8458a9df7e4368982 Mon Sep 17 00:00:00 2001 From: Chinsky Date: Sun, 2 Dec 2012 00:03:30 +0400 Subject: [PATCH 5/5] Removed armor suit from Captain's spawn gear --- code/game/jobs/job/captain.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/jobs/job/captain.dm b/code/game/jobs/job/captain.dm index 3c81adadc9..7303cb0d4d 100644 --- a/code/game/jobs/job/captain.dm +++ b/code/game/jobs/job/captain.dm @@ -21,7 +21,7 @@ var/obj/item/clothing/under/U = new /obj/item/clothing/under/rank/captain(H) U.hastie = new /obj/item/clothing/tie/medal/gold/captain(U) H.equip_to_slot_or_del(U, slot_w_uniform) - H.equip_to_slot_or_del(new /obj/item/device/pda/captain(H), slot_belt) + //H.equip_to_slot_or_del(new /obj/item/device/pda/captain(H), slot_belt) H.equip_to_slot_or_del(new /obj/item/clothing/suit/armor/captain(H), slot_wear_suit) H.equip_to_slot_or_del(new /obj/item/clothing/shoes/brown(H), slot_shoes) H.equip_to_slot_or_del(new /obj/item/clothing/head/caphat(H), slot_head)