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)
+74 -26
View File
@@ -492,32 +492,6 @@
return
/obj/item/mounted/shower
name = "shower fixture"
desc = "A self-adhering shower fixture. Simply stick to a wall, no plumber needed!"
icon = 'icons/obj/watercloset.dmi'
icon_state = "shower"
item_state = "buildpipe"
/obj/item/mounted/shower/try_build(turf/on_wall, mob/user, proximity_flag)
//overriding this because we don't care about other items on the wall, but still need to do adjacent checks
if(!on_wall || !user)
return
if(proximity_flag != 1) //if we aren't next to the wall
return
if(!(get_dir(on_wall,user) in cardinal))
to_chat(user, "<span class='rose'>You need to be standing next to a wall to place \the [src].</span>")
return
return 1
/obj/item/mounted/shower/do_build(turf/on_wall, mob/user)
var/obj/machinery/shower/S = new /obj/machinery/shower(get_turf(user), get_dir(on_wall, user), 1)
transfer_prints_to(S, TRUE)
qdel(src)
/obj/item/weapon/bikehorn/rubberducky
name = "rubber ducky"
desc = "Rubber ducky you're so fine, you make bathtime lots of fuuun. Rubber ducky I'm awfully fooooond of yooooouuuu~" //thanks doohl
@@ -682,3 +656,77 @@
icon_state = "puddle-splash"
..()
icon_state = "puddle"
//////////////////////////////////
// Bathroom Fixture Items //
//////////////////////////////////
/obj/item/mounted/shower
name = "shower fixture"
desc = "A self-adhering shower fixture. Simply stick to a wall, no plumber needed!"
icon = 'icons/obj/watercloset.dmi'
icon_state = "shower"
item_state = "buildpipe"
/obj/item/mounted/shower/try_build(turf/on_wall, mob/user, proximity_flag)
//overriding this because we don't care about other items on the wall, but still need to do adjacent checks
if(!on_wall || !user)
return
if(proximity_flag != 1) //if we aren't next to the wall
return
if(!(get_dir(on_wall,user) in cardinal))
to_chat(user, "<span class='rose'>You need to be standing next to a wall to place \the [src].</span>")
return
return 1
/obj/item/mounted/shower/do_build(turf/on_wall, mob/user)
var/obj/machinery/shower/S = new /obj/machinery/shower(get_turf(user), get_dir(on_wall, user), 1)
transfer_prints_to(S, TRUE)
qdel(src)
/obj/item/weapon/bathroom_parts
name = "toilet in a box"
desc = "An entire toilet in a box, straight from Space Sweden. It has an unpronounceable name."
icon = 'icons/obj/storage.dmi'
icon_state = "largebox"
w_class = WEIGHT_CLASS_BULKY
var/result = /obj/structure/toilet
var/result_name = "toilet"
/obj/item/weapon/bathroom_parts/urinal
name = "urinal in a box"
result = /obj/structure/urinal
result_name = "urinal"
/obj/item/weapon/bathroom_parts/sink
name = "sink in a box"
result = /obj/structure/sink
result_name = "sink"
/obj/item/weapon/bathroom_parts/New()
..()
desc = "An entire [result_name] in a box, straight from Space Sweden. It has an [pick("unpronounceable", "overly accented", "entirely gibberish", "oddly normal-sounding")] name."
/obj/item/weapon/bathroom_parts/attack_self(mob/user)
var/turf/T = get_turf(user)
if(!T)
to_chat(user, "<span class='warning'>You can't build that here!</span>")
return
if(result in T.contents)
to_chat(user, "<span class='warning'>There's already \an [result_name] here.</span>")
return
visible_message("[user] begins assembling a new [result_name].", "You begin assembling a new [result_name].")
if(do_after(user, 30, target = user))
visible_message("[user] finishes building a new [result_name]!", "You finish building a new [result_name]!")
var/obj/structure/S = new result(T)
S.anchored = 0
S.dir = user.dir
S.update_icon()
user.unEquip(src, 1)
qdel(src)
if(prob(50))
new /obj/item/stack/sheet/cardboard(T)