diff --git a/code/__DEFINES/admin.dm b/code/__DEFINES/admin.dm index 0b2764c4a7..198356f804 100644 --- a/code/__DEFINES/admin.dm +++ b/code/__DEFINES/admin.dm @@ -74,6 +74,7 @@ #define ADMIN_PUNISHMENT_MAZING "Puzzle" #define ADMIN_PUNISHMENT_PIE "Cream Pie" #define ADMIN_PUNISHMENT_CUSTOM_PIE "Custom Cream Pie" +#define ADMIN_PUNISHMENT_SHOES "Knot Shoes" #define ADMIN_PUNISHMENT_CRACK ":B:oneless" #define ADMIN_PUNISHMENT_BLEED ":B:loodless" #define ADMIN_PUNISHMENT_SCARIFY "Scarify" diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index 071dab20b1..120fdcb72d 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -535,4 +535,9 @@ GLOBAL_LIST_INIT(pda_reskins, list(PDA_SKIN_CLASSIC = 'icons/obj/pda.dmi', PDA_S #define LOOT_RESTRICTION_MIND_PILE 3 //limited to the current pile. #define LOOT_RESTRICTION_CKEY_PILE 4 //Idem +//stages of shoe tying-ness +#define SHOES_UNTIED 0 +#define SHOES_TIED 1 +#define SHOES_KNOTTED 2 + #define WANTED_FILE "wanted_message.json" diff --git a/code/__HELPERS/do_after.dm b/code/__HELPERS/do_after.dm index 84a818649a..30d40f3867 100644 --- a/code/__HELPERS/do_after.dm +++ b/code/__HELPERS/do_after.dm @@ -167,6 +167,7 @@ var/target_loc = target.loc LAZYADD(user.do_afters, target) + LAZYADD(target.targeted_by, user) var/holding = user.get_active_held_item() var/datum/progressbar/progbar @@ -189,6 +190,10 @@ . = FALSE break + if(!(target in user.do_afters)) + . = FALSE + break + if(drifting && !user.inertia_dir) drifting = 0 user_loc = user.loc @@ -198,8 +203,10 @@ break if(progress) qdel(progbar) + if(!QDELETED(target)) LAZYREMOVE(user.do_afters, target) + LAZYREMOVE(target.targeted_by, user) //some additional checks as a callback for for do_afters that want to break on losing health or on the mob taking action /mob/proc/break_do_after_checks(list/checked_health, check_clicks) @@ -224,6 +231,7 @@ if(target) LAZYADD(user.do_afters, target) + LAZYADD(target.targeted_by, user) var/atom/Uloc = user.loc @@ -288,6 +296,10 @@ if(!QDELETED(target)) LAZYREMOVE(user.do_afters, target) + if(!QDELETED(target)) + LAZYREMOVE(user.do_afters, target) + LAZYREMOVE(target.targeted_by, user) + /mob/proc/do_after_coefficent() // This gets added to the delay on a do_after, default 1 . = 1 return @@ -307,6 +319,7 @@ for(var/atom/target in targets) originalloc[target] = target.loc LAZYADD(user.do_afters, target) + LAZYADD(target.targeted_by, user) var/holding = user.get_active_held_item() var/datum/progressbar/progbar @@ -341,3 +354,4 @@ var/atom/target = thing if(!QDELETED(target)) LAZYREMOVE(user.do_afters, target) + LAZYREMOVE(target.targeted_by, user) diff --git a/code/_onclick/hud/alert.dm b/code/_onclick/hud/alert.dm index 9182360c5d..3942d96f29 100644 --- a/code/_onclick/hud/alert.dm +++ b/code/_onclick/hud/alert.dm @@ -22,7 +22,7 @@ if(alerts[category]) thealert = alerts[category] if(thealert.override_alerts) - return 0 + return thealert if(new_master && new_master != thealert.master) WARNING("[src] threw alert [category] with new_master [new_master] while already having that alert with master [thealert.master]") @@ -36,7 +36,7 @@ clear_alert(category) return .() else //no need to update - return 0 + return thealert else thealert = new type() thealert.override_alerts = override @@ -610,6 +610,23 @@ so as to remain in compliance with the most up-to-date laws." L.MarkResistTime() return L.resist_buckle() +/obj/screen/alert/shoes/untied + name = "Untied Shoes" + desc = "Your shoes are untied! Click the alert or your shoes to tie them." + icon_state = "shoealert" + +/obj/screen/alert/shoes/knotted + name = "Knotted Shoes" + desc = "Someone tied your shoelaces together! Click the alert or your shoes to undo the knot." + icon_state = "shoealert" + +/obj/screen/alert/shoes/Click() + var/mob/living/carbon/C = usr + if(!istype(C) || !C.can_resist() || C != mob_viewer || !C.shoes) + return + C.changeNext_move(CLICK_CD_RESIST) + C.shoes.handle_tying(C) + // PRIVATE = only edit, use, or override these if you're editing the system as a whole // Re-render all alerts - also called in /datum/hud/show_hud() because it's needed there diff --git a/code/datums/mood_events/generic_negative_events.dm b/code/datums/mood_events/generic_negative_events.dm index a2078a82e4..787d6375a7 100644 --- a/code/datums/mood_events/generic_negative_events.dm +++ b/code/datums/mood_events/generic_negative_events.dm @@ -274,3 +274,13 @@ description = "I've produced better art than that from my ass.\n" mood_change = -2 timeout = 1200 + +/datum/mood_event/tripped + description = "I can't believe I fell for the oldest trick in the book!\n" + mood_change = -6 + timeout = 2 MINUTES + +/datum/mood_event/untied + description = "I hate when my shoes come untied!\n" + mood_change = -3 + timeout = 1 MINUTES diff --git a/code/game/atoms.dm b/code/game/atoms.dm index c28f1e2a82..de9df3a23e 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -70,6 +70,9 @@ /// A luminescence-shifted value of the last color calculated for chatmessage overlays var/chat_color_darkened + ///Mobs that are currently do_after'ing this atom, to be cleared from on Destroy() + var/list/targeted_by + /atom/New(loc, ...) //atom creation method that preloads variables at creation if(GLOB.use_preloader && (src.type == GLOB._preloader.target_path))//in case the instanciated atom is creating other atoms in New() @@ -144,6 +147,11 @@ LAZYCLEARLIST(overlays) LAZYCLEARLIST(priority_overlays) + for(var/i in targeted_by) + var/mob/M = i + LAZYREMOVE(M.do_afters, src) + targeted_by = null + QDEL_NULL(light) return ..() diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index d0dc3c789e..c559135bd1 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -1280,12 +1280,12 @@ GLOBAL_LIST_EMPTY(custom_outfits) //Admin created outfits ADMIN_PUNISHMENT_SUPPLYPOD, ADMIN_PUNISHMENT_MAZING, ADMIN_PUNISHMENT_ROD, + ADMIN_PUNISHMENT_SHOES, ADMIN_PUNISHMENT_PICKLE, ADMIN_PUNISHMENT_FRY, - ADMIN_PUNISHMENT_CRACK, - ADMIN_PUNISHMENT_BLEED, - ADMIN_PUNISHMENT_SCARIFY) - + ADMIN_PUNISHMENT_CRACK, + ADMIN_PUNISHMENT_BLEED, + ADMIN_PUNISHMENT_SCARIFY) var/punishment = input("Choose a punishment", "DIVINE SMITING") as null|anything in punishment_list @@ -1395,6 +1395,17 @@ GLOBAL_LIST_EMPTY(custom_outfits) //Admin created outfits if(ADMIN_PUNISHMENT_FRY) target.fry() + if(ADMIN_PUNISHMENT_SHOES) + if(!iscarbon(target)) + to_chat(usr,"This must be used on a carbon mob.") + return + var/mob/living/carbon/C = target + var/obj/item/clothing/shoes/sick_kicks = C.shoes + if(!sick_kicks?.can_be_tied) + to_chat(usr,"[C] does not have knottable shoes!") + return + sick_kicks.adjust_laces(SHOES_KNOTTED) + punish_log(target, punishment) /client/proc/punish_log(var/whom, var/punishment) diff --git a/code/modules/clothing/shoes/_shoes.dm b/code/modules/clothing/shoes/_shoes.dm index d67aea11a1..c12702424b 100644 --- a/code/modules/clothing/shoes/_shoes.dm +++ b/code/modules/clothing/shoes/_shoes.dm @@ -20,6 +20,15 @@ var/last_blood_DNA = "" //same as last one var/last_blood_color = "" + ///Whether these shoes have laces that can be tied/untied + var/can_be_tied = TRUE + ///Are we currently tied? Can either be SHOES_UNTIED, SHOES_TIED, or SHOES_KNOTTED + var/tied = SHOES_TIED + ///How long it takes to lace/unlace these shoes + var/lace_time = 5 SECONDS + ///any alerts we have active + var/obj/screen/alert/our_alert + /obj/item/clothing/shoes/ComponentInitialize() . = ..() RegisterSignal(src, COMSIG_COMPONENT_CLEAN_ACT, /atom.proc/clean_blood) @@ -43,6 +52,15 @@ playsound(user, 'sound/weapons/genhit2.ogg', 50, 1) return(BRUTELOSS) +/obj/item/clothing/shoes/examine(mob/user) + . = ..() + + if(!ishuman(loc)) + return ..() + if(tied == SHOES_UNTIED) + . += "The shoelaces are untied." + else if(tied == SHOES_KNOTTED) + . += "The shoelaces are all knotted together." /obj/item/clothing/shoes/transfer_blood_dna(list/blood_dna, diseases) ..() @@ -74,6 +92,9 @@ worn_y_dimension -= (offset * 2) user.update_inv_shoes() equipped_before_drop = TRUE + if(can_be_tied && tied == SHOES_UNTIED) + our_alert = user.throw_alert("shoealert", /obj/screen/alert/shoes/untied) + RegisterSignal(src, COMSIG_SHOES_STEP_ACTION, .proc/check_trip, override=TRUE) /obj/item/clothing/shoes/proc/restore_offsets(mob/user) equipped_before_drop = FALSE @@ -81,6 +102,8 @@ worn_y_dimension = world.icon_size /obj/item/clothing/shoes/dropped(mob/user) + if(our_alert && (our_alert.mob_viewer == user)) + user.clear_alert("shoealert") if(offset && equipped_before_drop) restore_offsets(user) . = ..() @@ -101,3 +124,167 @@ /obj/item/proc/negates_gravity() return FALSE + +/** + * adjust_laces adjusts whether our shoes (assuming they can_be_tied) and tied, untied, or knotted + * + * In addition to setting the state, it will deal with getting rid of alerts if they exist, as well as registering and unregistering the stepping signals + * + * Arguments: + * * + * * state: SHOES_UNTIED, SHOES_TIED, or SHOES_KNOTTED, depending on what you want them to become + * * user: used to check to see if we're the ones unknotting our own laces + */ +/obj/item/clothing/shoes/proc/adjust_laces(state, mob/user) + if(!can_be_tied) + return + + var/mob/living/carbon/human/our_guy + if(ishuman(loc)) + our_guy = loc + + tied = state + if(tied == SHOES_TIED) + if(our_guy) + our_guy.clear_alert("shoealert") + UnregisterSignal(src, COMSIG_SHOES_STEP_ACTION) + else + if(tied == SHOES_UNTIED && our_guy && user == our_guy) + our_alert = our_guy.throw_alert("shoealert", /obj/screen/alert/shoes/untied) // if we're the ones unknotting our own laces, of course we know they're untied + RegisterSignal(src, COMSIG_SHOES_STEP_ACTION, .proc/check_trip, override=TRUE) + +/** + * handle_tying deals with all the actual tying/untying/knotting, inferring your intent from who you are in relation to the state of the laces + * + * If you're the wearer, you want them to move towards tied-ness (knotted -> untied -> tied). If you're not, you're pranking them, so you're moving towards knotted-ness (tied -> untied -> knotted) + * + * Arguments: + * * + * * user: who is the person interacting with the shoes? + */ +/obj/item/clothing/shoes/proc/handle_tying(mob/user) + ///our_guy here is the wearer, if one exists (and he must exist, or we don't care) + var/mob/living/carbon/human/our_guy = loc + if(!istype(our_guy)) + return + + if(!in_range(user, our_guy)) + to_chat(user, "You aren't close enough to interact with [src]'s laces!") + return + + if(user == loc && tied != SHOES_TIED) // if they're our own shoes, go tie-wards + if(INTERACTING_WITH(user, our_guy)) + to_chat(user, "You're already interacting with [src]!") + return + user.visible_message("[user] begins [tied ? "unknotting" : "tying"] the laces of [user.p_their()] [src.name].", "You begin [tied ? "unknotting" : "tying"] the laces of your [src.name]...") + + if(do_after(user, lace_time, needhand=TRUE, target=our_guy, extra_checks=CALLBACK(src, .proc/still_shoed, our_guy))) + to_chat(user, "You [tied ? "unknot" : "tie"] the laces of your [src.name].") + if(tied == SHOES_UNTIED) + adjust_laces(SHOES_TIED, user) + else + adjust_laces(SHOES_UNTIED, user) + + else // if they're someone else's shoes, go knot-wards + var/mob/living/L = user + if(istype(L) && (L.mobility_flags & MOBILITY_STAND)) + to_chat(user, "You must be on the floor to interact with [src]!") + return + if(tied == SHOES_KNOTTED) + to_chat(user, "The laces on [loc]'s [src.name] are already a hopelessly tangled mess!") + return + if(INTERACTING_WITH(user, our_guy)) + to_chat(user, "You're already interacting with [src]!") + return + + var/mod_time = lace_time + to_chat(user, "You quietly set to work [tied ? "untying" : "knotting"] [loc]'s [src.name]...") + if(HAS_TRAIT(user, TRAIT_CLUMSY)) // based clowns trained their whole lives for this + mod_time *= 0.75 + + if(do_after(user, mod_time, needhand=TRUE, target=our_guy, extra_checks=CALLBACK(src, .proc/still_shoed, our_guy))) + to_chat(user, "You [tied ? "untie" : "knot"] the laces on [loc]'s [src.name].") + if(tied == SHOES_UNTIED) + adjust_laces(SHOES_KNOTTED, user) + else + adjust_laces(SHOES_UNTIED, user) + else // if one of us moved + user.visible_message("[our_guy] stamps on [user]'s hand, mid-shoelace [tied ? "knotting" : "untying"]!", "Ow! [our_guy] stamps on your hand!", list(our_guy)) + to_chat(our_guy, "You stamp on [user]'s hand! What the- [user.p_they()] [user.p_were()] [tied ? "knotting" : "untying"] your shoelaces!") + user.emote("scream") + if(istype(L)) + var/obj/item/bodypart/ouchie = L.get_bodypart(pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM)) + if(ouchie) + ouchie.receive_damage(brute = 10, stamina = 40) + L.Paralyze(10) + +///checking to make sure we're still on the person we're supposed to be, for lacing do_after's +/obj/item/clothing/shoes/proc/still_shoed(mob/living/carbon/our_guy) + return (loc == our_guy) + +///check_trip runs on each step to see if we fall over as a result of our lace status. Knotted laces are a guaranteed trip, while untied shoes are just a chance to stumble +/obj/item/clothing/shoes/proc/check_trip() + var/mob/living/carbon/human/our_guy = loc + if(!istype(our_guy)) // are they REALLY /our guy/? + return + + if(tied == SHOES_KNOTTED) + our_guy.Paralyze(5) + our_guy.Knockdown(10) + our_guy.visible_message("[our_guy] trips on [our_guy.p_their()] knotted shoelaces and falls! What a klutz!", "You trip on your knotted shoelaces and fall over!") + SEND_SIGNAL(our_guy, COMSIG_ADD_MOOD_EVENT, "trip", /datum/mood_event/tripped) // well we realized they're knotted now! + our_alert = our_guy.throw_alert("shoealert", /obj/screen/alert/shoes/knotted) + + else if(tied == SHOES_UNTIED) + var/wiser = TRUE // did we stumble and realize our laces are undone? + switch(rand(1, 1000)) + if(1) // .1% chance to trip and fall over (note these are per step while our laces are undone) + our_guy.Paralyze(5) + our_guy.Knockdown(10) + SEND_SIGNAL(our_guy, COMSIG_ADD_MOOD_EVENT, "trip", /datum/mood_event/tripped) // well we realized they're knotted now! + our_guy.visible_message("[our_guy] trips on [our_guy.p_their()] untied shoelaces and falls! What a klutz!", "You trip on your untied shoelaces and fall over!") + + if(2 to 5) // .4% chance to stumble and lurch forward + our_guy.throw_at(get_step(our_guy, our_guy.dir), 3, 2) + to_chat(our_guy, "You stumble on your untied shoelaces and lurch forward!") + + if(6 to 13) // .7% chance to stumble and fling what we're holding + var/have_anything = FALSE + for(var/obj/item/I in our_guy.held_items) + have_anything = TRUE + our_guy.accident(I) + to_chat(our_guy, "You trip on your shoelaces a bit[have_anything ? ", flinging what you were holding" : ""]!") + + if(14 to 25) // 1.3ish% chance to stumble and be a bit off balance (like being disarmed) + to_chat(our_guy, "You stumble a bit on your untied shoelaces!") + if(!our_guy.has_movespeed_modifier(/datum/movespeed_modifier/shove)) + our_guy.add_movespeed_modifier(/datum/movespeed_modifier/shove) + addtimer(CALLBACK(our_guy, /mob/living/carbon/human/proc/clear_shove_slowdown), SHOVE_SLOWDOWN_LENGTH) + + if(26 to 1000) + wiser = FALSE + if(wiser) + SEND_SIGNAL(our_guy, COMSIG_ADD_MOOD_EVENT, "untied", /datum/mood_event/untied) // well we realized they're untied now! + our_alert = our_guy.throw_alert("shoealert", /obj/screen/alert/shoes/untied) + + +/obj/item/clothing/shoes/attack_hand(mob/living/carbon/human/user) + if(!istype(user)) + return ..() + if(loc == user && tied != SHOES_TIED && (user.mobility_flags & MOBILITY_USE)) + handle_tying(user) + return + ..() + +/obj/item/clothing/shoes/attack_self(mob/user) + . = ..() + + if(INTERACTING_WITH(user, src)) + to_chat(user, "You're already interacting with [src]!") + return + + to_chat(user, "You begin [tied ? "untying" : "tying"] the laces on [src]...") + + if(do_after(user, lace_time, needhand=TRUE, target=src,extra_checks=CALLBACK(src, .proc/still_shoed, user))) + to_chat(user, "You [tied ? "untie" : "tie"] the laces on [src].") + adjust_laces(tied ? SHOES_TIED : SHOES_UNTIED, user) diff --git a/code/modules/clothing/shoes/miscellaneous.dm b/code/modules/clothing/shoes/miscellaneous.dm index b68bef6329..b0d760ebd9 100644 --- a/code/modules/clothing/shoes/miscellaneous.dm +++ b/code/modules/clothing/shoes/miscellaneous.dm @@ -17,6 +17,7 @@ resistance_flags = NONE permeability_coefficient = 0.05 //Thick soles, and covers the ankle pocket_storage_component_path = /datum/component/storage/concrete/pockets/shoes + lace_time = 12 SECONDS /obj/item/clothing/shoes/combat/sneakboots name = "insidious sneakboots" @@ -49,6 +50,7 @@ strip_delay = 50 equip_delay_other = 50 permeability_coefficient = 0.9 + can_be_tied = FALSE /obj/item/clothing/shoes/sandal/marisa desc = "A pair of magic black shoes." @@ -73,6 +75,7 @@ resistance_flags = NONE armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 40, "acid" = 75) custom_price = PRICE_ABOVE_EXPENSIVE + can_be_tied = FALSE /obj/item/clothing/shoes/galoshes/dry name = "absorbent galoshes" @@ -99,6 +102,7 @@ icon_state = "clown_shoes" slowdown = SHOES_SLOWDOWN+1 pocket_storage_component_path = /datum/component/storage/concrete/pockets/shoes/clown + lace_time = 20 SECONDS // how the hell do these laces even work?? /obj/item/clothing/shoes/clown_shoes/Initialize() . = ..() @@ -130,6 +134,7 @@ resistance_flags = NONE permeability_coefficient = 0.05 //Thick soles, and covers the ankle pocket_storage_component_path = /datum/component/storage/concrete/pockets/shoes + lace_time = 12 SECONDS /obj/item/clothing/shoes/jackboots/fast slowdown = -1 @@ -144,6 +149,7 @@ heat_protection = FEET|LEGS max_heat_protection_temperature = SHOES_MAX_TEMP_PROTECT pocket_storage_component_path = /datum/component/storage/concrete/pockets/shoes + lace_time = 8 SECONDS /obj/item/clothing/shoes/winterboots/ice_boots name = "ice hiking boots" @@ -177,6 +183,7 @@ strip_delay = 40 equip_delay_other = 40 pocket_storage_component_path = /datum/component/storage/concrete/pockets/shoes + lace_time = 8 SECONDS /obj/item/clothing/shoes/workboots/mining name = "mining boots" @@ -196,6 +203,7 @@ min_cold_protection_temperature = SHOES_MIN_TEMP_PROTECT heat_protection = FEET max_heat_protection_temperature = SHOES_MAX_TEMP_PROTECT + lace_time = 10 SECONDS /obj/item/clothing/shoes/cult/alt name = "cultist boots" @@ -226,12 +234,14 @@ strip_delay = 100 equip_delay_other = 100 permeability_coefficient = 0.9 + can_be_tied = FALSE /obj/item/clothing/shoes/griffin name = "griffon boots" desc = "A pair of costume boots fashioned after bird talons." icon_state = "griffinboots" pocket_storage_component_path = /datum/component/storage/concrete/pockets/shoes + lace_time = 8 SECONDS /obj/item/clothing/shoes/bhop name = "jump boots" @@ -284,6 +294,7 @@ desc = "A giant, clunky pair of shoes crudely made out of bronze. Why would anyone wear these?" icon = 'icons/obj/clothing/clockwork_garb.dmi' icon_state = "clockwork_treads" + lace_time = 8 SECONDS /obj/item/clothing/shoes/bronze/Initialize() . = ..() @@ -358,6 +369,7 @@ icon_state = "rus_shoes" item_state = "rus_shoes" pocket_storage_component_path = /datum/component/storage/concrete/pockets/shoes + lace_time = 8 SECONDS // kevin is into feet /obj/item/clothing/shoes/wraps @@ -365,6 +377,7 @@ desc = "Ankle coverings. These ones have a golden design." icon_state = "gildedcuffs" body_parts_covered = FALSE + can_be_tied = FALSE /obj/item/clothing/shoes/wraps/silver name = "silver leg wraps" @@ -385,6 +398,7 @@ name = "cowboy boots" desc = "A standard pair of brown cowboy boots." icon_state = "cowboyboots" + can_be_tied = FALSE /obj/item/clothing/shoes/cowboyboots/black name = "black cowboy boots" diff --git a/code/modules/mob/living/carbon/carbon_defines.dm b/code/modules/mob/living/carbon/carbon_defines.dm index a05480ee01..2ce59fb790 100644 --- a/code/modules/mob/living/carbon/carbon_defines.dm +++ b/code/modules/mob/living/carbon/carbon_defines.dm @@ -24,7 +24,7 @@ var/obj/item/head = null var/obj/item/gloves = null //only used by humans - var/obj/item/shoes = null //only used by humans. + var/obj/item/clothing/shoes/shoes = null //only used by humans. var/obj/item/clothing/glasses/glasses = null //only used by humans. var/obj/item/ears = null //only used by humans. diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 6aae671d06..145db1be1e 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -170,7 +170,11 @@ if(SLOT_SHOES in obscured) dat += "