diff --git a/code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm b/code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm index 5ce5b33947f..33098fd66ec 100644 --- a/code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm +++ b/code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm @@ -39,3 +39,6 @@ /// For loss of limbs. #define COMSIG_LIMB_LOSS "lost_limb" + +/// From /mob/living/verb/execute_resist(). Resisting. +#define COMSIG_MOB_RESISTED "mob_resist" diff --git a/code/__HELPERS/visual_filters.dm b/code/__HELPERS/visual_filters.dm index d9465d0cdb1..15d06fc099a 100644 --- a/code/__HELPERS/visual_filters.dm +++ b/code/__HELPERS/visual_filters.dm @@ -60,3 +60,18 @@ for (var/atom/movable/AM as anything in get_above_oo()) monkeypatched_params[1] = AM.filters[index] animate(arglist(monkeypatched_params)) + +//Helpers to generate lists for filter helpers +//This is the only practical way of writing these that actually produces sane lists +/proc/alpha_mask_filter(x, y, icon/icon, render_source, flags) + . = list("type" = "alpha") + if(!isnull(x)) + .["x"] = x + if(!isnull(y)) + .["y"] = y + if(!isnull(icon)) + .["icon"] = icon + if(!isnull(render_source)) + .["render_source"] = render_source + if(!isnull(flags)) + .["flags"] = flags diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index 4bc5aec85f3..b2a51ac78b9 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -44,6 +44,9 @@ var/tmp/image/fake_wall_image var/tmp/cached_adjacency + /// A lazylist of humans leaning on this wall. + var/list/hiding_humans + smoothing_flags = SMOOTH_MORE | SMOOTH_NO_CLEAR_ICON | SMOOTH_UNDERLAYS pathing_pass_method = TURF_PATHING_PASS_NO //Literally a wall, until we implement bots that can wallwarp, we might aswell save the processing @@ -116,6 +119,7 @@ /turf/simulated/wall/Destroy() STOP_PROCESSING(SSprocessing, src) dismantle_wall(null, null, TRUE, TRUE) + LAZYNULL(hiding_humans) return ..() /turf/simulated/wall/process() @@ -309,3 +313,79 @@ /turf/simulated/wall/is_wall() return TRUE + +/turf/simulated/wall/mouse_drop_receive(atom/dropped, mob/user, params) + if(!ismob(dropped)) + return + + var/mob/living/carbon/human/current_mob = dropped + + // wall leaning by androbetel + if(!ishuman(current_mob)) + return + + if(current_mob != user) + return + + var/mob/living/carbon/hiding_human = current_mob + var/can_lean = TRUE + + if(istype(user.l_hand, /obj/item/grab) || istype(user.r_hand, /obj/item/grab)) + to_chat(user, SPAN_WARNING("You can't lean while grabbing someone!")) + can_lean = FALSE + if(current_mob.incapacitated()) + to_chat(user, SPAN_WARNING("You can't lean while incapacitated!")) + can_lean = FALSE + if(current_mob.resting) + to_chat(user, SPAN_WARNING("You can't lean while resting!")) + can_lean = FALSE + if(current_mob.buckled_to) + to_chat(user, SPAN_WARNING("You can't lean while buckled!")) + can_lean = FALSE + + var/direction = get_dir(src, current_mob) + var/shift_pixel_x = 0 + var/shift_pixel_y = 0 + + if(!can_lean) + return + switch(direction) + if(NORTH) + shift_pixel_y = -10 + if(SOUTH) + shift_pixel_y = 16 + if(WEST) + shift_pixel_x = 10 + if(EAST) + shift_pixel_x = -10 + else + return + + for(var/mob/living/carbon/human/hiding in hiding_humans) + if(hiding_humans[hiding] == direction) + return + + LAZYADD(hiding_humans, current_mob) + hiding_humans[current_mob] = direction + hiding_human.Moved() //just to be safe + hiding_human.set_dir(direction) + animate(hiding_human, pixel_x = shift_pixel_x, pixel_y = shift_pixel_y, time = 1) + if(direction == NORTH) + hiding_human.add_filter("cutout", 1, alpha_mask_filter(icon = icon('icons/effects/effects.dmi', "cutout"))) + hiding_human.density = FALSE + RegisterSignals(hiding_human, list(COMSIG_MOVABLE_MOVED, COMSIG_MOB_RESISTED), PROC_REF(unhide_human), hiding_human) + ..() + +/turf/simulated/wall/proc/unhide_human(mob/living/carbon/human/to_unhide) + SIGNAL_HANDLER + if(!to_unhide) + return + + to_unhide.density = FALSE + to_unhide.pixel_x = initial(to_unhide.pixel_x) + to_unhide.pixel_y = initial(to_unhide.pixel_y) + to_unhide.layer = initial(to_unhide.layer) + LAZYREMOVE(hiding_humans, to_unhide) + UnregisterSignal(to_unhide, list(COMSIG_MOVABLE_MOVED, COMSIG_MOB_RESISTED)) + to_chat(to_unhide, SPAN_NOTICE("You stop leaning on the wall.")) + to_unhide.remove_filter("cutout") diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index d13e43e7f9b..65cd4fbb778 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -678,6 +678,7 @@ default behaviour is: /mob/living/proc/execute_resist() if(!incapacitated(INCAPACITATION_KNOCKOUT) && canClick()) + SEND_SIGNAL(src, COMSIG_MOB_RESISTED) resist_grab() if(!weakened) process_resist() diff --git a/html/changelogs/mattatlas-cmwallleaning.yml b/html/changelogs/mattatlas-cmwallleaning.yml new file mode 100644 index 00000000000..13ad17010d4 --- /dev/null +++ b/html/changelogs/mattatlas-cmwallleaning.yml @@ -0,0 +1,58 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# - (fixes bugs) +# wip +# - (work in progress) +# qol +# - (quality of life) +# soundadd +# - (adds a sound) +# sounddel +# - (removes a sound) +# rscadd +# - (adds a feature) +# rscdel +# - (removes a feature) +# imageadd +# - (adds an image or sprite) +# imagedel +# - (removes an image or sprite) +# spellcheck +# - (fixes spelling or grammar) +# experiment +# - (experimental change) +# balance +# - (balance changes) +# code_imp +# - (misc internal code change) +# refactor +# - (refactors code) +# config +# - (makes a change to the config files) +# admin +# - (makes changes to administrator tools) +# server +# - (miscellaneous changes to server) +################################# + +# Your name. +author: MattAtlas + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Ported wall leaning from CM. Click-drag your sprite to a wall to lean on it." diff --git a/icons/effects/effects.dmi b/icons/effects/effects.dmi index ffad22cb103..78350a08b64 100644 Binary files a/icons/effects/effects.dmi and b/icons/effects/effects.dmi differ