mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-01-05 23:12:26 +00:00
Construction Update
This commit is contained in:
@@ -8,9 +8,18 @@
|
||||
anchored = 1
|
||||
var/shattered = 0
|
||||
var/list/ui_users = list()
|
||||
var/glass = 1
|
||||
|
||||
/obj/structure/mirror/New(var/loc, var/dir, var/building = 0, mob/user as mob)
|
||||
if(building)
|
||||
glass = 0
|
||||
icon_state = "mirror_frame"
|
||||
pixel_x = (dir & 3)? 0 : (dir == 4 ? -28 : 28)
|
||||
pixel_y = (dir & 3)? (dir == 1 ? -30 : 30) : 0
|
||||
return
|
||||
|
||||
/obj/structure/mirror/attack_hand(mob/user as mob)
|
||||
|
||||
if(!glass) return
|
||||
if(shattered) return
|
||||
|
||||
if(ishuman(user))
|
||||
@@ -22,6 +31,7 @@
|
||||
AC.ui_interact(user)
|
||||
|
||||
/obj/structure/mirror/proc/shatter()
|
||||
if(!glass) return
|
||||
if(shattered) return
|
||||
shattered = 1
|
||||
icon_state = "mirror_broke"
|
||||
@@ -34,18 +44,57 @@
|
||||
if(prob(Proj.get_structure_damage() * 2))
|
||||
if(!shattered)
|
||||
shatter()
|
||||
else
|
||||
else if(glass)
|
||||
playsound(src, 'sound/effects/hit_on_shattered_glass.ogg', 70, 1)
|
||||
..()
|
||||
|
||||
/obj/structure/mirror/attackby(obj/item/I as obj, mob/user as mob)
|
||||
if(shattered)
|
||||
if(istype(I, /obj/item/weapon/wrench))
|
||||
if(!glass)
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
if(do_after(user, 20))
|
||||
user << "<span class='notice'>You unfasten the frame.</span>"
|
||||
new /obj/item/frame/mirror( src.loc )
|
||||
qdel(src)
|
||||
return
|
||||
if(istype(I, /obj/item/weapon/crowbar))
|
||||
if(shattered && glass)
|
||||
user << "<span class='notice'>The broken glass falls out.</span>"
|
||||
icon_state = "mirror_frame"
|
||||
glass = !glass
|
||||
new /obj/item/weapon/material/shard( src.loc )
|
||||
return
|
||||
if(!shattered && glass)
|
||||
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)
|
||||
user << "<span class='notice'>You remove the glass.</span>"
|
||||
glass = !glass
|
||||
icon_state = "mirror_frame"
|
||||
new /obj/item/stack/material/glass( src.loc, 2 )
|
||||
return
|
||||
|
||||
if(istype(I, /obj/item/stack/material/glass))
|
||||
if(!glass)
|
||||
var/obj/item/stack/material/glass/G = I
|
||||
if (G.get_amount() < 2)
|
||||
user << "<span class='warning'>You need two sheets of glass to add them to the frame.</span>"
|
||||
return
|
||||
user << "<span class='notice'>You start to add the glass to the frame.</span>"
|
||||
if(do_after(user, 20))
|
||||
if (G.use(2))
|
||||
shattered = 0
|
||||
glass = 1
|
||||
icon_state = "mirror"
|
||||
user << "<span class='notice'>You add the glass to the frame.</span>"
|
||||
return
|
||||
|
||||
if(shattered && glass)
|
||||
playsound(src.loc, 'sound/effects/hit_on_shattered_glass.ogg', 70, 1)
|
||||
return
|
||||
|
||||
if(prob(I.force * 2))
|
||||
visible_message("<span class='warning'>[user] smashes [src] with [I]!</span>")
|
||||
shatter()
|
||||
if(glass)
|
||||
shatter()
|
||||
else
|
||||
visible_message("<span class='warning'>[user] hits [src] with [I]!</span>")
|
||||
playsound(src.loc, 'sound/effects/Glasshit.ogg', 70, 1)
|
||||
@@ -53,13 +102,14 @@
|
||||
/obj/structure/mirror/attack_generic(var/mob/user, var/damage)
|
||||
|
||||
user.do_attack_animation(src)
|
||||
if(shattered)
|
||||
if(shattered && glass)
|
||||
playsound(src.loc, 'sound/effects/hit_on_shattered_glass.ogg', 70, 1)
|
||||
return 0
|
||||
|
||||
if(damage)
|
||||
user.visible_message("<span class='danger'>[user] smashes [src]!</span>")
|
||||
shatter()
|
||||
if(glass)
|
||||
shatter()
|
||||
else
|
||||
user.visible_message("<span class='danger'>[user] hits [src] and bounces off!</span>")
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user