Darkness fixes

This commit is contained in:
Mark van Alphen
2019-04-24 00:47:55 +02:00
parent 44347029db
commit 9e9d72d2ae
11 changed files with 44 additions and 27 deletions
@@ -192,6 +192,8 @@
icon_state = "lantern-blue"
item_state = "lantern"
var/obj/effect/wisp/wisp
var/sight_flags = SEE_MOBS
var/lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE
/obj/item/wisp_lantern/attack_self(mob/user)
if(!wisp)
@@ -203,26 +205,25 @@
to_chat(user, "<span class='notice'>You release the wisp. It begins to bob around your head.</span>")
icon_state = "lantern"
wisp.orbit(user, 20)
user.update_sight()
feedback_add_details("wisp_lantern","F") // freed
RegisterSignal(user, COMSIG_MOB_UPDATE_SIGHT, .proc/update_user_sight)
user.update_sight()
to_chat(user, "<span class='notice'>The wisp enhances your vision.</span>")
feedback_add_details("wisp_lantern","F") // freed
else
to_chat(user, "<span class='notice'>You return the wisp to the lantern.</span>")
var/mob/target
if(wisp.orbiting)
target = wisp.orbiting
wisp.stop_orbit()
wisp.forceMove(src)
if (istype(target))
target.update_sight()
to_chat(target, "<span class='notice'>Your vision returns to normal.</span>")
UnregisterSignal(user, COMSIG_MOB_UPDATE_SIGHT)
user.update_sight()
to_chat(user, "<span class='notice'>Your vision returns to normal.</span>")
icon_state = "lantern-blue"
feedback_add_details("wisp_lantern","R") // returned
/obj/item/wisp_lantern/Initialize()
/obj/item/wisp_lantern/Initialize(mapload)
. = ..()
wisp = new(src)
@@ -232,7 +233,13 @@
qdel(wisp)
else
wisp.visible_message("<span class='notice'>[wisp] has a sad feeling for a moment, then it passes.</span>")
..()
return ..()
/obj/item/wisp_lantern/proc/update_user_sight(mob/user)
user.sight |= sight_flags
if(!isnull(lighting_alpha))
user.lighting_alpha = min(user.lighting_alpha, lighting_alpha)
user.sync_lighting_plane_alpha()
/obj/effect/wisp
name = "friendly wisp"
@@ -241,8 +248,6 @@
icon_state = "orb"
light_range = 7
layer = ABOVE_ALL_MOB_LAYER
var/sight_flags = SEE_MOBS
var/lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE
//Red/Blue Cubes
/obj/item/warp_cube