Instruments Refactor and Electric Guitars

This commit is contained in:
Fox-McCloud
2017-07-02 03:52:42 -04:00
parent 4c1de5f69d
commit 0b8e61e2cc
51 changed files with 133 additions and 112 deletions
-45
View File
@@ -1,45 +0,0 @@
//copy pasta of the space piano, don't hurt me -Pete
/obj/item/device/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
burn_state = FLAMMABLE
burntime = 20
var/datum/song/handheld/song
hitsound = 'sound/effects/guitarsmash.ogg'
/obj/item/device/guitar/New()
song = new("guitar", src)
song.instrumentExt = "ogg"
/obj/item/device/guitar/Destroy()
QDEL_NULL(song)
return ..()
/obj/item/device/guitar/attack_self(mob/user as mob)
ui_interact(user)
/obj/item/device/guitar/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
if(!isliving(user) || user.incapacitated())
return
song.ui_interact(user, ui_key, ui, force_open)
/obj/item/device/guitar/ui_data(mob/user, ui_key = "main", datum/topic_state/state = default_state)
return song.ui_data(user, ui_key, state)
/obj/item/device/guitar/Topic(href, href_list)
song.Topic(href, href_list)
/datum/crafting_recipe/guitar
name = "Guitar"
result = /obj/item/device/guitar
reqs = list(/obj/item/stack/sheet/wood = 5,
/obj/item/stack/cable_coil = 6,
/obj/item/stack/tape_roll = 5)
tools = list(/obj/item/weapon/screwdriver, /obj/item/weapon/wirecutters)
time = 80
@@ -0,0 +1,103 @@
//copy pasta of the space piano, don't hurt me -Pete
/obj/item/device/instrument
name = "generic instrument"
icon = 'icons/obj/musician.dmi'
burn_state = FLAMMABLE
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_NULL(song)
return ..()
/obj/item/device/instrument/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] begins to play 'Gloomy Sunday'! It looks like \he's trying to commit suicide!</span>")
return (BRUTELOSS)
/obj/item/device/instrument/initialize(mapload)
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)
ui_interact(user)
/obj/item/device/instrument/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1)
if(!isliving(user) || user.incapacitated())
return
song.ui_interact(user, ui_key, ui, force_open)
/obj/item/device/instrument/ui_data(mob/user, ui_key = "main", datum/topic_state/state = default_state)
return song.ui_data(user, ui_key, state)
/obj/item/device/instrument/Topic(href, href_list)
song.Topic(href, href_list)
/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_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"
burn_state = LAVA_PROOF
/obj/item/device/instrument/guitar
name = "guitar"
desc = "It's made of wood and has bronze strings."
icon_state = "guitar"
item_state = "guitar"
force = 10
attack_verb = list("played metal on", "serenaded", "crashed", "smashed")
hitsound = 'sound/effects/guitarsmash.ogg'
instrumentId = "guitar"
/obj/item/device/instrument/eguitar
name = "electric guitar"
desc = "Makes all your shredding needs possible."
icon_state = "eguitar"
item_state = "eguitar"
force = 12
attack_verb = list("played metal on", "shredded", "crashed", "smashed")
hitsound = 'sound/weapons/stringsmash.ogg'
instrumentId = "eguitar"
/datum/crafting_recipe/violin
name = "Violin"
result = /obj/item/device/instrument/violin
reqs = list(/obj/item/stack/sheet/wood = 5,
/obj/item/stack/cable_coil = 6,
/obj/item/stack/tape_roll = 5)
tools = list(/obj/item/weapon/screwdriver, /obj/item/weapon/wirecutters)
time = 80
/datum/crafting_recipe/guitar
name = "Guitar"
result = /obj/item/device/instrument/guitar
reqs = list(/obj/item/stack/sheet/wood = 5,
/obj/item/stack/cable_coil = 6,
/obj/item/stack/tape_roll = 5)
tools = list(/obj/item/weapon/screwdriver, /obj/item/weapon/wirecutters)
time = 80
/datum/crafting_recipe/eguitar
name = "Electric Guitar"
result = /obj/item/device/instrument/eguitar
reqs = list(/obj/item/stack/sheet/metal = 5,
/obj/item/stack/cable_coil = 6,
/obj/item/stack/tape_roll = 5)
tools = list(/obj/item/weapon/screwdriver, /obj/item/weapon/wirecutters)
time = 80
-41
View File
@@ -1,41 +0,0 @@
//copy pasta of the space piano, don't hurt me -Pete
/obj/item/device/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"
attack_verb = list("strung", "fiddled", "tuned", "pitched")
force = 10
burn_state = FLAMMABLE
burntime = 20
hitsound = 'sound/weapons/smash.ogg'
var/datum/song/handheld/song
/obj/item/device/violin/New()
song = new("violin", src)
song.instrumentExt = "ogg"
/obj/item/device/violin/Destroy()
QDEL_NULL(song)
return ..()
/obj/item/device/violin/initialize()
song.tempo = song.sanitize_tempo(song.tempo) // tick_lag isn't set when the map is loaded
..()
/obj/item/device/violin/attack_self(mob/user as mob)
ui_interact(user)
/obj/item/device/violin/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
if(!isliving(user) || user.incapacitated())
return
song.ui_interact(user, ui_key, ui, force_open)
/obj/item/device/violin/ui_data(mob/user, ui_key = "main", datum/topic_state/state = default_state)
return song.ui_data(user, ui_key, state)
/obj/item/device/violin/Topic(href, href_list)
song.Topic(href, href_list)
@@ -88,8 +88,8 @@
/obj/item/weapon/reagent_containers/food/snacks/grown/ambrosia/deus,
/obj/item/weapon/reagent_containers/food/snacks/grown/ambrosia/vulgaris,
/obj/item/device/paicard,
/obj/item/device/violin,
/obj/item/device/guitar,
/obj/item/device/instrument/violin,
/obj/item/device/instrument/guitar,
/obj/item/weapon/storage/belt/utility/full,
/obj/item/clothing/accessory/horrible,
/obj/random/carp_plushie,
+13 -15
View File
@@ -1,14 +1,14 @@
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:32
/datum/song
var/name = "Untitled"
var/list/lines = new()
var/tempo = 5 // delay between notes
var/tempo = 5 // delay between notes
var/playing = 0 // if we're playing
var/help = 0 // if help is open
var/repeat = 0 // number of times remaining to repeat
var/max_repeat = 10 // maximum times we can repeat
var/playing = 0 // if we're playing
var/help = 0 // if help is open
var/repeat = 0 // number of times remaining to repeat
var/max_repeat = 10 // maximum times we can repeat
var/instrumentDir = "piano" // the folder with the sounds
var/instrumentExt = "ogg" // the file extension
@@ -26,7 +26,7 @@
// 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(var/note, var/acc as text, var/oct)
/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)
@@ -70,7 +70,7 @@
else
return 1
/datum/song/proc/playsong(mob/user as mob)
/datum/song/proc/playsong(mob/user)
while(repeat >= 0)
var/cur_oct[7]
var/cur_acc[7]
@@ -79,18 +79,14 @@
cur_acc[i] = "n"
for(var/line in lines)
// to_chat(world, line)
for(var/beat in splittext(lowertext(line), ","))
// to_chat(world, "beat: [beat]")
var/list/notes = splittext(beat, "/")
for(var/note in splittext(notes[1], "-"))
// to_chat(world, "note: [note]")
if(!playing || shouldStopPlaying(user))//If the instrument is playing, or special case
if(!playing || shouldStopPlaying(user)) //If the instrument is playing, or special case
playing = 0
return
if(lentext(note) == 0)
continue
// to_chat(world, "Parse: [copytext(note,1,2)]")
var/cur_note = text2ascii(note) - 96
if(cur_note < 1 || cur_note > 7)
continue
@@ -244,6 +240,7 @@
playing = 0
/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
@@ -269,6 +266,7 @@
/obj/structure/piano/New()
..()
song = new("piano", src)
if(prob(50))
@@ -304,7 +302,7 @@
song.Topic(href, href_list)
/obj/structure/piano/attackby(obj/item/O as obj, mob/user as mob, params)
if(istype(O, /obj/item/weapon/wrench))
if(iswrench(O))
if(!anchored && !isinspace())
playsound(src.loc, O.usesound, 50, 1)
to_chat(user, "<span class='notice'> You begin to tighten \the [src] to the floor...</span>")
@@ -324,4 +322,4 @@
"You hear ratchet.")
anchored = 0
else
..()
return ..()
+1 -1
View File
@@ -246,7 +246,7 @@
new /obj/item/weapon/reagent_containers/food/drinks/cans/cola(src)
/obj/item/device/guitar/jello_guitar //Antcolon3: Dan Jello
/obj/item/device/instrument/guitar/jello_guitar //Antcolon3: Dan Jello
name = "Dan Jello's Pink Guitar"
desc = "Dan Jello's special pink guitar."
icon = 'icons/obj/custom_items.dmi'
+1 -1
View File
@@ -482,7 +482,7 @@
var/obj/item/weapon/storage/pill_bottle/dice/D = new(src)
load(D)
else
var/obj/item/device/guitar/G = new(src)
var/obj/item/device/instrument/guitar/G = new(src)
load(G)
//Fans
@@ -255,8 +255,9 @@
modules += new /obj/item/weapon/reagent_containers/food/condiment/enzyme(src)
modules += new /obj/item/weapon/pen(src)
modules += new /obj/item/weapon/razor(src)
modules += new /obj/item/device/violin(src)
modules += new /obj/item/device/guitar(src)
modules += new /obj/item/device/instrument/violin(src)
modules += new /obj/item/device/instrument/guitar(src)
modules += new /obj/item/device/instrument/eguitar(src)
var/obj/item/weapon/rsf/M = new /obj/item/weapon/rsf(src)
M.matter = 30
+9 -3
View File
@@ -96,14 +96,20 @@
/datum/storeitem/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.\""
typepath = /obj/item/device/violin
typepath = /obj/item/device/instrument/violin
cost = 500
/datum/storeitem/guitar
name = "guitar"
desc = "It's made of wood and has bronze strings."
typepath = /obj/item/device/guitar
cost = 700
typepath = /obj/item/device/instrument/guitar
cost = 500
/datum/storeitem/eguitar
name = "electric guitar"
desc = "Makes all your shredding needs possible."
typepath = /obj/item/device/instrument/eguitar
cost = 500
/datum/storeitem/baby
name = "Toddler"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 KiB

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 KiB

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

+1 -2
View File
@@ -733,7 +733,7 @@
#include "code\game\objects\items\devices\flash.dm"
#include "code\game\objects\items\devices\flashlight.dm"
#include "code\game\objects\items\devices\floor_painter.dm"
#include "code\game\objects\items\devices\guitar.dm"
#include "code\game\objects\items\devices\instruments.dm"
#include "code\game\objects\items\devices\laserpointer.dm"
#include "code\game\objects\items\devices\lightreplacer.dm"
#include "code\game\objects\items\devices\machineprototype.dm"
@@ -749,7 +749,6 @@
#include "code\game\objects\items\devices\traitordevices.dm"
#include "code\game\objects\items\devices\transfer_valve.dm"
#include "code\game\objects\items\devices\uplinks.dm"
#include "code\game\objects\items\devices\violin.dm"
#include "code\game\objects\items\devices\whistle.dm"
#include "code\game\objects\items\devices\radio\beacon.dm"
#include "code\game\objects\items\devices\radio\electropack.dm"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.