Files
Bubberstation/code/game/objects/items/devices/instruments.dm
Kyle Spier-Swenson dedb16826e Speeds up world init. (93s -> 49s) (#21992)
* Speeds up world init.

* Armor is now new inited for obj and the first level of subpaths.
* Actions is now lazyinited and deleted with empty.
* Actiontypes is now only inited when actually used and deleted once it pre-fills actions with the action buttons.
* Pipes now prefill their node list(s) in new() using new /list/ (count) syntax to speed up the list initaliztions and remove the init proc.
* Pipes no longer store their item version, instead creating it on the fly when deconned
* Walls no longer store their metal stacks, instead creating it on the fly when deconned.
* obj, walls, floor, plating, item, machinery, structure, pipe, pipenet, atom, and movable no longer have an (init) proc. (along with a few other smaller examples)
* Atmos can pass checking is now a var with the ability to have a proc be call in advance cases.
  * (as a side effect, I had to fix a few things that were calling atmosCanPass rather then using the pre-calculated list, this should speed up chemfoam and flame effects greatly)

* Reverts upload limit
(remind me one day to defuck this, it could easily be a config thats not editable by vv to make changes easier)

* Makes apc update icon a bit faster.
APC new is some what high on the profile of world init, still not sure why, but this stood out as a waste of cpu so i fixed it.

* Fixes runtime with atmos backpack water tanks.

* Makes smoothing faster (and fixes turfs smoothing twice at init)

* Makes apcs init faster by replacing some spawns with addtimer

* fix transit turfs.
2016-12-08 21:50:15 +13:00

83 lines
2.6 KiB
Plaintext

//copy pasta of the space piano, don't hurt me -Pete
/obj/item/device/instrument
name = "generic instrument"
resistance_flags = FLAMMABLE
obj_integrity = 100
max_integrity = 100
var/datum/song/handheld/song
var/instrumentId = "generic"
var/instrumentExt = "ogg"
/obj/item/device/instrument/New()
song = new(instrumentId, src)
song.instrumentExt = instrumentExt
..()
/obj/item/device/instrument/Destroy()
qdel(song)
song = null
return ..()
/obj/item/device/instrument/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] begins to play 'Gloomy Sunday'! It looks like [user.p_theyre()] trying to commit suicide!</span>")
return (BRUTELOSS)
/obj/item/device/instrument/initialize()
song.tempo = song.sanitize_tempo(song.tempo) // tick_lag isn't set when the map is loaded
..()
/obj/item/device/instrument/attack_self(mob/user)
if(!user.IsAdvancedToolUser())
user << "<span class='warning'>You don't have the dexterity to do this!</span>"
return 1
interact(user)
/obj/item/device/instrument/interact(mob/user)
if(!user)
return
if(!isliving(user) || user.stat || user.restrained() || user.lying)
return
user.set_machine(src)
song.interact(user)
/obj/item/device/instrument/violin
name = "space violin"
desc = "A wooden musical instrument with four strings and a bow. \"The devil went down to space, he was looking for an assistant to grief.\""
icon = 'icons/obj/musician.dmi'
icon_state = "violin"
item_state = "violin"
force = 10
hitsound = "swing_hit"
instrumentId = "violin"
/obj/item/device/instrument/violin/golden
name = "golden violin"
desc = "A golden musical instrument with four strings and a bow. \"The devil went down to space, he was looking for an assistant to grief.\""
icon_state = "golden_violin"
item_state = "golden_violin"
resistance_flags = LAVA_PROOF | FIRE_PROOF | ACID_PROOF
/obj/item/device/instrument/guitar
name = "guitar"
desc = "It's made of wood and has bronze strings."
icon = 'icons/obj/musician.dmi'
icon_state = "guitar"
item_state = "guitar"
force = 10
attack_verb = list("played metal on", "serenaded", "crashed", "smashed")
hitsound = 'sound/weapons/stringsmash.ogg'
instrumentId = "guitar"
/obj/item/device/instrument/eguitar
name = "electric guitar"
desc = "Makes all your shredding needs possible."
icon = 'icons/obj/musician.dmi'
icon_state = "eguitar"
item_state = "eguitar"
force = 12
attack_verb = list("played metal on", "shredded", "crashed", "smashed")
hitsound = 'sound/weapons/stringsmash.ogg'
instrumentId = "eguitar"