diff --git a/code/datums/actions/mobs/small_sprite.dm b/code/datums/actions/mobs/small_sprite.dm deleted file mode 100644 index 335d6c9aff3..00000000000 --- a/code/datums/actions/mobs/small_sprite.dm +++ /dev/null @@ -1,57 +0,0 @@ -//Small sprites -/datum/action/small_sprite - name = "Toggle Giant Sprite" - desc = "Others will always see you as giant." - button_icon = 'icons/mob/actions/actions_xeno.dmi' - button_icon_state = "smallqueen" - background_icon_state = "bg_alien" - overlay_icon_state = "bg_alien_border" - var/small = FALSE - var/small_icon - var/small_icon_state - -/datum/action/small_sprite/queen - small_icon = 'icons/mob/nonhuman-player/alien.dmi' - small_icon_state = "alienq" - -/datum/action/small_sprite/megafauna - button_icon = 'icons/mob/actions/actions_xeno.dmi' - small_icon = 'icons/mob/simple/lavaland/lavaland_monsters.dmi' - -/datum/action/small_sprite/megafauna/drake - small_icon_state = "ash_whelp" - -/datum/action/small_sprite/megafauna/colossus - small_icon_state = "basilisk" - -/datum/action/small_sprite/megafauna/bubblegum - small_icon_state = "goliath2" - -/datum/action/small_sprite/megafauna/legion - small_icon_state = "mega_legion" - -/datum/action/small_sprite/mega_arachnid - small_icon = 'icons/mob/simple/jungle/arachnid.dmi' - small_icon_state = "arachnid_mini" - background_icon_state = "bg_demon" - overlay_icon_state = "bg_demon_border" - - -/datum/action/small_sprite/space_dragon - small_icon = 'icons/mob/simple/carp.dmi' - small_icon_state = "carp" - button_icon = 'icons/mob/simple/carp.dmi' - button_icon_state = "carp" - -/datum/action/small_sprite/Trigger(trigger_flags) - ..() - if(!small) - var/image/I = image(icon = small_icon, icon_state = small_icon_state, loc = owner) - I.override = TRUE - I.pixel_x -= owner.pixel_x - I.pixel_y -= owner.pixel_y - owner.add_alt_appearance(/datum/atom_hud/alternate_appearance/basic, "smallsprite", I, AA_TARGET_SEE_APPEARANCE | AA_MATCH_TARGET_OVERLAYS) - small = TRUE - else - owner.remove_alt_appearance("smallsprite") - small = FALSE diff --git a/code/datums/components/seethrough_mob.dm b/code/datums/components/seethrough_mob.dm new file mode 100644 index 00000000000..b52cfb334ab --- /dev/null +++ b/code/datums/components/seethrough_mob.dm @@ -0,0 +1,135 @@ +///A component that lets you turn your character transparent in order to see and click through yourself. +/datum/component/seethrough_mob + ///The atom that enables our dark magic + var/atom/movable/render_source_atom + ///The fake version of ourselves + var/image/trickery_image + ///Which alpha do we animate towards? + var/target_alpha + ///How long our faze in/out takes + var/animation_time + ///Does this object let clicks from players its transparent to pass through it + var/clickthrough + ///Is the seethrough effect currently active + var/is_active + ///The mob's original render_target value + var/initial_render_target_value + ///This component's personal uid + var/personal_uid + +/datum/component/seethrough_mob/Initialize(target_alpha = 100, animation_time = 0.5 SECONDS, clickthrough = TRUE) + . = ..() + + if(!ismob(parent)) + return COMPONENT_INCOMPATIBLE + + src.target_alpha = target_alpha + src.animation_time = animation_time + src.clickthrough = clickthrough + src.is_active = FALSE + src.render_source_atom = new() + + var/static/uid = 0 + uid++ + src.personal_uid = uid + + render_source_atom.appearance_flags |= ( RESET_COLOR | RESET_TRANSFORM) + + render_source_atom.vis_flags |= (VIS_INHERIT_ID | VIS_INHERIT_PLANE | VIS_INHERIT_LAYER) + + render_source_atom.render_source = "*transparent_bigmob[personal_uid]" + + var/datum/action/toggle_seethrough/action = new(src) + action.Grant(parent) + +/datum/component/seethrough_mob/Destroy(force, silent) + QDEL_NULL(render_source_atom) + return ..() + +///Set up everything we need to trick the client and keep it looking normal for everyone else +/datum/component/seethrough_mob/proc/trick_mob() + SIGNAL_HANDLER + + var/mob/fool = parent + var/datum/hud/our_hud = fool.hud_used + for(var/atom/movable/screen/plane_master/seethrough as anything in our_hud.get_true_plane_masters(SEETHROUGH_PLANE)) + seethrough.unhide_plane(fool) + + var/icon/current_mob_icon = icon(fool.icon, fool.icon_state) + render_source_atom.pixel_x = -fool.pixel_x + render_source_atom.pixel_y = ((current_mob_icon.Height() - 32) * 0.5) + + initial_render_target_value = fool.render_target + fool.render_target = "*transparent_bigmob[personal_uid]" + fool.vis_contents.Add(render_source_atom) + + trickery_image = new(render_source_atom) + trickery_image.loc = render_source_atom + trickery_image.override = TRUE + + trickery_image.pixel_x = 0 + trickery_image.pixel_y = 0 + + if(clickthrough) + //Special plane so we can click through the overlay + SET_PLANE_EXPLICIT(trickery_image, SEETHROUGH_PLANE, fool) + + fool.client.images += trickery_image + + animate(trickery_image, alpha = target_alpha, time = animation_time) + + RegisterSignal(fool, COMSIG_MOB_LOGOUT, PROC_REF(on_client_disconnect)) + +///Remove the screen object and make us appear solid to ourselves again +/datum/component/seethrough_mob/proc/untrick_mob() + var/mob/fool = parent + animate(trickery_image, alpha = 255, time = animation_time) + UnregisterSignal(fool, COMSIG_MOB_LOGOUT) + + //after playing the fade-in animation, remove the image and the trick atom + addtimer(CALLBACK(src, PROC_REF(clear_image), trickery_image, fool.client), animation_time) + +///Remove the image and the trick atom +/datum/component/seethrough_mob/proc/clear_image(image/removee, client/remove_from) + var/atom/movable/atom_parent = parent + atom_parent.vis_contents -= render_source_atom + atom_parent.render_target = initial_render_target_value + remove_from?.images -= removee + +///Effect is disabled when they log out because client gets deleted +/datum/component/seethrough_mob/proc/on_client_disconnect() + SIGNAL_HANDLER + + var/mob/fool = parent + UnregisterSignal(fool, COMSIG_MOB_LOGOUT) + var/datum/hud/our_hud = fool.hud_used + for(var/atom/movable/screen/plane_master/seethrough as anything in our_hud.get_true_plane_masters(SEETHROUGH_PLANE)) + seethrough.hide_plane(fool) + clear_image(trickery_image, fool.client) + +/datum/component/seethrough_mob/proc/toggle_active() + is_active = !is_active + if(is_active) + trick_mob() + else + untrick_mob() + +/datum/action/toggle_seethrough + name = "Toggle Seethrough" + desc = "Allows you to see behind your massive body and click through it." + button_icon = 'icons/mob/actions/actions_xeno.dmi' + button_icon_state = "alien_sneak" + background_icon_state = "bg_alien" + +/datum/action/toggle_seethrough/Remove(mob/remove_from) + var/datum/component/seethrough_mob/seethroughComp = target + if(seethroughComp.is_active) + seethroughComp.untrick_mob() + return ..() + +/datum/action/toggle_seethrough/Trigger(trigger_flags) + . = ..() + if(!.) + return + var/datum/component/seethrough_mob/seethroughComp = target + seethroughComp.toggle_active() diff --git a/code/modules/mob/living/basic/festivus_pole.dm b/code/modules/mob/living/basic/festivus_pole.dm index 637a01cb0ec..058b74bfad8 100644 --- a/code/modules/mob/living/basic/festivus_pole.dm +++ b/code/modules/mob/living/basic/festivus_pole.dm @@ -42,6 +42,7 @@ /mob/living/basic/festivus/Initialize(mapload) . = ..() + AddComponent(/datum/component/seethrough_mob) var/static/list/death_loot = list(/obj/item/stack/rods) AddElement(/datum/element/death_drops, death_loot) AddComponent(/datum/component/aggro_emote, emote_list = string_list(list("growls")), emote_chance = 20) diff --git a/code/modules/mob/living/basic/jungle/mega_arachnid/mega_arachnid.dm b/code/modules/mob/living/basic/jungle/mega_arachnid/mega_arachnid.dm index 7f40e6ae0a1..bb109fdde61 100644 --- a/code/modules/mob/living/basic/jungle/mega_arachnid/mega_arachnid.dm +++ b/code/modules/mob/living/basic/jungle/mega_arachnid/mega_arachnid.dm @@ -36,12 +36,11 @@ /mob/living/basic/mega_arachnid/Initialize(mapload) . = ..() + AddComponent(/datum/component/seethrough_mob) var/datum/action/cooldown/spell/pointed/projectile/flesh_restraints/restrain = new(src) - var/datum/action/small_sprite/mega_arachnid/mini_arachnid = new(src) var/datum/action/cooldown/mob_cooldown/secrete_acid/acid_spray = new(src) acid_spray.Grant(src) restrain.Grant(src) - mini_arachnid.Grant(src) AddElement(/datum/element/swabable, CELL_LINE_TABLE_MEGA_ARACHNID, CELL_VIRUS_TABLE_GENERIC_MOB, 1, 5) AddComponent(/datum/component/appearance_on_aggro, alpha_on_aggro = 255, alpha_on_deaggro = alpha) AddComponent(/datum/component/tree_climber, climbing_distance = 15) diff --git a/code/modules/mob/living/basic/space_fauna/wumborian_fugu/fugu_gland.dm b/code/modules/mob/living/basic/space_fauna/wumborian_fugu/fugu_gland.dm index 485343c0a49..63eb39c74e6 100644 --- a/code/modules/mob/living/basic/space_fauna/wumborian_fugu/fugu_gland.dm +++ b/code/modules/mob/living/basic/space_fauna/wumborian_fugu/fugu_gland.dm @@ -32,6 +32,7 @@ return ADD_TRAIT(animal, TRAIT_FUGU_GLANDED, type) + animal.AddComponent(/datum/component/seethrough_mob) animal.maxHealth *= 1.5 animal.health = min(animal.maxHealth, animal.health * 1.5) animal.melee_damage_lower = max((animal.melee_damage_lower * 2), 10) diff --git a/code/modules/mob/living/basic/space_fauna/wumborian_fugu/wumborian_fugu.dm b/code/modules/mob/living/basic/space_fauna/wumborian_fugu/wumborian_fugu.dm index cb365f2e871..e13bef35482 100644 --- a/code/modules/mob/living/basic/space_fauna/wumborian_fugu/wumborian_fugu.dm +++ b/code/modules/mob/living/basic/space_fauna/wumborian_fugu/wumborian_fugu.dm @@ -49,6 +49,7 @@ /mob/living/basic/wumborian_fugu/Initialize(mapload) . = ..() + AddComponent(/datum/component/seethrough_mob) var/static/list/death_loot = list(/obj/item/fugu_gland) AddElement(/datum/element/death_drops, death_loot) add_traits(list(TRAIT_LAVA_IMMUNE, TRAIT_ASHSTORM_IMMUNE), ROUNDSTART_TRAIT) diff --git a/code/modules/mob/living/basic/tree.dm b/code/modules/mob/living/basic/tree.dm index 7e9bd353337..f93ab14a37f 100644 --- a/code/modules/mob/living/basic/tree.dm +++ b/code/modules/mob/living/basic/tree.dm @@ -54,6 +54,7 @@ /mob/living/basic/tree/Initialize(mapload) . = ..() + AddComponent(/datum/component/seethrough_mob) AddElement(/datum/element/swabable, CELL_LINE_TABLE_PINE, CELL_VIRUS_TABLE_GENERIC_MOB, 1, 5) var/static/list/death_loot = list(/obj/item/stack/sheet/mineral/wood) AddElement(/datum/element/death_drops, death_loot) diff --git a/code/modules/mob/living/carbon/alien/adult/queen.dm b/code/modules/mob/living/carbon/alien/adult/queen.dm index cb0f6119a2d..dd8e61b6699 100644 --- a/code/modules/mob/living/carbon/alien/adult/queen.dm +++ b/code/modules/mob/living/carbon/alien/adult/queen.dm @@ -19,6 +19,7 @@ . = ..() // as a wise man once wrote: "pull over that ass too fat" REMOVE_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT) + AddComponent(/datum/component/seethrough_mob) /mob/living/carbon/alien/adult/royal/on_lying_down(new_lying_angle) . = ..() @@ -57,9 +58,6 @@ var/datum/action/cooldown/spell/aoe/repulse/xeno/tail_whip = new(src) tail_whip.Grant(src) - var/datum/action/small_sprite/queen/smallsprite = new(src) - smallsprite.Grant(src) - var/datum/action/cooldown/alien/promote/promotion = new(src) promotion.Grant(src) diff --git a/code/modules/mob/living/simple_animal/hostile/jungle/leaper.dm b/code/modules/mob/living/simple_animal/hostile/jungle/leaper.dm index 7e7e0b34510..aa7ddc11c72 100644 --- a/code/modules/mob/living/simple_animal/hostile/jungle/leaper.dm +++ b/code/modules/mob/living/simple_animal/hostile/jungle/leaper.dm @@ -148,6 +148,7 @@ /mob/living/simple_animal/hostile/jungle/leaper/Initialize(mapload) . = ..() + AddComponent(/datum/component/seethrough_mob) remove_verb(src, /mob/living/verb/pulled) add_cell_sample() diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/_megafauna.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/_megafauna.dm index fc30447fdd7..3d2c266cc92 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/_megafauna.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/_megafauna.dm @@ -50,11 +50,10 @@ var/chosen_attack = 1 /// Attack actions, sets chosen_attack to the number in the action var/list/attack_action_types = list() - /// If there is a small sprite icon for players controlling the megafauna to use - var/small_sprite_type /mob/living/simple_animal/hostile/megafauna/Initialize(mapload) . = ..() + AddComponent(/datum/component/seethrough_mob) AddElement(/datum/element/simple_flying) if(gps_name && true_spawn) AddComponent(/datum/component/gps, gps_name) @@ -63,9 +62,6 @@ for(var/action_type in attack_action_types) var/datum/action/innate/megafauna_attack/attack_action = new action_type() attack_action.Grant(src) - if(small_sprite_type) - var/datum/action/small_sprite/small_action = new small_sprite_type() - small_action.Grant(src) /mob/living/simple_animal/hostile/megafauna/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change = TRUE) //Safety check diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm index 55b80a8d0b8..db18216880e 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm @@ -67,7 +67,6 @@ Difficulty: Hard score_achievement_type = /datum/award/score/bubblegum_score death_message = "sinks into a pool of blood, fleeing the battle. You've won, for now... " death_sound = 'sound/magic/enter_blood.ogg' - small_sprite_type = /datum/action/small_sprite/megafauna/bubblegum faction = list(FACTION_MINING, FACTION_BOSS, FACTION_HELL) /// Check to see if we should spawn blood var/spawn_blood = TRUE diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm index 99f7a69e777..9b2ef878f4e 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm @@ -55,7 +55,6 @@ loot = list(/obj/structure/closet/crate/necropolis/colossus) death_message = "disintegrates, leaving a glowing core in its wake." death_sound = 'sound/magic/demon_dies.ogg' - small_sprite_type = /datum/action/small_sprite/megafauna/colossus /// Spiral shots ability var/datum/action/cooldown/mob_cooldown/projectile_attack/spiral_shots/colossus/spiral_shots /// Random shots ablity diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm index a05d566b295..0b77d95cdeb 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm @@ -73,7 +73,6 @@ death_message = "collapses into a pile of bones, its flesh sloughing away." death_sound = 'sound/magic/demon_dies.ogg' footstep_type = FOOTSTEP_MOB_HEAVY - small_sprite_type = /datum/action/small_sprite/megafauna/drake /// Fire cone ability var/datum/action/cooldown/mob_cooldown/fire_breath/cone/fire_cone /// Meteors ability diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/legion.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/legion.dm index ec106189067..05695daf59a 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/legion.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/legion.dm @@ -60,7 +60,6 @@ attack_action_types = list(/datum/action/innate/megafauna_attack/create_skull, /datum/action/innate/megafauna_attack/charge_target, /datum/action/innate/megafauna_attack/create_turrets) - small_sprite_type = /datum/action/small_sprite/megafauna/legion var/size = LEGION_LARGE var/charging = FALSE diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm index a25da50f829..6fe1fa1ecfc 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm @@ -28,6 +28,7 @@ //Gives player-controlled variants the ability to swap attacks /mob/living/simple_animal/hostile/asteroid/elite/Initialize(mapload) . = ..() + AddComponent(/datum/component/seethrough_mob) for(var/action_type in attack_action_types) var/datum/action/innate/elite_attack/attack_action = new action_type() attack_action.Grant(src) diff --git a/code/modules/mob/living/simple_animal/hostile/space_dragon.dm b/code/modules/mob/living/simple_animal/hostile/space_dragon.dm index 1d5be805b56..8dec6cfd7d8 100644 --- a/code/modules/mob/living/simple_animal/hostile/space_dragon.dm +++ b/code/modules/mob/living/simple_animal/hostile/space_dragon.dm @@ -73,8 +73,6 @@ var/using_special = FALSE /// Determines whether or not Space Dragon is currently tearing through a wall. var/tearing_wall = FALSE - /// The ability to make your sprite smaller - var/datum/action/small_sprite/space_dragon/small_sprite /// The color of the space dragon. var/chosen_color /// Minimum devastation damage dealt coefficient based on max health @@ -84,12 +82,10 @@ /mob/living/simple_animal/hostile/space_dragon/Initialize(mapload) . = ..() + AddComponent(/datum/component/seethrough_mob) AddElement(/datum/element/simple_flying) add_traits(list(TRAIT_SPACEWALK, TRAIT_FREE_HYPERSPACE_MOVEMENT, TRAIT_NO_FLOATING_ANIM, TRAIT_HEALS_FROM_CARP_RIFTS), INNATE_TRAIT) AddElement(/datum/element/content_barfer) - small_sprite = new - small_sprite.Grant(src) - RegisterSignal(small_sprite, COMSIG_ACTION_TRIGGER, PROC_REF(add_dragon_overlay)) /mob/living/simple_animal/hostile/space_dragon/Login() . = ..() @@ -169,16 +165,11 @@ /mob/living/simple_animal/hostile/space_dragon/death(gibbed) . = ..() add_dragon_overlay() - UnregisterSignal(small_sprite, COMSIG_ACTION_TRIGGER) /mob/living/simple_animal/hostile/space_dragon/revive(full_heal_flags = NONE, excess_healing = 0, force_grab_ghost = FALSE) - var/was_dead = stat == DEAD . = ..() add_dragon_overlay() - if (was_dead) - RegisterSignal(small_sprite, COMSIG_ACTION_TRIGGER, PROC_REF(add_dragon_overlay)) - /** * Allows space dragon to choose its own name. * @@ -221,8 +212,6 @@ */ /mob/living/simple_animal/hostile/space_dragon/proc/add_dragon_overlay() cut_overlays() - if(!small_sprite.small) - return if(stat == DEAD) var/mutable_appearance/overlay = mutable_appearance(icon, "overlay_dead") overlay.appearance_flags = RESET_COLOR diff --git a/tgstation.dme b/tgstation.dme index b2770487b13..be7031b64ba 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -771,7 +771,6 @@ #include "code\datums\actions\mobs\open_mob_commands.dm" #include "code\datums\actions\mobs\projectileattack.dm" #include "code\datums\actions\mobs\sign_language.dm" -#include "code\datums\actions\mobs\small_sprite.dm" #include "code\datums\actions\mobs\sneak.dm" #include "code\datums\actions\mobs\transform_weapon.dm" #include "code\datums\actions\mobs\sequences\dash_attack.dm" @@ -1037,6 +1036,7 @@ #include "code\datums\components\seclight_attachable.dm" #include "code\datums\components\sect_nullrod_bonus.dm" #include "code\datums\components\seethrough.dm" +#include "code\datums\components\seethrough_mob.dm" #include "code\datums\components\shell.dm" #include "code\datums\components\shielded.dm" #include "code\datums\components\shovel_hands.dm"