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

Tutorial System #4442

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d69794a
basic tutorial system complete
Zonespace27 Sep 19, 2023
4a37897
improvements
Zonespace27 Sep 19, 2023
681851b
updated .md
Zonespace27 Sep 19, 2023
e7677ff
silent cryopod
Zonespace27 Sep 19, 2023
fdc0207
example tutorial added
Zonespace27 Sep 19, 2023
77d9929
WIP
Zonespace27 Sep 19, 2023
81161cd
(sort of) requested changes
Zonespace27 Sep 19, 2023
eab595b
better menu system
Zonespace27 Sep 19, 2023
9aefc3b
insurance
Zonespace27 Sep 19, 2023
501a26e
loc_from_corner addition
Zonespace27 Sep 19, 2023
52cd01e
basic SS13 tutorial, likely needs expansion
Zonespace27 Sep 20, 2023
076864d
nearly-done intents tutorial
Zonespace27 Sep 20, 2023
8eb3c6a
Mildly improved TGUI, still not done
Zonespace27 Sep 20, 2023
9ca44d7
Merge branch 'tutorial-system' of https://github.com/Zonespace27/cmss…
Zonespace27 Sep 20, 2023
2960762
save system and some cleanup
Zonespace27 Sep 22, 2023
c83b8ae
documentation
Zonespace27 Sep 22, 2023
f179463
Merge branch 'master' of https://github.com/cmss13-devs/cmss13 into t…
Zonespace27 Sep 27, 2023
319456d
mistake
Zonespace27 Sep 27, 2023
c0116c6
wip medical
Zonespace27 Sep 28, 2023
eba9309
whole bunch of junk
Zonespace27 Sep 28, 2023
ffc5893
buncha changes
Zonespace27 Oct 12, 2023
7eacd71
linters stop screaming
Zonespace27 Oct 12, 2023
f71f775
good for tm
Zonespace27 Oct 12, 2023
b23281c
insurance
Zonespace27 Oct 12, 2023
f6cc4d9
ui resize
Zonespace27 Oct 12, 2023
6ade0bd
million changes at once
Zonespace27 Oct 13, 2023
db7e09c
tutorial-fixem
Zonespace27 Oct 15, 2023
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
2 changes: 2 additions & 0 deletions code/__DEFINES/access.dm
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ most of them are tied into map-placed objects. This should be reworked in the fu
/// Ancients only
#define ACCESS_YAUTJA_ANCIENT 392

/// Anything in a tutorial sequence that shouldn't be accessed
#define ACCESS_TUTORIAL_LOCKED 998
///Temporary, just so I can flag places I need to change
#define ACCESS_COME_BACK_TO_ME 999

Expand Down
3 changes: 3 additions & 0 deletions code/__DEFINES/dcs/signals/atom/mob/living/signals_human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,6 @@
#define COMSIG_HUMAN_SURGERY_APPLY_MODIFIERS "human_surgery_apply_modifiers"
/// From /mob/living/carbon/human/proc/get_flags_cold_protection()
#define COMSIG_HUMAN_COLD_PROTECTION_APPLY_MODIFIERS "human_cold_protection_apply_modifiers"

/// From /obj/item/proc/dig_out_shrapnel() : ()
#define COMSIG_HUMAN_SHRAPNEL_REMOVED "human_shrapnel_removed"
9 changes: 9 additions & 0 deletions code/__DEFINES/dcs/signals/atom/mob/living/signals_living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,12 @@
/// From /mob/living/Collide(): (atom/A)
#define COMSIG_LIVING_PRE_COLLIDE "living_pre_collide"
#define COMPONENT_LIVING_COLLIDE_HANDLED (1<<0)

/// From /mob/living/proc/do_ghost() : (mob/dead/observer/ghost)
#define COMSIG_LIVING_GHOSTED "living_ghosted"

/// From /mob/living/carbon/human/attack_hand() : (mob/living/carbon/human/attacked_mob)
#define COMSIG_LIVING_ATTACKHAND_HUMAN "living_attackhand_human"

