Files
Bubberstation/code/game/objects/items/granters/_granters.dm
grungussuss 58501dce77 Reorganizes the sound folder (#86726)
## About The Pull Request

<details>

- renamed ai folder to announcer

-- announcer --
- moved vox_fem to announcer
- moved approachingTG to announcer

- separated the ambience folder into ambience and instrumental
-- ambience --

- created holy folder moved all related sounds there
- created engineering folder and moved all related sounds there
- created security folder and moved ambidet there
- created general folder and moved ambigen there
- created icemoon folder and moved all icebox-related ambience there
- created medical folder and moved all medbay-related ambi there
- created ruin folder and moves all ruins ambi there
- created beach folder and moved seag and shore there
- created lavaland folder and moved related ambi there
- created aurora_caelus folder and placed its ambi there
- created misc folder and moved the rest of the files that don't have a
specific category into it

-- instrumental --

- moved traitor folder here
- created lobby_music folder and placed our songs there (title0 not used
anywhere? - server-side modification?)

-- items --

- moved secdeath to hailer
- moved surgery to handling

-- effects --

- moved chemistry into effects
- moved hallucinations into effects
- moved health into effects
- moved magic into effects

-- vehicles --

- moved mecha into vehicles


created mobs folder

-- mobs --

- moved creatures folder into mobs
- moved voice into mobs

renamed creatures to non-humanoids
renamed voice to humanoids

-- non-humanoids--

created cyborg folder
created hiss folder
moved harmalarm.ogg to cyborg

-- humanoids --




-- misc --

moved ghostwhisper to misc
moved insane_low_laugh to misc

I give up trying to document this.

</details>

- [X] ambience
- [x] announcer
- [x] effects
- [X] instrumental
- [x] items
- [x] machines
- [x] misc 
- [X] mobs
- [X] runtime
- [X] vehicles

- [ ] attributions

## Why It's Good For The Game

This folder is so disorganized that it's vomit inducing, will make it
easier to find and add new sounds, providng a minor structure to the
sound folder.

## Changelog
🆑 grungussuss
refactor: the sound folder in the source code has been reorganized,
please report any oddities with sounds playing or not playing
server: lobby music has been repathed to sound/music/lobby_music
/🆑
2024-09-23 22:24:50 -07:00

111 lines
3.6 KiB
Plaintext

/**
* Books that teach things.
*
* (Intrinsic actions like bar flinging, spells like fireball or smoke, or martial arts)
*/
/obj/item/book/granter
due_date = 0
unique = TRUE
/// Flavor messages displayed to mobs reading the granter
var/list/remarks = list()
/// Controls how long a mob must keep the book in his hand to actually successfully learn
var/pages_to_mastery = 3
/// Sanity, whether it's currently being read
var/reading = FALSE
/// The amount of uses on the granter.
var/uses = 1
/// The time it takes to read the book
var/reading_time = 5 SECONDS
/// The sounds played as the user's reading the book.
var/list/book_sounds = list(
'sound/effects/page_turn/pageturn1.ogg',
'sound/effects/page_turn/pageturn2.ogg',
'sound/effects/page_turn/pageturn3.ogg',
)
/obj/item/book/granter/attack_self(mob/living/user)
if(reading)
to_chat(user, span_warning("You're already reading this!"))
return FALSE
if(user.is_blind())
to_chat(user, span_warning("You are blind and can't read anything!"))
return FALSE
if(!isliving(user) || !user.can_read(src))
return FALSE
if(!can_learn(user))
return FALSE
if(uses <= 0)
recoil(user)
return FALSE
if(!on_reading_start(user))
return
reading = TRUE
for(var/i in 1 to pages_to_mastery)
if(!turn_page(user))
on_reading_stopped()
reading = FALSE
return
if(do_after(user, reading_time, src))
uses--
on_reading_finished(user)
reading = FALSE
return TRUE
/// Called when the user starts to read the granter.
/obj/item/book/granter/proc/on_reading_start(mob/living/user)
to_chat(user, span_notice("You start reading [name]..."))
return TRUE
/// Called when the reading is interrupted without finishing.
/obj/item/book/granter/proc/on_reading_stopped(mob/living/user)
to_chat(user, span_notice("You stop reading..."))
/// Called when the reading is completely finished. This is where the actual granting should happen.
/obj/item/book/granter/proc/on_reading_finished(mob/living/user)
to_chat(user, span_notice("You finish reading [name]!"))
/// The actual "turning over of the page" flavor bit that happens while someone is reading the granter.
/obj/item/book/granter/proc/turn_page(mob/living/user)
playsound(user, pick(book_sounds), 30, TRUE)
if(!do_after(user, reading_time, src))
return FALSE
to_chat(user, span_notice("[length(remarks) ? pick(remarks) : "You keep reading..."]"))
return TRUE
/// Effects that occur whenever the book is read when it has no uses left.
/obj/item/book/granter/proc/recoil(mob/living/user)
/// Checks if the user can learn whatever this granter... grants
/obj/item/book/granter/proc/can_learn(mob/living/user)
return TRUE
// Generic action giver
/obj/item/book/granter/action
/// The typepath of action that is given
var/datum/action/granted_action
/// The name of the action, formatted in a more text-friendly way.
var/action_name = ""
/obj/item/book/granter/action/can_learn(mob/living/user)
if(!granted_action)
CRASH("Someone attempted to learn [type], which did not have an action set.")
if(locate(granted_action) in user.actions)
to_chat(user, span_warning("You already know all about [action_name]!"))
return FALSE
return TRUE
/obj/item/book/granter/action/on_reading_start(mob/living/user)
to_chat(user, span_notice("You start reading about [action_name]..."))
return TRUE
/obj/item/book/granter/action/on_reading_finished(mob/living/user)
to_chat(user, span_notice("You feel like you've got a good handle on [action_name]!"))
// Action goes on the mind as the user actually learns the thing in your brain
var/datum/action/new_action = new granted_action(user.mind || user)
new_action.Grant(user)