mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-24 04:28:12 +01:00
/atom New() => Initialize() [MDB IGNORE]
This commit is contained in:
@@ -10,8 +10,8 @@
|
||||
var/maxhealth = 100
|
||||
var/datum/material/material
|
||||
|
||||
/obj/structure/barricade/New(var/newloc, var/material_name)
|
||||
..(newloc)
|
||||
/obj/structure/barricade/Initialize(var/ml, var/material_name)
|
||||
. = ..()
|
||||
if(!material_name)
|
||||
material_name = "wood"
|
||||
material = get_material_by_name("[material_name]")
|
||||
@@ -116,10 +116,10 @@
|
||||
icon = 'icons/obj/sandbags.dmi'
|
||||
icon_state = "blank"
|
||||
|
||||
/obj/structure/barricade/sandbag/New(var/newloc, var/material_name)
|
||||
/obj/structure/barricade/sandbag/Initialize(var/ml, var/material_name)
|
||||
if(!material_name)
|
||||
material_name = "cloth"
|
||||
..(newloc, material_name)
|
||||
. = ..()
|
||||
material = get_material_by_name("[material_name]")
|
||||
if(!material)
|
||||
qdel(src)
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
else
|
||||
. += "It says '[icon_state]'"
|
||||
|
||||
/obj/structure/sign/double/barsign/New()
|
||||
..()
|
||||
/obj/structure/sign/double/barsign/Initialize()
|
||||
. = ..()
|
||||
icon_state = pick(get_valid_states())
|
||||
|
||||
/obj/structure/sign/double/barsign/attackby(obj/item/I, mob/user)
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
var/set_temperature = T0C + 30 //K
|
||||
var/heating_power = 80000
|
||||
|
||||
/obj/structure/bonfire/New(newloc, material_name)
|
||||
..(newloc)
|
||||
/obj/structure/bonfire/Initialize(var/ml, material_name)
|
||||
. = ..()
|
||||
if(!material_name)
|
||||
material_name = MAT_WOOD
|
||||
material = get_material_by_name("[material_name]")
|
||||
@@ -24,15 +24,15 @@
|
||||
color = material.icon_colour
|
||||
|
||||
// Blue wood.
|
||||
/obj/structure/bonfire/sifwood/New(newloc, material_name)
|
||||
..(newloc, MAT_SIFWOOD)
|
||||
/obj/structure/bonfire/sifwood/Initialize(var/ml, material_name)
|
||||
. = ..(ml, MAT_SIFWOOD)
|
||||
|
||||
/obj/structure/bonfire/permanent/New(newloc, material_name)
|
||||
..()
|
||||
/obj/structure/bonfire/permanent/Initialize(var/ml, material_name)
|
||||
. = ..()
|
||||
ignite()
|
||||
|
||||
/obj/structure/bonfire/permanent/sifwood/New(newloc, material_name)
|
||||
..(newloc, MAT_SIFWOOD)
|
||||
/obj/structure/bonfire/permanent/sifwood/Initialize(var/ml, material_name)
|
||||
. = ..(ml, MAT_SIFWOOD)
|
||||
|
||||
/obj/structure/bonfire/attackby(obj/item/W, mob/user)
|
||||
if(istype(W, /obj/item/stack/rods) && !can_buckle && !grill)
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
var/intialOxy = 0
|
||||
var/timer = 240 //eventually the person will be freed
|
||||
|
||||
/obj/structure/closet/statue/New(loc, var/mob/living/L)
|
||||
/obj/structure/closet/statue/Initialize(var/ml, var/mob/living/L)
|
||||
. = ..()
|
||||
if(L && (ishuman(L) || L.isMonkey() || iscorgi(L)))
|
||||
if(L.buckled)
|
||||
L.buckled = 0
|
||||
@@ -41,11 +42,8 @@
|
||||
desc = "If it takes forever, I will wait for you..."
|
||||
|
||||
if(health == 0) //meaning if the statue didn't find a valid target
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
return INITIALIZE_HINT_QDEL
|
||||
START_PROCESSING(SSobj, src)
|
||||
..()
|
||||
|
||||
/obj/structure/closet/statue/process()
|
||||
timer--
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
var/glass = 0 // 0 = glass can be installed. -1 = glass can't be installed. 1 = glass is already installed. Text = mineral plating is installed instead.
|
||||
var/created_name = null
|
||||
|
||||
/obj/structure/door_assembly/New()
|
||||
/obj/structure/door_assembly/Initialize()
|
||||
. = ..()
|
||||
update_state()
|
||||
|
||||
/obj/structure/door_assembly/door_assembly_com
|
||||
@@ -136,7 +137,8 @@
|
||||
airlock_type = "/multi_tile/glass"
|
||||
glass = -1 //To prevent bugs in deconstruction process.
|
||||
|
||||
/obj/structure/door_assembly/multi_tile/New()
|
||||
/obj/structure/door_assembly/multi_tile/Initialize()
|
||||
. = ..()
|
||||
if(dir in list(EAST, WEST))
|
||||
bound_width = width * world.icon_size
|
||||
bound_height = world.icon_size
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
|
||||
/obj/structure/bed/chair/e_chair/Initialize()
|
||||
. = ..()
|
||||
<<<<<<< HEAD
|
||||
add_overlay(image('icons/obj/objects.dmi', src, "echair_over", MOB_LAYER + 1, dir))
|
||||
=======
|
||||
overlays += image('icons/obj/objects.dmi', src, "echair_over", MOB_LAYER + 1, dir)
|
||||
>>>>>>> 2f0a618d451... /atom New() => Initialize() [MDB IGNORE] (#8298)
|
||||
return
|
||||
|
||||
/obj/structure/bed/chair/e_chair/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
|
||||
@@ -9,12 +9,21 @@
|
||||
var/obj/item/weapon/extinguisher/has_extinguisher
|
||||
var/opened = 0
|
||||
|
||||
<<<<<<< HEAD
|
||||
/obj/structure/extinguisher_cabinet/Initialize(var/mapload, var/dir, var/building = 0)
|
||||
. = ..()
|
||||
|
||||
if(building)
|
||||
pixel_x = (dir & 3)? 0 : (dir == 4 ? -27 : 27)
|
||||
pixel_y = (dir & 3)? (dir ==1 ? -27 : 27) : 0
|
||||
=======
|
||||
/obj/structure/extinguisher_cabinet/Initialize(var/ml, var/dir, var/building = 0)
|
||||
. = ..()
|
||||
if(building)
|
||||
pixel_x = (dir & 3)? 0 : (dir == 4 ? -27 : 27)
|
||||
pixel_y = (dir & 3)? (dir ==1 ? -27 : 27) : 0
|
||||
update_icon()
|
||||
>>>>>>> 2f0a618d451... /atom New() => Initialize() [MDB IGNORE] (#8298)
|
||||
else
|
||||
has_extinguisher = new/obj/item/weapon/extinguisher(src)
|
||||
|
||||
|
||||
@@ -91,8 +91,8 @@
|
||||
harvest_loot = list(/obj/item/stack/material/fiber = 1)
|
||||
max_harvests = 1
|
||||
|
||||
/obj/structure/flora/bush/New()
|
||||
..()
|
||||
/obj/structure/flora/bush/Initialize()
|
||||
. = ..()
|
||||
icon_state = "snowbush[rand(1, 6)]"
|
||||
|
||||
/obj/structure/flora/pottedplant
|
||||
@@ -140,113 +140,113 @@
|
||||
var/choice = pickweight(possibleseeds)
|
||||
new choice(get_turf(user))
|
||||
|
||||
/obj/structure/flora/ausbushes/New()
|
||||
..()
|
||||
/obj/structure/flora/ausbushes/Initialize()
|
||||
. = ..()
|
||||
icon_state = "firstbush_[rand(1, 4)]"
|
||||
|
||||
/obj/structure/flora/ausbushes/reedbush
|
||||
icon_state = "reedbush_1"
|
||||
|
||||
/obj/structure/flora/ausbushes/reedbush/New()
|
||||
..()
|
||||
/obj/structure/flora/ausbushes/reedbush/Initialize()
|
||||
. = ..()
|
||||
icon_state = "reedbush_[rand(1, 4)]"
|
||||
|
||||
/obj/structure/flora/ausbushes/leafybush
|
||||
icon_state = "leafybush_1"
|
||||
|
||||
/obj/structure/flora/ausbushes/leafybush/New()
|
||||
..()
|
||||
/obj/structure/flora/ausbushes/leafybush/Initialize()
|
||||
. = ..()
|
||||
icon_state = "leafybush_[rand(1, 3)]"
|
||||
|
||||
/obj/structure/flora/ausbushes/palebush
|
||||
icon_state = "palebush_1"
|
||||
|
||||
/obj/structure/flora/ausbushes/palebush/New()
|
||||
..()
|
||||
/obj/structure/flora/ausbushes/palebush/Initialize()
|
||||
. = ..()
|
||||
icon_state = "palebush_[rand(1, 4)]"
|
||||
|
||||
/obj/structure/flora/ausbushes/stalkybush
|
||||
icon_state = "stalkybush_1"
|
||||
|
||||
/obj/structure/flora/ausbushes/stalkybush/New()
|
||||
..()
|
||||
/obj/structure/flora/ausbushes/stalkybush/Initialize()
|
||||
. = ..()
|
||||
icon_state = "stalkybush_[rand(1, 3)]"
|
||||
|
||||
/obj/structure/flora/ausbushes/grassybush
|
||||
icon_state = "grassybush_1"
|
||||
|
||||
/obj/structure/flora/ausbushes/grassybush/New()
|
||||
..()
|
||||
/obj/structure/flora/ausbushes/grassybush/Initialize()
|
||||
. = ..()
|
||||
icon_state = "grassybush_[rand(1, 4)]"
|
||||
|
||||
/obj/structure/flora/ausbushes/fernybush
|
||||
icon_state = "fernybush_1"
|
||||
|
||||
/obj/structure/flora/ausbushes/fernybush/New()
|
||||
..()
|
||||
/obj/structure/flora/ausbushes/fernybush/Initialize()
|
||||
. = ..()
|
||||
icon_state = "fernybush_[rand(1, 3)]"
|
||||
|
||||
/obj/structure/flora/ausbushes/sunnybush
|
||||
icon_state = "sunnybush_1"
|
||||
|
||||
/obj/structure/flora/ausbushes/sunnybush/New()
|
||||
..()
|
||||
/obj/structure/flora/ausbushes/sunnybush/Initialize()
|
||||
. = ..()
|
||||
icon_state = "sunnybush_[rand(1, 3)]"
|
||||
|
||||
/obj/structure/flora/ausbushes/genericbush
|
||||
icon_state = "genericbush_1"
|
||||
|
||||
/obj/structure/flora/ausbushes/genericbush/New()
|
||||
..()
|
||||
/obj/structure/flora/ausbushes/genericbush/Initialize()
|
||||
. = ..()
|
||||
icon_state = "genericbush_[rand(1, 4)]"
|
||||
|
||||
/obj/structure/flora/ausbushes/pointybush
|
||||
icon_state = "pointybush_1"
|
||||
|
||||
/obj/structure/flora/ausbushes/pointybush/New()
|
||||
..()
|
||||
/obj/structure/flora/ausbushes/pointybush/Initialize()
|
||||
. = ..()
|
||||
icon_state = "pointybush_[rand(1, 4)]"
|
||||
|
||||
/obj/structure/flora/ausbushes/lavendergrass
|
||||
icon_state = "lavendergrass_1"
|
||||
|
||||
/obj/structure/flora/ausbushes/lavendergrass/New()
|
||||
..()
|
||||
/obj/structure/flora/ausbushes/lavendergrass/Initialize()
|
||||
. = ..()
|
||||
icon_state = "lavendergrass_[rand(1, 4)]"
|
||||
|
||||
/obj/structure/flora/ausbushes/ywflowers
|
||||
icon_state = "ywflowers_1"
|
||||
|
||||
/obj/structure/flora/ausbushes/ywflowers/New()
|
||||
..()
|
||||
/obj/structure/flora/ausbushes/ywflowers/Initialize()
|
||||
. = ..()
|
||||
icon_state = "ywflowers_[rand(1, 3)]"
|
||||
|
||||
/obj/structure/flora/ausbushes/brflowers
|
||||
icon_state = "brflowers_1"
|
||||
|
||||
/obj/structure/flora/ausbushes/brflowers/New()
|
||||
..()
|
||||
/obj/structure/flora/ausbushes/brflowers/Initialize()
|
||||
. = ..()
|
||||
icon_state = "brflowers_[rand(1, 3)]"
|
||||
|
||||
/obj/structure/flora/ausbushes/ppflowers
|
||||
icon_state = "ppflowers_1"
|
||||
|
||||
/obj/structure/flora/ausbushes/ppflowers/New()
|
||||
..()
|
||||
/obj/structure/flora/ausbushes/ppflowers/Initialize()
|
||||
. = ..()
|
||||
icon_state = "ppflowers_[rand(1, 3)]"
|
||||
|
||||
/obj/structure/flora/ausbushes/sparsegrass
|
||||
icon_state = "sparsegrass_1"
|
||||
|
||||
/obj/structure/flora/ausbushes/sparsegrass/New()
|
||||
..()
|
||||
/obj/structure/flora/ausbushes/sparsegrass/Initialize()
|
||||
. = ..()
|
||||
icon_state = "sparsegrass_[rand(1, 3)]"
|
||||
|
||||
/obj/structure/flora/ausbushes/fullgrass
|
||||
icon_state = "fullgrass_1"
|
||||
|
||||
/obj/structure/flora/ausbushes/fullgrass/New()
|
||||
..()
|
||||
/obj/structure/flora/ausbushes/fullgrass/Initialize()
|
||||
. = ..()
|
||||
icon_state = "fullgrass_[rand(1, 3)]"
|
||||
|
||||
/obj/structure/flora/skeleton
|
||||
|
||||
@@ -7,20 +7,20 @@
|
||||
/obj/structure/flora/grass/brown
|
||||
icon_state = "snowgrass1bb"
|
||||
|
||||
/obj/structure/flora/grass/brown/New()
|
||||
..()
|
||||
/obj/structure/flora/grass/brown/Initialize()
|
||||
. = ..()
|
||||
icon_state = "snowgrass[rand(1, 3)]bb"
|
||||
|
||||
/obj/structure/flora/grass/green
|
||||
icon_state = "snowgrass1gb"
|
||||
|
||||
/obj/structure/flora/grass/green/New()
|
||||
..()
|
||||
/obj/structure/flora/grass/green/Initialize()
|
||||
. = ..()
|
||||
icon_state = "snowgrass[rand(1, 3)]gb"
|
||||
|
||||
/obj/structure/flora/grass/both
|
||||
icon_state = "snowgrassall1"
|
||||
|
||||
/obj/structure/flora/grass/both/New()
|
||||
..()
|
||||
/obj/structure/flora/grass/both/Initialize()
|
||||
. = ..()
|
||||
icon_state = "snowgrassall[rand(1, 3)]"
|
||||
@@ -18,8 +18,8 @@
|
||||
var/applies_material_colour = 1
|
||||
var/wall_type = /turf/simulated/wall
|
||||
|
||||
/obj/structure/girder/New(var/newloc, var/material_key)
|
||||
..(newloc)
|
||||
/obj/structure/girder/Initialize(var/ml, var/material_key)
|
||||
. = ..(ml)
|
||||
if(!material_key)
|
||||
material_key = default_material
|
||||
set_material(material_key)
|
||||
@@ -74,8 +74,8 @@
|
||||
health = 50
|
||||
cover = 25
|
||||
|
||||
/obj/structure/girder/displaced/New(var/newloc, var/material_key)
|
||||
..(newloc, material_key)
|
||||
/obj/structure/girder/displaced/Initialize(var/ml, var/material_key)
|
||||
. = ..()
|
||||
displace()
|
||||
|
||||
/obj/structure/girder/proc/displace()
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
var/datum/material/material
|
||||
|
||||
/obj/structure/gravemarker/New(var/newloc, var/material_name)
|
||||
..(newloc)
|
||||
/obj/structure/gravemarker/Initialize(var/ml, var/material_name)
|
||||
. = ..(ml)
|
||||
if(!material_name)
|
||||
material_name = "wood"
|
||||
material = get_material_by_name("[material_name]")
|
||||
|
||||
@@ -225,8 +225,8 @@
|
||||
icon_state = "grille-b"
|
||||
density = FALSE
|
||||
|
||||
/obj/structure/grille/broken/New()
|
||||
..()
|
||||
/obj/structure/grille/broken/Initialize()
|
||||
. = ..()
|
||||
health = rand(-5, -1) //In the destroyed but not utterly threshold.
|
||||
healthcheck() //Send this to healthcheck just in case we want to do something else with it.
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
var/health = 50.0
|
||||
|
||||
|
||||
/obj/structure/inflatable/New(location)
|
||||
..()
|
||||
/obj/structure/inflatable/Initialize()
|
||||
. = ..()
|
||||
update_nearby_tiles(need_rebuild=1)
|
||||
|
||||
/obj/structure/inflatable/Destroy()
|
||||
|
||||
@@ -383,7 +383,8 @@ GLOBAL_LIST_BOILERPLATE(all_janitorial_carts, /obj/structure/janitorialcart)
|
||||
var/callme = "pimpin' ride" //how do people refer to it?
|
||||
|
||||
|
||||
/obj/structure/bed/chair/janicart/New()
|
||||
/obj/structure/bed/chair/janicart/Initialize()
|
||||
. = ..()
|
||||
create_reagents(300)
|
||||
update_layer()
|
||||
|
||||
|
||||
@@ -11,14 +11,18 @@
|
||||
var/glass = 1
|
||||
var/datum/tgui_module/appearance_changer/mirror/M
|
||||
|
||||
<<<<<<< HEAD
|
||||
/obj/structure/mirror/Initialize(mapload, var/dir, var/building = 0, mob/user as mob)
|
||||
=======
|
||||
/obj/structure/mirror/Initialize(var/ml, var/dir, var/building = 0, mob/user as mob)
|
||||
. = ..()
|
||||
>>>>>>> 2f0a618d451... /atom New() => Initialize() [MDB IGNORE] (#8298)
|
||||
M = new(src, null)
|
||||
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/Destroy()
|
||||
QDEL_NULL(M)
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
|
||||
GLOBAL_LIST_BOILERPLATE(all_mopbuckets, /obj/structure/mopbucket)
|
||||
|
||||
/obj/structure/mopbucket/New()
|
||||
/obj/structure/mopbucket/Initialize()
|
||||
create_reagents(300)
|
||||
..()
|
||||
. = ..()
|
||||
|
||||
/obj/structure/mopbucket/examine(mob/user)
|
||||
. = ..()
|
||||
|
||||
@@ -0,0 +1,366 @@
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:32
|
||||
|
||||
#define MUSICIAN_HEARCHECK_MINDELAY 4
|
||||
#define INSTRUMENT_MAX_LINE_LENGTH 50
|
||||
#define INSTRUMENT_MAX_LINE_NUMBER 300
|
||||
|
||||
/datum/song
|
||||
var/name = "Untitled"
|
||||
var/list/lines = new()
|
||||
var/tempo = 5 // delay between notes
|
||||
|
||||
var/playing = 0 // if we're playing
|
||||
var/help = 0 // if help is open
|
||||
var/edit = 1 // if we're in editing mode
|
||||
var/repeat = 0 // number of times remaining to repeat
|
||||
var/max_repeats = 10 // maximum times we can repeat
|
||||
|
||||
var/instrumentDir = "piano" // the folder with the sounds
|
||||
var/instrumentExt = "ogg" // the file extension
|
||||
var/obj/instrumentObj = null // the associated obj playing the sound
|
||||
var/last_hearcheck = 0
|
||||
var/list/hearing_mobs
|
||||
|
||||
/datum/song/New(dir, obj, ext = "ogg")
|
||||
instrumentDir = dir
|
||||
instrumentObj = obj
|
||||
instrumentExt = ext
|
||||
|
||||
/datum/song/Destroy()
|
||||
instrumentObj = null
|
||||
return ..()
|
||||
|
||||
|
||||
// note is a number from 1-7 for A-G
|
||||
// acc is either "b", "n", or "#"
|
||||
// oct is 1-8 (or 9 for C)
|
||||
/datum/song/proc/playnote(note, acc as text, oct)
|
||||
// handle accidental -> B<>C of E<>F
|
||||
if(acc == "b" && (note == 3 || note == 6)) // C or F
|
||||
if(note == 3)
|
||||
oct--
|
||||
note--
|
||||
acc = "n"
|
||||
else if(acc == "#" && (note == 2 || note == 5)) // B or E
|
||||
if(note == 2)
|
||||
oct++
|
||||
note++
|
||||
acc = "n"
|
||||
else if(acc == "#" && (note == 7)) //G#
|
||||
note = 1
|
||||
acc = "b"
|
||||
else if(acc == "#") // mass convert all sharps to flats, octave jump already handled
|
||||
acc = "b"
|
||||
note++
|
||||
|
||||
// check octave, C is allowed to go to 9
|
||||
if(oct < 1 || (note == 3 ? oct > 9 : oct > 8))
|
||||
return
|
||||
|
||||
// now generate name
|
||||
var/soundfile = "sound/instruments/[instrumentDir]/[ascii2text(note+64)][acc][oct].[instrumentExt]"
|
||||
soundfile = file(soundfile)
|
||||
// make sure the note exists
|
||||
if(!fexists(soundfile))
|
||||
return
|
||||
// and play
|
||||
var/turf/source = get_turf(instrumentObj)
|
||||
if((world.time - MUSICIAN_HEARCHECK_MINDELAY) > last_hearcheck)
|
||||
LAZYCLEARLIST(hearing_mobs)
|
||||
for(var/mob/M in hearers(15, source))
|
||||
if(!M.client || !(M.is_preference_enabled(/datum/client_preference/instrument_toggle)))
|
||||
continue
|
||||
LAZYSET(hearing_mobs, M, TRUE)
|
||||
last_hearcheck = world.time
|
||||
var/sound/music_played = sound(soundfile)
|
||||
for(var/i in hearing_mobs)
|
||||
var/mob/M = i
|
||||
M.playsound_local(source, null, 100, falloff = 0.5, S = music_played)
|
||||
|
||||
/datum/song/proc/updateDialog(mob/user)
|
||||
instrumentObj.updateDialog() // assumes it's an object in world, override if otherwise
|
||||
|
||||
/datum/song/proc/shouldStopPlaying(mob/user)
|
||||
if(instrumentObj)
|
||||
if(!instrumentObj.Adjacent(user) || user.stat)
|
||||
return 1
|
||||
return !instrumentObj.anchored // add special cases to stop in subclasses
|
||||
else
|
||||
return 1
|
||||
|
||||
/datum/song/proc/playsong(mob/user)
|
||||
while(repeat >= 0)
|
||||
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 lines)
|
||||
for(var/beat in splittext(lowertext(line), ","))
|
||||
var/list/notes = splittext(beat, "/")
|
||||
for(var/note in splittext(notes[1], "-"))
|
||||
if(!playing || shouldStopPlaying(user))//If the instrument is playing, or special case
|
||||
playing = 0
|
||||
return
|
||||
if(length(note) == 0)
|
||||
continue
|
||||
var/cur_note = text2ascii(note) - 96
|
||||
if(cur_note < 1 || cur_note > 7)
|
||||
continue
|
||||
for(var/i=2 to length(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] = text2num(ni)
|
||||
playnote(cur_note, cur_acc[cur_note], cur_oct[cur_note])
|
||||
if(notes.len >= 2 && text2num(notes[2]))
|
||||
sleep(sanitize_tempo(tempo / text2num(notes[2])))
|
||||
else
|
||||
sleep(tempo)
|
||||
repeat--
|
||||
playing = 0
|
||||
repeat = 0
|
||||
updateDialog(user)
|
||||
|
||||
/datum/song/proc/interact(mob/user)
|
||||
var/dat = ""
|
||||
if(lines.len > 0)
|
||||
dat += "<H3>Playback</H3>"
|
||||
if(!playing)
|
||||
dat += {"<A href='?src=\ref[src];play=1'>Play</A> <SPAN CLASS='linkOn'>Stop</SPAN><BR><BR>
|
||||
Repeat Song:
|
||||
[repeat > 0 ? "<A href='?src=\ref[src];repeat=-10'>-</A><A href='?src=\ref[src];repeat=-1'>-</A>" : "<SPAN CLASS='linkOff'>-</SPAN><SPAN CLASS='linkOff'>-</SPAN>"]
|
||||
[repeat] times
|
||||
[repeat < max_repeats ? "<A href='?src=\ref[src];repeat=1'>+</A><A href='?src=\ref[src];repeat=10'>+</A>" : "<SPAN CLASS='linkOff'>+</SPAN><SPAN CLASS='linkOff'>+</SPAN>"]
|
||||
<BR>"}
|
||||
else
|
||||
dat += {"<SPAN CLASS='linkOn'>Play</SPAN> <A href='?src=\ref[src];stop=1'>Stop</A><BR>
|
||||
Repeats left: <B>[repeat]</B><BR>"}
|
||||
if(!edit)
|
||||
dat += "<BR><B><A href='?src=\ref[src];edit=2'>Show Editor</A></B><BR>"
|
||||
else
|
||||
var/bpm = round(600 / tempo)
|
||||
dat += {"<H3>Editing</H3>
|
||||
<B><A href='?src=\ref[src];edit=1'>Hide Editor</A></B>
|
||||
<A href='?src=\ref[src];newsong=1'>Start a New Song</A>
|
||||
<A href='?src=\ref[src];import=1'>Import a Song</A><BR><BR>
|
||||
Tempo: <A href='?src=\ref[src];tempo=[world.tick_lag]'>-</A> [bpm] BPM <A href='?src=\ref[src];tempo=-[world.tick_lag]'>+</A><BR><BR>"}
|
||||
var/linecount = 0
|
||||
for(var/line in lines)
|
||||
linecount += 1
|
||||
dat += "Line [linecount]: <A href='?src=\ref[src];modifyline=[linecount]'>Edit</A> <A href='?src=\ref[src];deleteline=[linecount]'>X</A> [line]<BR>"
|
||||
dat += "<A href='?src=\ref[src];newline=1'>Add Line</A><BR><BR>"
|
||||
if(help)
|
||||
dat += {"<B><A href='?src=\ref[src];help=1'>Hide Help</A></B><BR>
|
||||
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 <i>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,F#/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 += "<B><A href='?src=\ref[src];help=2'>Show Help</A></B><BR>"
|
||||
var/datum/browser/popup = new(user, "instrument", instrumentObj.name, 700, 500)
|
||||
popup.set_content(dat)
|
||||
popup.set_title_image(user.browse_rsc_icon(instrumentObj.icon, instrumentObj.icon_state))
|
||||
popup.open()
|
||||
|
||||
/datum/song/Topic(href, href_list)
|
||||
if(!instrumentObj.Adjacent(usr) || usr.stat)
|
||||
usr << browse(null, "window=instrument")
|
||||
usr.unset_machine()
|
||||
return
|
||||
instrumentObj.add_fingerprint(usr)
|
||||
if(href_list["newsong"])
|
||||
lines = new()
|
||||
tempo = sanitize_tempo(5) // default 120 BPM
|
||||
name = ""
|
||||
else if(href_list["import"])
|
||||
var/t = ""
|
||||
do
|
||||
t = html_encode(input(usr, "Please paste the entire song, formatted:", text("[]", name), t) as message)
|
||||
if(!in_range(instrumentObj, usr))
|
||||
return
|
||||
if(length(t) >= INSTRUMENT_MAX_LINE_LENGTH*INSTRUMENT_MAX_LINE_NUMBER)
|
||||
var/cont = input(usr, "Your message is too long! Would you like to continue editing it?", "", "yes") in list("yes", "no")
|
||||
if(cont == "no")
|
||||
break
|
||||
while(length(t) > INSTRUMENT_MAX_LINE_LENGTH*INSTRUMENT_MAX_LINE_NUMBER)
|
||||
//split into lines
|
||||
spawn()
|
||||
lines = splittext(t, "\n")
|
||||
if(copytext(lines[1],1,6) == "BPM: ")
|
||||
tempo = sanitize_tempo(600 / text2num(copytext(lines[1],6)))
|
||||
lines.Cut(1,2)
|
||||
else
|
||||
tempo = sanitize_tempo(5) // default 120 BPM
|
||||
if(lines.len > INSTRUMENT_MAX_LINE_NUMBER)
|
||||
to_chat(usr, "Too many lines!")
|
||||
lines.Cut(INSTRUMENT_MAX_LINE_NUMBER+1)
|
||||
var/linenum = 1
|
||||
for(var/l in lines)
|
||||
if(length(l) > INSTRUMENT_MAX_LINE_LENGTH)
|
||||
to_chat(usr, "Line [linenum] too long!")
|
||||
lines.Remove(l)
|
||||
else
|
||||
linenum++
|
||||
updateDialog(usr) // make sure updates when complete
|
||||
else if(href_list["help"])
|
||||
help = text2num(href_list["help"]) - 1
|
||||
else if(href_list["edit"])
|
||||
edit = text2num(href_list["edit"]) - 1
|
||||
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.
|
||||
repeat += round(text2num(href_list["repeat"]))
|
||||
if(repeat < 0)
|
||||
repeat = 0
|
||||
if(repeat > max_repeats)
|
||||
repeat = max_repeats
|
||||
else if(href_list["tempo"])
|
||||
tempo = sanitize_tempo(tempo + text2num(href_list["tempo"]))
|
||||
else if(href_list["play"])
|
||||
playing = 1
|
||||
spawn()
|
||||
playsong(usr)
|
||||
else if(href_list["newline"])
|
||||
var/newline = html_encode(input("Enter your line: ", instrumentObj.name) as text|null)
|
||||
if(!newline || !in_range(instrumentObj, usr))
|
||||
return
|
||||
if(lines.len > INSTRUMENT_MAX_LINE_NUMBER)
|
||||
return
|
||||
if(length(newline) > INSTRUMENT_MAX_LINE_LENGTH)
|
||||
newline = copytext(newline, 1, INSTRUMENT_MAX_LINE_LENGTH)
|
||||
lines.Add(newline)
|
||||
else if(href_list["deleteline"])
|
||||
var/num = round(text2num(href_list["deleteline"]))
|
||||
if(num > lines.len || num < 1)
|
||||
return
|
||||
lines.Cut(num, num+1)
|
||||
else if(href_list["modifyline"])
|
||||
var/num = round(text2num(href_list["modifyline"]),1)
|
||||
var/content = html_encode(input("Enter your line: ", instrumentObj.name, lines[num]) as text|null)
|
||||
if(!content || !in_range(instrumentObj, usr))
|
||||
return
|
||||
if(length(content) > INSTRUMENT_MAX_LINE_LENGTH)
|
||||
content = copytext(content, 1, INSTRUMENT_MAX_LINE_LENGTH)
|
||||
if(num > lines.len || num < 1)
|
||||
return
|
||||
lines[num] = content
|
||||
else if(href_list["stop"])
|
||||
playing = 0
|
||||
updateDialog(usr)
|
||||
return
|
||||
|
||||
/datum/song/proc/sanitize_tempo(new_tempo)
|
||||
new_tempo = abs(new_tempo)
|
||||
return max(round(new_tempo, world.tick_lag), world.tick_lag)
|
||||
|
||||
// subclass for handheld instruments, like violin
|
||||
/datum/song/handheld
|
||||
|
||||
/datum/song/handheld/updateDialog(mob/user)
|
||||
instrumentObj.interact(user)
|
||||
|
||||
/datum/song/handheld/shouldStopPlaying()
|
||||
if(instrumentObj)
|
||||
return !isliving(instrumentObj.loc)
|
||||
else
|
||||
return 1
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/obj/structure/device/piano
|
||||
name = "space piano"
|
||||
desc = "This is a space piano; just like a regular piano, but always in tune! Even if the musician isn't."
|
||||
icon = 'icons/obj/musician.dmi'
|
||||
icon_state = "piano"
|
||||
anchored = 1
|
||||
density = 1
|
||||
var/datum/song/song
|
||||
|
||||
/obj/structure/device/piano/minimoog
|
||||
name = "space minimoog"
|
||||
icon_state = "minimoog"
|
||||
desc = "This is a minimoog; just like a space piano, but more spacey!"
|
||||
|
||||
/obj/structure/device/piano/Initialize()
|
||||
. = ..()
|
||||
song = new("piano", src)
|
||||
|
||||
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"
|
||||
|
||||
/obj/structure/device/piano/Destroy()
|
||||
qdel(song)
|
||||
song = null
|
||||
..()
|
||||
|
||||
/obj/structure/device/piano/verb/rotate_clockwise()
|
||||
set name = "Rotate Piano Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(ismouse(usr))
|
||||
return
|
||||
if(!usr || !isturf(usr.loc) || usr.stat || usr.restrained())
|
||||
return
|
||||
if (isobserver(usr) && !config.ghost_interaction)
|
||||
return
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
|
||||
/obj/structure/device/piano/attack_hand(mob/user)
|
||||
if(!user.IsAdvancedToolUser())
|
||||
to_chat(user, "<span class='warning'>You don't have the dexterity to do this!</span>")
|
||||
return 1
|
||||
interact(user)
|
||||
|
||||
/obj/structure/device/piano/interact(mob/user)
|
||||
if(!user || !anchored)
|
||||
return
|
||||
|
||||
user.set_machine(src)
|
||||
song.interact(user)
|
||||
|
||||
/obj/structure/device/piano/attackby(obj/item/O as obj, mob/user as mob)
|
||||
if(O.is_wrench())
|
||||
if(anchored)
|
||||
playsound(src, O.usesound, 50, 1)
|
||||
to_chat(user, "<span class='notice'>You begin to loosen \the [src]'s casters...</span>")
|
||||
if (do_after(user, 40 * O.toolspeed))
|
||||
user.visible_message( \
|
||||
"[user] loosens \the [src]'s casters.", \
|
||||
"<span class='notice'>You have loosened \the [src]. Now it can be pulled somewhere else.</span>", \
|
||||
"You hear ratchet.")
|
||||
src.anchored = 0
|
||||
else
|
||||
playsound(src, O.usesound, 50, 1)
|
||||
to_chat(user, "<span class='notice'>You begin to tighten \the [src] to the floor...</span>")
|
||||
if (do_after(user, 20 * O.toolspeed))
|
||||
user.visible_message( \
|
||||
"[user] tightens \the [src]'s casters.", \
|
||||
"<span class='notice'>You have tightened \the [src]'s casters. Now it can be played again</span>.", \
|
||||
"You hear ratchet.")
|
||||
src.anchored = 1
|
||||
else
|
||||
..()
|
||||
@@ -27,6 +27,7 @@
|
||||
interaction_message = "<span class='notice'>The prismatic turret seems to be able to rotate.</span>"
|
||||
|
||||
/obj/structure/prop/prism/Initialize()
|
||||
. = ..()
|
||||
if(degrees_from_north)
|
||||
animate(src, transform = turn(NORTH, degrees_from_north), time = 3)
|
||||
|
||||
|
||||
@@ -252,6 +252,7 @@
|
||||
icon_state = "stamper_on"
|
||||
|
||||
/obj/structure/prop/machine/stamper/starts_on/Initialize()
|
||||
. = ..()
|
||||
add_overlay("stamper_proc")
|
||||
add_overlay("stamper_but")
|
||||
|
||||
|
||||
@@ -51,7 +51,8 @@
|
||||
layer = ABOVE_WINDOW_LAYER
|
||||
interaction_message = "<span class = 'notice'>Cool to touch and unbelievable smooth. You can almost see your reflection in it.</span>"
|
||||
|
||||
/obj/structure/prop/statue/phoron/New()
|
||||
/obj/structure/prop/statue/phoron/Initialize()
|
||||
. = ..()
|
||||
set_light(2, 3, "#cc66ff")
|
||||
|
||||
/obj/structure/prop/statue/pillar
|
||||
|
||||
@@ -22,17 +22,14 @@
|
||||
icon_modifier = "grey_"
|
||||
icon_state = "grey_railing0"
|
||||
|
||||
/obj/structure/railing/New(loc, constructed = 0)
|
||||
..()
|
||||
/obj/structure/railing/Initialize(var/ml, constructed = 0)
|
||||
. = ..()
|
||||
// TODO - "constructed" is not passed to us. We need to find a way to do this safely.
|
||||
if (constructed) // player-constructed railings
|
||||
anchored = FALSE
|
||||
if(climbable)
|
||||
verbs += /obj/structure/proc/climb_on
|
||||
|
||||
/obj/structure/railing/Initialize()
|
||||
. = ..()
|
||||
if(src.anchored)
|
||||
if(anchored)
|
||||
update_icon(0)
|
||||
|
||||
/obj/structure/railing/Destroy()
|
||||
|
||||
@@ -22,14 +22,13 @@ FLOOR SAFES
|
||||
var/maxspace = 24 //the maximum combined w_class of stuff in the safe
|
||||
|
||||
|
||||
/obj/structure/safe/New()
|
||||
/obj/structure/safe/Initialize()
|
||||
. = ..()
|
||||
tumbler_1_pos = rand(0, 72)
|
||||
tumbler_1_open = rand(0, 72)
|
||||
|
||||
tumbler_2_pos = rand(0, 72)
|
||||
tumbler_2_open = rand(0, 72)
|
||||
|
||||
|
||||
/obj/structure/safe/Initialize()
|
||||
. = ..()
|
||||
for(var/obj/item/I in loc)
|
||||
|
||||
@@ -128,8 +128,8 @@
|
||||
name = "\improper WARNING"
|
||||
icon_state = "securearea"
|
||||
|
||||
/obj/structure/sign/warning/New()
|
||||
..()
|
||||
/obj/structure/sign/warning/Initialize()
|
||||
. = ..()
|
||||
desc = "A warning sign which reads '[name]'."
|
||||
|
||||
/obj/structure/sign/warning/airlock
|
||||
@@ -185,8 +185,8 @@
|
||||
name = "\improper LETHAL TURRETS"
|
||||
icon_state = "turrets"
|
||||
|
||||
/obj/structure/sign/warning/lethal_turrets/New()
|
||||
..()
|
||||
/obj/structure/sign/warning/lethal_turrets/Initialize()
|
||||
. = ..()
|
||||
desc += " Enter at own risk!."
|
||||
|
||||
/obj/structure/sign/warning/mail_delivery
|
||||
@@ -337,8 +337,8 @@
|
||||
//disabled this proc, it serves no purpose except to overwrite the description that already exists. may have been intended for making your own signs?
|
||||
//seems to defeat the point of having a generic directional sign that mappers could edit and use in POIs? left it here in case something breaks.
|
||||
/*
|
||||
/obj/structure/sign/directions/New()
|
||||
..()
|
||||
/obj/structure/sign/directions/Initialize()
|
||||
. = ..()
|
||||
desc = "A direction sign, pointing out the way to \the [src]."
|
||||
*/
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
hardness -= material.combustion_effect(get_turf(src),temperature, 0.3)
|
||||
CheckHardness()
|
||||
|
||||
<<<<<<< HEAD
|
||||
/obj/structure/simple_door/Initialize(mapload, var/material_name)
|
||||
. = ..()
|
||||
set_material(material_name)
|
||||
@@ -39,6 +40,17 @@
|
||||
material = get_material_by_name(material_name)
|
||||
if(!material)
|
||||
return
|
||||
=======
|
||||
/obj/structure/simple_door/Initialize(var/ml, var/material_name)
|
||||
. = ..()
|
||||
if(material_name && !material)
|
||||
material = material_name
|
||||
else if(!material)
|
||||
material = DEFAULT_WALL_MATERIAL
|
||||
if(!material)
|
||||
return INITIALIZE_HINT_QDEL
|
||||
material = get_material_by_name(material)
|
||||
>>>>>>> 2f0a618d451... /atom New() => Initialize() [MDB IGNORE] (#8298)
|
||||
hardness = max(1,round(material.integrity/10))
|
||||
icon_state = material.door_icon_base
|
||||
name = "[material.display_name] door"
|
||||
@@ -211,13 +223,13 @@
|
||||
if(3)
|
||||
hardness -= 0.1
|
||||
CheckHardness()
|
||||
return
|
||||
|
||||
/obj/structure/simple_door/process()
|
||||
if(!material.radioactivity)
|
||||
return
|
||||
SSradiation.radiate(src, round(material.radioactivity/3))
|
||||
|
||||
<<<<<<< HEAD
|
||||
/obj/structure/simple_door/iron/Initialize(mapload,var/material_name)
|
||||
..(mapload, material_name || "iron")
|
||||
|
||||
@@ -254,6 +266,40 @@
|
||||
|
||||
/obj/structure/simple_door/cult/Initialize(mapload,var/material_name)
|
||||
..(mapload, material_name || "cult")
|
||||
=======
|
||||
/obj/structure/simple_door/iron
|
||||
material = MAT_IRON
|
||||
|
||||
/obj/structure/simple_door/silver
|
||||
material = MAT_SILVER
|
||||
|
||||
/obj/structure/simple_door/gold
|
||||
material = MAT_GOLD
|
||||
|
||||
/obj/structure/simple_door/uranium
|
||||
material = MAT_URANIUM
|
||||
|
||||
/obj/structure/simple_door/sandstone
|
||||
material = MAT_SANDSTONE
|
||||
|
||||
/obj/structure/simple_door/phoron
|
||||
material = MAT_PHORON
|
||||
|
||||
/obj/structure/simple_door/diamond
|
||||
material = MAT_DIAMOND
|
||||
|
||||
/obj/structure/simple_door/wood
|
||||
material = MAT_WOOD
|
||||
|
||||
/obj/structure/simple_door/sifwood
|
||||
material = MAT_SIFWOOD
|
||||
|
||||
/obj/structure/simple_door/resin
|
||||
material = "resin"
|
||||
|
||||
/obj/structure/simple_door/cult
|
||||
material = "cult"
|
||||
>>>>>>> 2f0a618d451... /atom New() => Initialize() [MDB IGNORE] (#8298)
|
||||
|
||||
/obj/structure/simple_door/cult/TryToSwitchState(atom/user)
|
||||
if(isliving(user))
|
||||
|
||||
@@ -22,9 +22,14 @@
|
||||
var/base_icon = "bed"
|
||||
var/applies_material_colour = 1
|
||||
|
||||
<<<<<<< HEAD
|
||||
/obj/structure/bed/New(var/newloc, var/new_material, var/new_padding_material)
|
||||
..(newloc)
|
||||
color = null
|
||||
=======
|
||||
/obj/structure/bed/Initialize(var/ml, var/new_material, var/new_padding_material)
|
||||
. = ..(ml)
|
||||
>>>>>>> 2f0a618d451... /atom New() => Initialize() [MDB IGNORE] (#8298)
|
||||
if(!new_material)
|
||||
new_material = MAT_STEEL
|
||||
material = get_material_by_name(new_material)
|
||||
@@ -174,19 +179,19 @@
|
||||
icon_state = "psychbed"
|
||||
base_icon = "psychbed"
|
||||
|
||||
/obj/structure/bed/psych/New(var/newloc)
|
||||
..(newloc,"wood","leather")
|
||||
/obj/structure/bed/psych/Initialize(var/ml)
|
||||
. = ..(ml, MAT_WOOD, MAT_LEATHER)
|
||||
|
||||
/obj/structure/bed/padded/New(var/newloc)
|
||||
..(newloc,"plastic","cotton")
|
||||
/obj/structure/bed/padded/Initialize(var/ml)
|
||||
. = ..(ml, MAT_PLASTIC, MAT_CLOTH)
|
||||
|
||||
/obj/structure/bed/double
|
||||
name = "double bed"
|
||||
icon_state = "doublebed"
|
||||
base_icon = "doublebed"
|
||||
|
||||
/obj/structure/bed/double/padded/New(var/newloc)
|
||||
..(newloc,"wood","cotton")
|
||||
/obj/structure/bed/double/padded/Initialize(var/ml)
|
||||
. = ..(ml, MAT_WOOD, MAT_CLOTH)
|
||||
|
||||
/obj/structure/bed/double/post_buckle_mob(mob/living/M as mob)
|
||||
if(M.buckled == src)
|
||||
@@ -278,8 +283,8 @@
|
||||
icon_state = "rollerbed"
|
||||
var/obj/item/roller/held
|
||||
|
||||
/obj/item/roller_holder/New()
|
||||
..()
|
||||
/obj/item/roller_holder/Initialize()
|
||||
. = ..()
|
||||
held = new /obj/item/roller(src)
|
||||
|
||||
/obj/item/roller_holder/attack_self(mob/user as mob)
|
||||
|
||||
@@ -99,38 +99,38 @@
|
||||
icon_state = "comfychair"
|
||||
base_icon = "comfychair"
|
||||
|
||||
/obj/structure/bed/chair/comfy/brown/New(var/newloc,var/newmaterial)
|
||||
..(newloc,"steel","leather")
|
||||
/obj/structure/bed/chair/comfy/brown/Initialize(var/ml,var/newmaterial)
|
||||
. = ..(ml, MAT_STEEL, MAT_LEATHER)
|
||||
|
||||
/obj/structure/bed/chair/comfy/red/New(var/newloc,var/newmaterial)
|
||||
..(newloc,"steel","carpet")
|
||||
/obj/structure/bed/chair/comfy/red/Initialize(var/ml,var/newmaterial)
|
||||
. = ..(ml, MAT_STEEL, "carpet")
|
||||
|
||||
/obj/structure/bed/chair/comfy/teal/New(var/newloc,var/newmaterial)
|
||||
..(newloc,"steel","teal")
|
||||
/obj/structure/bed/chair/comfy/teal/Initialize(var/ml,var/newmaterial)
|
||||
. = ..(ml, MAT_STEEL, "teal")
|
||||
|
||||
/obj/structure/bed/chair/comfy/black/New(var/newloc,var/newmaterial)
|
||||
..(newloc,"steel","black")
|
||||
/obj/structure/bed/chair/comfy/black/Initialize(var/ml,var/newmaterial)
|
||||
. = ..(ml, MAT_STEEL, "black")
|
||||
|
||||
/obj/structure/bed/chair/comfy/green/New(var/newloc,var/newmaterial)
|
||||
..(newloc,"steel","green")
|
||||
/obj/structure/bed/chair/comfy/green/Initialize(var/ml,var/newmaterial)
|
||||
. = ..(ml, MAT_STEEL, "green")
|
||||
|
||||
/obj/structure/bed/chair/comfy/purp/New(var/newloc,var/newmaterial)
|
||||
..(newloc,"steel","purple")
|
||||
/obj/structure/bed/chair/comfy/purp/Initialize(var/ml,var/newmaterial)
|
||||
. = ..(ml, MAT_STEEL, "purple")
|
||||
|
||||
/obj/structure/bed/chair/comfy/blue/New(var/newloc,var/newmaterial)
|
||||
..(newloc,"steel","blue")
|
||||
/obj/structure/bed/chair/comfy/blue/Initialize(var/ml,var/newmaterial)
|
||||
. = ..(ml, MAT_STEEL, "blue")
|
||||
|
||||
/obj/structure/bed/chair/comfy/beige/New(var/newloc,var/newmaterial)
|
||||
..(newloc,"steel","beige")
|
||||
/obj/structure/bed/chair/comfy/beige/Initialize(var/ml,var/newmaterial)
|
||||
. = ..(ml, MAT_STEEL, "beige")
|
||||
|
||||
/obj/structure/bed/chair/comfy/lime/New(var/newloc,var/newmaterial)
|
||||
..(newloc,"steel","lime")
|
||||
/obj/structure/bed/chair/comfy/lime/Initialize(var/ml,var/newmaterial)
|
||||
. = ..(ml, MAT_STEEL, "lime")
|
||||
|
||||
/obj/structure/bed/chair/comfy/yellow/New(var/newloc,var/newmaterial)
|
||||
..(newloc,"steel","yellow")
|
||||
/obj/structure/bed/chair/comfy/yellow/Initialize(var/ml,var/newmaterial)
|
||||
. = ..(ml, MAT_STEEL, "yellow")
|
||||
|
||||
/obj/structure/bed/chair/comfy/orange/New(var/newloc,var/newmaterial)
|
||||
..(newloc,"steel","orange")
|
||||
/obj/structure/bed/chair/comfy/orange/Initialize(var/ml,var/newmaterial)
|
||||
. = ..(ml, MAT_STEEL, "orange")
|
||||
|
||||
/obj/structure/bed/chair/office
|
||||
anchored = FALSE
|
||||
@@ -210,8 +210,13 @@
|
||||
return
|
||||
..()
|
||||
|
||||
<<<<<<< HEAD
|
||||
/obj/structure/bed/chair/wood/New(var/newloc)
|
||||
..(newloc, "wood")
|
||||
=======
|
||||
/obj/structure/bed/chair/wood/Initialize(var/ml, var/newmaterial)
|
||||
. = ..(ml, MAT_WOOD)
|
||||
>>>>>>> 2f0a618d451... /atom New() => Initialize() [MDB IGNORE] (#8298)
|
||||
|
||||
/obj/structure/bed/chair/wood/wings
|
||||
icon_state = "wooden_chair_wings"
|
||||
|
||||
@@ -18,8 +18,8 @@ var/global/list/stool_cache = list() //haha stool
|
||||
/obj/item/weapon/stool/padded
|
||||
icon_state = "stool_padded_preview" //set for the map
|
||||
|
||||
/obj/item/weapon/stool/New(var/newloc, var/new_material, var/new_padding_material)
|
||||
..(newloc)
|
||||
/obj/item/weapon/stool/Initialize(var/ml, var/new_material, var/new_padding_material)
|
||||
. = ..()
|
||||
if(!new_material)
|
||||
new_material = MAT_STEEL
|
||||
material = get_material_by_name(new_material)
|
||||
@@ -31,8 +31,8 @@ var/global/list/stool_cache = list() //haha stool
|
||||
force = round(material.get_blunt_damage()*0.4)
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/stool/padded/New(var/newloc, var/new_material)
|
||||
..(newloc, "steel", "carpet")
|
||||
/obj/item/weapon/stool/padded/Initialize(var/ml, var/new_material)
|
||||
. = ..(ml, MAT_STEEL, "carpet")
|
||||
|
||||
/obj/item/weapon/stool/update_icon()
|
||||
// Prep icon.
|
||||
@@ -149,3 +149,25 @@ var/global/list/stool_cache = list() //haha stool
|
||||
remove_padding()
|
||||
else
|
||||
..()
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
/obj/item/weapon/stool/barstool
|
||||
name = "bar stool"
|
||||
desc = "Apply butt."
|
||||
icon = 'icons/obj/furniture.dmi'
|
||||
icon_state = "bar_stool_preview" //set for the map
|
||||
randpixel = 0
|
||||
center_of_mass = null
|
||||
force = 10
|
||||
throwforce = 10
|
||||
w_class = ITEMSIZE_HUGE
|
||||
base_icon = "bar_stool_base"
|
||||
anchored = 1
|
||||
|
||||
/obj/item/weapon/stool/barstool/padded
|
||||
icon_state = "bar_stool_padded_preview" //set for the map
|
||||
|
||||
/obj/item/weapon/stool/barstool/padded/Initialize(var/ml, var/new_material)
|
||||
. = ..(ml, MAT_STEEL, "carpet")
|
||||
>>>>>>> 2f0a618d451... /atom New() => Initialize() [MDB IGNORE] (#8298)
|
||||
|
||||
@@ -78,26 +78,18 @@
|
||||
|
||||
|
||||
|
||||
/obj/structure/transit_tube_pod/New(loc)
|
||||
..(loc)
|
||||
|
||||
/obj/structure/transit_tube_pod/Initialize()
|
||||
. = ..()
|
||||
air_contents.adjust_multi("oxygen", MOLES_O2STANDARD * 2, "nitrogen", MOLES_N2STANDARD)
|
||||
air_contents.temperature = T20C
|
||||
|
||||
// Give auto tubes time to align before trying to start moving
|
||||
spawn(5)
|
||||
follow_tube()
|
||||
|
||||
|
||||
|
||||
/obj/structure/transit_tube/New(loc)
|
||||
..(loc)
|
||||
addtimer(CALLBACK(src, .proc/follow_tube), 5)
|
||||
|
||||
/obj/structure/transit_tube/Initialize()
|
||||
. = ..(loc)
|
||||
if(tube_dirs == null)
|
||||
init_dirs()
|
||||
|
||||
|
||||
|
||||
/obj/structure/transit_tube/Bumped(mob/AM as mob|obj)
|
||||
var/obj/structure/transit_tube/T = locate() in AM.loc
|
||||
if(T)
|
||||
@@ -107,12 +99,6 @@
|
||||
AM.loc = src.loc
|
||||
to_chat(AM, "<span class='info'>You slip under the tube.</span>")
|
||||
|
||||
|
||||
/obj/structure/transit_tube/station/New(loc)
|
||||
..(loc)
|
||||
|
||||
|
||||
|
||||
/obj/structure/transit_tube/station/Bumped(mob/AM as mob|obj)
|
||||
if(!pod_moving && icon_state == "open" && istype(AM, /mob))
|
||||
for(var/obj/structure/transit_tube_pod/pod in loc)
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
var/w_items = 0 //the combined w_class of all the items in the cistern
|
||||
var/mob/living/swirlie = null //the mob being given a swirlie
|
||||
|
||||
/obj/structure/toilet/New()
|
||||
/obj/structure/toilet/Initialize()
|
||||
. = ..()
|
||||
open = round(rand(0, 1))
|
||||
update_icon()
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
secure = "secure_"
|
||||
icon_state = "l_secure_windoor_assembly01"
|
||||
|
||||
/obj/structure/windoor_assembly/New(Loc, start_dir=NORTH, constructed=0)
|
||||
..()
|
||||
/obj/structure/windoor_assembly/Initialize(var/ml, start_dir=NORTH, constructed=0)
|
||||
. = ..()
|
||||
if(constructed)
|
||||
state = "01"
|
||||
anchored = FALSE
|
||||
@@ -43,7 +43,6 @@
|
||||
else //If the user is facing northeast. northwest, southeast, southwest or north, default to north
|
||||
set_dir(NORTH)
|
||||
update_state()
|
||||
|
||||
update_nearby_tiles(need_rebuild=1)
|
||||
|
||||
/obj/structure/windoor_assembly/Destroy()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<<<<<<< HEAD
|
||||
/obj/structure/window
|
||||
name = "window"
|
||||
desc = "A window."
|
||||
@@ -695,3 +696,704 @@
|
||||
qdel(src)
|
||||
return TRUE
|
||||
return FALSE
|
||||
=======
|
||||
/obj/structure/window
|
||||
name = "window"
|
||||
desc = "A window."
|
||||
icon = 'icons/obj/structures.dmi'
|
||||
density = 1
|
||||
can_atmos_pass = ATMOS_PASS_PROC
|
||||
w_class = ITEMSIZE_NORMAL
|
||||
|
||||
layer = WINDOW_LAYER
|
||||
pressure_resistance = 4*ONE_ATMOSPHERE
|
||||
anchored = 1.0
|
||||
flags = ON_BORDER
|
||||
var/maxhealth = 14.0
|
||||
var/maximal_heat = T0C + 100 // Maximal heat before this window begins taking damage from fire
|
||||
var/damage_per_fire_tick = 2.0 // Amount of damage per fire tick. Regular windows are not fireproof so they might as well break quickly.
|
||||
var/health
|
||||
var/force_threshold = 0
|
||||
var/ini_dir = null
|
||||
var/state = 2
|
||||
var/reinf = 0
|
||||
var/basestate
|
||||
var/shardtype = /obj/item/weapon/material/shard
|
||||
var/glasstype = null // Set this in subtypes. Null is assumed strange or otherwise impossible to dismantle, such as for shuttle glass.
|
||||
var/silicate = 0 // number of units of silicate
|
||||
var/fulltile = FALSE // Set to true on full-tile variants.
|
||||
|
||||
/obj/structure/window/examine(mob/user)
|
||||
. = ..()
|
||||
|
||||
if(health == maxhealth)
|
||||
. += "<span class='notice'>It looks fully intact.</span>"
|
||||
else
|
||||
var/perc = health / maxhealth
|
||||
if(perc > 0.75)
|
||||
. += "<span class='notice'>It has a few cracks.</span>"
|
||||
else if(perc > 0.5)
|
||||
. += "<span class='warning'>It looks slightly damaged.</span>"
|
||||
else if(perc > 0.25)
|
||||
. += "<span class='warning'>It looks moderately damaged.</span>"
|
||||
else
|
||||
. += "<span class='danger'>It looks heavily damaged.</span>"
|
||||
if(silicate)
|
||||
if (silicate < 30)
|
||||
. += "<span class='notice'>It has a thin layer of silicate.</span>"
|
||||
else if (silicate < 70)
|
||||
. += "<span class='notice'>It is covered in silicate.</span>"
|
||||
else
|
||||
. += "<span class='notice'>There is a thick layer of silicate covering it.</span>"
|
||||
|
||||
/obj/structure/window/examine_icon()
|
||||
return icon(icon=initial(icon),icon_state=initial(icon_state))
|
||||
|
||||
/obj/structure/window/take_damage(var/damage = 0, var/sound_effect = 1)
|
||||
var/initialhealth = health
|
||||
|
||||
if(silicate)
|
||||
damage = damage * (1 - silicate / 200)
|
||||
|
||||
health = max(0, health - damage)
|
||||
|
||||
if(health <= 0)
|
||||
shatter()
|
||||
else
|
||||
if(sound_effect)
|
||||
playsound(src, 'sound/effects/Glasshit.ogg', 100, 1)
|
||||
if(health < maxhealth / 4 && initialhealth >= maxhealth / 4)
|
||||
visible_message("[src] looks like it's about to shatter!" )
|
||||
update_icon()
|
||||
else if(health < maxhealth / 2 && initialhealth >= maxhealth / 2)
|
||||
visible_message("[src] looks seriously damaged!" )
|
||||
update_icon()
|
||||
else if(health < maxhealth * 3/4 && initialhealth >= maxhealth * 3/4)
|
||||
visible_message("Cracks begin to appear in [src]!" )
|
||||
update_icon()
|
||||
return
|
||||
|
||||
/obj/structure/window/proc/apply_silicate(var/amount)
|
||||
if(health < maxhealth) // Mend the damage
|
||||
health = min(health + amount * 3, maxhealth)
|
||||
if(health == maxhealth)
|
||||
visible_message("[src] looks fully repaired." )
|
||||
else // Reinforce
|
||||
silicate = min(silicate + amount, 100)
|
||||
updateSilicate()
|
||||
|
||||
/obj/structure/window/proc/updateSilicate()
|
||||
if (overlays)
|
||||
overlays.Cut()
|
||||
update_icon()
|
||||
|
||||
var/image/img = image(src)
|
||||
img.color = "#ffffff"
|
||||
img.alpha = silicate * 255 / 100
|
||||
overlays += img
|
||||
|
||||
/obj/structure/window/proc/shatter(var/display_message = 1)
|
||||
playsound(src, "shatter", 70, 1)
|
||||
if(display_message)
|
||||
visible_message("[src] shatters!")
|
||||
new shardtype(loc)
|
||||
if(reinf)
|
||||
new /obj/item/stack/rods(loc)
|
||||
if(is_fulltile())
|
||||
new shardtype(loc) //todo pooling?
|
||||
if(reinf)
|
||||
new /obj/item/stack/rods(loc)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/window/bullet_act(var/obj/item/projectile/Proj)
|
||||
|
||||
var/proj_damage = Proj.get_structure_damage()
|
||||
if(!proj_damage) return
|
||||
|
||||
..()
|
||||
take_damage(proj_damage)
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/window/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
qdel(src)
|
||||
return
|
||||
if(2.0)
|
||||
shatter(0)
|
||||
return
|
||||
if(3.0)
|
||||
if(prob(50))
|
||||
shatter(0)
|
||||
return
|
||||
|
||||
/obj/structure/window/blob_act()
|
||||
take_damage(50)
|
||||
|
||||
/obj/structure/window/CanPass(atom/movable/mover, turf/target)
|
||||
if(istype(mover) && mover.checkpass(PASSGLASS))
|
||||
return TRUE
|
||||
if(is_fulltile())
|
||||
return FALSE //full tile window, you can't move into it!
|
||||
if((get_dir(loc, target) & dir) || (get_dir(mover, target) == turn(dir, 180)))
|
||||
return !density
|
||||
else
|
||||
return TRUE
|
||||
|
||||
/obj/structure/window/CanZASPass(turf/T, is_zone)
|
||||
if(is_fulltile() || get_dir(T, loc) == turn(dir, 180)) // Make sure we're handling the border correctly.
|
||||
return !anchored // If it's anchored, it'll block air.
|
||||
return TRUE // Don't stop airflow from the other sides.
|
||||
|
||||
/obj/structure/window/CheckExit(atom/movable/O as mob|obj, target as turf)
|
||||
if(istype(O) && O.checkpass(PASSGLASS))
|
||||
return 1
|
||||
if(get_dir(O.loc, target) == dir)
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/obj/structure/window/hitby(AM as mob|obj)
|
||||
..()
|
||||
visible_message("<span class='danger'>[src] was hit by [AM].</span>")
|
||||
var/tforce = 0
|
||||
if(ismob(AM))
|
||||
tforce = 40
|
||||
else if(isobj(AM))
|
||||
var/obj/item/I = AM
|
||||
tforce = I.throwforce
|
||||
if(reinf) tforce *= 0.25
|
||||
if(health - tforce <= 7 && !reinf)
|
||||
anchored = 0
|
||||
update_verbs()
|
||||
update_nearby_icons()
|
||||
step(src, get_dir(AM, src))
|
||||
take_damage(tforce)
|
||||
|
||||
/obj/structure/window/attack_tk(mob/user as mob)
|
||||
user.visible_message("<span class='notice'>Something knocks on [src].</span>")
|
||||
playsound(src, 'sound/effects/Glasshit.ogg', 50, 1)
|
||||
|
||||
/obj/structure/window/attack_hand(mob/user as mob)
|
||||
user.setClickCooldown(user.get_attack_speed())
|
||||
if(HULK in user.mutations)
|
||||
user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!"))
|
||||
user.visible_message("<span class='danger'>[user] smashes through [src]!</span>")
|
||||
user.do_attack_animation(src)
|
||||
shatter()
|
||||
|
||||
else if (usr.a_intent == I_HURT)
|
||||
|
||||
if (istype(usr,/mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = usr
|
||||
if(H.species.can_shred(H))
|
||||
attack_generic(H,25)
|
||||
return
|
||||
|
||||
playsound(src, 'sound/effects/glassknock.ogg', 80, 1)
|
||||
user.do_attack_animation(src)
|
||||
usr.visible_message("<span class='danger'>\The [usr] bangs against \the [src]!</span>",
|
||||
"<span class='danger'>You bang against \the [src]!</span>",
|
||||
"You hear a banging sound.")
|
||||
else
|
||||
playsound(src, 'sound/effects/glassknock.ogg', 80, 1)
|
||||
usr.visible_message("[usr.name] knocks on the [src.name].",
|
||||
"You knock on the [src.name].",
|
||||
"You hear a knocking sound.")
|
||||
return
|
||||
|
||||
/obj/structure/window/attack_generic(var/mob/user, var/damage)
|
||||
user.setClickCooldown(user.get_attack_speed())
|
||||
if(!damage)
|
||||
return
|
||||
if(damage >= STRUCTURE_MIN_DAMAGE_THRESHOLD)
|
||||
visible_message("<span class='danger'>[user] smashes into [src]!</span>")
|
||||
if(reinf)
|
||||
damage = damage / 2
|
||||
take_damage(damage)
|
||||
else
|
||||
visible_message("<span class='notice'>\The [user] bonks \the [src] harmlessly.</span>")
|
||||
user.do_attack_animation(src)
|
||||
return 1
|
||||
|
||||
/obj/structure/window/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(!istype(W)) return//I really wish I did not need this
|
||||
|
||||
// Fixing.
|
||||
if(istype(W, /obj/item/weapon/weldingtool) && user.a_intent == I_HELP)
|
||||
var/obj/item/weapon/weldingtool/WT = W
|
||||
if(health < maxhealth)
|
||||
if(WT.remove_fuel(1 ,user))
|
||||
to_chat(user, "<span class='notice'>You begin repairing [src]...</span>")
|
||||
playsound(src, WT.usesound, 50, 1)
|
||||
if(do_after(user, 40 * WT.toolspeed, target = src))
|
||||
health = maxhealth
|
||||
// playsound(src, 'sound/items/Welder.ogg', 50, 1)
|
||||
update_icon()
|
||||
to_chat(user, "<span class='notice'>You repair [src].</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>[src] is already in good condition!</span>")
|
||||
return
|
||||
|
||||
// Slamming.
|
||||
if (istype(W, /obj/item/weapon/grab) && get_dist(src,user)<2)
|
||||
var/obj/item/weapon/grab/G = W
|
||||
if(istype(G.affecting,/mob/living))
|
||||
var/mob/living/M = G.affecting
|
||||
var/state = G.state
|
||||
qdel(W) //gotta delete it here because if window breaks, it won't get deleted
|
||||
switch (state)
|
||||
if(1)
|
||||
M.visible_message("<span class='warning'>[user] slams [M] against \the [src]!</span>")
|
||||
M.apply_damage(7)
|
||||
hit(10)
|
||||
if(2)
|
||||
M.visible_message("<span class='danger'>[user] bashes [M] against \the [src]!</span>")
|
||||
if (prob(50))
|
||||
M.Weaken(1)
|
||||
M.apply_damage(10)
|
||||
hit(25)
|
||||
if(3)
|
||||
M.visible_message("<span class='danger'><big>[user] crushes [M] against \the [src]!</big></span>")
|
||||
M.Weaken(5)
|
||||
M.apply_damage(20)
|
||||
hit(50)
|
||||
return
|
||||
|
||||
if(W.flags & NOBLUDGEON) return
|
||||
|
||||
if(W.is_screwdriver())
|
||||
if(reinf && state >= 1)
|
||||
state = 3 - state
|
||||
update_nearby_icons()
|
||||
playsound(src, W.usesound, 75, 1)
|
||||
to_chat(user, "<span class='notice'>You have [state == 1 ? "un" : ""]fastened the window [state ? "from" : "to"] the frame.</span>")
|
||||
else if(reinf && state == 0)
|
||||
anchored = !anchored
|
||||
update_nearby_icons()
|
||||
update_verbs()
|
||||
playsound(src, W.usesound, 75, 1)
|
||||
to_chat(user, "<span class='notice'>You have [anchored ? "" : "un"]fastened the frame [anchored ? "to" : "from"] the floor.</span>")
|
||||
else if(!reinf)
|
||||
anchored = !anchored
|
||||
update_nearby_icons()
|
||||
update_verbs()
|
||||
playsound(src, W.usesound, 75, 1)
|
||||
to_chat(user, "<span class='notice'>You have [anchored ? "" : "un"]fastened the window [anchored ? "to" : "from"] the floor.</span>")
|
||||
else if(W.is_crowbar() && reinf && state <= 1)
|
||||
state = 1 - state
|
||||
playsound(src, W.usesound, 75, 1)
|
||||
to_chat(user, "<span class='notice'>You have pried the window [state ? "into" : "out of"] the frame.</span>")
|
||||
else if(W.is_wrench() && !anchored && (!state || !reinf))
|
||||
if(!glasstype)
|
||||
to_chat(user, "<span class='notice'>You're not sure how to dismantle \the [src] properly.</span>")
|
||||
else
|
||||
playsound(src, W.usesound, 75, 1)
|
||||
visible_message("<span class='notice'>[user] dismantles \the [src].</span>")
|
||||
var/obj/item/stack/material/mats = new glasstype(loc)
|
||||
if(is_fulltile())
|
||||
mats.amount = 4
|
||||
qdel(src)
|
||||
else if(istype(W, /obj/item/stack/cable_coil) && reinf && state == 0 && !istype(src, /obj/structure/window/reinforced/polarized))
|
||||
var/obj/item/stack/cable_coil/C = W
|
||||
if (C.use(1))
|
||||
playsound(src, 'sound/effects/sparks1.ogg', 75, 1)
|
||||
user.visible_message( \
|
||||
"<span class='notice'>\The [user] begins to wire \the [src] for electrochromic tinting.</span>", \
|
||||
"<span class='notice'>You begin to wire \the [src] for electrochromic tinting.</span>", \
|
||||
"You hear sparks.")
|
||||
if(do_after(user, 20 * C.toolspeed, src) && state == 0)
|
||||
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
var/obj/structure/window/reinforced/polarized/P = new(loc, dir)
|
||||
if(is_fulltile())
|
||||
P.fulltile = TRUE
|
||||
P.icon_state = "fwindow"
|
||||
P.maxhealth = maxhealth
|
||||
P.health = health
|
||||
P.state = state
|
||||
P.anchored = anchored
|
||||
qdel(src)
|
||||
else if(istype(W,/obj/item/frame) && anchored)
|
||||
var/obj/item/frame/F = W
|
||||
F.try_build(src, user)
|
||||
else
|
||||
user.setClickCooldown(user.get_attack_speed(W))
|
||||
if(W.damtype == BRUTE || W.damtype == BURN)
|
||||
user.do_attack_animation(src)
|
||||
hit(W.force)
|
||||
if(health <= 7)
|
||||
anchored = 0
|
||||
update_nearby_icons()
|
||||
step(src, get_dir(user, src))
|
||||
else
|
||||
playsound(src, 'sound/effects/Glasshit.ogg', 75, 1)
|
||||
..()
|
||||
return
|
||||
|
||||
/obj/structure/window/proc/hit(var/damage, var/sound_effect = 1)
|
||||
if(damage < force_threshold || force_threshold < 0)
|
||||
return
|
||||
if(reinf) damage *= 0.5
|
||||
take_damage(damage)
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/window/verb/rotate_counterclockwise()
|
||||
set name = "Rotate Window Counterclockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(usr.incapacitated())
|
||||
return 0
|
||||
|
||||
if(is_fulltile())
|
||||
return 0
|
||||
|
||||
if(anchored)
|
||||
to_chat(usr, "It is fastened to the floor therefore you can't rotate it!")
|
||||
return 0
|
||||
|
||||
update_nearby_tiles(need_rebuild=1) //Compel updates before
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
updateSilicate()
|
||||
update_nearby_tiles(need_rebuild=1)
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/window/verb/rotate_clockwise()
|
||||
set name = "Rotate Window Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(usr.incapacitated())
|
||||
return 0
|
||||
|
||||
if(is_fulltile())
|
||||
return 0
|
||||
|
||||
if(anchored)
|
||||
to_chat(usr, "It is fastened to the floor therefore you can't rotate it!")
|
||||
return 0
|
||||
|
||||
update_nearby_tiles(need_rebuild=1) //Compel updates before
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
updateSilicate()
|
||||
update_nearby_tiles(need_rebuild=1)
|
||||
return
|
||||
|
||||
/obj/structure/window/Initialize(var/ml, start_dir=null, constructed=0)
|
||||
. = ..()
|
||||
|
||||
if (start_dir)
|
||||
set_dir(start_dir)
|
||||
|
||||
//player-constructed windows
|
||||
if (constructed)
|
||||
anchored = 0
|
||||
state = 0
|
||||
update_verbs()
|
||||
|
||||
health = maxhealth
|
||||
|
||||
ini_dir = dir
|
||||
|
||||
update_nearby_tiles(need_rebuild=1)
|
||||
update_nearby_icons()
|
||||
|
||||
for(var/obj/structure/table/T in view(src, 1))
|
||||
T.update_connections()
|
||||
T.update_icon()
|
||||
|
||||
/obj/structure/window/Destroy()
|
||||
density = 0
|
||||
update_nearby_tiles()
|
||||
var/turf/location = loc
|
||||
. = ..()
|
||||
for(var/obj/structure/window/W in orange(location, 1))
|
||||
W.update_icon()
|
||||
for(var/obj/structure/table/T in view(location, 1))
|
||||
T.update_connections()
|
||||
T.update_icon()
|
||||
|
||||
/obj/structure/window/Move()
|
||||
var/ini_dir = dir
|
||||
update_nearby_tiles(need_rebuild=1)
|
||||
var/oldloc = loc
|
||||
. = ..()
|
||||
set_dir(ini_dir)
|
||||
update_nearby_tiles(need_rebuild=1)
|
||||
if(loc != oldloc)
|
||||
for(var/obj/structure/table/T in view(oldloc, 1) | view(loc, 1))
|
||||
T.update_connections()
|
||||
T.update_icon()
|
||||
|
||||
//checks if this window is full-tile one
|
||||
/obj/structure/window/proc/is_fulltile()
|
||||
return fulltile
|
||||
|
||||
/obj/structure/window/is_between_turfs(var/turf/origin, var/turf/target)
|
||||
if(fulltile)
|
||||
return TRUE
|
||||
return ..()
|
||||
|
||||
//This proc is used to update the icons of nearby windows. It should not be confused with update_nearby_tiles(), which is an atmos proc!
|
||||
/obj/structure/window/proc/update_nearby_icons()
|
||||
update_icon()
|
||||
for(var/obj/structure/window/W in orange(src, 1))
|
||||
W.update_icon()
|
||||
|
||||
//Updates the availabiliy of the rotation verbs
|
||||
/obj/structure/window/proc/update_verbs()
|
||||
if(anchored || is_fulltile())
|
||||
verbs -= /obj/structure/window/verb/rotate_counterclockwise
|
||||
verbs -= /obj/structure/window/verb/rotate_clockwise
|
||||
else if(!is_fulltile())
|
||||
verbs += /obj/structure/window/verb/rotate_counterclockwise
|
||||
verbs += /obj/structure/window/verb/rotate_clockwise
|
||||
|
||||
//merges adjacent full-tile windows into one (blatant ripoff from game/smoothwall.dm)
|
||||
/obj/structure/window/update_icon()
|
||||
//A little cludge here, since I don't know how it will work with slim windows. Most likely VERY wrong.
|
||||
//this way it will only update full-tile ones
|
||||
overlays.Cut()
|
||||
if(!is_fulltile())
|
||||
// Rotate the sprite somewhat so non-fulltiled windows can be seen as needing repair.
|
||||
var/full_tilt_degrees = 15
|
||||
var/tilt_to_apply = abs((health / maxhealth) - 1)
|
||||
if(tilt_to_apply && prob(50))
|
||||
tilt_to_apply = -tilt_to_apply
|
||||
adjust_rotation(LERP(0, full_tilt_degrees, tilt_to_apply))
|
||||
|
||||
icon_state = "[basestate]"
|
||||
return
|
||||
var/list/dirs = list()
|
||||
if(anchored)
|
||||
for(var/obj/structure/window/W in orange(src,1))
|
||||
if(W.anchored && W.density && W.glasstype == src.glasstype && W.is_fulltile()) //Only counts anchored, not-destroyed fill-tile windows.
|
||||
dirs += get_dir(src, W)
|
||||
|
||||
var/list/connections = dirs_to_corner_states(dirs)
|
||||
|
||||
icon_state = ""
|
||||
for(var/i = 1 to 4)
|
||||
var/image/I = image(icon, "[basestate][connections[i]]", dir = 1<<(i-1))
|
||||
overlays += I
|
||||
|
||||
// Damage overlays.
|
||||
var/ratio = health / maxhealth
|
||||
ratio = CEILING(ratio * 4, 1) * 25
|
||||
|
||||
if(ratio > 75)
|
||||
return
|
||||
var/image/I = image(icon, "damage[ratio]", layer = layer + 0.1)
|
||||
overlays += I
|
||||
|
||||
return
|
||||
|
||||
/obj/structure/window/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
|
||||
if(exposed_temperature > maximal_heat)
|
||||
hit(damage_per_fire_tick, 0)
|
||||
..()
|
||||
|
||||
|
||||
|
||||
/obj/structure/window/basic
|
||||
desc = "It looks thin and flimsy. A few knocks with... almost anything, really should shatter it."
|
||||
icon_state = "window"
|
||||
basestate = "window"
|
||||
glasstype = /obj/item/stack/material/glass
|
||||
maximal_heat = T0C + 100
|
||||
damage_per_fire_tick = 2.0
|
||||
maxhealth = 12.0
|
||||
force_threshold = 3
|
||||
|
||||
/obj/structure/window/basic/full
|
||||
icon_state = "window-full"
|
||||
maxhealth = 24
|
||||
fulltile = TRUE
|
||||
|
||||
/obj/structure/window/phoronbasic
|
||||
name = "phoron window"
|
||||
desc = "A borosilicate alloy window. It seems to be quite strong."
|
||||
basestate = "phoronwindow"
|
||||
icon_state = "phoronwindow"
|
||||
shardtype = /obj/item/weapon/material/shard/phoron
|
||||
glasstype = /obj/item/stack/material/glass/phoronglass
|
||||
maximal_heat = T0C + 2000
|
||||
damage_per_fire_tick = 1.0
|
||||
maxhealth = 40.0
|
||||
force_threshold = 5
|
||||
|
||||
/obj/structure/window/phoronbasic/full
|
||||
icon_state = "phoronwindow-full"
|
||||
maxhealth = 80
|
||||
fulltile = TRUE
|
||||
|
||||
/obj/structure/window/phoronreinforced
|
||||
name = "reinforced borosilicate window"
|
||||
desc = "A borosilicate alloy window, with rods supporting it. It seems to be very strong."
|
||||
basestate = "phoronrwindow"
|
||||
icon_state = "phoronrwindow"
|
||||
shardtype = /obj/item/weapon/material/shard/phoron
|
||||
glasstype = /obj/item/stack/material/glass/phoronrglass
|
||||
reinf = 1
|
||||
maximal_heat = T0C + 4000
|
||||
damage_per_fire_tick = 1.0 // This should last for 80 fire ticks if the window is not damaged at all. The idea is that borosilicate windows have something like ablative layer that protects them for a while.
|
||||
maxhealth = 80.0
|
||||
force_threshold = 10
|
||||
|
||||
/obj/structure/window/phoronreinforced/full
|
||||
icon_state = "phoronrwindow-full"
|
||||
maxhealth = 160
|
||||
fulltile = TRUE
|
||||
|
||||
/obj/structure/window/reinforced
|
||||
name = "reinforced window"
|
||||
desc = "It looks rather strong. Might take a few good hits to shatter it."
|
||||
icon_state = "rwindow"
|
||||
basestate = "rwindow"
|
||||
maxhealth = 40.0
|
||||
reinf = 1
|
||||
maximal_heat = T0C + 750
|
||||
damage_per_fire_tick = 2.0
|
||||
glasstype = /obj/item/stack/material/glass/reinforced
|
||||
force_threshold = 6
|
||||
|
||||
/obj/structure/window/reinforced/full
|
||||
icon_state = "rwindow-full"
|
||||
maxhealth = 80
|
||||
fulltile = TRUE
|
||||
|
||||
/obj/structure/window/reinforced/tinted
|
||||
name = "tinted window"
|
||||
desc = "It looks rather strong and opaque. Might take a few good hits to shatter it."
|
||||
icon_state = "twindow"
|
||||
basestate = "twindow"
|
||||
opacity = 1
|
||||
|
||||
/obj/structure/window/reinforced/tinted/frosted
|
||||
name = "frosted window"
|
||||
desc = "It looks rather strong and frosted over. Looks like it might take a few less hits then a normal reinforced window."
|
||||
icon_state = "fwindow"
|
||||
basestate = "fwindow"
|
||||
maxhealth = 30
|
||||
force_threshold = 5
|
||||
|
||||
/obj/structure/window/shuttle
|
||||
name = "shuttle window"
|
||||
desc = "It looks rather strong. Might take a few good hits to shatter it."
|
||||
icon = 'icons/obj/podwindows.dmi'
|
||||
icon_state = "window"
|
||||
basestate = "window"
|
||||
maxhealth = 40
|
||||
reinf = 1
|
||||
basestate = "w"
|
||||
dir = 5
|
||||
force_threshold = 7
|
||||
|
||||
/obj/structure/window/reinforced/polarized
|
||||
name = "electrochromic window"
|
||||
desc = "Adjusts its tint with voltage. Might take a few good hits to shatter it."
|
||||
var/id
|
||||
|
||||
/obj/structure/window/reinforced/polarized/full
|
||||
icon_state = "rwindow-full"
|
||||
maxhealth = 80
|
||||
fulltile = TRUE
|
||||
|
||||
/obj/structure/window/reinforced/polarized/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/device/multitool) && !anchored) // Only allow programming if unanchored!
|
||||
var/obj/item/device/multitool/MT = W
|
||||
// First check if they have a windowtint button buffered
|
||||
if(istype(MT.connectable, /obj/machinery/button/windowtint))
|
||||
var/obj/machinery/button/windowtint/buffered_button = MT.connectable
|
||||
src.id = buffered_button.id
|
||||
to_chat(user, "<span class='notice'>\The [src] is linked to \the [buffered_button].</span>")
|
||||
return TRUE
|
||||
// Otherwise fall back to asking them
|
||||
var/t = sanitizeSafe(input(user, "Enter the ID for the window.", src.name, null), MAX_NAME_LEN)
|
||||
if (!t && user.get_active_hand() != W && in_range(src, user))
|
||||
src.id = t
|
||||
to_chat(user, "<span class='notice'>The new ID of \the [src] is [id]</span>")
|
||||
return TRUE
|
||||
. = ..()
|
||||
|
||||
/obj/structure/window/reinforced/polarized/proc/toggle()
|
||||
if(opacity)
|
||||
animate(src, color="#FFFFFF", time=5)
|
||||
set_opacity(0)
|
||||
else
|
||||
animate(src, color="#222222", time=5)
|
||||
set_opacity(1)
|
||||
|
||||
|
||||
|
||||
/obj/machinery/button/windowtint
|
||||
name = "window tint control"
|
||||
icon = 'icons/obj/power.dmi'
|
||||
icon_state = "light0"
|
||||
desc = "A remote control switch for polarized windows."
|
||||
var/range = 7
|
||||
|
||||
/obj/machinery/button/windowtint/attack_hand(mob/user as mob)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
toggle_tint()
|
||||
|
||||
/obj/machinery/button/windowtint/proc/toggle_tint()
|
||||
use_power(5)
|
||||
|
||||
active = !active
|
||||
update_icon()
|
||||
|
||||
for(var/obj/structure/window/reinforced/polarized/W in range(src,range))
|
||||
if (W.id == src.id || !W.id)
|
||||
spawn(0)
|
||||
W.toggle()
|
||||
return
|
||||
|
||||
/obj/machinery/button/windowtint/power_change()
|
||||
..()
|
||||
if(active && !powered(power_channel))
|
||||
toggle_tint()
|
||||
|
||||
/obj/machinery/button/windowtint/update_icon()
|
||||
icon_state = "light[active]"
|
||||
|
||||
/obj/machinery/button/windowtint/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/device/multitool))
|
||||
var/obj/item/device/multitool/MT = W
|
||||
if(!id)
|
||||
// If no ID is set yet (newly built button?) let them select an ID for first-time use!
|
||||
var/t = sanitizeSafe(input(user, "Enter an ID for \the [src].", src.name, null), MAX_NAME_LEN)
|
||||
if (t && user.get_active_hand() != W && in_range(src, user))
|
||||
src.id = t
|
||||
to_chat(user, "<span class='notice'>The new ID of \the [src] is [id]</span>")
|
||||
if(id)
|
||||
// It already has an ID (or they just set one), buffer it for copying to windows.
|
||||
to_chat(user, "<span class='notice'>You store \the [src] in \the [MT]'s buffer!</span>")
|
||||
MT.connectable = src
|
||||
MT.update_icon()
|
||||
return TRUE
|
||||
. = ..()
|
||||
|
||||
/obj/structure/window/rcd_values(mob/living/user, obj/item/weapon/rcd/the_rcd, passed_mode)
|
||||
switch(passed_mode)
|
||||
if(RCD_DECONSTRUCT)
|
||||
return list(
|
||||
RCD_VALUE_MODE = RCD_DECONSTRUCT,
|
||||
RCD_VALUE_DELAY = 5 SECONDS,
|
||||
RCD_VALUE_COST = RCD_SHEETS_PER_MATTER_UNIT * 5
|
||||
)
|
||||
|
||||
/obj/structure/window/rcd_act(mob/living/user, obj/item/weapon/rcd/the_rcd, passed_mode)
|
||||
switch(passed_mode)
|
||||
if(RCD_DECONSTRUCT)
|
||||
to_chat(user, span("notice", "You deconstruct \the [src]."))
|
||||
qdel(src)
|
||||
return TRUE
|
||||
return FALSE
|
||||
>>>>>>> 2f0a618d451... /atom New() => Initialize() [MDB IGNORE] (#8298)
|
||||
|
||||
Reference in New Issue
Block a user