/// From /obj/item/reagent_container/hypospray/attack() : (obj/item/reagent_container/hypospray/injector)
#define COMSIG_LIVING_HYPOSPRAY_INJECTED "living_hypospray_injected"
39 changes: 39 additions & 0 deletions code/__DEFINES/dcs/signals/atom/mob/signals_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,42 @@

/// From /obj/item/proc/pickup() : (obj/item/picked_up)
#define COMSIG_MOB_PICKUP_ITEM "mob_pickup_item"

/// From /obj/item/proc/attack_self() : (obj/item/used)
#define COMSIG_MOB_ITEM_ATTACK_SELF "mob_item_attack_self"

/// From /obj/item/proc/dropped() : (obj/item/dropped)
#define COMSIG_MOB_ITEM_DROPPED "mob_item_dropped"


/// From /obj/item/reagent_container/food/snacks/proc/on_Consume() : (obj/item/reagent_container/food/snacks/eaten_food)
#define COMSIG_MOB_EATEN_SNACK "mob_eaten_snack"

/// From /atom/proc/attackby() : (atom/attacked, obj/item/attacked_with)
#define COMSIG_MOB_PARENT_ATTACKBY "mob_parent_attackby"

/// From /obj/item/weapon/gun/proc/reload_into_chamber() : (obj/item/weapon/gun/empty_gun)
#define COMSIG_MOB_GUN_EMPTY "mob_gun_empty"

/// From /obj/item/weapon/gun/proc/reload() : (obj/item/weapon/gun/reloaded)
#define COMSIG_MOB_RELOADED_GUN "mob_reloaded_gun"

/// From /mob/proc/get_status_tab_items() : (list/status_list)
#define COMSIG_MOB_GET_STATUS_TAB_ITEMS "mob_get_status_tab_items"

/// From /datum/tutorial/proc/update_objective() : (new_objective)
#define COMSIG_MOB_TUTORIAL_UPDATE_OBJECTIVE "mob_tutorial_update_objective"

/// From /mob/proc/swap_hand() : ()
#define COMSIG_MOB_SWAPPED_HAND "mob_swapped_hand"

/// From /mob/proc/a_intent_change() : (new_intent)
#define COMSIG_MOB_INTENT_CHANGE "mob_intent_change"

/// From /obj/item/grab/proc/progress_aggressive() : (mob/living/carbon/human/choker)
#define COMSIG_MOB_CHOKEHELD "mob_chokeheld"
#define COMSIG_MOB_CHOKEHELD_CANCEL (1<<0)

/// From /obj/item/grab/proc/progress_passive() : (mob/living/carbon/human/grabber)
#define COMSIG_MOB_AGGRESSIVELY_GRABBED "mob_aggressively_grabbed"
#define COMSIG_MOB_AGGRESIVE_GRAB_CANCEL (1<<0)
9 changes: 9 additions & 0 deletions code/__DEFINES/dcs/signals/atom/signals_obj.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,12 @@

/// from /obj/proc/afterbuckle()
#define COSMIG_OBJ_AFTER_BUCKLE "signal_obj_after_buckle"

/// from /obj/structure/machinery/cryopod/go_out()
#define COMSIG_CRYOPOD_GO_OUT "cryopod_go_out"

/// from /proc/vendor_successful_vend() : (obj/structure/machinery/cm_vending/vendor, list/itemspec, mob/living/carbon/human/user)
#define COMSIG_VENDOR_SUCCESSFUL_VEND "vendor_successful_vend"

/// from /obj/limb/proc/remove_all_bleeding() : (external, internal)
#define COMSIG_LIMB_STOP_BLEEDING "limb_stop_bleeding"
1 change: 1 addition & 0 deletions code/__DEFINES/mob.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define DEFAULT_MOB_STATUS_FLAGS CANKNOCKDOWN|CANPUSH|STATUS_FLAGS_DEBILITATE
5 changes: 5 additions & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@
#define TRAIT_HARDCORE "t_hardcore"
/// If the mob is able to use the vulture rifle or spotting scope
#define TRAIT_VULTURE_USER "t_vulture_user"
/// If the mob is currently loading a tutorial
#define TRAIT_IN_TUTORIAL "t_IN_TUTORIAL"
/// If the mob is cloaked in any form
#define TRAIT_CLOAKED "t_cloaked"

