Buildable toilets, urinals, sinks, mirrors

Toilets, urinals, sinks, and mirrors are now buildable.

Mirrors are also able to be unfastened from walls, shattered mirrors
return a glass shard instead of a mirror item.
This commit is contained in:
FalseIncarnate
2017-08-06 21:29:42 -04:00
parent bb6ff349da
commit 67c42ea2c0
2 changed files with 128 additions and 38 deletions
+54 -12
View File
@@ -9,8 +9,22 @@
var/shattered = 0
var/list/ui_users = list()
/obj/structure/mirror/attack_hand(mob/user as mob)
if(shattered) return
/obj/structure/mirror/New(turf/T, newdir = SOUTH, building = FALSE)
..()
if(building)
switch(newdir)
if(NORTH)
pixel_y = -32
if(SOUTH)
pixel_y = 32
if(EAST)
pixel_x = -32
if(WEST)
pixel_x = 32
/obj/structure/mirror/attack_hand(mob/user)
if(shattered)
return
if(ishuman(user))
var/datum/nano_module/appearance_changer/AC = ui_users[user]
@@ -22,14 +36,15 @@
AC.ui_interact(user)
/obj/structure/mirror/proc/shatter()
if(shattered) return
if(shattered)
return
shattered = 1
icon_state = "mirror_broke"
playsound(src, "shatter", 70, 1)
desc = "Oh no, seven years of bad luck!"
/obj/structure/mirror/bullet_act(var/obj/item/projectile/Proj)
/obj/structure/mirror/bullet_act(obj/item/projectile/Proj)
if(prob(Proj.damage * 2))
if(!shattered)
shatter()
@@ -38,7 +53,19 @@
..()
/obj/structure/mirror/attackby(obj/item/I as obj, mob/living/user as mob, params)
/obj/structure/mirror/attackby(obj/item/I, mob/living/user, params)
if(isscrewdriver(I))
visible_message("[user] begins to unfasten the [src].", "You begin to unfasten the [name].")
if(do_after(user, 30 * I.toolspeed, target = src))
if(shattered)
visible_message("[user] drops the broken shards to the floor.", "You drop the broken shards on the floor.")
new /obj/item/weapon/shard(get_turf(user))
else
visible_message("[user] carefully places [src] on the floor.", "You carefully place [src] on the floor.")
new /obj/item/mounted/mirror(get_turf(user))
qdel(src)
return
user.do_attack_animation(src)
if(shattered)
playsound(src.loc, 'sound/effects/hit_on_shattered_glass.ogg', 70, 1)
@@ -52,8 +79,9 @@
playsound(src.loc, 'sound/effects/Glasshit.ogg', 70, 1)
/obj/structure/mirror/attack_alien(mob/living/user as mob)
if(islarva(user)) return
/obj/structure/mirror/attack_alien(mob/living/user)
if(islarva(user))
return
user.do_attack_animation(src)
if(shattered)
playsound(src.loc, 'sound/effects/hit_on_shattered_glass.ogg', 70, 1)
@@ -62,10 +90,12 @@
shatter()
/obj/structure/mirror/attack_animal(mob/living/user as mob)
if(!isanimal(user)) return
/obj/structure/mirror/attack_animal(mob/living/user)
if(!isanimal(user))
return
var/mob/living/simple_animal/M = user
if(M.melee_damage_upper <= 0) return
if(M.melee_damage_upper <= 0)
return
M.do_attack_animation(src)
if(shattered)
playsound(src.loc, 'sound/effects/hit_on_shattered_glass.ogg', 70, 1)
@@ -74,7 +104,7 @@
shatter()
/obj/structure/mirror/attack_slime(mob/living/user as mob)
/obj/structure/mirror/attack_slime(mob/living/user)
var/mob/living/carbon/slime/S = user
if(!S.is_adult)
return
@@ -83,4 +113,16 @@
playsound(src.loc, 'sound/effects/hit_on_shattered_glass.ogg', 70, 1)
return
user.visible_message("<span class='danger'>[user] smashes [src]!</span>")
shatter()
shatter()
/obj/item/mounted/mirror
name = "mirror"
desc = "Some reflective glass ready to be hung on a wall. Don't break it!"
icon = 'icons/obj/watercloset.dmi'
icon_state = "mirror"
/obj/item/mounted/mirror/do_build(turf/on_wall, mob/user)
var/obj/structure/mirror/M = new /obj/structure/mirror(get_turf(user), get_dir(on_wall, user), 1)
transfer_prints_to(M, TRUE)
qdel(src)