Skip to content

Commit

Permalink
Merge pull request tgstation#13595 from Menshin/broken_solar_fix
Browse files Browse the repository at this point in the history
Fixes broken solar devices giving intact sheets back on deconstruction
  • Loading branch information
Cheridan committed Dec 13, 2015
2 parents ef989fe + 5142a97 commit 1e4b902
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
36 changes: 19 additions & 17 deletions code/modules/power/solar.dm
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@


/obj/machinery/power/solar/attackby(obj/item/weapon/W, mob/user, params)

if(istype(W, /obj/item/weapon/crowbar))
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
user.visible_message("[user] begins to take the glass off the solar panel.", "<span class='notice'>You begin to take the glass off the solar panel...</span>")
if(do_after(user, 50/W.toolspeed, target = src))
var/obj/item/solar_assembly/S = locate() in src
if(S)
S.loc = src.loc
S.give_glass()
S.give_glass(stat & BROKEN)

playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
user.visible_message("[user] takes the glass off the solar panel.", "<span class='notice'>You take the glass off the solar panel.</span>")
qdel(src)
Expand All @@ -78,7 +78,7 @@
/obj/machinery/power/solar/proc/healthcheck()
if (src.health <= 0)
if(!(stat & BROKEN))
broken()
set_broken()
else
new /obj/item/weapon/shard(src.loc)
new /obj/item/weapon/shard(src.loc)
Expand Down Expand Up @@ -129,7 +129,7 @@
else //if we're no longer on the same powernet, remove from control computer
unset_control()

/obj/machinery/power/solar/proc/broken()
/obj/machinery/power/solar/proc/set_broken()
. = (!(stat & BROKEN))
stat |= BROKEN
unset_control()
Expand All @@ -142,11 +142,11 @@
if(!gc_destroyed)
switch(severity)
if(2)
if(prob(50) && broken())
new /obj/item/weapon/shard(src.loc)
if(prob(50))
set_broken()
if(3)
if(prob(25) && broken())
new /obj/item/weapon/shard(src.loc)
if(prob(25))
set_broken()

/obj/machinery/power/solar/fake/New(var/turf/loc, var/obj/item/solar_assembly/S)
..(loc, S, 0)
Expand Down Expand Up @@ -201,15 +201,17 @@
..()

// Give back the glass type we were supplied with
/obj/item/solar_assembly/proc/give_glass()
if(glass_type)
var/obj/item/stack/sheet/S = new glass_type(src.loc)
/obj/item/solar_assembly/proc/give_glass(device_broken)
if(device_broken)
new /obj/item/weapon/shard(loc)
new /obj/item/weapon/shard(loc)
else if(glass_type)
var/obj/item/stack/sheet/S = new glass_type(loc)
S.amount = 2
glass_type = null
glass_type = null


/obj/item/solar_assembly/attackby(obj/item/weapon/W, mob/user, params)

if(istype(W, /obj/item/weapon/wrench) && isturf(loc))
if(isinspace())
user << "<span class='warning'>You can't secure [src] here.</span>"
Expand Down Expand Up @@ -484,7 +486,7 @@
update_icon()


/obj/machinery/power/solar_control/proc/broken()
/obj/machinery/power/solar_control/proc/set_broken()
stat |= BROKEN
update_icon()

Expand All @@ -495,14 +497,14 @@
switch(severity)
if(2)
if(prob(50))
broken()
set_broken()
if(3)
if(prob(25))
broken()
set_broken()

/obj/machinery/power/solar_control/blob_act()
if (prob(75))
broken()
set_broken()
src.density = 0


Expand Down
2 changes: 1 addition & 1 deletion code/modules/power/tracker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
var/obj/item/solar_assembly/S = locate() in src
if(S)
S.loc = src.loc
S.give_glass()
S.give_glass(stat & BROKEN)
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
user.visible_message("[user] takes the glass off the tracker.", "<span class='notice'>You take the glass off the tracker.</span>")
qdel(src)
Expand Down

0 comments on commit 1e4b902

Please sign in to comment.