Expand Down Expand Up @@ -252,6 +254,7 @@ GLOBAL_LIST_INIT(mob_traits, list(
TRAIT_REAGENT_SCANNER,
TRAIT_ABILITY_BURROWED,
TRAIT_VULTURE_USER,
TRAIT_IN_TUTORIAL,
))

/*
Expand Down Expand Up @@ -351,6 +354,8 @@ GLOBAL_LIST(trait_name_map)
#define TRAIT_SOURCE_JOB "t_s_job"
///Status trait forced by staff
#define TRAIT_SOURCE_ADMIN "t_s_admin"
/// Status trait coming from a tutorial
#define TRAIT_SOURCE_TUTORIAL "t_s_tutorials"
///Status trait coming from equipment
#define TRAIT_SOURCE_EQUIPMENT(slot) "t_s_equipment_[slot]"
///Status trait coming from skill
Expand Down
6 changes: 6 additions & 0 deletions code/__DEFINES/tutorial.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#define TUTORIAL_ATOM_FROM_TRACKING(path, varname) var##path/##varname = tracking_atoms[##path]

#define TUTORIAL_CATEGORY_BASE "Base" // Shouldn't be used outside of base types
#define TUTORIAL_CATEGORY_SS13 "Space Station 13"
#define TUTORIAL_CATEGORY_MARINE "Marine"
#define TUTORIAL_CATEGORY_XENO "Xenomorph"
1 change: 0 additions & 1 deletion code/__HELPERS/level_traits.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#define is_admin_level(z) SSmapping.level_trait(z, ZTRAIT_ADMIN)

#define is_ground_level(z) SSmapping.level_trait(z, ZTRAIT_GROUND)
Expand Down
12 changes: 12 additions & 0 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2093,3 +2093,15 @@ GLOBAL_LIST_INIT(duplicate_forbidden_vars,list(

if(NORTHWEST)
return list(NORTHWEST, NORTH, WEST)

/// Returns TRUE if the target is somewhere that the game should not interact with if possible
/// In this case, admin Zs and tutorial areas
/proc/should_block_game_interaction(atom/target)
if(is_admin_level(target.z))
return TRUE

var/area/target_area = get_area(target)
if(target_area?.block_game_interaction)
return TRUE

return FALSE
2 changes: 2 additions & 0 deletions code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/obj/item/proc/attack_self(mob/user)
SHOULD_CALL_PARENT(TRUE)
SEND_SIGNAL(src, COMSIG_ITEM_ATTACK_SELF, user)
SEND_SIGNAL(user, COMSIG_MOB_ITEM_ATTACK_SELF, src)

if(flags_item & CAN_DIG_SHRAPNEL && ishuman(user))
dig_out_shrapnel(user)
Expand All @@ -11,6 +12,7 @@
/atom/proc/attackby(obj/item/W, mob/living/user,list/mods)
if(SEND_SIGNAL(src, COMSIG_PARENT_ATTACKBY, W, user, mods) & COMPONENT_NO_AFTERATTACK)
return TRUE
SEND_SIGNAL(user, COMSIG_MOB_PARENT_ATTACKBY, src, W)
return FALSE

/atom/movable/attackby(obj/item/W, mob/living/user)
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
if(ismob(target) || isVehicle(target))
if(isxeno(target) && SSticker.mode.check_xeno_late_join(src)) //if it's a xeno and all checks are alright, we are gonna try to take their body
var/mob/living/carbon/xenomorph/xeno = target
if(xeno.stat == DEAD || is_admin_level(xeno.z) || xeno.aghosted)
if(xeno.stat == DEAD || should_block_game_interaction(xeno) || xeno.aghosted)
to_chat(src, SPAN_WARNING("You cannot join as [xeno]."))
do_observe(xeno)
return FALSE
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/xeno.dm
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ so that it doesn't double up on the delays) so that it applies the delay immedia
if(alt_pressed && shift_pressed)
if(istype(target, /mob/living/carbon/xenomorph))
var/mob/living/carbon/xenomorph/xeno = target
if(!QDELETED(xeno) && xeno.stat != DEAD && !is_admin_level(xeno.z) && xeno.check_state(TRUE) && xeno.hivenumber == hivenumber)
if(!QDELETED(xeno) && xeno.stat != DEAD && !should_block_game_interaction(xeno) && xeno.check_state(TRUE) && xeno.hivenumber == hivenumber)
overwatch(xeno)
next_move = world.time + 3 // Some minimal delay so this isn't crazy spammy
return TRUE
Expand Down
1 change: 1 addition & 0 deletions code/controllers/subsystem/ticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ SUBSYSTEM_DEF(ticker)

var/totalPlayers = 0 //used for pregame stats on statpanel
var/totalPlayersReady = 0 //used for pregame stats on statpanel
var/tutorial_disabled = FALSE //zonenote

/datum/controller/subsystem/ticker/Initialize(timeofday)
load_mode()
Expand Down
25 changes: 25 additions & 0 deletions code/datums/components/tutorial_status.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/datum/component/tutorial_status
dupe_mode = COMPONENT_DUPE_UNIQUE
/// What the mob's current tutorial status is, displayed in the status panel
var/tutorial_status = ""

/datum/component/tutorial_status/Initialize()
. = ..()
if(!ismob(parent))
return COMPONENT_INCOMPATIBLE

/datum/component/tutorial_status/RegisterWithParent()
..()
RegisterSignal(parent, COMSIG_MOB_TUTORIAL_UPDATE_OBJECTIVE, PROC_REF(update_objective))
RegisterSignal(parent, COMSIG_MOB_GET_STATUS_TAB_ITEMS, PROC_REF(get_status_tab_item))

/datum/component/tutorial_status/proc/update_objective(datum/source, objective_text)
SIGNAL_HANDLER

tutorial_status = objective_text

/datum/component/tutorial_status/proc/get_status_tab_item(datum/source, list/status_tab_items)
SIGNAL_HANDLER

if(tutorial_status)
status_tab_items += "Tutorial Objective: " + tutorial_status
4 changes: 2 additions & 2 deletions code/datums/datacore.dm
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new)
sleep(40)

var/list/jobs_to_check = ROLES_CIC + ROLES_AUXIL_SUPPORT + ROLES_MISC + ROLES_POLICE + ROLES_ENGINEERING + ROLES_REQUISITION + ROLES_MEDICAL + ROLES_MARINES
for(var/mob/living/carbon/human/H in GLOB.human_mob_list)
if(is_admin_level(H.z))
for(var/mob/living/carbon/human/H as anything in GLOB.human_mob_list)
if(should_block_game_interaction(H))
continue
if(H.job in jobs_to_check)
manifest_inject(H)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/helper_datums/teleport.dm
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
teleatom.visible_message(SPAN_DANGER("<B>The [teleatom] bounces off of the portal!</B>"))
return 0

if(is_admin_level(destination.z))
if(should_block_game_interaction(destination))
if(length(teleatom.search_contents_for(/obj/item/storage/backpack/holding)))
teleatom.visible_message(SPAN_DANGER("<B>The Bag of Holding bounces off of the portal!</B>"))
return 0
Expand Down
3 changes: 2 additions & 1 deletion code/datums/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
msg_admin_niche("[key]/[ckey] has tried to transfer to deleted [new_character].")
return

SEND_SIGNAL(current.client, COMSIG_CLIENT_MIND_TRANSFER, new_character)
if(current.client)
SEND_SIGNAL(current.client, COMSIG_CLIENT_MIND_TRANSFER, new_character)

if(current)
current.mind = null //remove ourself from our old body's mind variable
Expand Down
Loading