diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index c2f3dcf7315..26fe0a596c2 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -189,7 +189,7 @@ /mob/living/simple_animal/hostile/adjustBruteLoss(var/damage) ..(damage) - if(!stat && search_objects < 3)//Not unconscious, and we don't ignore mobs + if(!client && !stat && search_objects < 3)//Not unconscious, and we don't ignore mobs if(search_objects)//Turn off item searching and ignore whatever item we were looking at, we're more concerned with fight or flight search_objects = 0 target = null diff --git a/code/modules/mob/living/simple_animal/morph/morph.dm b/code/modules/mob/living/simple_animal/morph/morph.dm new file mode 100644 index 00000000000..fb17c943adf --- /dev/null +++ b/code/modules/mob/living/simple_animal/morph/morph.dm @@ -0,0 +1,214 @@ +#define MORPH_COOLDOWN 50 + +/mob/living/simple_animal/hostile/morph + name = "Morph" + real_name = "Morph" + desc = "some amorphous blob" + speak_emote = list("gurgles") + emote_hear = list("gurgles") + icon = 'icons/mob/animal.dmi' + icon_state = "morph" + icon_living = "morph" + icon_dead = "morph_dead" + speed = 2 + a_intent = "harm" + stop_automated_movement = 1 + status_flags = CANPUSH + pass_flags = PASSTABLE + ventcrawler = 2 + atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0) + minbodytemp = 0 + maxHealth = 150 + health = 150 + environment_smash = 1 + melee_damage_lower = 30 + melee_damage_upper = 30 + see_in_dark = 8 + see_invisible = SEE_INVISIBLE_MINIMUM + idle_vision_range = 1 // Only attack when target is close + wander = 0 + + var/morphed = 0 + var/atom/movable/form = null + var/morph_time = 0 + +/mob/living/simple_animal/hostile/morph/examine(mob/user) + if(morphed) + form.examine(user) // Refactor examine to return desc so it's static? Not sure if worth it + if(get_dist(user,src)<=3) + user << "Looks odd!" + else + ..() + return + +/mob/living/simple_animal/hostile/morph/proc/allowed(var/atom/movable/A) // make it into property/proc ? not sure if worth it + if(istype(A,/obj/screen)) + return 0 + if(istype(A,/obj/singularity)) + return 0 + return 1 + +/mob/living/simple_animal/hostile/morph/ShiftClickOn(var/atom/movable/A) + if(morph_time <= world.time) + if(A == src) + restore() + return + if(istype(A) && allowed(A)) + assume(A) + else + ..() + +/mob/living/simple_animal/hostile/morph/proc/assume(var/atom/movable/target) + morphed = 1 + form = target + + //anim(loc,src,'icons/mob/mob.dmi',,"morph",,src.dir) No effect better than shit effect + + //Todo : update to .appearance once 508 hits + if(ishuman(target)) + var/mob/living/carbon/human/H = target + overlays = H.get_overlays_copy(list(L_HAND_LAYER,R_HAND_LAYER)) + else + overlays = target.overlays.Copy() + + name = target.name + icon = target.icon + icon_state = target.icon_state + overlays = target.overlays + + //Morphed is weaker + melee_damage_lower = 5 + melee_damage_upper = 5 + speed = 0 + + morph_time = world.time + MORPH_COOLDOWN + return + +/mob/living/simple_animal/hostile/morph/proc/restore() + if(!morphed) + return + morphed = 0 + form = null + + //anim(loc,src,'icons/mob/mob.dmi',,"morph",,src.dir) + + name = initial(name) + icon = initial(icon) + icon_state = initial(icon_state) + overlays.Cut() + + //Baseline stats + melee_damage_lower = initial(melee_damage_lower) + melee_damage_upper = initial(melee_damage_upper) + speed = initial(speed) + + morph_time = world.time + MORPH_COOLDOWN + return + +/mob/living/simple_animal/hostile/morph/death() + if(morphed) + visible_message("The [src] dissolves!") + restore() + + //Dump eaten stuff + for(var/obj/O in src) + O.loc = loc + + for(var/mob/M in src) + M.loc = loc + + ..(0) + return + +/mob/living/simple_animal/hostile/morph/Aggro() // automated only + ..() + restore() + +/mob/living/simple_animal/hostile/morph/LoseAggro() + vision_range = idle_vision_range + +/mob/living/simple_animal/hostile/morph/AIShouldSleep() + . = ..() + if(.) + var/list/things = list() + for(var/atom/movable/A in view(src)) + if(allowed(A)) + things += A + var/atom/movable/T = pick(things) + assume(T) + +/mob/living/simple_animal/hostile/morph/can_track(mob/living/user) + if(morphed) + return 0 + return ..() + +/mob/living/simple_animal/hostile/morph/AttackingTarget() + if(isliving(target)) // Eat Corpses to regen health + var/mob/living/L = target + if(L.stat == DEAD) + if(do_after(src, 30, target = L)) + visible_message("[src] swallows the [target] whole!") + L.loc = src + adjustBruteLoss(-50) + return + if(istype(target,/obj/item)) // Eat items just to be annoying + var/obj/item/I = target + if(!I.anchored) + if(do_after(src,20, target = I)) + visible_message("[src] swallows the [target] whole!") + I.loc = src + return + target.attack_animal(src) + +//Spawn Event + +/datum/round_event_control/morph + name = "Spawn Morph" + typepath = /datum/round_event/morph + weight = 0 //Admin only + max_occurrences = 1 + +/datum/round_event/morph + var/key_of_morph + +/datum/round_event/morph/proc/get_morph(var/end_if_fail = 0) + key_of_morph = null + if(!key_of_morph) + var/list/candidates = get_candidates(BE_ALIEN) + if(!candidates.len) + if(end_if_fail) + return 0 + return find_morph() + var/client/C = pick(candidates) + key_of_morph = C.key + if(!key_of_morph) + if(end_if_fail) + return 0 + return find_morph() + var/datum/mind/player_mind = new /datum/mind(key_of_morph) + player_mind.active = 1 + if(!xeno_spawn) + return find_morph() + var/mob/living/simple_animal/hostile/morph/S = new /mob/living/simple_animal/hostile/morph(pick(xeno_spawn)) + player_mind.transfer_to(S) + player_mind.assigned_role = "Morph" + player_mind.special_role = "Morph" + ticker.mode.traitors |= player_mind + S << "You are a Morph, a shapeshifting alien creature.
You can assume the shape of anything in sight by Shift-Clicking it.
You can only transform every 5 seconds.
To return to your basic form Shift-Click on yourself." + message_admins("[key_of_morph] has been made into Morph by an event.") + log_game("[key_of_morph] was spawned as a Morph by an event.") + return 1 + +/datum/round_event/morph/start() + get_morph() + + +/datum/round_event/morph/proc/find_morph() + message_admins("Attempted to spawn a Morph but there was no players available. Will try again momentarily.") + spawn(50) + if(get_morph(1)) + message_admins("Situation has been resolved, [key_of_morph] has been spawned as a Morph.") + log_game("[key_of_morph] was spawned as a Morph by an event.") + return 0 + message_admins("Unfortunately, no candidates were available for becoming a Morph. Shutting down.") + return kill() \ No newline at end of file diff --git a/html/changelogs/AnturK-Morph.yml b/html/changelogs/AnturK-Morph.yml new file mode 100644 index 00000000000..f8af17015e9 --- /dev/null +++ b/html/changelogs/AnturK-Morph.yml @@ -0,0 +1,37 @@ + +################################ +# 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 +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# spellcheck (typo fixes) +# experiment +# tgs (TG-ported fixes?) +################################# + +# Your name. +author: AnturK + +# 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: "New species of mimic was spotted in the wilderness of space. Watch out!" \ No newline at end of file diff --git a/icons/mob/animal.dmi b/icons/mob/animal.dmi index 0518872ccf8..e33396b7049 100644 Binary files a/icons/mob/animal.dmi and b/icons/mob/animal.dmi differ diff --git a/tgstation.dme b/tgstation.dme index ca68b0b100e..8144137aef2 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -1253,6 +1253,7 @@ #include "code\modules\mob\living\simple_animal\hostile\retaliate\bat.dm" #include "code\modules\mob\living\simple_animal\hostile\retaliate\clown.dm" #include "code\modules\mob\living\simple_animal\hostile\retaliate\retaliate.dm" +#include "code\modules\mob\living\simple_animal\morph\morph.dm" #include "code\modules\mob\living\simple_animal\revenant\revenant.dm" #include "code\modules\mob\living\simple_animal\revenant\revenant_abilities.dm" #include "code\modules\mob\living\simple_animal\revenant\revenant_spawn_event.dm"