mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 04:26:03 +01:00
21b4095dfd
Upstream 04/17/2026 fixes https://github.com/Bubberstation/Bubberstation/issues/5549 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: tgstation-ci[bot] <179393467+tgstation-ci[bot]@users.noreply.github.com> Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com> Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Co-authored-by: Rhials <28870487+Rhials@users.noreply.github.com> Co-authored-by: rageguy505 <54517726+rageguy505@users.noreply.github.com> Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Co-authored-by: Aliceee2ch <160794176+Aliceee2ch@users.noreply.github.com> Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com> Co-authored-by: Tsar-Salat <62388554+Tsar-Salat@users.noreply.github.com> Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Co-authored-by: Maxipat <108554989+Maxipat112@users.noreply.github.com> Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com> Co-authored-by: SimplyLogan <47579821+loganuk@users.noreply.github.com> Co-authored-by: loganuk <fakeemail123@aol.com> Co-authored-by: Leland Kemble <70413276+lelandkemble@users.noreply.github.com> Co-authored-by: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com> Co-authored-by: Roxy <75404941+TealSeer@users.noreply.github.com> Co-authored-by: Lucy <lucy@absolucy.moe> Co-authored-by: siliconOpossum <138069572+siliconOpossum@users.noreply.github.com> Co-authored-by: Isratosh <Isratosh@hotmail.com> Co-authored-by: TheRyeGuyWhoWillNowDie <70169560+TheRyeGuyWhoWillNowDie@users.noreply.github.com> Co-authored-by: Neocloudy <88008002+Neocloudy@users.noreply.github.com> Co-authored-by: Alexander V. <volas@ya.ru> Co-authored-by: ElGitificador <168473461+ElGitificador@users.noreply.github.com> Co-authored-by: Twaticus <46540570+Twaticus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> Co-authored-by: Cameron Lennox <killer65311@gmail.com> Co-authored-by: Tim <timothymtorres@gmail.com> Co-authored-by: Iamgoofball <iamgoofball@gmail.com> Co-authored-by: Layzu666 <121319428+Layzu666@users.noreply.github.com> Co-authored-by: Arturlang <24881678+Arturlang@users.noreply.github.com> Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com> Co-authored-by: mrmanlikesbt <99309552+mrmanlikesbt@users.noreply.github.com> Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com> Co-authored-by: John F. Kennedy <54908920+MacaroniCritter@users.noreply.github.com> Co-authored-by: Cursor <102828457+theselfish@users.noreply.github.com> Co-authored-by: Josh <josh.adam.powell@gmail.com> Co-authored-by: Josh Powell <josh.powell@softwire.com> Co-authored-by: Yobrocharlie <Charliemiller5617@gmail.com> Co-authored-by: Hardly3D <66234359+Hardly3D@users.noreply.github.com> Co-authored-by: shayoki <96078776+shayoki@users.noreply.github.com> Co-authored-by: LT3 <83487515+lessthnthree@users.noreply.github.com>
159 lines
5.5 KiB
Plaintext
159 lines
5.5 KiB
Plaintext
/mob/living/carbon/human/species/monkey
|
|
icon_state = "monkey" //for mapping
|
|
race = /datum/species/monkey
|
|
ai_controller = /datum/ai_controller/monkey
|
|
|
|
/mob/living/carbon/human/species/monkey/Initialize(mapload, cubespawned = FALSE, mob/spawner)
|
|
ADD_TRAIT(src, TRAIT_BORN_MONKEY, INNATE_TRAIT)
|
|
if (cubespawned)
|
|
var/cap = CONFIG_GET(number/monkeycap)
|
|
if (LAZYLEN(SSmobs.cubemonkeys) > cap)
|
|
if (spawner)
|
|
to_chat(spawner, span_warning("Bluespace harmonics prevent the spawning of more than [cap] monkeys on the station at one time!"))
|
|
return INITIALIZE_HINT_QDEL
|
|
SSmobs.cubemonkeys += src
|
|
return ..()
|
|
|
|
/mob/living/carbon/human/species/monkey/Destroy()
|
|
SSmobs.cubemonkeys -= src
|
|
return ..()
|
|
|
|
/mob/living/carbon/human/species/monkey/angry
|
|
ai_controller = /datum/ai_controller/monkey/angry
|
|
|
|
/mob/living/carbon/human/species/monkey/angry/Initialize(mapload, cubespawned = FALSE, mob/spawner)
|
|
. = ..()
|
|
if(prob(10))
|
|
INVOKE_ASYNC(src, PROC_REF(give_ape_escape_helmet))
|
|
|
|
/// Gives our funny monkey an Ape Escape hat reference
|
|
/mob/living/carbon/human/species/monkey/angry/proc/give_ape_escape_helmet()
|
|
var/obj/item/clothing/head/helmet/toggleable/justice/escape/helmet = new(src)
|
|
equip_to_slot_or_del(helmet, ITEM_SLOT_HEAD)
|
|
helmet.attack_self(src) // todo encapsulate toggle
|
|
|
|
GLOBAL_DATUM(the_one_and_only_punpun, /mob/living/carbon/human/species/monkey/punpun)
|
|
|
|
/mob/living/carbon/human/species/monkey/punpun
|
|
name = "Pun Pun" //C A N O N
|
|
unique_name = FALSE
|
|
use_random_name = FALSE
|
|
ai_controller = /datum/ai_controller/monkey/pun_pun
|
|
/// If we had one of the rare names in a past life
|
|
var/ancestor_name
|
|
/// The number of times Pun Pun has died since he was last gibbed
|
|
var/ancestor_chain = 1
|
|
var/relic_hat //Note: these two are paths
|
|
var/relic_mask
|
|
var/memory_saved = FALSE
|
|
|
|
/mob/living/carbon/human/species/monkey/punpun/Initialize(mapload)
|
|
. = ..()
|
|
|
|
REGISTER_REQUIRED_MAP_ITEM(1, 1) // pun pun is required on maps.
|
|
if(mapload && (locate(/datum/station_trait/job/pun_pun) in SSstation.station_traits))
|
|
new /obj/effect/landmark/start/pun_pun(loc) //Pun Pun is a crewmember, and may late-join.
|
|
return INITIALIZE_HINT_QDEL
|
|
|
|
equip_to_slot_or_del(new /obj/item/clothing/under/suit/waiter(src), ITEM_SLOT_ICLOTHING)
|
|
|
|
if(!GLOB.the_one_and_only_punpun && mapload)
|
|
GLOB.the_one_and_only_punpun = src
|
|
Read_Memory()
|
|
|
|
else if(GLOB.the_one_and_only_punpun)
|
|
ADD_TRAIT(src, TRAIT_DONT_WRITE_MEMORY, INNATE_TRAIT) //faaaaaaake!
|
|
|
|
// Everything past here MUST be called AFTER memory has been read
|
|
give_special_name()
|
|
give_scars()
|
|
give_special_equipment()
|
|
|
|
/mob/living/carbon/human/species/monkey/punpun/Destroy()
|
|
if(GLOB.the_one_and_only_punpun == src)
|
|
GLOB.the_one_and_only_punpun = null
|
|
|
|
return ..()
|
|
|
|
/mob/living/carbon/human/species/monkey/punpun/Life(seconds_per_tick = SSMOBS_DT)
|
|
if(!stat && SSticker.current_state == GAME_STATE_FINISHED && !memory_saved)
|
|
Write_Memory(FALSE, FALSE)
|
|
memory_saved = TRUE
|
|
|
|
return ..()
|
|
|
|
/mob/living/carbon/human/species/monkey/punpun/death(gibbed)
|
|
if(!memory_saved)
|
|
Write_Memory(TRUE, gibbed)
|
|
|
|
return ..()
|
|
|
|
/mob/living/carbon/human/species/monkey/punpun/proc/Read_Memory()
|
|
if(fexists("data/npc_saves/Punpun.sav")) //legacy compatability to convert old format to new
|
|
var/savefile/S = new /savefile("data/npc_saves/Punpun.sav")
|
|
S["ancestor_name"] >> ancestor_name
|
|
S["ancestor_chain"] >> ancestor_chain
|
|
S["relic_hat"] >> relic_hat
|
|
S["relic_mask"] >> relic_mask
|
|
fdel("data/npc_saves/Punpun.sav")
|
|
else
|
|
var/json_file = file("data/npc_saves/Punpun.json")
|
|
if(!fexists(json_file))
|
|
return
|
|
var/list/json = json_decode(file2text(json_file))
|
|
ancestor_name = json["ancestor_name"]
|
|
ancestor_chain = json["ancestor_chain"]
|
|
relic_hat = json["relic_hat"]
|
|
relic_mask = json["relic_hat"]
|
|
|
|
/mob/living/carbon/human/species/monkey/punpun/Write_Memory(dead, gibbed)
|
|
. = ..()
|
|
if(!.)
|
|
return
|
|
var/json_file = file("data/npc_saves/Punpun.json")
|
|
var/list/file_data = list()
|
|
if(gibbed)
|
|
file_data["ancestor_name"] = null
|
|
file_data["ancestor_chain"] = null
|
|
file_data["relic_hat"] = null
|
|
file_data["relic_mask"] = null
|
|
else
|
|
file_data["ancestor_name"] = ancestor_name ? ancestor_name : real_name
|
|
file_data["ancestor_chain"] = dead ? ancestor_chain + 1 : ancestor_chain
|
|
file_data["relic_hat"] = head ? head.type : null
|
|
file_data["relic_mask"] = wear_mask ? wear_mask.type : null
|
|
fdel(json_file)
|
|
WRITE_FILE(json_file, json_encode(file_data))
|
|
|
|
|
|
/// Gives pun pun a special name based on various factors such as their past
|
|
/mob/living/carbon/human/species/monkey/punpun/proc/give_special_name()
|
|
var/name_to_use = initial(name)
|
|
|
|
#ifndef UNIT_TESTS
|
|
if(ancestor_name)
|
|
name_to_use = ancestor_name
|
|
if(ancestor_chain > 1)
|
|
name_to_use += " \Roman[ancestor_chain]"
|
|
|
|
else if(prob(10))
|
|
name_to_use = pick(list("Professor Bobo", "Deempisi's Revenge", "Furious George", "King Louie", "Dr. Zaius", "Jimmy Rustles", "Dinner", "Lanky"))
|
|
if(name_to_use == "Furious George")
|
|
qdel(ai_controller)
|
|
ai_controller = new /datum/ai_controller/monkey/angry(src) //hes always mad
|
|
#endif
|
|
|
|
fully_replace_character_name(real_name, name_to_use)
|
|
|
|
/// Gives pun pun scars based on how many times he's died in the past
|
|
/mob/living/carbon/human/species/monkey/punpun/proc/give_scars()
|
|
if(ancestor_chain > 1)
|
|
generate_fake_scars(rand(ancestor_chain, ancestor_chain * 4))
|
|
|
|
/// Gives pun pun special equipment from their past
|
|
/mob/living/carbon/human/species/monkey/punpun/proc/give_special_equipment()
|
|
if(relic_hat)
|
|
equip_to_slot_or_del(new relic_hat, ITEM_SLOT_HEAD)
|
|
if(relic_mask)
|
|
equip_to_slot_or_del(new relic_mask, ITEM_SLOT_MASK)
|