diff --git a/ModularTegustation/lc13_adventuredatum.dm b/ModularTegustation/lc13_adventuredatum.dm new file mode 100644 index 000000000000..a85bf41079e8 --- /dev/null +++ b/ModularTegustation/lc13_adventuredatum.dm @@ -0,0 +1,152 @@ +/*TEXT BASED ADVENTURES!!! Adventures that are mostly predefined paths. + This was difficult to finalize since i havent made a text based + adventure before. */ +/*-------------\ +|Adventure Code| +\-------------*/ +/datum/adventure_layout + var/virtual_integirty = 100 + var/virtual_coins = 1 + var/display_event = FALSE + +/datum/adventure_layout/proc/UI_Display(mob/living/carbon/human/H) + . = "|USER:[H.name]|HP:[virtual_integirty]|COINS:[virtual_coins]|
" + . += " [path_change][choice_desc]
" + + /* + This definition requires the destination of the path change, + the description of the choice, and the interface recieving this + definition. Hopefully this definition makes creating these easier. + */ +#define BUTTON_FORMAT(path_change,choice_desc,interface_caller) . += " [path_change][choice_desc]
" + +/*---------\ +|Event Code| +\---------*/ +/datum/adventure_event + //Name of adventure, displayed at top. + var/name + //Description of adventure. + var/desc + //Where the user is. + var/cords = 1 + //Discriptions of areas. If cords is 2 then B will be displayed for flavor_desc in UI_Display() + var/list/adventure_cords = list( + "A", + "B", + "C", + ) + +/*This is where most of the choices and effects will appear. + After your condition for the choice is made with + "if(cords == 2)" remember to add a return if you do not + want the continue button to appear.*/ +/datum/adventure_event/proc/EventChoiceFormat(obj/machinery/M, mob/living/carbon/human/H) + if(cords) + BUTTON_FORMAT(0,"CONTINUE", M) + +/* This proc is called by the machine in order to build the UI. + Its like a hub where all other general things are called. */ +/datum/adventure_event/proc/Event(obj/machinery/caller, mob/living/carbon/human/H) + if(cords == 0) + EventComplete(caller,H) + return + + //UI Data for machine that calls us. + . = UI_Display() + . += EventChoiceFormat(caller, H) + + if(!caller) + return "
ERROR: USERFACE SOURCE MISSING" + +/* Formating stuff such as UI display that is + returned to the calling userface such as + the events name, current cords, and + flavor text. */ +/datum/adventure_event/proc/UI_Display(mob/living/carbon/human/H) + var/flavor_desc = adventure_cords[cords] + . += "[name]:[cords]
" + . += "-----------
[flavor_desc]
-----------
" + +//Code that runs when the event is complete. Mostly resets things. +/datum/adventure_event/proc/EventComplete(obj/machinery/machine_thingly/M, mob/living/carbon/human/H) + cords = 1 + +//Called by console after a choice is recieved. +/datum/adventure_event/proc/EventReact(new_cords) + cords = new_cords + + /*------------\ + |Unique Events| + \------------*/ + +//Refrence to a shot from the early access trailer to lobotomy corp where a cowering agent is surrounded by a void of monsters. +/datum/adventure_event/legacy + name = "The Falling World" + desc = "Adrift in a dark sea is the silloette of a doorway and a cowering figure." + adventure_cords = list( + "A twisting green hue pours out from a door. Silhouetted against that light is a humanoid figure. \ +
The figure grabs their head and cowers as the edges of the room crumble away. \ +
Encircling the doorway at the edge of your visions are the writhing outline of monsters.", + //Not great story results i know -IP + "You remain silent as the shadows obscure your view of the figure", + "The figure looks towards you, and so do the shadows. You are not alone.", + ) + +/datum/adventure_event/legacy/EventChoiceFormat(obj/machinery/M, mob/living/carbon/human/H) + if(cords == 1) + BUTTON_FORMAT(2,"HIDE", M) + BUTTON_FORMAT(3,"REACH OUT", M) + return + if(cords == 3) + playsound(get_turf(H), 'sound/effects/creak1.ogg', 20, FALSE) + . = ..() + +/datum/adventure_event/match + name = "Final Match" + desc = "The window to a warm house in a chilly winters eve." + adventure_cords = list( + "You stand in the snow peering into a nicely lit home. Inside is the scene of a family \ + having dinner. Next to you is a small girl holding a box of matches, she stands there \ + watching blankly as the world ignores her.", + "The window breaks as the inside of the house erupts into flames. The warmth of the fire \ + is comforting in the bitter chill. The girl next to you smiles weakly before the fire \ + dies down leaving nothing but cold ash and burnt matches.", + //You cannot change the outcome of the story. + "You feel strangely out of place while you fish out a coin from your pocket and request a \ + match. The girl turns to you, her form starts to sizzle and burn. After handing you a \ + match she erupts into a fire that carries no warmth.", + ) + +/datum/adventure_event/match/EventChoiceFormat(obj/machinery/M, mob/living/carbon/human/H) + if(cords == 1) + BUTTON_FORMAT(2,"CONTINUE TO WATCH", M) + BUTTON_FORMAT(3,"REQUEST A MATCH", M) + return + . = ..() + +//This event is mostly based on what i THINK the creators of forsaken murderer are trying to say. -IP +/datum/adventure_event/murderer + name = "The Forsaken Killer" + desc = "A metal table and a killer ripe for the reaping." + adventure_cords = list( + "Before you is a emaciated man strapped to a table. Next to him on a metal table are \ + documents of his crimes and a medical diagram indicating the location of something \ + of value within his brain.", + "Within his brain you find what you wanted. The glee of the oppertunity to gain so much \ + passes your mind as the man slumps over, still alive but wrong... ", + "As you turn to leave the monsterous man strapped to his table you hear the muffled \ + screams and tearing of flesh. You look back at the fading scene of a shadowy woman \ + tearing out something from the mans brain.", + ) + +/datum/adventure_event/murderer/EventChoiceFormat(obj/machinery/M, mob/living/carbon/human/H) + if(cords == 1) + BUTTON_FORMAT(2,"BUTCHER THE MANS BRAIN", M) + BUTTON_FORMAT(3,"LEAVE", M) + return + if(cords == 2) + new /obj/item/coin/gold(get_turf(H)) + . = ..() + +#undef BUTTON_FORMAT diff --git a/ModularTegustation/lc13_machinery.dm b/ModularTegustation/lc13_machinery.dm index 7396bd70f18e..801cec6531e4 100644 --- a/ModularTegustation/lc13_machinery.dm +++ b/ModularTegustation/lc13_machinery.dm @@ -185,3 +185,77 @@ new type(T) break return TRUE + +/*------------------\ +|Text Adventure Code| +\------------------*/ +/obj/machinery/machine_thingly + name = "UI TEST" + desc = "UI TEST." + icon = 'icons/obj/money_machine.dmi' + icon_state = "bogdanoff" + density = TRUE + var/datum/adventure_layout/adventure_data + var/datum/adventure_event/event_data + var/list/event_options = list() + var/static/list/events = list() + +/obj/machinery/machine_thingly/Initialize() + . = ..() + if(!events.len) + for(var/_event in subtypesof(/datum/adventure_event)) + events += new _event() + event_options = events.Copy() + +/obj/machinery/machine_thingly/ui_interact(mob/user) + . = ..() + if(isliving(user)) + playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, FALSE) + + var/dat + if(!event_data) + dat += "~~~~~~~~~~
CHOOSE AN ADVENTURE
~~~~~~~~~~
" + for(var/_option in event_options) + var/datum/adventure_event/A = _option + dat += " [A.name][A.desc]
" + + //Some insane statments where the copyright should be. + dat += "~~~~~~~~~~
[pick("THE RUINS ARE CLOSING IN","THEY ALL MARCH OUTWARDS
LEAVING THE CITY BEHIND",\ + "IS THAT YOU","I REMEMBER ALL THEIR NAMES","I WILL MEND THIS SHATTERED WORLD","WHAT CANT THE BEHOLDERS SEE",\ + "THE CITY IS STARVING")]
" + else + dat += event_data.Event(src, user) + var/datum/browser/popup = new(user, "Adventure", "AdventureTest", 440, 640) + popup.set_content(dat) + popup.open() + return + +/obj/machinery/machine_thingly/Topic(href, href_list) + . = ..() + if(.) + return . + if(ishuman(usr)) + usr.set_machine(src) + add_fingerprint(usr) + if(href_list["adventure"]) + /* There must be a better way of doing this because returning + A itself just brings the name instead of the instance. -IP */ + event_data = locate(href_list["adventure"]) in event_options + playsound(get_turf(src), 'sound/machines/uplinkpurchase.ogg', 50, TRUE) + updateUsrDialog() + return TRUE + if(href_list["choice"]) + var/reaction = text2num(href_list["choice"]) + //Remotely call event reaction with our choice. + event_data.EventReact(reaction) + //Essential for refreshing the UI after completing a event. + if(reaction == 0) + PickNewEvent() + playsound(get_turf(src), 'sound/machines/pda_button2.ogg', 50, TRUE) + updateUsrDialog() + return TRUE + +//Called by event datum +/obj/machinery/machine_thingly/proc/PickNewEvent() + event_data = null + updateUsrDialog() diff --git a/lobotomy-corp13.dme b/lobotomy-corp13.dme index 39ea20ba5fa6..0e546587be48 100644 --- a/lobotomy-corp13.dme +++ b/lobotomy-corp13.dme @@ -3816,6 +3816,7 @@ #include "interface\skin.dmf" #include "ModularTegustation\engineering_bounties.dm" #include "ModularTegustation\languagebooks.dm" +#include "ModularTegustation\lc13_adventuredatum.dm" #include "ModularTegustation\lc13_machinery.dm" #include "ModularTegustation\looc.dm" #include "ModularTegustation\resindoor.dm"