Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] [MODULAR] Add: Ethereal & Synthetic Music Synthesizer #5158

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/datum/species/ethereal/on_species_gain(mob/living/carbon/human/new_ethereal, datum/species/old_species, pref_load)
. = ..()
var/datum/action/sing_tones/sing_action = new
sing_action.Grant(new_ethereal)

/datum/species/ethereal/create_pref_unique_perks()
var/list/to_add = list()

Expand All @@ -14,6 +19,12 @@
SPECIES_PERK_NAME = "Disco Ball",
SPECIES_PERK_DESC = "Ethereals passively generate their own light.",
),
list(
SPECIES_PERK_TYPE = SPECIES_POSITIVE_PERK,
SPECIES_PERK_ICON = "music",
SPECIES_PERK_NAME = "Musical Discharger",
SPECIES_PERK_DESC = "Ethereals can sing musical tones using their electric discharger.",
),
list(
SPECIES_PERK_TYPE = SPECIES_NEUTRAL_PERK,
SPECIES_PERK_ICON = "gem",
Expand Down
22 changes: 22 additions & 0 deletions modular_nova/modules/species_synthesizer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
https://github.com/NovaSector/NovaSector/pull/4531

## Title: All the emotes.

MODULE ID: species_synthesizer

### Description:

Adds an action to Synthetic and Ethereal species that allows them to synthesize music.

- Added to `modular_nova/modules/synths/code/species/synthetic.dm`:
- Edited `/datum/species/synthetic/on_species_gain()` to add the action to the mob.
- Added to `/datum/species/ethereal/create_pref_unique_perks()` to add the "Musical Discharger" species perk.

### Master File Additions

- Added to `modular_nova/master_files/code/modules/mob/living/carbon/human/species_type/ethereal.dm`:
- Overrode `/datum/species/ethereal/on_species_gain()` to add the action to the mob.
- Added to `/datum/species/synthetic/create_pref_unique_perks()` to add the "Tone Synthesizer" species perk.

### Credits:
- [@Floofies](https://github.com/Floofies)
48 changes: 48 additions & 0 deletions modular_nova/modules/species_synthesizer/sing_tones.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/datum/action/sing_tones
name = "Sing Tones"
desc = "Use your internal synthesizer to sing!"
button_icon = 'icons/obj/art/musician.dmi'
button_icon_state = "xylophone"
var/datum/song/song
/// What instruments can be used.
var/allowed_instrument_ids = list("spaceman", "meowsynth", "square", "sine", "saw")
/// Instruments added after being emagged.
var/emag_instrument_ids = list("honk")
/// Set to TRUE if already emagged.
var/emagged = FALSE

/datum/action/sing_tones/Grant(mob/grant_to)
..()
RegisterSignal(grant_to, COMSIG_SPECIES_LOSS, PROC_REF(on_species_loss))
RegisterSignal(grant_to, COMSIG_ATOM_EMAG_ACT, PROC_REF(on_emag_act))
song = new(grant_to, allowed_instrument_ids, 15)
if(isethereal(grant_to))
desc = "Use your electric discharger to sing!"

/datum/action/sing_tones/Remove(mob/remove_from)
..()
QDEL_NULL(song)
UnregisterSignal(remove_from, list(
COMSIG_SPECIES_LOSS,
COMSIG_ATOM_EMAG_ACT,
))

/datum/action/sing_tones/proc/on_species_loss(mob/living/carbon/human/human)
SIGNAL_HANDLER

qdel(src)

/datum/action/sing_tones/proc/on_emag_act(mob/living/carbon/human/source, mob/user)
SIGNAL_HANDLER

if(emagged)
return
emagged = TRUE
song.allowed_instrument_ids += emag_instrument_ids
song.set_instrument("honk")

/datum/action/sing_tones/Trigger(trigger_flags)
. = ..()
if(!.)
return
song.ui_interact(owner)
25 changes: 25 additions & 0 deletions modular_nova/modules/synths/code/species/synthetic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
var/datum/action/innate/monitor_change/screen
/// This is the screen that is given to the user after they get revived. On death, their screen is temporarily set to BSOD before it turns off, hence the need for this var.
var/saved_screen = "Blank"
/// Set to TRUE if the species was emagged before
var/emag_effect = FALSE

/datum/species/synthetic/allows_food_preferences()
return FALSE
Expand Down Expand Up @@ -87,6 +89,11 @@
/datum/species/synthetic/on_species_gain(mob/living/carbon/human/transformer)
. = ..()

RegisterSignal(transformer, COMSIG_ATOM_EMAG_ACT, PROC_REF(on_emag_act))

var/datum/action/sing_tones/sing_action = new
sing_action.Grant(transformer)

var/screen_mutant_bodypart = transformer.dna.mutant_bodyparts[MUTANT_SYNTH_SCREEN]
var/obj/item/organ/internal/eyes/eyes = transformer.get_organ_slot(ORGAN_SLOT_EYES)

Expand Down Expand Up @@ -142,6 +149,8 @@
/datum/species/synthetic/on_species_loss(mob/living/carbon/human/human)
. = ..()

UnregisterSignal(human, COMSIG_ATOM_EMAG_ACT)

var/obj/item/organ/internal/eyes/eyes = human.get_organ_slot(ORGAN_SLOT_EYES)

if(eyes)
Expand All @@ -166,6 +175,15 @@
old_stomach.moveToNullspace()
STOP_PROCESSING(SSobj, old_stomach)

/datum/species/synthetic/proc/on_emag_act(mob/living/carbon/human/source, mob/user)
SIGNAL_HANDLER

if(emag_effect)
return
emag_effect = TRUE
playsound(source.loc, 'sound/misc/interference.ogg', 50)
to_chat(source, span_warning("Alert: Security breach detected in central processing unit. Error Code: 540-EXO"))

/**
* Makes the IPC screen switch to BSOD followed by a blank screen
*
Expand Down Expand Up @@ -219,6 +237,13 @@
SPECIES_PERK_DESC = "[plural_form] can't be husked, disappointing changelings galaxy-wide.",
))

perk_descriptions += list(list(
SPECIES_PERK_TYPE = SPECIES_POSITIVE_PERK,
SPECIES_PERK_ICON = "music",
SPECIES_PERK_NAME = "Tone Synthesizer",
SPECIES_PERK_DESC = "[plural_form] can sing musical tones using an internal synthesizer.",
))

perk_descriptions += list(list(
SPECIES_PERK_TYPE = SPECIES_NEUTRAL_PERK,
SPECIES_PERK_ICON = "robot",
Expand Down
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -8560,6 +8560,7 @@
#include "modular_nova\modules\specialist_armor\code\hardened.dm"
#include "modular_nova\modules\specialist_armor\code\peacekeeper.dm"
#include "modular_nova\modules\specialist_armor\code\sacrificial.dm"
#include "modular_nova\modules\species_synthesizer\sing_tones.dm"
#include "modular_nova\modules\stasisrework\code\all_nodes.dm"
#include "modular_nova\modules\stasisrework\code\bodybag.dm"
#include "modular_nova\modules\stasisrework\code\bodybag_structure.dm"
Expand Down
Loading