You can now no longer toggle your flashlight, lantern, pen light or hardhat when in closets or other containers. This it to prevent some strange abnormalities. Urist said he'll fix it more in-depth by making a new item-lighting interfacing system, but after 3 weeks he has yet to deliver on his promise. Until then this is a temp-fix (And because I know Urist won't ever deliver, this is a permanent fix.)

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2419 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
baloh.matevz
2011-10-22 16:00:47 +00:00
parent bbac01f4c8
commit d090ec651d
2 changed files with 77 additions and 70 deletions
+77 -44
View File
@@ -14,61 +14,64 @@
icon_off = "flight0"
attack_self(mob/user)
on = !on
if (on)
icon_state = icon_on
user.total_luminosity += brightness_on
else
icon_state = icon_off
user.total_luminosity -= brightness_on
/obj/item/device/flashlight/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
if (on)
icon_state = icon_on
user.total_luminosity += brightness_on
else
icon_state = icon_off
user.total_luminosity -= brightness_on
return
attack(mob/M as mob, mob/user as mob)
src.add_fingerprint(user)
if(src.on && user.zone_sel.selecting == "eyes")
if ((user.mutations & CLUMSY || user.brainloss >= 60) && prob(50))//too dumb to use flashlight properly
return ..()//just hit them in the head
/obj/item/device/flashlight/attack(mob/M as mob, mob/user as mob)
src.add_fingerprint(user)
if(src.on && user.zone_sel.selecting == "eyes")
if ((user.mutations & CLUMSY || user.brainloss >= 60) && prob(50))//too dumb to use flashlight properly
return ..()//just hit them in the head
if (!(istype(usr, /mob/living/carbon/human) || ticker) && ticker.mode.name != "monkey")//don't have dexterity
usr.show_message("\red You don't have the dexterity to do this!",1)
return
if (!(istype(usr, /mob/living/carbon/human) || ticker) && ticker.mode.name != "monkey")//don't have dexterity
usr.show_message("\red You don't have the dexterity to do this!",1)
return
var/mob/living/carbon/human/H = M//mob has protective eyewear
if(istype(M, /mob/living/carbon/human) && ((H.head && H.head.flags & HEADCOVERSEYES) || (H.wear_mask && H.wear_mask.flags & MASKCOVERSEYES) || (H.glasses && H.glasses.flags & GLASSESCOVERSEYES)))
user << text("\blue You're going to need to remove that [] first.", ((H.head && H.head.flags & HEADCOVERSEYES) ? "helmet" : ((H.wear_mask && H.wear_mask.flags & MASKCOVERSEYES) ? "mask": "glasses")))
return
var/mob/living/carbon/human/H = M//mob has protective eyewear
if(istype(M, /mob/living/carbon/human) && ((H.head && H.head.flags & HEADCOVERSEYES) || (H.wear_mask && H.wear_mask.flags & MASKCOVERSEYES) || (H.glasses && H.glasses.flags & GLASSESCOVERSEYES)))
user << text("\blue You're going to need to remove that [] first.", ((H.head && H.head.flags & HEADCOVERSEYES) ? "helmet" : ((H.wear_mask && H.wear_mask.flags & MASKCOVERSEYES) ? "mask": "glasses")))
return
for(var/mob/O in viewers(M, null))//echo message
if ((O.client && !(O.blinded )))
O.show_message("\blue [(O==user?"You direct":"[user] directs")] [src] to [(M==user? "your":"[M]")] eyes", 1)
for(var/mob/O in viewers(M, null))//echo message
if ((O.client && !(O.blinded )))
O.show_message("\blue [(O==user?"You direct":"[user] directs")] [src] to [(M==user? "your":"[M]")] eyes", 1)
if(istype(M, /mob/living/carbon/human) || istype(M, /mob/living/carbon/monkey))//robots and aliens are unaffected
if(M.stat > 1 || M.sdisabilities & 1)//mob is dead or fully blind
if(M!=user)
user.show_message(text("\red [] pupils does not react to the light!", M),1)
else if(M.mutations & XRAY)//mob has X-RAY vision
if(M!=user)
user.show_message(text("\red [] pupils give an eerie glow!", M),1)
else //nothing wrong
flick("flash", M.flash)//flash the affected mob
if(M!=user)
user.show_message(text("\blue [] pupils narrow", M),1)
else
return ..()
if(istype(M, /mob/living/carbon/human) || istype(M, /mob/living/carbon/monkey))//robots and aliens are unaffected
if(M.stat > 1 || M.sdisabilities & 1)//mob is dead or fully blind
if(M!=user)
user.show_message(text("\red [] pupils does not react to the light!", M),1)
else if(M.mutations & XRAY)//mob has X-RAY vision
if(M!=user)
user.show_message(text("\red [] pupils give an eerie glow!", M),1)
else //nothing wrong
flick("flash", M.flash)//flash the affected mob
if(M!=user)
user.show_message(text("\blue [] pupils narrow", M),1)
else
return ..()
pickup(mob/user)
if(on)
src.sd_SetLuminosity(0)
user.total_luminosity += brightness_on
/obj/item/device/flashlight/pickup(mob/user)
if(on)
src.sd_SetLuminosity(0)
user.total_luminosity += brightness_on
dropped(mob/user)
if(on)
user.total_luminosity -= brightness_on
src.sd_SetLuminosity(brightness_on)
/obj/item/device/flashlight/dropped(mob/user)
if(on)
user.total_luminosity -= brightness_on
src.sd_SetLuminosity(brightness_on)
/obj/item/device/flashlight/pen
@@ -83,8 +86,38 @@
/obj/item/device/flashlight/pen/paralysis/attack(mob/M as mob, mob/user as mob)
if(!ismob(M))
return
user << "\red You stab [M] with the pen."
M << "\red You feel a tiny prick!"
M.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been stabbed with [src.name] by [user.name] ([user.ckey])</font>")
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Used the [src.name] to stab [M.name] ([M.ckey])</font>")
..()
return
/obj/item/device/flashlight/pen/paralysis/New()
var/datum/reagents/R = new/datum/reagents(15)
reagents = R
R.my_atom = src
R.add_reagent("zombiepowder", 15)
..()
return
/obj/item/device/flashlight/pen/paralysis/attack(mob/M as mob, mob/user as mob)
if (!( istype(M, /mob) ))
return
..()
if (reagents.total_volume)
if(M.reagents) reagents.trans_to(M, 15)
return
//Looks like most of the clothing lights are here
/obj/item/clothing/head/helmet/hardhat/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]"
-26
View File
@@ -196,32 +196,6 @@
if(M.reagents) reagents.trans_to(M, 50) //used to be 150
return
/obj/item/device/flashlight/pen/paralysis/attack(mob/M as mob, mob/user as mob)
if(!ismob(M))
return
user << "\red You stab [M] with the pen."
M << "\red You feel a tiny prick!"
M.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been stabbed with [src.name] by [user.name] ([user.ckey])</font>")
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Used the [src.name] to stab [M.name] ([M.ckey])</font>")
..()
return
/obj/item/device/flashlight/pen/paralysis/New()
var/datum/reagents/R = new/datum/reagents(15)
reagents = R
R.my_atom = src
R.add_reagent("zombiepowder", 15)
..()
return
/obj/item/device/flashlight/pen/paralysis/attack(mob/M as mob, mob/user as mob)
if (!( istype(M, /mob) ))
return
..()
if (reagents.total_volume)
if(M.reagents) reagents.trans_to(M, 15)
return
/obj/item/weapon/Bump(mob/M as mob)
spawn( 0 )
..()