Merge remote-tracking branch 'remotes/git-svn' into bs12_with_tgport (r4618)

Conflicts:
	baystation12.dme
	code/controllers/master_controller.dm
	code/defines/obj.dm
	code/game/gamemodes/events.dm
	code/game/machinery/newscaster.dm
	code/game/objects/items/blueprints.dm
	code/game/objects/items/stacks/sheets/sheet_types.dm
	code/game/objects/items/stacks/stack.dm
	code/game/objects/structures/stool_bed_chair_nest/bed.dm
	code/game/turfs/turf.dm
	code/modules/awaymissions/zlevel.dm
	code/modules/maps/fromdmp.dm
	code/modules/mob/living/silicon/ai/freelook/eye.dm
	code/modules/mob/living/silicon/ai/freelook/update_triggers.dm
	code/modules/mob/living/silicon/silicon.dm
	code/modules/mob/living/simple_animal/life.dm
	code/modules/mob/mob_movement.dm
	code/setup.dm
	icons/mob/uniform.dmi
	icons/obj/closet.dmi
	icons/obj/clothing/uniforms.dmi
	maps/RandomZLevels/assistantChamber.dmm
	maps/RandomZLevels/fileList.txt
	maps/tgstation.2.0.9.dmm

Signed-off-by: Cael_Aislinn <cael_aislinn@yahoo.com.au>
This commit is contained in:
Cael_Aislinn
2012-09-04 22:19:03 +10:00
185 changed files with 14805 additions and 13212 deletions
@@ -1,5 +1,13 @@
// BEDSHEET BIN
/obj/structure/bedsheetbin
name = "linen bin"
desc = "A bin for containing bedsheets. It looks rather cosy."
icon = 'icons/obj/items.dmi'
icon_state = "bedbin"
var/amount = 23.0
anchored = 1.0
/obj/structure/bedsheetbin/attackby(obj/item/weapon/W as obj, mob/user as mob)
if (istype(W, /obj/item/weapon/bedsheet))
del(W)
@@ -1,3 +1,15 @@
/obj/structure/displaycase
name = "Display Case"
icon = 'icons/obj/stationobjs.dmi'
icon_state = "glassbox1"
desc = "A display case for prized possessions. It taunts you to kick it."
density = 1
anchored = 1
unacidable = 1//Dissolving the case would also delete the gun.
var/health = 30
var/occupied = 1
var/destroyed = 0
/obj/structure/displaycase/ex_act(severity)
switch(severity)
if (1)
+36 -5
View File
@@ -1,34 +1,65 @@
/obj/structure/falsewall
var/mineral = "metal"
/obj/structure/falserwall
var/mineral = "metal"
/obj/structure/falsewall/gold
name = "gold wall"
desc = "A wall with gold plating. Swag"
icon_state = ""
mineral = "gold"
/obj/structure/falsewall/silver
name = "silver wall"
desc = "A wall with silver plating. Shiny"
icon_state = ""
mineral = "silver"
/obj/structure/falsewall/diamond
name = "diamond wall"
desc = "A wall with diamond plating. You monster"
icon_state = ""
mineral = "diamond"
/obj/structure/falsewall/uranium
name = "uranium wall"
desc = "A wall with uranium plating. This is probably a bad idea"
icon_state = ""
mineral = "uranium"
var/active = null
var/last_event = 0
/obj/structure/falsewall/plasma
name = "plasma wall"
desc = "A wall with plasma plating. This is definately a bad idea"
icon_state = ""
mineral = "plasma"
//-----------wtf?-----------start
/obj/structure/falsewall/bananium
name = "bananium wall"
desc = "A wall with bananium plating. Honk"
icon_state = ""
/obj/structure/falsewall/clown
mineral = "clown"
/obj/structure/falsewall/sand
name = "sandstone wall"
desc = "A wall with sandstone plating."
icon_state = ""
/obj/structure/falsewall/sandstone
mineral = "sandstone"
//------------wtf?------------end
/*/obj/structure/falsewall/wood
mineral = "wood"*/
/obj/structure/falserwall
name = "r wall"
desc = "A huge chunk of reinforced metal used to seperate rooms."
icon = 'icons/turf/walls.dmi'
icon_state = "r_wall"
density = 1
opacity = 1
anchored = 1
var/mineral = "metal"
/obj/structure/falsewall/attack_hand(mob/user as mob)
if(density)
+3 -5
View File
@@ -12,9 +12,7 @@
layer = 2.9
var/health = 10
var/destroyed = 0
proc
healthcheck()
shock(mob/user, prb)
explosion_resistance = 5
ex_act(severity)
switch(severity)
@@ -178,7 +176,7 @@
return
healthcheck()
proc/healthcheck()
if (src.health <= 0)
if (!( src.destroyed ))
src.icon_state = "brokengrille"
@@ -197,7 +195,7 @@
// shock user with probability prb (if all connections & power are working)
// returns 1 if shocked, 0 otherwise
shock(mob/user, prb)
proc/shock(mob/user, prb)
if(!anchored || destroyed) // anchored/destroyed grilles are never connected
return 0
if(!prob(prb))
@@ -1,5 +1,16 @@
//////Kitchen Spike
/obj/structure/kitchenspike
name = "a meat spike"
icon = 'icons/obj/kitchen.dmi'
icon_state = "spike"
desc = "A spike for collecting meat from animals"
density = 1
anchored = 1
var/meat = 0
var/occupied = 0
var/meattype = 0 // 0 - Nothing, 1 - Monkey, 2 - Xeno
/obj/structure/kitchenspike
attack_paw(mob/user as mob)
return src.attack_hand(usr)
+53 -1
View File
@@ -1,3 +1,37 @@
/obj/structure/lattice
desc = "A lightweight support lattice."
name = "lattice"
icon = 'icons/obj/structures.dmi'
icon_state = "latticefull"
density = 0
anchored = 1.0
layer = 2.3 //under pipes
// flags = CONDUCT
/obj/structure/lattice/New()
..()
if(!(istype(src.loc, /turf/space)))
del(src)
for(var/obj/structure/lattice/LAT in src.loc)
if(LAT != src)
del(LAT)
icon = 'icons/obj/smoothlattice.dmi'
icon_state = "latticeblank"
updateOverlays()
for (var/dir in cardinal)
var/obj/structure/lattice/L
if(locate(/obj/structure/lattice, get_step(src, dir)))
L = locate(/obj/structure/lattice, get_step(src, dir))
L.updateOverlays()
/obj/structure/lattice/Del()
for (var/dir in cardinal)
var/obj/structure/lattice/L
if(locate(/obj/structure/lattice, get_step(src, dir)))
L = locate(/obj/structure/lattice, get_step(src, dir))
L.updateOverlays(src.loc)
..()
/obj/structure/lattice/blob_act()
del(src)
return
@@ -28,4 +62,22 @@
new /obj/item/stack/rods(src.loc)
del(src)
return
return
/obj/structure/lattice/proc/updateOverlays()
//if(!(istype(src.loc, /turf/space)))
// del(src)
spawn(1)
overlays = list()
var/dir_sum = 0
for (var/direction in cardinal)
if(locate(/obj/structure/lattice, get_step(src, direction)))
dir_sum += direction
else
if(!(istype(get_step(src, direction), /turf/space)))
dir_sum += direction
icon_state = "lattice[dir_sum]"
return
@@ -1,3 +1,14 @@
/obj/structure/mopbucket
desc = "Fill it with water, but don't forget a mop!"
name = "mop bucket"
icon = 'icons/obj/janitor.dmi'
icon_state = "mopbucket"
density = 1
flags = FPRINT
pressure_resistance = ONE_ATMOSPHERE
flags = FPRINT | TABLEPASS | OPENCONTAINER
var/amount_per_transfer_from_this = 5 //shit I dunno, adding this so syringes stop runtime erroring. --NeoFite
/obj/structure/mopbucket/New()
var/datum/reagents/R = new/datum/reagents(100)
reagents = R
+401
View File
@@ -0,0 +1,401 @@
/* Morgue stuff
* Contains:
* Morgue
* Morgue trays
* Creamatorium
* Creamatorium trays
*/
/*
* Morgue
*/
/obj/structure/morgue
name = "morgue"
desc = "Used to keep bodies in untill someone fetches them."
icon = 'icons/obj/stationobjs.dmi'
icon_state = "morgue1"
density = 1
var/obj/structure/m_tray/connected = null
anchored = 1.0
/obj/structure/morgue/proc/update()
if (src.connected)
src.icon_state = "morgue0"
else
if (src.contents.len)
src.icon_state = "morgue2"
else
src.icon_state = "morgue1"
return
/obj/structure/morgue/ex_act(severity)
switch(severity)
if(1.0)
for(var/atom/movable/A as mob|obj in src)
A.loc = src.loc
ex_act(severity)
del(src)
return
if(2.0)
if (prob(50))
for(var/atom/movable/A as mob|obj in src)
A.loc = src.loc
ex_act(severity)
del(src)
return
if(3.0)
if (prob(5))
for(var/atom/movable/A as mob|obj in src)
A.loc = src.loc
ex_act(severity)
del(src)
return
return
/obj/structure/morgue/alter_health()
return src.loc
/obj/structure/morgue/attack_paw(mob/user as mob)
return src.attack_hand(user)
/obj/structure/morgue/attack_hand(mob/user as mob)
if (src.connected)
for(var/atom/movable/A as mob|obj in src.connected.loc)
if (!( A.anchored ))
A.loc = src
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
//src.connected = null
del(src.connected)
else
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
src.connected = new /obj/structure/m_tray( src.loc )
step(src.connected, EAST)
src.connected.layer = OBJ_LAYER
var/turf/T = get_step(src, EAST)
if (T.contents.Find(src.connected))
src.connected.connected = src
src.icon_state = "morgue0"
for(var/atom/movable/A as mob|obj in src)
A.loc = src.connected.loc
src.connected.icon_state = "morguet"
else
//src.connected = null
del(src.connected)
src.add_fingerprint(user)
update()
return
/obj/structure/morgue/attackby(P as obj, mob/user as mob)
if (istype(P, /obj/item/weapon/pen))
var/t = input(user, "What would you like the label to be?", text("[]", src.name), null) as text
if (user.get_active_hand() != P)
return
if ((!in_range(src, usr) && src.loc != user))
return
t = copytext(sanitize(t),1,MAX_MESSAGE_LEN)
if (t)
src.name = text("Morgue- '[]'", t)
else
src.name = "Morgue"
src.add_fingerprint(user)
return
/obj/structure/morgue/relaymove(mob/user as mob)
if (user.stat)
return
src.connected = new /obj/structure/m_tray( src.loc )
step(src.connected, EAST)
src.connected.layer = OBJ_LAYER
var/turf/T = get_step(src, EAST)
if (T.contents.Find(src.connected))
src.connected.connected = src
src.icon_state = "morgue0"
for(var/atom/movable/A as mob|obj in src)
A.loc = src.connected.loc
//Foreach goto(106)
src.connected.icon_state = "morguet"
else
//src.connected = null
del(src.connected)
return
/*
* Morgue tray
*/
/obj/structure/m_tray
name = "morgue tray"
desc = "Apply corpse before closing."
icon = 'icons/obj/stationobjs.dmi'
icon_state = "morguet"
density = 1
layer = 2.0
var/obj/structure/morgue/connected = null
anchored = 1.0
/obj/structure/m_tray/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if (istype(mover, /obj/item/weapon/dummy))
return 1
else
return ..()
/obj/structure/m_tray/attack_paw(mob/user as mob)
return src.attack_hand(user)
/obj/structure/m_tray/attack_hand(mob/user as mob)
if (src.connected)
for(var/atom/movable/A as mob|obj in src.loc)
if (!( A.anchored ))
A.loc = src.connected
//Foreach goto(26)
src.connected.connected = null
src.connected.update()
add_fingerprint(user)
//SN src = null
del(src)
return
return
/obj/structure/m_tray/MouseDrop_T(atom/movable/O as mob|obj, mob/user as mob)
if ((!( istype(O, /atom/movable) ) || O.anchored || get_dist(user, src) > 1 || get_dist(user, O) > 1 || user.contents.Find(src) || user.contents.Find(O)))
return
if (!ismob(O) && !istype(O, /obj/structure/closet/body_bag))
return
O.loc = src.loc
if (user != O)
for(var/mob/B in viewers(user, 3))
if ((B.client && !( B.blinded )))
B << text("\red [] stuffs [] into []!", user, O, src)
return
/*
* Crematorium
*/
/obj/structure/crematorium
name = "crematorium"
desc = "A human incinerator. Works well on barbeque nights."
icon = 'icons/obj/stationobjs.dmi'
icon_state = "crema1"
density = 1
var/obj/structure/c_tray/connected = null
anchored = 1.0
var/cremating = 0
var/id = 1
var/locked = 0
/obj/structure/crematorium/proc/update()
if (src.connected)
src.icon_state = "crema0"
else
if (src.contents.len)
src.icon_state = "crema2"
else
src.icon_state = "crema1"
return
/obj/structure/crematorium/ex_act(severity)
switch(severity)
if(1.0)
for(var/atom/movable/A as mob|obj in src)
A.loc = src.loc
ex_act(severity)
del(src)
return
if(2.0)
if (prob(50))
for(var/atom/movable/A as mob|obj in src)
A.loc = src.loc
ex_act(severity)
del(src)
return
if(3.0)
if (prob(5))
for(var/atom/movable/A as mob|obj in src)
A.loc = src.loc
ex_act(severity)
del(src)
return
return
/obj/structure/crematorium/alter_health()
return src.loc
/obj/structure/crematorium/attack_paw(mob/user as mob)
return src.attack_hand(user)
/obj/structure/crematorium/attack_hand(mob/user as mob)
// if (cremating) AWW MAN! THIS WOULD BE SO MUCH MORE FUN ... TO WATCH
// user.show_message("\red Uh-oh, that was a bad idea.", 1)
// //usr << "Uh-oh, that was a bad idea."
// src:loc:poison += 20000000
// src:loc:firelevel = src:loc:poison
// return
if (cremating)
usr << "\red It's locked."
return
if ((src.connected) && (src.locked == 0))
for(var/atom/movable/A as mob|obj in src.connected.loc)
if (!( A.anchored ))
A.loc = src
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
//src.connected = null
del(src.connected)
else if (src.locked == 0)
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
src.connected = new /obj/structure/c_tray( src.loc )
step(src.connected, SOUTH)
src.connected.layer = OBJ_LAYER
var/turf/T = get_step(src, SOUTH)
if (T.contents.Find(src.connected))
src.connected.connected = src
src.icon_state = "crema0"
for(var/atom/movable/A as mob|obj in src)
A.loc = src.connected.loc
src.connected.icon_state = "cremat"
else
//src.connected = null
del(src.connected)
src.add_fingerprint(user)
update()
/obj/structure/crematorium/attackby(P as obj, mob/user as mob)
if (istype(P, /obj/item/weapon/pen))
var/t = input(user, "What would you like the label to be?", text("[]", src.name), null) as text
if (user.get_active_hand() != P)
return
if ((!in_range(src, usr) > 1 && src.loc != user))
return
t = copytext(sanitize(t),1,MAX_MESSAGE_LEN)
if (t)
src.name = text("Crematorium- '[]'", t)
else
src.name = "Crematorium"
src.add_fingerprint(user)
return
/obj/structure/crematorium/relaymove(mob/user as mob)
if (user.stat || locked)
return
src.connected = new /obj/structure/c_tray( src.loc )
step(src.connected, SOUTH)
src.connected.layer = OBJ_LAYER
var/turf/T = get_step(src, SOUTH)
if (T.contents.Find(src.connected))
src.connected.connected = src
src.icon_state = "crema0"
for(var/atom/movable/A as mob|obj in src)
A.loc = src.connected.loc
//Foreach goto(106)
src.connected.icon_state = "cremat"
else
//src.connected = null
del(src.connected)
return
/obj/structure/crematorium/proc/cremate(atom/A, mob/user as mob)
// for(var/obj/machinery/crema_switch/O in src) //trying to figure a way to call the switch, too drunk to sort it out atm
// if(var/on == 1)
// return
if(cremating)
return //don't let you cremate something twice or w/e
if(contents.len <= 0)
for (var/mob/M in viewers(src))
M.show_message("\red You hear a hollow crackle.", 1)
return
else
if(!isemptylist(src.search_contents_for(/obj/item/weapon/disk/nuclear)))
usr << "You get the feeling that you shouldn't cremate one of the items in the cremator."
return
for (var/mob/M in viewers(src))
M.show_message("\red You hear a roar as the crematorium activates.", 1)
cremating = 1
locked = 1
for(var/mob/living/M in contents)
if (M.stat!=2)
M.emote("scream")
//Logging for this causes runtimes resulting in the cremator locking up. Commenting it out until that's figured out.
//M.attack_log += "\[[time_stamp()]\] Has been cremated by <b>[user]/[user.ckey]</b>" //No point in this when the mob's about to be deleted
//user.attack_log +="\[[time_stamp()]\] Cremated <b>[M]/[M.ckey]</b>"
//log_attack("\[[time_stamp()]\] <b>[user]/[user.ckey]</b> cremated <b>[M]/[M.ckey]</b>")
M.death(1)
M.ghostize()
del(M)
for(var/obj/O in contents) //obj instead of obj/item so that bodybags and ashes get destroyed. We dont want tons and tons of ash piling up
del(O)
new /obj/effect/decal/cleanable/ash(src)
sleep(30)
cremating = 0
locked = 0
playsound(src.loc, 'sound/machines/ding.ogg', 50, 1)
return
/*
* Crematorium tray
*/
/obj/structure/c_tray
name = "crematorium tray"
desc = "Apply body before burning."
icon = 'icons/obj/stationobjs.dmi'
icon_state = "cremat"
density = 1
layer = 2.0
var/obj/structure/crematorium/connected = null
anchored = 1.0
/obj/structure/c_tray/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if (istype(mover, /obj/item/weapon/dummy))
return 1
else
return ..()
/obj/structure/c_tray/attack_paw(mob/user as mob)
return src.attack_hand(user)
/obj/structure/c_tray/attack_hand(mob/user as mob)
if (src.connected)
for(var/atom/movable/A as mob|obj in src.loc)
if (!( A.anchored ))
A.loc = src.connected
//Foreach goto(26)
src.connected.connected = null
src.connected.update()
add_fingerprint(user)
//SN src = null
del(src)
return
return
/obj/structure/c_tray/MouseDrop_T(atom/movable/O as mob|obj, mob/user as mob)
if ((!( istype(O, /atom/movable) ) || O.anchored || get_dist(user, src) > 1 || get_dist(user, O) > 1 || user.contents.Find(src) || user.contents.Find(O)))
return
if (!ismob(O) && !istype(O, /obj/structure/closet/body_bag))
return
O.loc = src.loc
if (user != O)
for(var/mob/B in viewers(user, 3))
if ((B.client && !( B.blinded )))
B << text("\red [] stuffs [] into []!", user, O, src)
//Foreach goto(99)
return
/obj/machinery/crema_switch/attack_hand(mob/user as mob)
if(src.allowed(usr))
for (var/obj/structure/crematorium/C in world)
if (C.id == id)
if (!C.cremating)
C.cremate(user)
else
usr << "\red Access denied."
return
+322 -478
View File
@@ -17,470 +17,313 @@
var/edit = 1
var/repeat = 0
proc
playnote(var/note as text)
//world << "Note: [note]"
var/soundfile
/*BYOND loads resource files at compile time if they are ''. This means you can't really manipulate them dynamically.
Tried doing it dynamically at first but its more trouble than its worth. Would have saved many lines tho.*/
switch(note)
if("Cn1")
soundfile = 'sound/piano/Cn1.ogg'
if("C#1")
soundfile = 'sound/piano/C#1.ogg'
if("Db1")
soundfile = 'sound/piano/Db1.ogg'
if("Dn1")
soundfile = 'sound/piano/Dn1.ogg'
if("D#1")
soundfile = 'sound/piano/D#1.ogg'
if("Eb1")
soundfile = 'sound/piano/Eb1.ogg'
if("En1")
soundfile = 'sound/piano/En1.ogg'
if("E#1")
soundfile = 'sound/piano/E#1.ogg'
if("Fb1")
soundfile = 'sound/piano/Fb1.ogg'
if("Fn1")
soundfile = 'sound/piano/Fn1.ogg'
if("F#1")
soundfile = 'sound/piano/F#1.ogg'
if("Gb1")
soundfile = 'sound/piano/Gb1.ogg'
if("Gn1")
soundfile = 'sound/piano/Gn1.ogg'
if("G#1")
soundfile = 'sound/piano/G#1.ogg'
if("Ab1")
soundfile = 'sound/piano/Ab1.ogg'
if("An1")
soundfile = 'sound/piano/An1.ogg'
if("A#1")
soundfile = 'sound/piano/A#1.ogg'
if("Bb1")
soundfile = 'sound/piano/Bb1.ogg'
if("Bn1")
soundfile = 'sound/piano/Bn1.ogg'
if("B#1")
soundfile = 'sound/piano/B#1.ogg'
if("Cb2")
soundfile = 'sound/piano/Cb2.ogg'
if("Cn2")
soundfile = 'sound/piano/Cn2.ogg'
if("C#2")
soundfile = 'sound/piano/C#2.ogg'
if("Db2")
soundfile = 'sound/piano/Db2.ogg'
if("Dn2")
soundfile = 'sound/piano/Dn2.ogg'
if("D#2")
soundfile = 'sound/piano/D#2.ogg'
if("Eb2")
soundfile = 'sound/piano/Eb2.ogg'
if("En2")
soundfile = 'sound/piano/En2.ogg'
if("E#2")
soundfile = 'sound/piano/E#2.ogg'
if("Fb2")
soundfile = 'sound/piano/Fb2.ogg'
if("Fn2")
soundfile = 'sound/piano/Fn2.ogg'
if("F#2")
soundfile = 'sound/piano/F#2.ogg'
if("Gb2")
soundfile = 'sound/piano/Gb2.ogg'
if("Gn2")
soundfile = 'sound/piano/Gn2.ogg'
if("G#2")
soundfile = 'sound/piano/G#2.ogg'
if("Ab2")
soundfile = 'sound/piano/Ab2.ogg'
if("An2")
soundfile = 'sound/piano/An2.ogg'
if("A#2")
soundfile = 'sound/piano/A#2.ogg'
if("Bb2")
soundfile = 'sound/piano/Bb2.ogg'
if("Bn2")
soundfile = 'sound/piano/Bn2.ogg'
if("B#2")
soundfile = 'sound/piano/B#2.ogg'
if("Cb3")
soundfile = 'sound/piano/Cb3.ogg'
if("Cn3")
soundfile = 'sound/piano/Cn3.ogg'
if("C#3")
soundfile = 'sound/piano/C#3.ogg'
if("Db3")
soundfile = 'sound/piano/Db3.ogg'
if("Dn3")
soundfile = 'sound/piano/Dn3.ogg'
if("D#3")
soundfile = 'sound/piano/D#3.ogg'
if("Eb3")
soundfile = 'sound/piano/Eb3.ogg'
if("En3")
soundfile = 'sound/piano/En3.ogg'
if("E#3")
soundfile = 'sound/piano/E#3.ogg'
if("Fb3")
soundfile = 'sound/piano/Fb3.ogg'
if("Fn3")
soundfile = 'sound/piano/Fn3.ogg'
if("F#3")
soundfile = 'sound/piano/F#3.ogg'
if("Gb3")
soundfile = 'sound/piano/Gb3.ogg'
if("Gn3")
soundfile = 'sound/piano/Gn3.ogg'
if("G#3")
soundfile = 'sound/piano/G#3.ogg'
if("Ab3")
soundfile = 'sound/piano/Ab3.ogg'
if("An3")
soundfile = 'sound/piano/An3.ogg'
if("A#3")
soundfile = 'sound/piano/A#3.ogg'
if("Bb3")
soundfile = 'sound/piano/Bb3.ogg'
if("Bn3")
soundfile = 'sound/piano/Bn3.ogg'
if("B#3")
soundfile = 'sound/piano/B#3.ogg'
if("Cb4")
soundfile = 'sound/piano/Cb4.ogg'
if("Cn4")
soundfile = 'sound/piano/Cn4.ogg'
if("C#4")
soundfile = 'sound/piano/C#4.ogg'
if("Db4")
soundfile = 'sound/piano/Db4.ogg'
if("Dn4")
soundfile = 'sound/piano/Dn4.ogg'
if("D#4")
soundfile = 'sound/piano/D#4.ogg'
if("Eb4")
soundfile = 'sound/piano/Eb4.ogg'
if("En4")
soundfile = 'sound/piano/En4.ogg'
if("E#4")
soundfile = 'sound/piano/E#4.ogg'
if("Fb4")
soundfile = 'sound/piano/Fb4.ogg'
if("Fn4")
soundfile = 'sound/piano/Fn4.ogg'
if("F#4")
soundfile = 'sound/piano/F#4.ogg'
if("Gb4")
soundfile = 'sound/piano/Gb4.ogg'
if("Gn4")
soundfile = 'sound/piano/Gn4.ogg'
if("G#4")
soundfile = 'sound/piano/G#4.ogg'
if("Ab4")
soundfile = 'sound/piano/Ab4.ogg'
if("An4")
soundfile = 'sound/piano/An4.ogg'
if("A#4")
soundfile = 'sound/piano/A#4.ogg'
if("Bb4")
soundfile = 'sound/piano/Bb4.ogg'
if("Bn4")
soundfile = 'sound/piano/Bn4.ogg'
if("B#4")
soundfile = 'sound/piano/B#4.ogg'
if("Cb5")
soundfile = 'sound/piano/Cb5.ogg'
if("Cn5")
soundfile = 'sound/piano/Cn5.ogg'
if("C#5")
soundfile = 'sound/piano/C#5.ogg'
if("Db5")
soundfile = 'sound/piano/Db5.ogg'
if("Dn5")
soundfile = 'sound/piano/Dn5.ogg'
if("D#5")
soundfile = 'sound/piano/D#5.ogg'
if("Eb5")
soundfile = 'sound/piano/Eb5.ogg'
if("En5")
soundfile = 'sound/piano/En5.ogg'
if("E#5")
soundfile = 'sound/piano/E#5.ogg'
if("Fb5")
soundfile = 'sound/piano/Fb5.ogg'
if("Fn5")
soundfile = 'sound/piano/Fn5.ogg'
if("F#5")
soundfile = 'sound/piano/F#5.ogg'
if("Gb5")
soundfile = 'sound/piano/Gb5.ogg'
if("Gn5")
soundfile = 'sound/piano/Gn5.ogg'
if("G#5")
soundfile = 'sound/piano/G#5.ogg'
if("Ab5")
soundfile = 'sound/piano/Ab5.ogg'
if("An5")
soundfile = 'sound/piano/An5.ogg'
if("A#5")
soundfile = 'sound/piano/A#5.ogg'
if("Bb5")
soundfile = 'sound/piano/Bb5.ogg'
if("Bn5")
soundfile = 'sound/piano/Bn5.ogg'
if("B#5")
soundfile = 'sound/piano/B#5.ogg'
if("Cb6")
soundfile = 'sound/piano/Cb6.ogg'
if("Cn6")
soundfile = 'sound/piano/Cn6.ogg'
if("C#6")
soundfile = 'sound/piano/C#6.ogg'
if("Db6")
soundfile = 'sound/piano/Db6.ogg'
if("Dn6")
soundfile = 'sound/piano/Dn6.ogg'
if("D#6")
soundfile = 'sound/piano/D#6.ogg'
if("Eb6")
soundfile = 'sound/piano/Eb6.ogg'
if("En6")
soundfile = 'sound/piano/En6.ogg'
if("E#6")
soundfile = 'sound/piano/E#6.ogg'
if("Fb6")
soundfile = 'sound/piano/Fb6.ogg'
if("Fn6")
soundfile = 'sound/piano/Fn6.ogg'
if("F#6")
soundfile = 'sound/piano/F#6.ogg'
if("Gb6")
soundfile = 'sound/piano/Gb6.ogg'
if("Gn6")
soundfile = 'sound/piano/Gn6.ogg'
if("G#6")
soundfile = 'sound/piano/G#6.ogg'
if("Ab6")
soundfile = 'sound/piano/Ab6.ogg'
if("An6")
soundfile = 'sound/piano/An6.ogg'
if("A#6")
soundfile = 'sound/piano/A#6.ogg'
if("Bb6")
soundfile = 'sound/piano/Bb6.ogg'
if("Bn6")
soundfile = 'sound/piano/Bn6.ogg'
if("B#6")
soundfile = 'sound/piano/B#6.ogg'
if("Cb7")
soundfile = 'sound/piano/Cb7.ogg'
if("Cn7")
soundfile = 'sound/piano/Cn7.ogg'
if("C#7")
soundfile = 'sound/piano/C#7.ogg'
if("Db7")
soundfile = 'sound/piano/Db7.ogg'
if("Dn7")
soundfile = 'sound/piano/Dn7.ogg'
if("D#7")
soundfile = 'sound/piano/D#7.ogg'
if("Eb7")
soundfile = 'sound/piano/Eb7.ogg'
if("En7")
soundfile = 'sound/piano/En7.ogg'
if("E#7")
soundfile = 'sound/piano/E#7.ogg'
if("Fb7")
soundfile = 'sound/piano/Fb7.ogg'
if("Fn7")
soundfile = 'sound/piano/Fn7.ogg'
if("F#7")
soundfile = 'sound/piano/F#7.ogg'
if("Gb7")
soundfile = 'sound/piano/Gb7.ogg'
if("Gn7")
soundfile = 'sound/piano/Gn7.ogg'
if("G#7")
soundfile = 'sound/piano/G#7.ogg'
if("Ab7")
soundfile = 'sound/piano/Ab7.ogg'
if("An7")
soundfile = 'sound/piano/An7.ogg'
if("A#7")
soundfile = 'sound/piano/A#7.ogg'
if("Bb7")
soundfile = 'sound/piano/Bb7.ogg'
if("Bn7")
soundfile = 'sound/piano/Bn7.ogg'
if("B#7")
soundfile = 'sound/piano/B#7.ogg'
if("Cb8")
soundfile = 'sound/piano/Cb8.ogg'
if("Cn8")
soundfile = 'sound/piano/Cn8.ogg'
if("C#8")
soundfile = 'sound/piano/C#8.ogg'
if("Db8")
soundfile = 'sound/piano/Db8.ogg'
if("Dn8")
soundfile = 'sound/piano/Dn8.ogg'
if("D#8")
soundfile = 'sound/piano/D#8.ogg'
if("Eb8")
soundfile = 'sound/piano/Eb8.ogg'
if("En8")
soundfile = 'sound/piano/En8.ogg'
if("E#8")
soundfile = 'sound/piano/E#8.ogg'
if("Fb8")
soundfile = 'sound/piano/Fb8.ogg'
if("Fn8")
soundfile = 'sound/piano/Fn8.ogg'
if("F#8")
soundfile = 'sound/piano/F#8.ogg'
if("Gb8")
soundfile = 'sound/piano/Gb8.ogg'
if("Gn8")
soundfile = 'sound/piano/Gn8.ogg'
if("G#8")
soundfile = 'sound/piano/G#8.ogg'
if("Ab8")
soundfile = 'sound/piano/Ab8.ogg'
if("An8")
soundfile = 'sound/piano/An8.ogg'
if("A#8")
soundfile = 'sound/piano/A#8.ogg'
if("Bb8")
soundfile = 'sound/piano/Bb8.ogg'
if("Bn8")
soundfile = 'sound/piano/Bn8.ogg'
if("B#8")
soundfile = 'sound/piano/B#8.ogg'
if("Cb9")
soundfile = 'sound/piano/Cb9.ogg'
if("Cn9")
soundfile = 'sound/piano/Cn9.ogg'
else
return
/obj/structure/device/piano/New()
if(prob(50))
name = "space minimoog"
desc = "This is a minimoog, like a space piano, but more spacey!"
icon_state = "minimoog"
else
name = "space piano"
desc = "This is a space piano, like a regular piano, but always in tune! Even if the musician isn't."
icon_state = "piano"
for(var/mob/M in hearers(15, src))
M << sound(soundfile)
/obj/structure/device/piano/proc/playnote(var/note as text)
//world << "Note: [note]"
var/soundfile
/*BYOND loads resource files at compile time if they are ''. This means you can't really manipulate them dynamically.
Tried doing it dynamically at first but its more trouble than its worth. Would have saved many lines tho.*/
switch(note)
if("Cn1") soundfile = 'sound/piano/Cn1.ogg'
if("C#1") soundfile = 'sound/piano/C#1.ogg'
if("Db1") soundfile = 'sound/piano/Db1.ogg'
if("Dn1") soundfile = 'sound/piano/Dn1.ogg'
if("D#1") soundfile = 'sound/piano/D#1.ogg'
if("Eb1") soundfile = 'sound/piano/Eb1.ogg'
if("En1") soundfile = 'sound/piano/En1.ogg'
if("E#1") soundfile = 'sound/piano/E#1.ogg'
if("Fb1") soundfile = 'sound/piano/Fb1.ogg'
if("Fn1") soundfile = 'sound/piano/Fn1.ogg'
if("F#1") soundfile = 'sound/piano/F#1.ogg'
if("Gb1") soundfile = 'sound/piano/Gb1.ogg'
if("Gn1") soundfile = 'sound/piano/Gn1.ogg'
if("G#1") soundfile = 'sound/piano/G#1.ogg'
if("Ab1") soundfile = 'sound/piano/Ab1.ogg'
if("An1") soundfile = 'sound/piano/An1.ogg'
if("A#1") soundfile = 'sound/piano/A#1.ogg'
if("Bb1") soundfile = 'sound/piano/Bb1.ogg'
if("Bn1") soundfile = 'sound/piano/Bn1.ogg'
if("B#1") soundfile = 'sound/piano/B#1.ogg'
if("Cb2") soundfile = 'sound/piano/Cb2.ogg'
if("Cn2") soundfile = 'sound/piano/Cn2.ogg'
if("C#2") soundfile = 'sound/piano/C#2.ogg'
if("Db2") soundfile = 'sound/piano/Db2.ogg'
if("Dn2") soundfile = 'sound/piano/Dn2.ogg'
if("D#2") soundfile = 'sound/piano/D#2.ogg'
if("Eb2") soundfile = 'sound/piano/Eb2.ogg'
if("En2") soundfile = 'sound/piano/En2.ogg'
if("E#2") soundfile = 'sound/piano/E#2.ogg'
if("Fb2") soundfile = 'sound/piano/Fb2.ogg'
if("Fn2") soundfile = 'sound/piano/Fn2.ogg'
if("F#2") soundfile = 'sound/piano/F#2.ogg'
if("Gb2") soundfile = 'sound/piano/Gb2.ogg'
if("Gn2") soundfile = 'sound/piano/Gn2.ogg'
if("G#2") soundfile = 'sound/piano/G#2.ogg'
if("Ab2") soundfile = 'sound/piano/Ab2.ogg'
if("An2") soundfile = 'sound/piano/An2.ogg'
if("A#2") soundfile = 'sound/piano/A#2.ogg'
if("Bb2") soundfile = 'sound/piano/Bb2.ogg'
if("Bn2") soundfile = 'sound/piano/Bn2.ogg'
if("B#2") soundfile = 'sound/piano/B#2.ogg'
if("Cb3") soundfile = 'sound/piano/Cb3.ogg'
if("Cn3") soundfile = 'sound/piano/Cn3.ogg'
if("C#3") soundfile = 'sound/piano/C#3.ogg'
if("Db3") soundfile = 'sound/piano/Db3.ogg'
if("Dn3") soundfile = 'sound/piano/Dn3.ogg'
if("D#3") soundfile = 'sound/piano/D#3.ogg'
if("Eb3") soundfile = 'sound/piano/Eb3.ogg'
if("En3") soundfile = 'sound/piano/En3.ogg'
if("E#3") soundfile = 'sound/piano/E#3.ogg'
if("Fb3") soundfile = 'sound/piano/Fb3.ogg'
if("Fn3") soundfile = 'sound/piano/Fn3.ogg'
if("F#3") soundfile = 'sound/piano/F#3.ogg'
if("Gb3") soundfile = 'sound/piano/Gb3.ogg'
if("Gn3") soundfile = 'sound/piano/Gn3.ogg'
if("G#3") soundfile = 'sound/piano/G#3.ogg'
if("Ab3") soundfile = 'sound/piano/Ab3.ogg'
if("An3") soundfile = 'sound/piano/An3.ogg'
if("A#3") soundfile = 'sound/piano/A#3.ogg'
if("Bb3") soundfile = 'sound/piano/Bb3.ogg'
if("Bn3") soundfile = 'sound/piano/Bn3.ogg'
if("B#3") soundfile = 'sound/piano/B#3.ogg'
if("Cb4") soundfile = 'sound/piano/Cb4.ogg'
if("Cn4") soundfile = 'sound/piano/Cn4.ogg'
if("C#4") soundfile = 'sound/piano/C#4.ogg'
if("Db4") soundfile = 'sound/piano/Db4.ogg'
if("Dn4") soundfile = 'sound/piano/Dn4.ogg'
if("D#4") soundfile = 'sound/piano/D#4.ogg'
if("Eb4") soundfile = 'sound/piano/Eb4.ogg'
if("En4") soundfile = 'sound/piano/En4.ogg'
if("E#4") soundfile = 'sound/piano/E#4.ogg'
if("Fb4") soundfile = 'sound/piano/Fb4.ogg'
if("Fn4") soundfile = 'sound/piano/Fn4.ogg'
if("F#4") soundfile = 'sound/piano/F#4.ogg'
if("Gb4") soundfile = 'sound/piano/Gb4.ogg'
if("Gn4") soundfile = 'sound/piano/Gn4.ogg'
if("G#4") soundfile = 'sound/piano/G#4.ogg'
if("Ab4") soundfile = 'sound/piano/Ab4.ogg'
if("An4") soundfile = 'sound/piano/An4.ogg'
if("A#4") soundfile = 'sound/piano/A#4.ogg'
if("Bb4") soundfile = 'sound/piano/Bb4.ogg'
if("Bn4") soundfile = 'sound/piano/Bn4.ogg'
if("B#4") soundfile = 'sound/piano/B#4.ogg'
if("Cb5") soundfile = 'sound/piano/Cb5.ogg'
if("Cn5") soundfile = 'sound/piano/Cn5.ogg'
if("C#5") soundfile = 'sound/piano/C#5.ogg'
if("Db5") soundfile = 'sound/piano/Db5.ogg'
if("Dn5") soundfile = 'sound/piano/Dn5.ogg'
if("D#5") soundfile = 'sound/piano/D#5.ogg'
if("Eb5") soundfile = 'sound/piano/Eb5.ogg'
if("En5") soundfile = 'sound/piano/En5.ogg'
if("E#5") soundfile = 'sound/piano/E#5.ogg'
if("Fb5") soundfile = 'sound/piano/Fb5.ogg'
if("Fn5") soundfile = 'sound/piano/Fn5.ogg'
if("F#5") soundfile = 'sound/piano/F#5.ogg'
if("Gb5") soundfile = 'sound/piano/Gb5.ogg'
if("Gn5") soundfile = 'sound/piano/Gn5.ogg'
if("G#5") soundfile = 'sound/piano/G#5.ogg'
if("Ab5") soundfile = 'sound/piano/Ab5.ogg'
if("An5") soundfile = 'sound/piano/An5.ogg'
if("A#5") soundfile = 'sound/piano/A#5.ogg'
if("Bb5") soundfile = 'sound/piano/Bb5.ogg'
if("Bn5") soundfile = 'sound/piano/Bn5.ogg'
if("B#5") soundfile = 'sound/piano/B#5.ogg'
if("Cb6") soundfile = 'sound/piano/Cb6.ogg'
if("Cn6") soundfile = 'sound/piano/Cn6.ogg'
if("C#6") soundfile = 'sound/piano/C#6.ogg'
if("Db6") soundfile = 'sound/piano/Db6.ogg'
if("Dn6") soundfile = 'sound/piano/Dn6.ogg'
if("D#6") soundfile = 'sound/piano/D#6.ogg'
if("Eb6") soundfile = 'sound/piano/Eb6.ogg'
if("En6") soundfile = 'sound/piano/En6.ogg'
if("E#6") soundfile = 'sound/piano/E#6.ogg'
if("Fb6") soundfile = 'sound/piano/Fb6.ogg'
if("Fn6") soundfile = 'sound/piano/Fn6.ogg'
if("F#6") soundfile = 'sound/piano/F#6.ogg'
if("Gb6") soundfile = 'sound/piano/Gb6.ogg'
if("Gn6") soundfile = 'sound/piano/Gn6.ogg'
if("G#6") soundfile = 'sound/piano/G#6.ogg'
if("Ab6") soundfile = 'sound/piano/Ab6.ogg'
if("An6") soundfile = 'sound/piano/An6.ogg'
if("A#6") soundfile = 'sound/piano/A#6.ogg'
if("Bb6") soundfile = 'sound/piano/Bb6.ogg'
if("Bn6") soundfile = 'sound/piano/Bn6.ogg'
if("B#6") soundfile = 'sound/piano/B#6.ogg'
if("Cb7") soundfile = 'sound/piano/Cb7.ogg'
if("Cn7") soundfile = 'sound/piano/Cn7.ogg'
if("C#7") soundfile = 'sound/piano/C#7.ogg'
if("Db7") soundfile = 'sound/piano/Db7.ogg'
if("Dn7") soundfile = 'sound/piano/Dn7.ogg'
if("D#7") soundfile = 'sound/piano/D#7.ogg'
if("Eb7") soundfile = 'sound/piano/Eb7.ogg'
if("En7") soundfile = 'sound/piano/En7.ogg'
if("E#7") soundfile = 'sound/piano/E#7.ogg'
if("Fb7") soundfile = 'sound/piano/Fb7.ogg'
if("Fn7") soundfile = 'sound/piano/Fn7.ogg'
if("F#7") soundfile = 'sound/piano/F#7.ogg'
if("Gb7") soundfile = 'sound/piano/Gb7.ogg'
if("Gn7") soundfile = 'sound/piano/Gn7.ogg'
if("G#7") soundfile = 'sound/piano/G#7.ogg'
if("Ab7") soundfile = 'sound/piano/Ab7.ogg'
if("An7") soundfile = 'sound/piano/An7.ogg'
if("A#7") soundfile = 'sound/piano/A#7.ogg'
if("Bb7") soundfile = 'sound/piano/Bb7.ogg'
if("Bn7") soundfile = 'sound/piano/Bn7.ogg'
if("B#7") soundfile = 'sound/piano/B#7.ogg'
if("Cb8") soundfile = 'sound/piano/Cb8.ogg'
if("Cn8") soundfile = 'sound/piano/Cn8.ogg'
if("C#8") soundfile = 'sound/piano/C#8.ogg'
if("Db8") soundfile = 'sound/piano/Db8.ogg'
if("Dn8") soundfile = 'sound/piano/Dn8.ogg'
if("D#8") soundfile = 'sound/piano/D#8.ogg'
if("Eb8") soundfile = 'sound/piano/Eb8.ogg'
if("En8") soundfile = 'sound/piano/En8.ogg'
if("E#8") soundfile = 'sound/piano/E#8.ogg'
if("Fb8") soundfile = 'sound/piano/Fb8.ogg'
if("Fn8") soundfile = 'sound/piano/Fn8.ogg'
if("F#8") soundfile = 'sound/piano/F#8.ogg'
if("Gb8") soundfile = 'sound/piano/Gb8.ogg'
if("Gn8") soundfile = 'sound/piano/Gn8.ogg'
if("G#8") soundfile = 'sound/piano/G#8.ogg'
if("Ab8") soundfile = 'sound/piano/Ab8.ogg'
if("An8") soundfile = 'sound/piano/An8.ogg'
if("A#8") soundfile = 'sound/piano/A#8.ogg'
if("Bb8") soundfile = 'sound/piano/Bb8.ogg'
if("Bn8") soundfile = 'sound/piano/Bn8.ogg'
if("B#8") soundfile = 'sound/piano/B#8.ogg'
if("Cb9") soundfile = 'sound/piano/Cb9.ogg'
if("Cn9") soundfile = 'sound/piano/Cn9.ogg'
else return
playsong()
do
var/cur_oct[7]
var/cur_acc[7]
for(var/i = 1 to 7)
cur_oct[i] = "3"
cur_acc[i] = "n"
hearers(15, src) << sound(soundfile)
for(var/line in song.lines)
//world << line
for(var/beat in dd_text2list(lowertext(line), ","))
//world << "beat: [beat]"
var/list/notes = dd_text2list(beat, "/")
for(var/note in dd_text2list(notes[1], "-"))
//world << "note: [note]"
if(!playing || !anchored)//If the piano is playing, or is loose
playing = 0
return
if(lentext(note) == 0)
continue
//world << "Parse: [copytext(note,1,2)]"
var/cur_note = text2ascii(note) - 96
if(cur_note < 1 || cur_note > 7)
continue
for(var/i=2 to lentext(note))
var/ni = copytext(note,i,i+1)
if(!text2num(ni))
if(ni == "#" || ni == "b" || ni == "n")
cur_acc[cur_note] = ni
else if(ni == "s")
cur_acc[cur_note] = "#" // so shift is never required
else
cur_oct[cur_note] = ni
playnote(uppertext(copytext(note,1,2)) + cur_acc[cur_note] + cur_oct[cur_note])
if(notes.len >= 2 && text2num(notes[2]))
sleep(song.tempo / text2num(notes[2]))
/obj/structure/device/piano/proc/playsong()
do
var/cur_oct[7]
var/cur_acc[7]
for(var/i = 1 to 7)
cur_oct[i] = "3"
cur_acc[i] = "n"
for(var/line in song.lines)
//world << line
for(var/beat in dd_text2list(lowertext(line), ","))
//world << "beat: [beat]"
var/list/notes = dd_text2list(beat, "/")
for(var/note in dd_text2list(notes[1], "-"))
//world << "note: [note]"
if(!playing || !anchored)//If the piano is playing, or is loose
playing = 0
return
if(lentext(note) == 0)
continue
//world << "Parse: [copytext(note,1,2)]"
var/cur_note = text2ascii(note) - 96
if(cur_note < 1 || cur_note > 7)
continue
for(var/i=2 to lentext(note))
var/ni = copytext(note,i,i+1)
if(!text2num(ni))
if(ni == "#" || ni == "b" || ni == "n")
cur_acc[cur_note] = ni
else if(ni == "s")
cur_acc[cur_note] = "#" // so shift is never required
else
sleep(song.tempo)
if(repeat > 0)
repeat-- //Infinite loops are baaaad.
while(repeat > 0)
playing = 0
updateUsrDialog()
cur_oct[cur_note] = ni
playnote(uppertext(copytext(note,1,2)) + cur_acc[cur_note] + cur_oct[cur_note])
if(notes.len >= 2 && text2num(notes[2]))
sleep(song.tempo / text2num(notes[2]))
else
sleep(song.tempo)
if(repeat > 0)
repeat-- //Infinite loops are baaaad.
while(repeat > 0)
playing = 0
updateUsrDialog()
attack_hand(var/mob/user as mob)
if(!anchored)
return
/obj/structure/device/piano/attack_hand(var/mob/user as mob)
if(!anchored)
return
usr.machine = src
var/dat = "<HEAD><TITLE>Piano</TITLE></HEAD><BODY>"
usr.machine = src
var/dat = "<HEAD><TITLE>Piano</TITLE></HEAD><BODY>"
if(song)
if(song.lines.len > 0 && !(playing))
dat += "<A href='?src=\ref[src];play=1'>Play Song</A><BR><BR>"
dat += "<A href='?src=\ref[src];repeat=1'>Repeat Song: [repeat] times.</A><BR><BR>"
if(playing)
dat += "<A href='?src=\ref[src];stop=1'>Stop Playing</A><BR>"
dat += "Repeats left: [repeat].<BR><BR>"
if(!edit)
dat += "<A href='?src=\ref[src];edit=2'>Show Editor</A><BR><BR>"
else
dat += "<A href='?src=\ref[src];edit=1'>Hide Editor</A><BR>"
dat += "<A href='?src=\ref[src];newsong=1'>Start a New Song</A><BR>"
dat += "<A href='?src=\ref[src];import=1'>Import a Song</A><BR><BR>"
if(song)
if(song.lines.len > 0 && !(playing))
dat += "<A href='?src=\ref[src];play=1'>Play Song</A><BR><BR>"
dat += "<A href='?src=\ref[src];repeat=1'>Repeat Song: [repeat] times.</A><BR><BR>"
if(playing)
dat += "<A href='?src=\ref[src];stop=1'>Stop Playing</A><BR>"
dat += "Repeats left: [repeat].<BR><BR>"
if(!edit)
dat += "<A href='?src=\ref[src];edit=2'>Show Editor</A><BR><BR>"
var/calctempo = (10/song.tempo)*60
dat += "Tempo : <A href='?src=\ref[src];tempo=10'>-</A><A href='?src=\ref[src];tempo=1'>-</A> [calctempo] BPM <A href='?src=\ref[src];tempo=-1'>+</A><A href='?src=\ref[src];tempo=-10'>+</A><BR><BR>"
var/linecount = 0
for(var/line in song.lines)
linecount += 1
dat += "Line [linecount]: [line] <A href='?src=\ref[src];deleteline=[linecount]'>Delete Line</A> <A href='?src=\ref[src];modifyline=[linecount]'>Modify Line</A><BR>"
dat += "<A href='?src=\ref[src];newline=1'>Add Line</A><BR><BR>"
if(help)
dat += "<A href='?src=\ref[src];help=1'>Hide Help</A><BR>"
dat += {"
Lines are a series of chords, separated by commas (,), each with notes seperated by hyphens (-).<br>
Every note in a chord will play together, with chord timed by the tempo.<br>
<br>
Notes are played by the names of the note, and optionally, the accidental, and/or the octave number.<br>
By default, every note is natural and in octave 3. Defining otherwise is remembered for each note.<br>
Example: <i>C,D,E,F,G,A,B</i> will play a C major scale.<br>
After a note has an accidental placed, it will be remembered: <i>C,C4,C,C3</i> is C3,C4,C4,C3</i><br>
Chords can be played simply by seperating each note with a hyphon: <i>A-C#,Cn-E,E-G#,Gn-B</i><br>
A pause may be denoted by an empty chord: <i>C,E,,C,G</i><br>
To make a chord be a different time, end it with /x, where the chord length will be length<br>
defined by tempo / x: <i>C,G/2,E/4</i><br>
Combined, an example is: <i>E-E4/4,/2,G#/8,B/8,E3-E4/4</i>
<br>
Lines may be up to 50 characters.<br>
A song may only contain up to 50 lines.<br>
"}
else
dat += "<A href='?src=\ref[src];edit=1'>Hide Editor</A><BR>"
dat += "<A href='?src=\ref[src];newsong=1'>Start a New Song</A><BR>"
dat += "<A href='?src=\ref[src];import=1'>Import a Song</A><BR><BR>"
if(song)
var/calctempo = (10/song.tempo)*60
dat += "Tempo : <A href='?src=\ref[src];tempo=10'>-</A><A href='?src=\ref[src];tempo=1'>-</A> [calctempo] BPM <A href='?src=\ref[src];tempo=-1'>+</A><A href='?src=\ref[src];tempo=-10'>+</A><BR><BR>"
var/linecount = 0
for(var/line in song.lines)
linecount += 1
dat += "Line [linecount]: [line] <A href='?src=\ref[src];deleteline=[linecount]'>Delete Line</A> <A href='?src=\ref[src];modifyline=[linecount]'>Modify Line</A><BR>"
dat += "<A href='?src=\ref[src];newline=1'>Add Line</A><BR><BR>"
if(help)
dat += "<A href='?src=\ref[src];help=1'>Hide Help</A><BR>"
dat += {"
Lines are a series of chords, separated by commas (,), each with notes seperated by hyphens (-).<br>
Every note in a chord will play together, with chord timed by the tempo.<br>
<br>
Notes are played by the names of the note, and optionally, the accidental, and/or the octave number.<br>
By default, every note is natural and in octave 3. Defining otherwise is remembered for each note.<br>
Example: <i>C,D,E,F,G,A,B</i> will play a C major scale.<br>
After a note has an accidental placed, it will be remembered: <i>C,C4,C,C3</i> is C3,C4,C4,C3</i><br>
Chords can be played simply by seperating each note with a hyphon: <i>A-C#,Cn-E,E-G#,Gn-B</i><br>
A pause may be denoted by an empty chord: <i>C,E,,C,G</i><br>
To make a chord be a different time, end it with /x, where the chord length will be length<br>
defined by tempo / x: <i>C,G/2,E/4</i><br>
Combined, an example is: <i>E-E4/4,/2,G#/8,B/8,E3-E4/4</i>
<br>
Lines may be up to 50 characters.<br>
A song may only contain up to 50 lines.<br>
"}
else
dat += "<A href='?src=\ref[src];help=2'>Show Help</A><BR>"
dat += "</BODY></HTML>"
user << browse(dat, "window=piano;size=700x300")
onclose(user, "piano")
dat += "<A href='?src=\ref[src];help=2'>Show Help</A><BR>"
dat += "</BODY></HTML>"
user << browse(dat, "window=piano;size=700x300")
onclose(user, "piano")
Topic(href, href_list)
/obj/structure/device/piano/Topic(href, href_list)
if(!in_range(src, usr) || issilicon(usr) || !anchored || !usr.canmove || usr.restrained())
usr << browse(null, "window=piano;size=700x300")
onclose(usr, "piano")
return
if(!in_range(src, usr) || issilicon(usr) || !anchored || !usr.canmove || usr.restrained())
usr << browse(null, "window=piano;size=700x300")
onclose(usr, "piano")
return
if(href_list["newsong"])
song = new()
else if(song)
if(href_list["repeat"]) //Changing this from a toggle to a number of repeats to avoid infinite loops.
if(playing) return //So that people cant keep adding to repeat. If the do it intentionally, it could result in the server crashing.
var/tempnum = input("How many times do you want to repeat this piece? (max:10)") as num
var/tempnum = input("How many times do you want to repeat this piece? (max:10)") as num|null
if(tempnum > 10)
tempnum = 10
repeat = tempnum
if(tempnum < 0)
tempnum = 0
repeat = round(tempnum)
else if(href_list["tempo"])
song.tempo += text2num(href_list["tempo"])
song.tempo += round(text2num(href_list["tempo"]))
if(song.tempo < 1)
song.tempo = 1
@@ -489,11 +332,8 @@
playing = 1
spawn() playsong()
else if(href_list["newsong"])
song = new()
else if(href_list["newline"])
var/newline = input("Enter your line: ", "Piano") as text|null
var/newline = html_encode(input("Enter your line: ", "Piano") as text|null)
if(!newline)
return
if(song.lines.len > 50)
@@ -503,16 +343,20 @@
song.lines.Add(newline)
else if(href_list["deleteline"])
var/num = text2num(href_list["deleteline"])
var/num = round(text2num(href_list["deleteline"]))
if(num > song.lines.len || num < 1)
return
song.lines.Cut(num, num+1)
else if(href_list["modifyline"])
var/num = text2num(href_list["modifyline"])
var/content = input("Enter your line: ", "Piano", song.lines[num]) as text|null
var/num = round(text2num(href_list["modifyline"]),1)
var/content = html_encode(input("Enter your line: ", "Piano", song.lines[num]) as text|null)
if(!content)
return
if(lentext(content) > 50)
content = copytext(content, 1, 50)
if(num > song.lines.len || num < 1)
return
song.lines[num] = content
else if(href_list["stop"])
@@ -527,7 +371,7 @@
else if(href_list["import"])
var/t = ""
do
t = input(usr, "Please paste the entire song, formatted:", text("[]", src.name), t) as message
t = html_encode(input(usr, "Please paste the entire song, formatted:", text("[]", src.name), t) as message)
if (!in_range(src, usr))
return
@@ -559,29 +403,29 @@
song.tempo = tempo
updateUsrDialog()
add_fingerprint(usr)
updateUsrDialog()
return
add_fingerprint(usr)
updateUsrDialog()
return
attackby(obj/item/O as obj, mob/user as mob)
if (istype(O, /obj/item/weapon/wrench))
if (anchored)
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "\blue You begin to loosen \the [src]'s casters..."
if (do_after(user, 40))
user.visible_message( \
"[user] loosens \the [src]'s casters.", \
"\blue You have loosened \the [src]. Now it can be pulled somewhere else.", \
"You hear ratchet.")
src.anchored = 0
else
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "\blue You begin to tighten \the [src] to the floor..."
if (do_after(user, 20))
user.visible_message( \
"[user] tightens \the [src]'s casters.", \
"\blue You have tightened \the [src]'s casters. Now it can be played again.", \
"You hear ratchet.")
src.anchored = 1
/obj/structure/device/piano/attackby(obj/item/O as obj, mob/user as mob)
if (istype(O, /obj/item/weapon/wrench))
if (anchored)
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "\blue You begin to loosen \the [src]'s casters..."
if (do_after(user, 40))
user.visible_message( \
"[user] loosens \the [src]'s casters.", \
"\blue You have loosened \the [src]. Now it can be pulled somewhere else.", \
"You hear ratchet.")
src.anchored = 0
else
..()
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "\blue You begin to tighten \the [src] to the floor..."
if (do_after(user, 20))
user.visible_message( \
"[user] tightens \the [src]'s casters.", \
"\blue You have tightened \the [src]'s casters. Now it can be played again.", \
"You hear ratchet.")
src.anchored = 1
else
..()
@@ -1,4 +1,12 @@
/obj/structure/noticeboard
name = "Notice Board"
icon = 'icons/obj/stationobjs.dmi'
icon_state = "nboard00"
flags = FPRINT
desc = "A board for pinning important notices upon."
density = 0
anchored = 1
var/notices = 0
//attaching papers!!
/obj/structure/noticeboard/attackby(var/obj/item/weapon/O as obj, var/mob/user as mob)
@@ -1,4 +1,12 @@
//Alium nests. Essentially beds with an unbuckle delay that only aliums can buckle mobs to.
/obj/structure/stool/bed/nest
name = "alien nest"
desc = "It's a gruesome pile of thick, sticky resin shaped like a nest."
icon = 'icons/mob/alien.dmi'
icon_state = "nest"
var/health = 100
/obj/structure/stool/bed/nest/manual_unbuckle(mob/user as mob)
if(buckled_mob)
if(buckled_mob.buckled == src)
@@ -48,9 +56,6 @@
src.add_fingerprint(user)
return
/obj/structure/stool/blob_act()
del(src)
/obj/structure/stool/bed/nest/attackby(obj/item/weapon/W as obj, mob/user as mob)
var/aforce = W.force
health = max(0, health - aforce)
@@ -0,0 +1,125 @@
/* Beds... get your mind out of the gutter, they're for sleeping!
* Contains:
* Beds
* Roller beds
*/
/*
* Beds
*/
/obj/structure/stool/bed
name = "bed"
desc = "This is used to lie in, sleep in or strap on."
icon_state = "bed"
var/mob/living/buckled_mob
/obj/structure/stool/bed/alien
name = "resting contraption"
desc = "This looks similar to contraptions from earth. Could aliens be stealing our technology?"
icon_state = "abed"
/obj/structure/stool/bed/Del()
unbuckle()
..()
return
/obj/structure/stool/bed/attack_paw(mob/user as mob)
return src.attack_hand(user)
/obj/structure/stool/bed/attack_hand(mob/user as mob)
manual_unbuckle(user)
return
/obj/structure/stool/bed/MouseDrop_T(mob/M as mob, mob/user as mob)
if(!istype(M)) return
buckle_mob(M, user)
return
/obj/structure/stool/bed/proc/unbuckle()
if(buckled_mob)
if(buckled_mob.buckled == src) //this is probably unneccesary, but it doesn't hurt
buckled_mob.buckled = null
buckled_mob.anchored = initial(buckled_mob.anchored)
buckled_mob.update_canmove()
buckled_mob = null
return
/obj/structure/stool/bed/proc/manual_unbuckle(mob/user as mob)
if(buckled_mob)
if(buckled_mob.buckled == src)
if(buckled_mob != user)
buckled_mob.visible_message(\
"\blue [buckled_mob.name] was unbuckled by [user.name]!",\
"You were unbuckled from [src] by [user.name].",\
"You hear metal clanking")
else
buckled_mob.visible_message(\
"\blue [buckled_mob.name] unbuckled \himself!",\
"You unbuckle yourself from [src].",\
"You hear metal clanking")
unbuckle()
src.add_fingerprint(user)
return
/obj/structure/stool/bed/proc/buckle_mob(mob/M as mob, mob/user as mob)
if (!ticker)
user << "You can't buckle anyone in before the game starts."
if ( !ismob(M) || (get_dist(src, user) > 1) || (M.loc != src.loc) || user.restrained() || user.lying || user.stat || M.buckled || istype(user, /mob/living/silicon/pai) )
return
unbuckle()
if (M == usr)
M.visible_message(\
"\blue [M.name] buckles in!",\
"You buckle yourself to [src].",\
"You hear metal clanking")
else
M.visible_message(\
"\blue [M.name] is buckled in to [src] by [user.name]!",\
"You are buckled in to [src] by [user.name].",\
"You hear metal clanking")
M.buckled = src
M.loc = src.loc
M.dir = src.dir
M.update_canmove()
src.buckled_mob = M
src.add_fingerprint(user)
return
/*
* Roller beds
*/
/obj/structure/stool/bed/roller
name = "roller bed"
icon = 'icons/obj/rollerbed.dmi'
icon_state = "down"
anchored = 0
/obj/structure/stool/bed/roller/Move()
..()
if(buckled_mob)
if(buckled_mob.buckled == src)
buckled_mob.loc = src.loc
/obj/structure/stool/bed/roller/buckle_mob(mob/M as mob, mob/user as mob)
if ( !ismob(M) || (get_dist(src, user) > 1) || (M.loc != src.loc) || user.restrained() || user.lying || user.stat || M.buckled || istype(usr, /mob/living/silicon/pai) )
return
M.pixel_y = 6
density = 1
icon_state = "up"
..()
return
/obj/structure/stool/bed/roller/manual_unbuckle(mob/user as mob)
if(buckled_mob)
if(buckled_mob.buckled == src) //this is probably unneccesary, but it doesn't hurt
buckled_mob.pixel_y = 0
buckled_mob.anchored = initial(buckled_mob.anchored)
buckled_mob.buckled = null
buckled_mob.update_canmove()
buckled_mob = null
density = 0
icon_state = "down"
..()
return
@@ -0,0 +1,109 @@
/obj/structure/stool/bed/chair //YES, chairs are a type of bed, which are a type of stool. This works, believe me. -Pete
name = "chair"
desc = "You sit in this. Either by will or force."
icon_state = "chair"
/obj/structure/stool/bed/chair/New()
if(anchored)
src.verbs -= /atom/movable/verb/pull
handle_rotation()
..()
return
/obj/structure/stool/bed/chair/attackby(obj/item/weapon/W as obj, mob/user as mob)
..()
if(istype(W, /obj/item/assembly/shock_kit))
var/obj/structure/stool/bed/chair/e_chair/E = new /obj/structure/stool/bed/chair/e_chair(src.loc)
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
E.dir = src.dir
E.part = W
W.loc = E
W.master = E
user.u_equip(W)
W.layer = initial(W.layer)
del(src)
return
return
/obj/structure/stool/bed/chair/proc/handle_rotation() //making this into a seperate proc so office chairs can call it on Move()
if(src.dir == NORTH)
src.layer = FLY_LAYER
else
src.layer = OBJ_LAYER
if(buckled_mob)
if(buckled_mob.loc != src.loc)
buckled_mob.buckled = null //Temporary, so Move() succeeds.
if(!buckled_mob.Move(loc))
unbuckle()
buckled_mob = null
else
buckled_mob.buckled = src //Restoring
if(buckled_mob)
buckled_mob.dir = dir
/obj/structure/stool/bed/chair/verb/rotate()
set name = "Rotate Chair"
set category = "Object"
set src in oview(1)
src.dir = turn(src.dir, 90)
handle_rotation()
return
/obj/structure/stool/bed/chair/MouseDrop_T(mob/M as mob, mob/user as mob)
if(!istype(M)) return
buckle_mob(M, user)
return
// Chair types
/obj/structure/stool/bed/chair/wood/normal
icon_state = "wooden_chair"
name = "wooden chair"
desc = "Old is never too old to not be in fashion."
/obj/structure/stool/bed/chair/wood/wings
icon_state = "wooden_chair_wings"
name = "wooden chair"
desc = "Old is never too old to not be in fashion."
/obj/structure/stool/bed/chair/wood/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/wrench))
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
new /obj/item/stack/sheet/wood(src.loc)
del(src)
else
..()
/obj/structure/stool/bed/chair/comfy
name = "comfy chair"
desc = "It looks comfy."
/obj/structure/stool/bed/chair/comfy/brown
icon_state = "comfychair_brown"
/obj/structure/stool/bed/chair/comfy/beige
icon_state = "comfychair_beige"
/obj/structure/stool/bed/chair/comfy/teal
icon_state = "comfychair_teal"
/obj/structure/stool/bed/chair/office
anchored = 0
/obj/structure/stool/bed/chair/comfy/black
icon_state = "comfychair_black"
/obj/structure/stool/bed/chair/comfy/lime
icon_state = "comfychair_lime"
/obj/structure/stool/bed/chair/office/Move()
..()
handle_rotation()
/obj/structure/stool/bed/chair/office/light
icon_state = "officechair_white"
/obj/structure/stool/bed/chair/office/dark
icon_state = "officechair_dark"
@@ -0,0 +1,35 @@
/obj/structure/stool
name = "stool"
desc = "Apply butt."
icon = 'icons/obj/objects.dmi'
icon_state = "stool"
anchored = 1.0
flags = FPRINT
pressure_resistance = 3*ONE_ATMOSPHERE
/obj/structure/stool/ex_act(severity)
switch(severity)
if(1.0)
del(src)
return
if(2.0)
if (prob(50))
del(src)
return
if(3.0)
if (prob(5))
del(src)
return
return
/obj/structure/stool/blob_act()
if(prob(75))
new /obj/item/stack/sheet/metal(src.loc)
del(src)
/obj/structure/stool/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/wrench))
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
new /obj/item/stack/sheet/metal(src.loc)
del(src)
return
@@ -1,227 +0,0 @@
/obj/structure/stool/ex_act(severity)
switch(severity)
if(1.0)
del(src)
return
if(2.0)
if (prob(50))
del(src)
return
if(3.0)
if (prob(5))
del(src)
return
return
/obj/structure/stool/blob_act()
if(prob(75))
new /obj/item/stack/sheet/metal(src.loc)
del(src)
/obj/structure/stool/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/screwdriver))
if (src.anchored)
src.anchored = 0
user << "\blue You unfasten [src] from the floor."
else
src.anchored = 1
user << "\blue You fasten [src] to the floor."
if(istype(W, /obj/item/weapon/wrench))
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
new /obj/item/stack/sheet/metal(src.loc)
del(src)
return
/obj/structure/stool/bed/chair/attackby(obj/item/weapon/W as obj, mob/user as mob)
..()
if(istype(W, /obj/item/assembly/shock_kit))
var/obj/structure/stool/bed/chair/e_chair/E = new /obj/structure/stool/bed/chair/e_chair(src.loc)
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
E.dir = src.dir
E.part = W
W.loc = E
W.master = E
user.u_equip(W)
W.layer = initial(W.layer)
del(src)
return
return
/obj/structure/stool/bed/chair/wood/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/wrench))
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
new /obj/item/stack/sheet/wood(src.loc)
del(src)
else
..()
/obj/structure/stool/bed/Del()
unbuckle()
..()
return
/obj/structure/stool/bed/proc/unbuckle()
if(buckled_mob)
if(buckled_mob.buckled == src) //this is probably unneccesary, but it doesn't hurt
buckled_mob.buckled = null
buckled_mob.anchored = initial(buckled_mob.anchored)
buckled_mob.update_canmove()
buckled_mob = null
return
/obj/structure/stool/bed/proc/manual_unbuckle(mob/user as mob)
if(buckled_mob)
if(buckled_mob.buckled == src)
if(buckled_mob != user)
buckled_mob.visible_message(\
"\blue [buckled_mob.name] was unbuckled by [user.name]!",\
"You were unbuckled from [src] by [user.name].",\
"You hear metal clanking")
else
buckled_mob.visible_message(\
"\blue [buckled_mob.name] unbuckles!",\
"You unbuckle yourself from [src].",\
"You hear metal clanking")
unbuckle()
src.add_fingerprint(user)
return
/obj/structure/stool/bed/proc/buckle_mob(mob/M as mob, mob/user as mob)
if (!ticker)
user << "You can't buckle anyone in before the game starts."
if ( !ismob(M) || (get_dist(src, user) > 1) || (M.loc != src.loc) || user.restrained() || user.lying || user.stat || M.buckled || istype(user, /mob/living/silicon/pai) )
return
unbuckle()
if (M == usr)
M.visible_message(\
"\blue [M.name] buckles in!",\
"You buckle yourself to [src].",\
"You hear metal clanking")
else
M.visible_message(\
"\blue [M.name] is buckled in to [src] by [user.name]!",\
"You are buckled in to [src] by [user.name].",\
"You hear metal clanking")
M.buckled = src
M.loc = src.loc
M.dir = src.dir
M.update_canmove()
src.buckled_mob = M
src.add_fingerprint(user)
return
/obj/structure/stool/bed/MouseDrop_T(mob/M as mob, mob/user as mob)
if(!istype(M)) return
if(issimpleanimal(user))
user << "\red You are unable to work the complex mechanisms of a buckle!"
return
buckle_mob(M, user)
return
/obj/structure/stool/bed/attack_paw(mob/user as mob)
return src.attack_hand(user)
/obj/structure/stool/bed/attack_hand(mob/user as mob)
manual_unbuckle(user)
return
/obj/structure/stool/bed/chair/New()
if(anchored)
src.verbs -= /atom/movable/verb/pull
handle_rotation()
..()
return
/obj/structure/stool/bed/chair/proc/handle_rotation() //making this into a seperate proc so office chairs can call it on Move()
if(src.dir == NORTH)
src.layer = FLY_LAYER
else
src.layer = OBJ_LAYER
if(buckled_mob)
if(buckled_mob.loc != src.loc)
buckled_mob.buckled = null //Temporary, so Move() succeeds.
if(!buckled_mob.Move(loc))
unbuckle()
buckled_mob = null
else
buckled_mob.buckled = src //Restoring
if(buckled_mob)
buckled_mob.dir = dir
/obj/structure/stool/bed/chair/verb/rotate()
set name = "Rotate Chair"
set category = "Object"
set src in oview(1)
src.dir = turn(src.dir, 90)
handle_rotation()
return
/obj/structure/stool/bed/chair/MouseDrop_T(mob/M as mob, mob/user as mob)
if(!istype(M)) return
buckle_mob(M, user)
return
//roller bed
/obj/structure/stool/bed/roller
name = "roller bed"
icon = 'icons/obj/rollerbed.dmi'
icon_state = "down"
anchored = 0
/obj/item/roller
name = "roller bed"
desc = "A collapsed roller bed that can be carried around."
icon = 'rollerbed.dmi'
icon_state = "folded"
w_class = 4.0 // Can't be put in backpacks. Oh well.
attack_self(mob/user)
var/obj/structure/stool/bed/roller/R = new /obj/structure/stool/bed/roller(user.loc)
R.add_fingerprint(user)
del(src)
/obj/structure/stool/bed/roller/Move()
..()
if(buckled_mob)
if(buckled_mob.buckled == src)
buckled_mob.loc = src.loc
/obj/structure/stool/bed/roller/buckle_mob(mob/M as mob, mob/user as mob)
if ( !ismob(M) || (get_dist(src, user) > 1) || (M.loc != src.loc) || user.restrained() || user.lying || user.stat || M.buckled || istype(usr, /mob/living/silicon/pai) )
return
M.pixel_y = 6
density = 1
icon_state = "up"
..()
return
/obj/structure/stool/bed/roller/manual_unbuckle(mob/user as mob)
if(buckled_mob)
if(buckled_mob.buckled == src) //this is probably unneccesary, but it doesn't hurt
buckled_mob.pixel_y = 0
buckled_mob.anchored = initial(buckled_mob.anchored)
buckled_mob.buckled = null
buckled_mob.update_canmove()
buckled_mob = null
density = 0
icon_state = "down"
..()
return
/obj/structure/stool/bed/roller/MouseDrop(over_object, src_location, over_location)
..()
if((over_object == usr && (in_range(src, usr) || usr.contents.Find(src))))
if(!ishuman(usr)) return
if(buckled_mob) return 0
visible_message("\The [usr] collapses \the [src.name]")
new/obj/item/roller(get_turf(src))
spawn(0)
del(src)
return
+239 -7
View File
@@ -1,10 +1,213 @@
/* Tables and Racks
* Contains:
* Tables
* Wooden tables
* Reinforced tables
* Racks
*/
/*
CONTAINS:
TABLE AND RACK OBJECT INTERATIONS
*/
* Tables
*/
/obj/structure/table
name = "table"
desc = "A square piece of metal standing on four metal legs. It can not move."
icon = 'icons/obj/structures.dmi'
icon_state = "table"
density = 1
anchored = 1.0
layer = 2.8
throwpass = 1 //You can throw objects over this, despite it's density.")
/obj/structure/table/New()
..()
for(var/obj/structure/table/T in src.loc)
if(T != src)
del(T)
update_icon()
for(var/direction in list(1,2,4,8,5,6,9,10))
if(locate(/obj/structure/table,get_step(src,direction)))
var/obj/structure/table/T = locate(/obj/structure/table,get_step(src,direction))
T.update_icon()
/obj/structure/table/Del()
for(var/direction in list(1,2,4,8,5,6,9,10))
if(locate(/obj/structure/table,get_step(src,direction)))
var/obj/structure/table/T = locate(/obj/structure/table,get_step(src,direction))
T.update_icon()
..()
/obj/structure/table/update_icon()
spawn(2) //So it properly updates when deleting
var/dir_sum = 0
for(var/direction in list(1,2,4,8,5,6,9,10))
var/skip_sum = 0
for(var/obj/structure/window/W in src.loc)
if(W.dir == direction) //So smooth tables don't go smooth through windows
skip_sum = 1
continue
var/inv_direction //inverse direction
switch(direction)
if(1)
inv_direction = 2
if(2)
inv_direction = 1
if(4)
inv_direction = 8
if(8)
inv_direction = 4
if(5)
inv_direction = 10
if(6)
inv_direction = 9
if(9)
inv_direction = 6
if(10)
inv_direction = 5
for(var/obj/structure/window/W in get_step(src,direction))
if(W.dir == inv_direction) //So smooth tables don't go smooth through windows when the window is on the other table's tile
skip_sum = 1
continue
if(!skip_sum) //means there is a window between the two tiles in this direction
if(locate(/obj/structure/table,get_step(src,direction)))
if(direction <5)
dir_sum += direction
else
if(direction == 5) //This permits the use of all table directions. (Set up so clockwise around the central table is a higher value, from north)
dir_sum += 16
if(direction == 6)
dir_sum += 32
if(direction == 8) //Aherp and Aderp. Jezes I am stupid. -- SkyMarshal
dir_sum += 8
if(direction == 10)
dir_sum += 64
if(direction == 9)
dir_sum += 128
var/table_type = 0 //stand_alone table
if(dir_sum%16 in cardinal)
table_type = 1 //endtable
dir_sum %= 16
if(dir_sum%16 in list(3,12))
table_type = 2 //1 tile thick, streight table
if(dir_sum%16 == 3) //3 doesn't exist as a dir
dir_sum = 2
if(dir_sum%16 == 12) //12 doesn't exist as a dir.
dir_sum = 4
if(dir_sum%16 in list(5,6,9,10))
if(locate(/obj/structure/table,get_step(src.loc,dir_sum%16)))
table_type = 3 //full table (not the 1 tile thick one, but one of the 'tabledir' tables)
else
table_type = 2 //1 tile thick, corner table (treated the same as streight tables in code later on)
dir_sum %= 16
if(dir_sum%16 in list(13,14,7,11)) //Three-way intersection
table_type = 5 //full table as three-way intersections are not sprited, would require 64 sprites to handle all combinations. TOO BAD -- SkyMarshal
switch(dir_sum%16) //Begin computation of the special type tables. --SkyMarshal
if(7)
if(dir_sum == 23)
table_type = 6
dir_sum = 8
else if(dir_sum == 39)
dir_sum = 4
table_type = 6
else if(dir_sum == 55 || dir_sum == 119 || dir_sum == 247 || dir_sum == 183)
dir_sum = 4
table_type = 3
else
dir_sum = 4
if(11)
if(dir_sum == 75)
dir_sum = 5
table_type = 6
else if(dir_sum == 139)
dir_sum = 9
table_type = 6
else if(dir_sum == 203 || dir_sum == 219 || dir_sum == 251 || dir_sum == 235)
dir_sum = 8
table_type = 3
else
dir_sum = 8
if(13)
if(dir_sum == 29)
dir_sum = 10
table_type = 6
else if(dir_sum == 141)
dir_sum = 6
table_type = 6
else if(dir_sum == 189 || dir_sum == 221 || dir_sum == 253 || dir_sum == 157)
dir_sum = 1
table_type = 3
else
dir_sum = 1
if(14)
if(dir_sum == 46)
dir_sum = 1
table_type = 6
else if(dir_sum == 78)
dir_sum = 2
table_type = 6
else if(dir_sum == 110 || dir_sum == 254 || dir_sum == 238 || dir_sum == 126)
dir_sum = 2
table_type = 3
else
dir_sum = 2 //These translate the dir_sum to the correct dirs from the 'tabledir' icon_state.
if(dir_sum%16 == 15)
table_type = 4 //4-way intersection, the 'middle' table sprites will be used.
if(istype(src,/obj/structure/table/reinforced))
switch(table_type)
if(0)
icon_state = "reinf_table"
if(1)
icon_state = "reinf_1tileendtable"
if(2)
icon_state = "reinf_1tilethick"
if(3)
icon_state = "reinf_tabledir"
if(4)
icon_state = "reinf_middle"
if(5)
icon_state = "reinf_tabledir2"
if(6)
icon_state = "reinf_tabledir3"
else if(istype(src,/obj/structure/table/woodentable))
switch(table_type)
if(0)
icon_state = "wood_table"
if(1)
icon_state = "wood_1tileendtable"
if(2)
icon_state = "wood_1tilethick"
if(3)
icon_state = "wood_tabledir"
if(4)
icon_state = "wood_middle"
if(5)
icon_state = "wood_tabledir2"
if(6)
icon_state = "wood_tabledir3"
else
switch(table_type)
if(0)
icon_state = "table"
if(1)
icon_state = "table_1tileendtable"
if(2)
icon_state = "table_1tilethick"
if(3)
icon_state = "tabledir"
if(4)
icon_state = "table_middle"
if(5)
icon_state = "tabledir2"
if(6)
icon_state = "tabledir3"
if (dir_sum in list(1,2,4,8,5,6,9,10))
dir = dir_sum
else
dir = 2
//TABLE
/obj/structure/table/ex_act(severity)
switch(severity)
if(1.0)
@@ -179,7 +382,15 @@ TABLE AND RACK OBJECT INTERATIONS
return
//WOODEN TABLES
/*
* Wooden tables
*/
/obj/structure/table/woodentable
name = "wooden table"
desc = "Do not apply fire to this. Rumour says it burns easily."
icon_state = "wood_table"
/obj/structure/table/woodentable/attackby(obj/item/weapon/W as obj, mob/user as mob)
if (istype(W, /obj/item/weapon/grab))
@@ -221,7 +432,16 @@ TABLE AND RACK OBJECT INTERATIONS
return
//REINFORCED TABLES
/*
* Reinforced tables
*/
/obj/structure/table/reinforced
name = "reinforced table"
desc = "A version of the four legged table. It is stronger."
icon_state = "reinf_table"
var/status = 2
/obj/structure/table/reinforced/attackby(obj/item/weapon/W as obj, mob/user as mob)
if (istype(W, /obj/item/weapon/grab))
@@ -289,7 +509,19 @@ TABLE AND RACK OBJECT INTERATIONS
//if(W && W.loc) W.loc = src.loc
return
//RACKS
/*
* Racks
*/
/obj/structure/rack
name = "rack"
desc = "Different from the Middle Ages version."
icon = 'icons/obj/objects.dmi'
icon_state = "rack"
density = 1
flags = FPRINT
anchored = 1.0
throwpass = 1 //You can throw objects over this, despite it's density.
/obj/structure/rack/ex_act(severity)
switch(severity)