From 966ba79a285b6b7f69c21aa99982a999951fc9ca Mon Sep 17 00:00:00 2001 From: Kelenius Date: Fri, 9 Jan 2015 02:44:02 +0300 Subject: [PATCH 1/4] Update for the slimes Water damage relative to water amount Better interface for player-controlled slimes Feed on simple_animals Heavy refactoring Friendly glomps at the slimes of the same color, non-friendly at the slimes of different color Fixes #7647 Fixes #7107 Fixes #6812 for the slimes only --- baystation12.dme | 1 + code/_onclick/other_mobs.dm | 75 ++- .../mob/living/carbon/metroid/death.dm | 33 +- .../mob/living/carbon/metroid/emote.dm | 3 - .../mob/living/carbon/metroid/items.dm | 366 ++++++++++++ .../modules/mob/living/carbon/metroid/life.dm | 383 ++++++------- .../mob/living/carbon/metroid/metroid.dm | 528 +++--------------- .../mob/living/carbon/metroid/powers.dm | 200 +++---- code/modules/mob/living/carbon/metroid/say.dm | 6 +- .../mob/living/carbon/metroid/subtypes.dm | 2 +- .../mob/living/carbon/metroid/update_icons.dm | 10 +- code/modules/mob/mob_helpers.dm | 2 +- code/modules/reagents/Chemistry-Reagents.dm | 2 +- 13 files changed, 754 insertions(+), 857 deletions(-) create mode 100644 code/modules/mob/living/carbon/metroid/items.dm diff --git a/baystation12.dme b/baystation12.dme index f0a68647ed..701ec2fd39 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -1056,6 +1056,7 @@ #include "code\modules\mob\living\carbon\metroid\emote.dm" #include "code\modules\mob\living\carbon\metroid\examine.dm" #include "code\modules\mob\living\carbon\metroid\hud.dm" +#include "code\modules\mob\living\carbon\metroid\items.dm" #include "code\modules\mob\living\carbon\metroid\life.dm" #include "code\modules\mob\living\carbon\metroid\login.dm" #include "code\modules\mob\living\carbon\metroid\metroid.dm" diff --git a/code/_onclick/other_mobs.dm b/code/_onclick/other_mobs.dm index 479e097251..8d49ffd91b 100644 --- a/code/_onclick/other_mobs.dm +++ b/code/_onclick/other_mobs.dm @@ -120,45 +120,60 @@ // Eating if(Victim) + if (Victim == A) + Feedstop() return - // Basic attack. - A.attack_generic(src, (is_adult ? rand(20,40) : rand(5,25)), "glomped") - - // Handle mob shocks. var/mob/living/M = A - if(istype(M) && powerlevel > 0 && !istype(A,/mob/living/carbon/slime)) + if (istype(M)) - if(ishuman(M)) - var/mob/living/carbon/human/H = M - if(H.species.flags & IS_SYNTHETIC || (H.species.siemens_coefficient<0.5)) - return + switch(src.a_intent) + if ("help") // We just poke the other + M.visible_message("[src] gently pokes [M]!", "[src] gently pokes you!") + if ("disarm") // We stun the target, with the intention to feed + var/stunprob = 0 + var/power = max(0, min(10, (powerlevel + rand(0, 3)))) + if (powerlevel > 0 && !istype(A, /mob/living/carbon/slime)) + if(ishuman(M)) + var/mob/living/carbon/human/H = M + if(H.species.flags & IS_SYNTHETIC || (H.species.siemens_coefficient<0.5)) + return - var/power = max(0,min(10,(powerlevel+rand(0,3)))) - var/stunprob = 10 - switch(power*10) - if(1 to 2) stunprob = 20 - if(3 to 4) stunprob = 30 - if(5 to 6) stunprob = 40 - if(7 to 8) stunprob = 60 - if(9) stunprob = 70 - if(10) stunprob = 95 + switch(power * 10) + if(0) stunprob = 10 + if(1 to 2) stunprob = 20 + if(3 to 4) stunprob = 30 + if(5 to 6) stunprob = 40 + if(7 to 8) stunprob = 60 + if(9) stunprob = 70 + if(10) stunprob = 95 - if(prob(stunprob)) - powerlevel = max(0,powerlevel-3) - src.visible_message("\red The [name] has shocked [M]!") - M.Weaken(power) - M.Stun(power) - if (M.stuttering < power) M.stuttering = power + if(prob(stunprob)) + powerlevel = max(0, powerlevel-3) + M.visible_message("[src] has shocked [M]!", "[src] has shocked you!") + M.Weaken(power) + M.Stun(power) + M.stuttering = max(M.stuttering, power) - var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread - s.set_up(5, 1, M) - s.start() + var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread + s.set_up(5, 1, M) + s.start() - if(prob(stunprob) && powerlevel >= 8) - M.adjustFireLoss(powerlevel * rand(6,10)) - M.updatehealth() + if(prob(stunprob) && powerlevel >= 8) + M.adjustFireLoss(powerlevel * rand(6,10)) + else if(prob(40)) + M.visible_message("[src] has pounced at [M]!", "[src] has pounced at you!") + M.Weaken(power) + else + M.visible_message("[src] has tried to pounce at [M]!", "[src] has tried to pounce at you!") + M.updatehealth() + if ("grab") // We feed + Wrap(M) + if ("hurt") // Attacking + A.attack_generic(src, (is_adult ? rand(20,40) : rand(5,25)), "glomped") + else + A.attack_generic(src, (is_adult ? rand(20,40) : rand(5,25)), "glomped") // Basic attack. /* New Players: Have no reason to click on anything at all. diff --git a/code/modules/mob/living/carbon/metroid/death.dm b/code/modules/mob/living/carbon/metroid/death.dm index 2ebc5c576b..022726b00a 100644 --- a/code/modules/mob/living/carbon/metroid/death.dm +++ b/code/modules/mob/living/carbon/metroid/death.dm @@ -1,22 +1,23 @@ /mob/living/carbon/slime/death(gibbed) if(stat == DEAD) return - stat = DEAD - if(!gibbed) - if(is_adult) - var/mob/living/carbon/slime/M = new /mob/living/carbon/slime(loc) - M.colour = colour - M.rabid = 1 - is_adult = 0 - maxHealth = 150 - revive() - regenerate_icons() - number = rand(1, 1000) - name = "[colour] [is_adult ? "adult" : "baby"] slime ([number])" - return + if(!gibbed && is_adult) + var/mob/living/carbon/slime/M = new /mob/living/carbon/slime(loc, colour) + M.rabid = 1 + M.Friends = Friends.Copy() + step_away(M, src) + is_adult = 0 + maxHealth = 150 + revive() + regenerate_icons() + if (!client) rabid = 1 + number = rand(1, 1000) + name = "[colour] [is_adult ? "adult" : "baby"] slime ([number])" + return - icon_state = "[colour] baby slime dead" - overlays.Cut() + . = ..(gibbed, "seizes up and falls limp...") - return ..(gibbed) \ No newline at end of file + regenerate_icons() + + return \ No newline at end of file diff --git a/code/modules/mob/living/carbon/metroid/emote.dm b/code/modules/mob/living/carbon/metroid/emote.dm index 2cbc139f5a..829b9dcf1e 100644 --- a/code/modules/mob/living/carbon/metroid/emote.dm +++ b/code/modules/mob/living/carbon/metroid/emote.dm @@ -1,6 +1,5 @@ /mob/living/carbon/slime/emote(var/act, var/m_type=1, var/message = null) - if (findtext(act, "-", 1, null)) var/t1 = findtext(act, "-", 1, null) //param = copytext(act, t1 + 1, length(act) + 1) @@ -68,9 +67,7 @@ if (m_type & 1) for(var/mob/O in viewers(src, null)) O.show_message(message, m_type) - //Foreach goto(703) else for(var/mob/O in hearers(src, null)) O.show_message(message, m_type) - //Foreach goto(746) return \ No newline at end of file diff --git a/code/modules/mob/living/carbon/metroid/items.dm b/code/modules/mob/living/carbon/metroid/items.dm new file mode 100644 index 0000000000..eb3836daad --- /dev/null +++ b/code/modules/mob/living/carbon/metroid/items.dm @@ -0,0 +1,366 @@ +/obj/item/slime_extract + name = "slime extract" + desc = "Goo extracted from a slime. Legends claim these to have \"magical powers\"." + icon = 'icons/mob/slimes.dmi' + icon_state = "grey slime extract" + force = 1.0 + w_class = 1.0 + throwforce = 0 + throw_speed = 3 + throw_range = 6 + origin_tech = "biotech=4" + var/Uses = 1 // uses before it goes inert + var/enhanced = 0 //has it been enhanced before? + + attackby(obj/item/O as obj, mob/user as mob) + if(istype(O, /obj/item/weapon/slimesteroid2)) + if(enhanced == 1) + user << " This extract has already been enhanced!" + return ..() + if(Uses == 0) + user << " You can't enhance a used extract!" + return ..() + user <<"You apply the enhancer. It now has triple the amount of uses." + Uses = 3 + enhanced = 1 + del(O) + +/obj/item/slime_extract/New() + ..() + create_reagents(100) + +/obj/item/slime_extract/grey + name = "grey slime extract" + icon_state = "grey slime extract" + +/obj/item/slime_extract/gold + name = "gold slime extract" + icon_state = "gold slime extract" + +/obj/item/slime_extract/silver + name = "silver slime extract" + icon_state = "silver slime extract" + +/obj/item/slime_extract/metal + name = "metal slime extract" + icon_state = "metal slime extract" + +/obj/item/slime_extract/purple + name = "purple slime extract" + icon_state = "purple slime extract" + +/obj/item/slime_extract/darkpurple + name = "dark purple slime extract" + icon_state = "dark purple slime extract" + +/obj/item/slime_extract/orange + name = "orange slime extract" + icon_state = "orange slime extract" + +/obj/item/slime_extract/yellow + name = "yellow slime extract" + icon_state = "yellow slime extract" + +/obj/item/slime_extract/red + name = "red slime extract" + icon_state = "red slime extract" + +/obj/item/slime_extract/blue + name = "blue slime extract" + icon_state = "blue slime extract" + +/obj/item/slime_extract/darkblue + name = "dark blue slime extract" + icon_state = "dark blue slime extract" + +/obj/item/slime_extract/pink + name = "pink slime extract" + icon_state = "pink slime extract" + +/obj/item/slime_extract/green + name = "green slime extract" + icon_state = "green slime extract" + +/obj/item/slime_extract/lightpink + name = "light pink slime extract" + icon_state = "light pink slime extract" + +/obj/item/slime_extract/black + name = "black slime extract" + icon_state = "black slime extract" + +/obj/item/slime_extract/oil + name = "oil slime extract" + icon_state = "oil slime extract" + +/obj/item/slime_extract/adamantine + name = "adamantine slime extract" + icon_state = "adamantine slime extract" + +/obj/item/slime_extract/bluespace + name = "bluespace slime extract" + icon_state = "bluespace slime extract" + +/obj/item/slime_extract/pyrite + name = "pyrite slime extract" + icon_state = "pyrite slime extract" + +/obj/item/slime_extract/cerulean + name = "cerulean slime extract" + icon_state = "cerulean slime extract" + +/obj/item/slime_extract/sepia + name = "sepia slime extract" + icon_state = "sepia slime extract" + +/obj/item/slime_extract/rainbow + name = "rainbow slime extract" + icon_state = "rainbow slime extract" + +////Pet Slime Creation/// + +/obj/item/weapon/slimepotion + name = "docility potion" + desc = "A potent chemical mix that will nullify a slime's powers, causing it to become docile and tame." + icon = 'icons/obj/chemical.dmi' + icon_state = "bottle19" + + attack(mob/living/carbon/slime/M as mob, mob/user as mob) + if(!istype(M, /mob/living/carbon/slime))//If target is not a slime. + user << " The potion only works on baby slimes!" + return ..() + if(M.is_adult) //Can't tame adults + user << " Only baby slimes can be tamed!" + return..() + if(M.stat) + user << " The slime is dead!" + return..() + if(M.mind) + user << " The slime resists!" + return ..() + var/mob/living/simple_animal/slime/pet = new /mob/living/simple_animal/slime(M.loc) + pet.icon_state = "[M.colour] baby slime" + pet.icon_living = "[M.colour] baby slime" + pet.icon_dead = "[M.colour] baby slime dead" + pet.colour = "[M.colour]" + user <<"You feed the slime the potion, removing it's powers and calming it." + del(M) + var/newname = copytext(sanitize(input(user, "Would you like to give the slime a name?", "Name your new pet", "pet slime") as null|text),1,MAX_NAME_LEN) + + if (!newname) + newname = "pet slime" + pet.name = newname + pet.real_name = newname + del(src) + +/obj/item/weapon/slimepotion2 + name = "advanced docility potion" + desc = "A potent chemical mix that will nullify a slime's powers, causing it to become docile and tame. This one is meant for adult slimes" + icon = 'icons/obj/chemical.dmi' + icon_state = "bottle19" + + attack(mob/living/carbon/slime/M as mob, mob/user as mob) + if(!istype(M, /mob/living/carbon/slime/))//If target is not a slime. + user << " The potion only works on slimes!" + return ..() + if(M.stat) + user << " The slime is dead!" + return..() + if(M.mind) + user << " The slime resists!" + return ..() + var/mob/living/simple_animal/adultslime/pet = new /mob/living/simple_animal/adultslime(M.loc) + pet.icon_state = "[M.colour] adult slime" + pet.icon_living = "[M.colour] adult slime" + pet.icon_dead = "[M.colour] baby slime dead" + pet.colour = "[M.colour]" + user <<"You feed the slime the potion, removing it's powers and calming it." + del(M) + var/newname = copytext(sanitize(input(user, "Would you like to give the slime a name?", "Name your new pet", "pet slime") as null|text),1,MAX_NAME_LEN) + + if (!newname) + newname = "pet slime" + pet.name = newname + pet.real_name = newname + del(src) + + +/obj/item/weapon/slimesteroid + name = "slime steroid" + desc = "A potent chemical mix that will cause a slime to generate more extract." + icon = 'icons/obj/chemical.dmi' + icon_state = "bottle16" + + attack(mob/living/carbon/slime/M as mob, mob/user as mob) + if(!istype(M, /mob/living/carbon/slime))//If target is not a slime. + user << " The steroid only works on baby slimes!" + return ..() + if(M.is_adult) //Can't tame adults + user << " Only baby slimes can use the steroid!" + return..() + if(M.stat) + user << " The slime is dead!" + return..() + if(M.cores == 3) + user <<" The slime already has the maximum amount of extract!" + return..() + + user <<"You feed the slime the steroid. It now has triple the amount of extract." + M.cores = 3 + del(src) + +/obj/item/weapon/slimesteroid2 + name = "extract enhancer" + desc = "A potent chemical mix that will give a slime extract three uses." + icon = 'icons/obj/chemical.dmi' + icon_state = "bottle17" + + /*afterattack(obj/target, mob/user , flag) + if(istype(target, /obj/item/slime_extract)) + if(target.enhanced == 1) + user << " This extract has already been enhanced!" + return ..() + if(target.Uses == 0) + user << " You can't enhance a used extract!" + return ..() + user <<"You apply the enhancer. It now has triple the amount of uses." + target.Uses = 3 + target.enahnced = 1 + del(src)*/ + +/obj/effect/golemrune + anchored = 1 + desc = "a strange rune used to create golems. It glows when spirits are nearby." + name = "rune" + icon = 'icons/obj/rune.dmi' + icon_state = "golem" + unacidable = 1 + layer = TURF_LAYER + + New() + ..() + processing_objects.Add(src) + + process() + var/mob/dead/observer/ghost + for(var/mob/dead/observer/O in src.loc) + if(!O.client) continue + if(O.mind && O.mind.current && O.mind.current.stat != DEAD) continue + ghost = O + break + if(ghost) + icon_state = "golem2" + else + icon_state = "golem" + + attack_hand(mob/living/user as mob) + var/mob/dead/observer/ghost + for(var/mob/dead/observer/O in src.loc) + if(!O.client) continue + if(O.mind && O.mind.current && O.mind.current.stat != DEAD) continue + ghost = O + break + if(!ghost) + user << "The rune fizzles uselessly. There is no spirit nearby." + return + var/mob/living/carbon/human/G = new(src.loc) + G.set_species("Golem") + G.key = ghost.key + G << "You are an adamantine golem. You move slowly, but are highly resistant to heat and cold as well as blunt trauma. You are unable to wear clothes, but can still use most tools. Serve [user], and assist them in completing their goals at any cost." + del (src) + + + proc/announce_to_ghosts() + for(var/mob/dead/observer/G in player_list) + if(G.client) + var/area/A = get_area(src) + if(A) + G << "Golem rune created in [A.name]." + +/mob/living/carbon/slime/has_eyes() + return 0 + +//////////////////////////////Old shit from metroids/RoRos, and the old cores, would not take much work to re-add them//////////////////////// + +/* +// Basically this slime Core catalyzes reactions that normally wouldn't happen anywhere +/obj/item/slime_core + name = "slime extract" + desc = "Goo extracted from a slime. Legends claim these to have \"magical powers\"." + icon = 'icons/mob/slimes.dmi' + icon_state = "slime extract" + force = 1.0 + w_class = 1.0 + throwforce = 1.0 + throw_speed = 2 + throw_range = 6 + origin_tech = "biotech=4" + var/POWERFLAG = 0 // sshhhhhhh + var/Flush = 30 + var/Uses = 5 // uses before it goes inert + +/obj/item/slime_core/New() + ..() + create_reagents(100) + POWERFLAG = rand(1,10) + Uses = rand(7, 25) + //flags |= NOREACT +/* + spawn() + Life() + + proc/Life() + while(src) + sleep(25) + Flush-- + if(Flush <= 0) + reagents.clear_reagents() + Flush = 30 +*/ + + + +/obj/item/weapon/reagent_containers/food/snacks/egg/slime + name = "slime egg" + desc = "A small, gelatinous egg." + icon = 'icons/mob/mob.dmi' + icon_state = "slime egg-growing" + bitesize = 12 + origin_tech = "biotech=4" + var/grown = 0 + +/obj/item/weapon/reagent_containers/food/snacks/egg/slime/New() + ..() + reagents.add_reagent("nutriment", 4) + reagents.add_reagent("slimejelly", 1) + spawn(rand(1200,1500))//the egg takes a while to "ripen" + Grow() + +/obj/item/weapon/reagent_containers/food/snacks/egg/slime/proc/Grow() + grown = 1 + icon_state = "slime egg-grown" + processing_objects.Add(src) + return + +/obj/item/weapon/reagent_containers/food/snacks/egg/slime/proc/Hatch() + processing_objects.Remove(src) + var/turf/T = get_turf(src) + src.visible_message(" The [name] pulsates and quivers!") + spawn(rand(50,100)) + src.visible_message(" The [name] bursts open!") + new/mob/living/carbon/slime(T) + del(src) + + +/obj/item/weapon/reagent_containers/food/snacks/egg/slime/process() + var/turf/location = get_turf(src) + var/datum/gas_mixture/environment = location.return_air() + if (environment.phoron > MOLES_PHORON_VISIBLE)//phoron exposure causes the egg to hatch + src.Hatch() + +/obj/item/weapon/reagent_containers/food/snacks/egg/slime/attackby(obj/item/weapon/W as obj, mob/user as mob) + if(istype( W, /obj/item/toy/crayon )) + return + else + ..() +*/ diff --git a/code/modules/mob/living/carbon/metroid/life.dm b/code/modules/mob/living/carbon/metroid/life.dm index de34d74afa..22b61291ef 100644 --- a/code/modules/mob/living/carbon/metroid/life.dm +++ b/code/modules/mob/living/carbon/metroid/life.dm @@ -1,10 +1,3 @@ -/mob/living/carbon/slime - var/AIproc = 0 // determines if the AI loop is activated - var/Atkcool = 0 // attack cooldown - var/Tempstun = 0 // temporary temperature stuns - var/Discipline = 0 // if a slime has been hit with a freeze gun, or wrestled/attacked off a human, they become disciplined and don't attack anymore for a while - var/SStun = 0 // stun variable - /mob/living/carbon/slime/Life() set invisibility = 0 set background = 1 @@ -15,113 +8,27 @@ ..() if(stat != DEAD) - //Chemicals in the body handle_chemicals_in_body() - handle_nutrition() - handle_targets() - - if (!ckey) + if (!client) + handle_targets() + if (!AIproc) + spawn() + handle_AI() handle_speech_and_mood() var/datum/gas_mixture/environment if(src.loc) environment = loc.return_air() - //Apparently, the person who wrote this code designed it so that - //blinded get reset each cycle and then get activated later in the - //code. Very ugly. I dont care. Moving this stuff here so its easy - //to find it. - src.blinded = null - - regular_hud_updates() // Basically just deletes any screen objects :< + regular_hud_updates() if(environment) handle_environment(environment) // Handle temperature/pressure differences between body and environment handle_regular_status_updates() // Status updates, death etc. -/mob/living/carbon/slime/proc/AIprocess() // the master AI process - - if(AIproc || stat == DEAD || client) return - - var/hungry = 0 - if (nutrition < get_starve_nutrition()) - hungry = 2 - else if (nutrition < get_grow_nutrition() && prob(25) || nutrition < get_hunger_nutrition()) - hungry = 1 - - AIproc = 1 - - while(AIproc && stat != 2 && (attacked || hungry || rabid || Victim)) - if(Victim) // can't eat AND have this little process at the same time - break - - if(!Target || client) - break - - if(Target.health <= -70 || Target.stat == 2) - Target = null - AIproc = 0 - break - - if(Target) - for(var/mob/living/carbon/slime/M in view(1,Target)) - if(M.Victim == Target) - Target = null - AIproc = 0 - break - if(!AIproc) - break - - if(Target in view(1,src)) - if(istype(Target, /mob/living/silicon)) - if(!Atkcool) - Atkcool = 1 - spawn(45) - Atkcool = 0 - - if(Target.Adjacent(src)) - UnarmedAttack(Target) - return - if(!Target.lying && prob(80)) - - if(Target.client && Target.health >= 20) - if(!Atkcool) - Atkcool = 1 - spawn(45) - Atkcool = 0 - - if(Target.Adjacent(src)) - UnarmedAttack(Target) - - else - if(!Atkcool && Target.Adjacent(src)) - Feedon(Target) - - else - if(!Atkcool && Target.Adjacent(src)) - Feedon(Target) - - else - if(Target in view(7, src)) - if(!Target.Adjacent(src)) // Bug of the month candidate: slimes were attempting to move to target only if it was directly next to them, which caused them to target things, but not approach them - step_to(src, Target) - sleep(5) - - else - Target = null - AIproc = 0 - break - - var/sleeptime = movement_delay() - if(sleeptime <= 0) sleeptime = 1 - - sleep(sleeptime + 2) // this is about as fast as a player slime can go - - AIproc = 0 - /mob/living/carbon/slime/proc/handle_environment(datum/gas_mixture/environment) if(!environment) adjustToxLoss(rand(10,20)) @@ -146,8 +53,6 @@ //Account for massive pressure differences if(bodytemperature < (T0C + 5)) // start calculating temperature damage etc - if(bodytemperature <= (T0C - 40)) // stun temperature - Tempstun = 1 if(bodytemperature <= (T0C - 50)) // hurt temperature if(bodytemperature <= 50) // sqrting negative numbers is bad @@ -155,9 +60,6 @@ else adjustToxLoss(round(sqrt(bodytemperature)) * 2) - else - Tempstun = 0 - updatehealth() return //TODO: DEFERRED @@ -189,22 +91,16 @@ /mob/living/carbon/slime/proc/handle_regular_status_updates() - if(is_adult) - health = 200 - (getOxyLoss() + getToxLoss() + getFireLoss() + getBruteLoss() + getCloneLoss()) - else - health = 150 - (getOxyLoss() + getToxLoss() + getFireLoss() + getBruteLoss() + getCloneLoss()) + src.blinded = null - if(health < config.health_threshold_dead && stat != 2) + health = maxHealth - (getOxyLoss() + getToxLoss() + getFireLoss() + getBruteLoss() + getCloneLoss()) + + if(health < 0 && stat != DEAD) death() return - else if(src.health < config.health_threshold_crit) - - if(!src.reagents.has_reagent("inaprovaline")) - src.adjustOxyLoss(10) - - if(src.stat != DEAD) - src.stat = UNCONSCIOUS + if (halloss) + halloss = 0 if(prob(30)) adjustOxyLoss(-1) @@ -267,27 +163,16 @@ if(nutrition <= 0) nutrition = 0 - if(prob(75)) - adjustToxLoss(rand(0,5)) + adjustToxLoss(rand(1,3)) + if (client && prob(5)) + src << "You are starving!" else if (nutrition >= get_grow_nutrition() && amount_grown < 10) nutrition -= 20 amount_grown++ - if(amount_grown >= 10 && !Victim && !Target && !ckey) - if(is_adult) - Reproduce() - else - Evolve() - /mob/living/carbon/slime/proc/handle_targets() - if(Tempstun) - if(!Victim) // not while they're eating! - canmove = 0 - else - canmove = 1 - - if(attacked > 50) attacked = 50 + if(attacked > 50) attacked = 50 // Let's not get into absurdly long periods of rage if(attacked > 0) attacked-- @@ -300,106 +185,180 @@ if(prob(10)) Discipline-- - if(!client) - if(!canmove) return + if(!canmove) return - if(Victim) return // if it's eating someone already, continue eating! + if(Victim) return // if it's eating someone already, continue eating! - if(Target) - --target_patience - if (target_patience <= 0 || SStun || Discipline || attacked) // Tired of chasing or something draws out attention - target_patience = 0 - Target = null + if(Target) + --target_patience + if (target_patience <= 0 || SStun || Discipline || attacked) // Tired of chasing or something draws out attention + target_patience = 0 + Target = null - if(AIproc && SStun) return + var/hungry = 0 // determines if the slime is hungry - var/hungry = 0 // determines if the slime is hungry + if (nutrition < get_starve_nutrition()) + hungry = 2 + else if (nutrition < get_grow_nutrition() && prob(25) || nutrition < get_hunger_nutrition()) + hungry = 1 - if (nutrition < get_starve_nutrition()) - hungry = 2 - else if (nutrition < get_grow_nutrition() && prob(25) || nutrition < get_hunger_nutrition()) - hungry = 1 + if(hungry == 2 && !client) // if a slime is starving, it starts losing its friends + if(Friends.len > 0 && prob(1)) + var/mob/nofriend = pick(Friends) + --Friends[nofriend] + if (Friends[nofriend] <= 0) + Friends -= nofriend - if(hungry == 2 && !client) // if a slime is starving, it starts losing its friends - if(Friends.len > 0 && prob(1)) - var/mob/nofriend = pick(Friends) - --Friends[nofriend] + if(!Target) + if(will_hunt(hungry) || attacked || rabid) // Only add to the list if we need to + var/list/targets = list() - if(!Target) - if(will_hunt() && hungry || attacked || rabid) // Only add to the list if we need to - var/list/targets = list() + for(var/mob/living/L in view(7,src)) - for(var/mob/living/L in view(7,src)) + if(isslime(L) || L.stat == DEAD) // Ignore other slimes and dead mobs + continue - if(isslime(L) || L.stat == DEAD) // Ignore other slimes and dead mobs - continue - - if(L in Friends) // No eating friends! - continue - - if(issilicon(L) && (rabid || attacked)) // They can't eat silicons, but they can glomp them in defence - targets += L // Possible target found! - - if(istype(L, /mob/living/carbon/human) && dna) //Ignore slime(wo)men - var/mob/living/carbon/human/H = L - if(H.species.name == "Slime") - continue - - if(!L.canmove) // Only one slime can latch on at a time. - var/notarget = 0 - for(var/mob/living/carbon/slime/M in view(1,L)) - if(M.Victim == L) - notarget = 1 - if(notarget) - continue + if(L in Friends) // No eating friends! + continue + if(issilicon(L) && (rabid || attacked)) // They can't eat silicons, but they can glomp them in defence targets += L // Possible target found! - if(targets.len > 0) - if(attacked || rabid || hungry == 2) - Target = targets[1] // I am attacked and am fighting back or so hungry I don't even care - else - for(var/mob/living/carbon/C in targets) - if(!Discipline && prob(5)) - if(ishuman(C)) - Target = C - break + if(istype(L, /mob/living/carbon/human) && dna) //Ignore slime(wo)men + var/mob/living/carbon/human/H = L + if(H.species.name == "Slime") + continue - if(isalien(C) || ismonkey(C)) - Target = C - break + if(!L.canmove) // Only one slime can latch on at a time. + var/notarget = 0 + for(var/mob/living/carbon/slime/M in view(1,L)) + if(M.Victim == L) + notarget = 1 + if(notarget) + continue - if (Target) - target_patience = rand(5,7) - if (is_adult) - target_patience += 3 + targets += L // Possible target found! - if(!Target) // If we have no target, we are wandering or following orders - if (Leader) - if (holding_still) - holding_still = max(holding_still - 1, 0) - else if(canmove && isturf(loc)) - step_to(src, Leader) + if(targets.len > 0) + if(attacked || rabid || hungry == 2) + Target = targets[1] // I am attacked and am fighting back or so hungry I don't even care + else + for(var/mob/living/carbon/C in targets) + if(ishuman(C) && !Discipline && prob(5)) + Target = C + break - else if(hungry) - if (holding_still) - holding_still = max(holding_still - hungry, 0) - else if(canmove && isturf(loc) && prob(50)) - step(src, pick(cardinal)) + if(isalien(C) || ismonkey(C) || isanimal(C)) + Target = C + break + + if (Target) + target_patience = rand(5,7) + if (is_adult) + target_patience += 3 + + if(!Target) // If we have no target, we are wandering or following orders + if (Leader) + if (holding_still) + holding_still = max(holding_still - 1, 0) + else if(canmove && isturf(loc)) + step_to(src, Leader) + + else if(hungry) + if (holding_still) + holding_still = max(holding_still - 1 - hungry, 0) + else if(canmove && isturf(loc) && prob(50)) + step(src, pick(cardinal)) + + else + if (holding_still) + holding_still = max(holding_still - 1, 0) + else if(canmove && isturf(loc) && prob(33)) + step(src, pick(cardinal)) + +/mob/living/carbon/slime/proc/handle_AI() // the master AI process + + if(stat == DEAD || client || Victim) return // If we're dead or have a client, we don't need AI, if we're feeding, we continue feeding + AIproc = 1 + + if(amount_grown >= 10 && !Target) + if(is_adult) + Reproduce() + else + Evolve() + AIproc = 0 + return + + if(Target) // We're chasing the target + if(Target.stat == DEAD) + Target = null + AIproc = 0 + return + + for(var/mob/living/carbon/slime/M in view(1, Target)) + if(M.Victim == Target) + Target = null + AIproc = 0 + return + + if(Target.Adjacent(src)) + if(istype(Target, /mob/living/silicon)) // Glomp the silicons + if(!Atkcool) + a_intent = "hurt" + UnarmedAttack(Target) + Atkcool = 1 + spawn(45) + Atkcool = 0 + AIproc = 0 + return + + if(Target.client && !Target.lying && prob(60 + powerlevel * 4)) // Try to take down the target first + if(!Atkcool) + Atkcool = 1 + spawn(45) + Atkcool = 0 + + a_intent = "disarm" + UnarmedAttack(Target) else - if (holding_still) - holding_still = max(holding_still - 1, 0) - else if(canmove && isturf(loc) && prob(33)) - step(src, pick(cardinal)) - else if(!AIproc) - spawn() - AIprocess() + if(!Atkcool) + a_intent = "grab" + UnarmedAttack(Target) + + else if(Target in view(7, src)) + step_to(src, Target) + + else + Target = null + AIproc = 0 + return + + else + var/mob/living/carbon/slime/frenemy + for (var/mob/living/carbon/slime/S in view(1, src)) + if (S != src) + frenemy = S + if (frenemy && prob(1)) + if (frenemy.colour == colour) + a_intent = "help" + else + a_intent = "hurt" + UnarmedAttack(frenemy) + + var/sleeptime = movement_delay() + if(sleeptime <= 5) sleeptime = 5 // Maximum one action per half a second + spawn (sleeptime) + handle_AI() + return /mob/living/carbon/slime/proc/handle_speech_and_mood() //Mood starts here var/newmood = "" - if (rabid || attacked) newmood = "angry" + a_intent = "help" + if (rabid || attacked) + newmood = "angry" + a_intent = "hurt" else if (Target) newmood = "mischevous" if (!newmood) @@ -569,11 +528,13 @@ if (is_adult) return 300 else return 200 -/mob/living/carbon/slime/proc/will_hunt(var/hunger = -1) // Check for being stopped from feeding and chasing +/mob/living/carbon/slime/proc/will_hunt(var/hunger) // Check for being stopped from feeding and chasing if (hunger == 2 || rabid || attacked) return 1 if (Leader) return 0 if (holding_still) return 0 - return 1 + if (hunger == 1 || prob(25)) + return 1 + return 0 /mob/living/carbon/slime/slip() //Can't slip something without legs. return 0 \ No newline at end of file diff --git a/code/modules/mob/living/carbon/metroid/metroid.dm b/code/modules/mob/living/carbon/metroid/metroid.dm index e6a1938a05..c5e7366218 100644 --- a/code/modules/mob/living/carbon/metroid/metroid.dm +++ b/code/modules/mob/living/carbon/metroid/metroid.dm @@ -4,10 +4,9 @@ icon_state = "grey baby slime" pass_flags = PASSTABLE var/is_adult = 0 - speak_emote = list("telepathically chirps") + speak_emote = list("chirps") layer = 5 - maxHealth = 150 health = 150 gender = NEUTER @@ -25,7 +24,7 @@ var/cores = 1 // the number of /obj/item/slime_extract's the slime has left inside var/mutation_chance = 30 // Chance of mutating, should be between 25 and 35 - var/powerlevel = 0 // 1-10 controls how much electricity they are generating + var/powerlevel = 0 // 0-10 controls how much electricity they are generating var/amount_grown = 0 // controls how long the slime has been overfed, if 10, grows or reproduces var/number = 0 // Used to understand when someone is talking to it @@ -45,6 +44,11 @@ var/mood = "" // To show its face + var/AIproc = 0 // If it's 0, we need to launch an AI proc + var/Atkcool = 0 // attack cooldown + var/SStun = 0 // NPC stun variable. Used to calm them down when they are attacked while feeding, or they will immediately re-attach + var/Discipline = 0 // if a slime has been hit with a freeze gun, or wrestled/attacked off a human, they become disciplined and don't attack anymore for a while. The part about freeze gun is a lie + ///////////TIME FOR SUBSPECIES var/colour = "grey" @@ -53,28 +57,21 @@ var/core_removal_stage = 0 //For removing cores. -/mob/living/carbon/slime/New() +/mob/living/carbon/slime/New(var/location, var/colour="grey") verbs += /mob/living/proc/ventcrawl create_reagents(100) - spawn (0) - number = rand(1, 1000) - name = "[colour] [is_adult ? "adult" : "baby"] slime ([number])" - icon_state = "[colour] [is_adult ? "adult" : "baby"] slime" - real_name = name - slime_mutation = mutation_table(colour) - mutation_chance = rand(25, 35) - var/sanitizedcolour = replacetext(colour, " ", "") - coretype = text2path("/obj/item/slime_extract/[sanitizedcolour]") - ..() -/mob/living/carbon/slime/regenerate_icons() - icon_state = "[colour] [is_adult ? "adult" : "baby"] slime" - overlays.len = 0 - if (mood) - overlays += image('icons/mob/slimes.dmi', icon_state = "aslime-[mood]") - ..() + src.colour = colour + number = rand(1, 1000) + name = "[colour] [is_adult ? "adult" : "baby"] slime ([number])" + real_name = name + slime_mutation = mutation_table(colour) + mutation_chance = rand(25, 35) + var/sanitizedcolour = replacetext(colour, " ", "") + coretype = text2path("/obj/item/slime_extract/[sanitizedcolour]") + ..(location) /mob/living/carbon/slime/movement_delay() if (bodytemperature >= 330.23) // 135 F @@ -82,8 +79,8 @@ var/tally = 0 - var/health_deficiency = (100 - health) - if(health_deficiency >= 45) tally += (health_deficiency / 25) + var/health_deficiency = (maxHealth - health) + if(health_deficiency >= 30) tally += (health_deficiency / 25) if (bodytemperature < 183.222) tally += (283.222 - bodytemperature) / 10 * 1.75 @@ -105,25 +102,23 @@ return now_pushing = 1 - if(isobj(AM)) - if(!client && powerlevel > 0) - var/probab = 10 - switch(powerlevel) - if(1 to 2) probab = 20 - if(3 to 4) probab = 30 - if(5 to 6) probab = 40 - if(7 to 8) probab = 60 - if(9) probab = 70 - if(10) probab = 95 - if(prob(probab)) - if(istype(AM, /obj/structure/window) || istype(AM, /obj/structure/grille)) - if(nutrition <= get_hunger_nutrition() && !Atkcool) - if (is_adult || prob(5)) - UnarmedAttack(AM) - spawn() - Atkcool = 1 - sleep(45) - Atkcool = 0 + if(isobj(AM) && !client && powerlevel > 0) + var/probab = 10 + switch(powerlevel) + if(1 to 2) probab = 20 + if(3 to 4) probab = 30 + if(5 to 6) probab = 40 + if(7 to 8) probab = 60 + if(9) probab = 70 + if(10) probab = 95 + if(prob(probab)) + if(istype(AM, /obj/structure/window) || istype(AM, /obj/structure/grille)) + if(nutrition <= get_hunger_nutrition() && !Atkcool) + if (is_adult || prob(5)) + UnarmedAttack(AM) + Atkcool = 1 + spawn(45) + Atkcool = 0 if(ismob(AM)) var/mob/tmob = AM @@ -139,21 +134,8 @@ return now_pushing = 0 + ..() - if (!istype(AM, /atom/movable)) - return - if (!( now_pushing )) - now_pushing = 1 - if (!( AM.anchored )) - var/t = get_dir(src, AM) - if (istype(AM, /obj/structure/window)) - var/obj/structure/window/W = AM - if(W.is_full_window()) - for(var/obj/structure/window/win in get_step(AM,t)) - now_pushing = 0 - return - step(AM, t) - now_pushing = null /mob/living/carbon/slime/Process_Spacemove() return 2 @@ -162,10 +144,8 @@ ..() statpanel("Status") - if(is_adult) - stat(null, "Health: [round((health / 200) * 100)]%") - else - stat(null, "Health: [round((health / 150) * 100)]%") + stat(null, "Health: [round((health / maxHealth) * 100)]%") + stat(null, "Intent: [a_intent]") if (client.statpanel == "Status") stat(null, "Nutrition: [nutrition]/[get_max_nutrition()]") @@ -227,9 +207,7 @@ if(shielded) damage /= 4 - //paralysis += 1 - - show_message(" The blob attacks you!") + show_message(" The blob attacks you!") adjustFireLoss(damage) @@ -244,14 +222,12 @@ return /mob/living/carbon/slime/meteorhit(O as obj) - for(var/mob/M in viewers(src, null)) - if ((M.client && !( M.blinded ))) - M.show_message(text("\red [] has been hit by []", src, O), 1) - if (health > 0) - adjustBruteLoss((istype(O, /obj/effect/meteor/small) ? 10 : 25)) - adjustFireLoss(30) + visible_message("[src] has been hit by [O]") - updatehealth() + adjustBruteLoss((istype(O, /obj/effect/meteor/small) ? 10 : 25)) + adjustFireLoss(30) + + updatehealth() return /mob/living/carbon/slime/attack_hand(mob/living/carbon/human/M as mob) @@ -271,11 +247,9 @@ if(prob(90) && !client) Discipline++ - spawn() - SStun = 1 - sleep(rand(45,60)) - if(src) - SStun = 0 + SStun = 1 + spawn(rand(45,60)) + SStun = 0 Victim = null anchored = 0 @@ -299,11 +273,9 @@ if(Discipline == 1) attacked = 0 - spawn() - SStun = 1 - sleep(rand(55,65)) - if(src) - SStun = 0 + SStun = 1 + spawn(rand(55,65)) + SStun = 0 Victim = null anchored = 0 @@ -345,15 +317,13 @@ if(prob(80) && !client) Discipline++ spawn(0) - step_away(src,M,15) sleep(3) step_away(src,M,15) - playsound(loc, "punch", 25, 1, -1) visible_message("[M] has punched [src]!", \ - "[M] has punched [src]!") + "[M] has punched [src]!") adjustBruteLoss(damage) updatehealth() @@ -381,9 +351,8 @@ Target = null anchored = 0 - spawn() - SStun = 1 - sleep(rand(5,20)) + SStun = 1 + spawn(rand(5,20)) SStun = 0 spawn(0) @@ -403,9 +372,8 @@ Discipline++ if(Discipline == 1) attacked = 0 - spawn() - SStun = 1 - sleep(rand(5,20)) + SStun = 1 + spawn(rand(5,20)) SStun = 0 Victim = null @@ -426,8 +394,8 @@ /mob/living/carbon/slime/restrained() return 0 -mob/living/carbon/slime/var/co2overloadtime = null -mob/living/carbon/slime/var/temperature_resistance = T0C+75 +/mob/living/carbon/slime/var/co2overloadtime = null +/mob/living/carbon/slime/var/temperature_resistance = T0C+75 /mob/living/carbon/slime/show_inv(mob/user) return @@ -435,8 +403,17 @@ mob/living/carbon/slime/var/temperature_resistance = T0C+75 /mob/living/carbon/slime/toggle_throw_mode() return -/mob/living/carbon/slime/proc/apply_water() - adjustToxLoss(rand(15,20)) +/mob/living/carbon/slime/proc/gain_nutrition(var/amount) + nutrition += amount + if(prob(amount * 2)) // Gain around one level per 50 nutrition + powerlevel++ + if(powerlevel > 10) + powerlevel = 10 + adjustToxLoss(-10) + nutrition = max(nutrition, get_max_nutrition()) + +/mob/living/carbon/slime/proc/apply_water(var/amount) + adjustToxLoss(15 + amount) if (!client) if (Target) // Like cats Target = null @@ -447,370 +424,3 @@ mob/living/carbon/slime/var/temperature_resistance = T0C+75 if(Victim) return "You cannot ventcrawl while feeding." ..() - -/obj/item/slime_extract - name = "slime extract" - desc = "Goo extracted from a slime. Legends claim these to have \"magical powers\"." - icon = 'icons/mob/slimes.dmi' - icon_state = "grey slime extract" - force = 1.0 - w_class = 1.0 - throwforce = 0 - throw_speed = 3 - throw_range = 6 - origin_tech = "biotech=4" - var/Uses = 1 // uses before it goes inert - var/enhanced = 0 //has it been enhanced before? - - attackby(obj/item/O as obj, mob/user as mob) - if(istype(O, /obj/item/weapon/slimesteroid2)) - if(enhanced == 1) - user << " This extract has already been enhanced!" - return ..() - if(Uses == 0) - user << " You can't enhance a used extract!" - return ..() - user <<"You apply the enhancer. It now has triple the amount of uses." - Uses = 3 - enhanced = 1 - del(O) - -/obj/item/slime_extract/New() - ..() - create_reagents(100) - -/obj/item/slime_extract/grey - name = "grey slime extract" - icon_state = "grey slime extract" - -/obj/item/slime_extract/gold - name = "gold slime extract" - icon_state = "gold slime extract" - -/obj/item/slime_extract/silver - name = "silver slime extract" - icon_state = "silver slime extract" - -/obj/item/slime_extract/metal - name = "metal slime extract" - icon_state = "metal slime extract" - -/obj/item/slime_extract/purple - name = "purple slime extract" - icon_state = "purple slime extract" - -/obj/item/slime_extract/darkpurple - name = "dark purple slime extract" - icon_state = "dark purple slime extract" - -/obj/item/slime_extract/orange - name = "orange slime extract" - icon_state = "orange slime extract" - -/obj/item/slime_extract/yellow - name = "yellow slime extract" - icon_state = "yellow slime extract" - -/obj/item/slime_extract/red - name = "red slime extract" - icon_state = "red slime extract" - -/obj/item/slime_extract/blue - name = "blue slime extract" - icon_state = "blue slime extract" - -/obj/item/slime_extract/darkblue - name = "dark blue slime extract" - icon_state = "dark blue slime extract" - -/obj/item/slime_extract/pink - name = "pink slime extract" - icon_state = "pink slime extract" - -/obj/item/slime_extract/green - name = "green slime extract" - icon_state = "green slime extract" - -/obj/item/slime_extract/lightpink - name = "light pink slime extract" - icon_state = "light pink slime extract" - -/obj/item/slime_extract/black - name = "black slime extract" - icon_state = "black slime extract" - -/obj/item/slime_extract/oil - name = "oil slime extract" - icon_state = "oil slime extract" - -/obj/item/slime_extract/adamantine - name = "adamantine slime extract" - icon_state = "adamantine slime extract" - -/obj/item/slime_extract/bluespace - name = "bluespace slime extract" - icon_state = "bluespace slime extract" - -/obj/item/slime_extract/pyrite - name = "pyrite slime extract" - icon_state = "pyrite slime extract" - -/obj/item/slime_extract/cerulean - name = "cerulean slime extract" - icon_state = "cerulean slime extract" - -/obj/item/slime_extract/sepia - name = "sepia slime extract" - icon_state = "sepia slime extract" - -/obj/item/slime_extract/rainbow - name = "rainbow slime extract" - icon_state = "rainbow slime extract" - -////Pet Slime Creation/// - -/obj/item/weapon/slimepotion - name = "docility potion" - desc = "A potent chemical mix that will nullify a slime's powers, causing it to become docile and tame." - icon = 'icons/obj/chemical.dmi' - icon_state = "bottle19" - - attack(mob/living/carbon/slime/M as mob, mob/user as mob) - if(!istype(M, /mob/living/carbon/slime))//If target is not a slime. - user << " The potion only works on baby slimes!" - return ..() - if(M.is_adult) //Can't tame adults - user << " Only baby slimes can be tamed!" - return..() - if(M.stat) - user << " The slime is dead!" - return..() - if(M.mind) - user << " The slime resists!" - return ..() - var/mob/living/simple_animal/slime/pet = new /mob/living/simple_animal/slime(M.loc) - pet.icon_state = "[M.colour] baby slime" - pet.icon_living = "[M.colour] baby slime" - pet.icon_dead = "[M.colour] baby slime dead" - pet.colour = "[M.colour]" - user <<"You feed the slime the potion, removing it's powers and calming it." - del(M) - var/newname = copytext(sanitize(input(user, "Would you like to give the slime a name?", "Name your new pet", "pet slime") as null|text),1,MAX_NAME_LEN) - - if (!newname) - newname = "pet slime" - pet.name = newname - pet.real_name = newname - del(src) - -/obj/item/weapon/slimepotion2 - name = "advanced docility potion" - desc = "A potent chemical mix that will nullify a slime's powers, causing it to become docile and tame. This one is meant for adult slimes" - icon = 'icons/obj/chemical.dmi' - icon_state = "bottle19" - - attack(mob/living/carbon/slime/M as mob, mob/user as mob) - if(!istype(M, /mob/living/carbon/slime/))//If target is not a slime. - user << " The potion only works on slimes!" - return ..() - if(M.stat) - user << " The slime is dead!" - return..() - if(M.mind) - user << " The slime resists!" - return ..() - var/mob/living/simple_animal/adultslime/pet = new /mob/living/simple_animal/adultslime(M.loc) - pet.icon_state = "[M.colour] adult slime" - pet.icon_living = "[M.colour] adult slime" - pet.icon_dead = "[M.colour] baby slime dead" - pet.colour = "[M.colour]" - user <<"You feed the slime the potion, removing it's powers and calming it." - del(M) - var/newname = copytext(sanitize(input(user, "Would you like to give the slime a name?", "Name your new pet", "pet slime") as null|text),1,MAX_NAME_LEN) - - if (!newname) - newname = "pet slime" - pet.name = newname - pet.real_name = newname - del(src) - - -/obj/item/weapon/slimesteroid - name = "slime steroid" - desc = "A potent chemical mix that will cause a slime to generate more extract." - icon = 'icons/obj/chemical.dmi' - icon_state = "bottle16" - - attack(mob/living/carbon/slime/M as mob, mob/user as mob) - if(!istype(M, /mob/living/carbon/slime))//If target is not a slime. - user << " The steroid only works on baby slimes!" - return ..() - if(M.is_adult) //Can't tame adults - user << " Only baby slimes can use the steroid!" - return..() - if(M.stat) - user << " The slime is dead!" - return..() - if(M.cores == 3) - user <<" The slime already has the maximum amount of extract!" - return..() - - user <<"You feed the slime the steroid. It now has triple the amount of extract." - M.cores = 3 - del(src) - -/obj/item/weapon/slimesteroid2 - name = "extract enhancer" - desc = "A potent chemical mix that will give a slime extract three uses." - icon = 'icons/obj/chemical.dmi' - icon_state = "bottle17" - - /*afterattack(obj/target, mob/user , flag) - if(istype(target, /obj/item/slime_extract)) - if(target.enhanced == 1) - user << " This extract has already been enhanced!" - return ..() - if(target.Uses == 0) - user << " You can't enhance a used extract!" - return ..() - user <<"You apply the enhancer. It now has triple the amount of uses." - target.Uses = 3 - target.enahnced = 1 - del(src)*/ - -/obj/effect/golemrune - anchored = 1 - desc = "a strange rune used to create golems. It glows when spirits are nearby." - name = "rune" - icon = 'icons/obj/rune.dmi' - icon_state = "golem" - unacidable = 1 - layer = TURF_LAYER - - New() - ..() - processing_objects.Add(src) - - process() - var/mob/dead/observer/ghost - for(var/mob/dead/observer/O in src.loc) - if(!O.client) continue - if(O.mind && O.mind.current && O.mind.current.stat != DEAD) continue - ghost = O - break - if(ghost) - icon_state = "golem2" - else - icon_state = "golem" - - attack_hand(mob/living/user as mob) - var/mob/dead/observer/ghost - for(var/mob/dead/observer/O in src.loc) - if(!O.client) continue - if(O.mind && O.mind.current && O.mind.current.stat != DEAD) continue - ghost = O - break - if(!ghost) - user << "The rune fizzles uselessly. There is no spirit nearby." - return - var/mob/living/carbon/human/G = new(src.loc) - G.set_species("Golem") - G.key = ghost.key - G << "You are an adamantine golem. You move slowly, but are highly resistant to heat and cold as well as blunt trauma. You are unable to wear clothes, but can still use most tools. Serve [user], and assist them in completing their goals at any cost." - del (src) - - - proc/announce_to_ghosts() - for(var/mob/dead/observer/G in player_list) - if(G.client) - var/area/A = get_area(src) - if(A) - G << "Golem rune created in [A.name]." - -/mob/living/carbon/slime/has_eyes() - return 0 - -//////////////////////////////Old shit from metroids/RoRos, and the old cores, would not take much work to re-add them//////////////////////// - -/* -// Basically this slime Core catalyzes reactions that normally wouldn't happen anywhere -/obj/item/slime_core - name = "slime extract" - desc = "Goo extracted from a slime. Legends claim these to have \"magical powers\"." - icon = 'icons/mob/slimes.dmi' - icon_state = "slime extract" - force = 1.0 - w_class = 1.0 - throwforce = 1.0 - throw_speed = 2 - throw_range = 6 - origin_tech = "biotech=4" - var/POWERFLAG = 0 // sshhhhhhh - var/Flush = 30 - var/Uses = 5 // uses before it goes inert - -/obj/item/slime_core/New() - ..() - create_reagents(100) - POWERFLAG = rand(1,10) - Uses = rand(7, 25) - //flags |= NOREACT -/* - spawn() - Life() - - proc/Life() - while(src) - sleep(25) - Flush-- - if(Flush <= 0) - reagents.clear_reagents() - Flush = 30 -*/ - - - -/obj/item/weapon/reagent_containers/food/snacks/egg/slime - name = "slime egg" - desc = "A small, gelatinous egg." - icon = 'icons/mob/mob.dmi' - icon_state = "slime egg-growing" - bitesize = 12 - origin_tech = "biotech=4" - var/grown = 0 - -/obj/item/weapon/reagent_containers/food/snacks/egg/slime/New() - ..() - reagents.add_reagent("nutriment", 4) - reagents.add_reagent("slimejelly", 1) - spawn(rand(1200,1500))//the egg takes a while to "ripen" - Grow() - -/obj/item/weapon/reagent_containers/food/snacks/egg/slime/proc/Grow() - grown = 1 - icon_state = "slime egg-grown" - processing_objects.Add(src) - return - -/obj/item/weapon/reagent_containers/food/snacks/egg/slime/proc/Hatch() - processing_objects.Remove(src) - var/turf/T = get_turf(src) - src.visible_message(" The [name] pulsates and quivers!") - spawn(rand(50,100)) - src.visible_message(" The [name] bursts open!") - new/mob/living/carbon/slime(T) - del(src) - - -/obj/item/weapon/reagent_containers/food/snacks/egg/slime/process() - var/turf/location = get_turf(src) - var/datum/gas_mixture/environment = location.return_air() - if (environment.phoron > MOLES_PHORON_VISIBLE)//phoron exposure causes the egg to hatch - src.Hatch() - -/obj/item/weapon/reagent_containers/food/snacks/egg/slime/attackby(obj/item/weapon/W as obj, mob/user as mob) - if(istype( W, /obj/item/toy/crayon )) - return - else - ..() -*/ diff --git a/code/modules/mob/living/carbon/metroid/powers.dm b/code/modules/mob/living/carbon/metroid/powers.dm index 23ca8acbf6..b2f8c2588f 100644 --- a/code/modules/mob/living/carbon/metroid/powers.dm +++ b/code/modules/mob/living/carbon/metroid/powers.dm @@ -1,75 +1,46 @@ -/mob/living/carbon/slime/verb/Feed() - set category = "Slime" - set desc = "This will let you feed on any valid creature in the surrounding area. This should also be used to halt the feeding process." - if(Victim) +/mob/living/carbon/slime/proc/Wrap(var/mob/living/M) // This is a proc for the clicks + if (Victim == M || src == M) Feedstop() return - if(stat) - src << "I must be conscious to do this..." + if (Victim) + src << "I am already feeding..." return - var/list/choices = list() - for(var/mob/living/C in view(1,src)) - if(C!=src && !istype(C,/mob/living/carbon/slime) && Adjacent(C)) - choices += C - - var/mob/living/M = input(src,"Who do you wish to feed on?") in null|choices - if(!M) return - if(Adjacent(M)) - - if(!istype(src, /mob/living/carbon/brain)) - if(!istype(M, /mob/living/carbon/slime)) - if(stat != 2) - if(health > -70) - - for(var/mob/living/carbon/slime/met in view()) - if(met.Victim == M && met != src) - src << "The [met.name] is already feeding on this subject..." - return - src << "\blue I have latched onto the subject and begun feeding..." - M << "\red The [src.name] has latched onto your head!" - Feedon(M) - - else - src << "This subject does not have a strong enough life energy..." - else - src << "This subject does not have an edible life energy..." - else - src << "I must not feed on my brothers..." - else - src << "This subject does not have an edible life energy..." + var t = invalidFeedTarget(M) + if (t) + src << t + return + Feedon(M) +/mob/living/carbon/slime/proc/invalidFeedTarget(var/mob/living/M) + if (!M || !istype(M)) + return "This subject is incomparable..." + if (istype(M, /mob/living/carbon/slime)) // No cannibalism... yet + return "I cannot feed on other slimes..." + if (!Adjacent(M)) + return "This subject is too far away..." + if (istype(M, /mob/living/carbon) && M.getCloneLoss() > 150 || istype(M, /mob/living/simple_animal) && M.stat == DEAD) + return "This subject does not have an edible life energy..." + for(var/mob/living/carbon/slime/met in view()) + if(met.Victim == M && met != src) + return "The [met.name] is already feeding on this subject..." + return 0 /mob/living/carbon/slime/proc/Feedon(var/mob/living/M) Victim = M - src.loc = M.loc + loc = M.loc canmove = 0 anchored = 1 - var/lastnut = nutrition - var/fed_succesfully = 0 - if(is_adult) - icon_state = "[colour] adult slime eat" - else - icon_state = "[colour] baby slime eat" - while(Victim && M.health > -70 && stat != 2) + regenerate_icons() + + while(Victim && !invalidFeedTarget(M) && stat != 2) canmove = 0 if(Adjacent(M)) - loc = M.loc - - if(prob(15) && M.client && istype(M, /mob/living/carbon)) - var/mob/living/carbon/C = M - if (!(C.species && (C.species.flags & NO_PAIN))) - M << "[pick("You can feel your body becoming weak!", \ - "You feel like you're about to die!", \ - "You feel every part of your body screaming in agony!", \ - "A low, rolling pain passes through your body!", \ - "Your body feels as if it's falling apart!", \ - "You feel extremely weak!", \ - "A sharp, deep pain bathes every inch of your body!")]" + UpdateFeed(M) if(istype(M, /mob/living/carbon)) Victim.adjustCloneLoss(rand(5,6)) @@ -77,83 +48,51 @@ if(Victim.health <= 0) Victim.adjustToxLoss(rand(2,4)) - fed_succesfully = 1 - else if(istype(M, /mob/living/simple_animal)) Victim.adjustBruteLoss(is_adult ? rand(7, 15) : rand(4, 12)) - fed_succesfully = 1 else - if(prob(25)) - src << "[pick("This subject is incompatable", \ - "This subject does not have a life energy", "This subject is empty", \ - "I am not satisified", "I can not feed from this subject", \ - "I do not feel nourished", "This subject is not food")]..." + src << "[pick("This subject is incompatable", "This subject does not have a life energy", "This subject is empty", "I am not satisified", "I can not feed from this subject", "I do not feel nourished", "This subject is not food")]..." + Feedstop() + break - if(fed_succesfully) - //I have no idea why this is not in handle_nutrition() - nutrition += rand(15,30) - if(nutrition >= lastnut + 50) - if(prob(80)) - lastnut = nutrition - powerlevel++ - if(powerlevel > 10) - powerlevel = 10 - adjustToxLoss(-10) + if(prob(15) && M.client && istype(M, /mob/living/carbon)) + var/painMes = pick("You can feel your body becoming weak!", "You feel like you're about to die!", "You feel every part of your body screaming in agony!", "A low, rolling pain passes through your body!", "Your body feels as if it's falling apart!", "You feel extremely weak!", "A sharp, deep pain bathes every inch of your body!") + if (ishuman(M)) + var/mob/living/carbon/human/H = M + H.custom_pain(painMes) + else if (istype(M, /mob/living/carbon)) + var/mob/living/carbon/C = M + if (!(C.species && (C.species.flags & NO_PAIN))) + M << "[painMes]" - //Heal yourself. - adjustOxyLoss(-10) - adjustBruteLoss(-10) - adjustFireLoss(-10) - adjustCloneLoss(-10) + gain_nutrition(rand(20,25)) - updatehealth() - if(Victim) - Victim.updatehealth() - - sleep(rand(15,45)) + adjustOxyLoss(-10) //Heal yourself + adjustBruteLoss(-10) + adjustFireLoss(-10) + adjustCloneLoss(-10) + updatehealth() + if(Victim) + Victim.updatehealth() + sleep(30) // Deal damage every 3 seconds else break - if(stat == 2) - if(!is_adult) - icon_state = "[colour] baby slime dead" - - else - if(is_adult) - icon_state = "[colour] adult slime" - else - icon_state = "[colour] baby slime" - canmove = 1 anchored = 0 - if(M) - if(M.health <= -70) - M.canmove = 0 - if(!client) - if(Victim && !rabid && !attacked) - if(Victim.LAssailant && Victim.LAssailant != Victim) - if(prob(50)) - if(!(Victim.LAssailant in Friends)) - Friends[Victim.LAssailant] = 1 - //Friends.Add(Victim.LAssailant) // no idea why i was using the |= operator - else - ++Friends[Victim.LAssailant] + if(M && invalidFeedTarget(M)) // This means that the slime drained the victim + if(!client) + if(Victim && !rabid && !attacked && Victim.LAssailant && Victim.LAssailant != Victim && prob(50)) + if(!(Victim.LAssailant in Friends)) + Friends[Victim.LAssailant] = 1 + else + ++Friends[Victim.LAssailant] - - if(M.client && istype(src, /mob/living/carbon/human)) - if(prob(85)) - rabid = 1 // UUUNNBGHHHH GONNA EAT JUUUUUU - - if(client) src << "This subject does not have a strong enough life energy anymore..." else - M.canmove = 1 - - if(client) src << "I have stopped feeding..." - else - if(client) src << "I have stopped feeding..." + src << "This subject does not have a strong enough life energy anymore..." Victim = null @@ -167,14 +106,14 @@ if(Victim == M) loc = M.loc // simple "attach to head" effect! - /mob/living/carbon/slime/verb/Evolve() set category = "Slime" set desc = "This will let you evolve from baby to adult slime." if(stat) - src << "I must be conscious to do this..." + src << "I must be conscious to do this..." return + if(!is_adult) if(amount_grown >= 10) is_adult = 1 @@ -183,36 +122,35 @@ regenerate_icons() name = text("[colour] [is_adult ? "adult" : "baby"] slime ([number])") else - src << "I am not ready to evolve yet..." + src << "I am not ready to evolve yet..." else - src << "I have already evolved..." + src << "I have already evolved..." /mob/living/carbon/slime/verb/Reproduce() set category = "Slime" set desc = "This will make you split into four Slimes." if(stat) - src << "I must be conscious to do this..." + src << "I must be conscious to do this..." return if(is_adult) if(amount_grown >= 10) if(stat) - src << "I must be conscious to do this..." + src << "I must be conscious to do this..." return var/list/babies = list() var/new_nutrition = round(nutrition * 0.9) var/new_powerlevel = round(powerlevel / 4) - for(var/i=1,i<=4,i++) - var/mob/living/carbon/slime/M = new /mob/living/carbon/slime/(loc) + for(var/i = 1, i <= 4, i++) + var/t = colour if(prob(mutation_chance)) - M.colour = slime_mutation[rand(1,4)] - else - M.colour = colour + t = slime_mutation[rand(1,4)] + var/mob/living/carbon/slime/M = new /mob/living/carbon/slime/(loc, t) if(ckey) M.nutrition = new_nutrition //Player slimes are more robust at spliting. Once an oversight of poor copypasta, now a feature! M.powerlevel = new_powerlevel - if(i != 1) step_away(M,src) + if(i != 1) step_away(M, src) M.Friends = Friends.Copy() babies += M feedback_add_details("slime_babies_born","slimebirth_[replacetext(M.colour," ","_")]") @@ -225,6 +163,6 @@ new_slime.key = src.key del(src) else - src << "I am not ready to reproduce yet..." + src << "I am not ready to reproduce yet..." else - src << "I am not old enough to reproduce yet..." \ No newline at end of file + src << "I am not old enough to reproduce yet..." \ No newline at end of file diff --git a/code/modules/mob/living/carbon/metroid/say.dm b/code/modules/mob/living/carbon/metroid/say.dm index f4de10ceb7..f1a1761908 100644 --- a/code/modules/mob/living/carbon/metroid/say.dm +++ b/code/modules/mob/living/carbon/metroid/say.dm @@ -10,11 +10,11 @@ var/ending = copytext(text, length(text)) if (ending == "?") - return "telepathically asks"; + return "asks"; else if (ending == "!") - return "telepathically cries"; + return "cries"; - return "telepathically chirps"; + return "chirps"; /mob/living/carbon/slime/say_understands(var/other) if (istype(other, /mob/living/carbon/slime)) diff --git a/code/modules/mob/living/carbon/metroid/subtypes.dm b/code/modules/mob/living/carbon/metroid/subtypes.dm index 9db9e7b02f..6aa75990ac 100644 --- a/code/modules/mob/living/carbon/metroid/subtypes.dm +++ b/code/modules/mob/living/carbon/metroid/subtypes.dm @@ -1,4 +1,4 @@ -proc/mutation_table(var/colour) +/mob/living/carbon/slime/proc/mutation_table(var/colour) var/list/slime_mutation[4] switch(colour) //Tier 1 diff --git a/code/modules/mob/living/carbon/metroid/update_icons.dm b/code/modules/mob/living/carbon/metroid/update_icons.dm index 8902770055..847dcaeb18 100644 --- a/code/modules/mob/living/carbon/metroid/update_icons.dm +++ b/code/modules/mob/living/carbon/metroid/update_icons.dm @@ -1 +1,9 @@ -//no special icon processing +/mob/living/carbon/slime/regenerate_icons() + if (stat == DEAD) + icon_state = "[colour] baby slime dead" + else + icon_state = "[colour] [is_adult ? "adult" : "baby"] slime[Victim ? "" : " eat"]" + overlays.len = 0 + if (mood) + overlays += image('icons/mob/slimes.dmi', icon_state = "aslime-[mood]") + ..() \ No newline at end of file diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index b3e04533d4..9542cb9689 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -414,7 +414,7 @@ var/list/intents = list("help","disarm","grab","hurt") set name = "a-intent" set hidden = 1 - if(ishuman(src) || isbrain(src)) + if(ishuman(src) || isbrain(src) || isslime(src)) switch(input) if("help","disarm","grab","hurt") a_intent = input diff --git a/code/modules/reagents/Chemistry-Reagents.dm b/code/modules/reagents/Chemistry-Reagents.dm index 984c1aeb67..8f853dbe2b 100644 --- a/code/modules/reagents/Chemistry-Reagents.dm +++ b/code/modules/reagents/Chemistry-Reagents.dm @@ -261,7 +261,7 @@ datum reaction_mob(var/mob/M, var/method=TOUCH, var/volume) if (istype(M, /mob/living/carbon/slime)) var/mob/living/carbon/slime/S = M - S.apply_water() + S.apply_water(volume) water/holywater name = "Holy Water" From c69bdd81a8ae3a4e8d4bab906d31afe5d2fe67aa Mon Sep 17 00:00:00 2001 From: Kelenius Date: Tue, 3 Feb 2015 23:38:35 +0300 Subject: [PATCH 2/4] Working conflict fix --- .../mob/living/carbon/metroid/items.dm | 4 +- .../mob/living/carbon/metroid/metroid.dm | 370 +----------------- 2 files changed, 3 insertions(+), 371 deletions(-) diff --git a/code/modules/mob/living/carbon/metroid/items.dm b/code/modules/mob/living/carbon/metroid/items.dm index eb3836daad..4c7aed74f4 100644 --- a/code/modules/mob/living/carbon/metroid/items.dm +++ b/code/modules/mob/living/carbon/metroid/items.dm @@ -145,7 +145,7 @@ pet.colour = "[M.colour]" user <<"You feed the slime the potion, removing it's powers and calming it." del(M) - var/newname = copytext(sanitize(input(user, "Would you like to give the slime a name?", "Name your new pet", "pet slime") as null|text),1,MAX_NAME_LEN) + var/newname = sanitize(copytext(input(user, "Would you like to give the slime a name?", "Name your new pet", "pet slime") as null|text,1,MAX_NAME_LEN)) if (!newname) newname = "pet slime" @@ -176,7 +176,7 @@ pet.colour = "[M.colour]" user <<"You feed the slime the potion, removing it's powers and calming it." del(M) - var/newname = copytext(sanitize(input(user, "Would you like to give the slime a name?", "Name your new pet", "pet slime") as null|text),1,MAX_NAME_LEN) + var/newname = sanitize(copytext(input(user, "Would you like to give the slime a name?", "Name your new pet", "pet slime") as null|text,1,MAX_NAME_LEN)) if (!newname) newname = "pet slime" diff --git a/code/modules/mob/living/carbon/metroid/metroid.dm b/code/modules/mob/living/carbon/metroid/metroid.dm index d83e713e34..d6c8c226c4 100644 --- a/code/modules/mob/living/carbon/metroid/metroid.dm +++ b/code/modules/mob/living/carbon/metroid/metroid.dm @@ -423,372 +423,4 @@ /mob/living/carbon/slime/can_use_vents() if(Victim) return "You cannot ventcrawl while feeding." - ..() - -/obj/item/slime_extract - name = "slime extract" - desc = "Goo extracted from a slime. Legends claim these to have \"magical powers\"." - icon = 'icons/mob/slimes.dmi' - icon_state = "grey slime extract" - force = 1.0 - w_class = 1.0 - throwforce = 0 - throw_speed = 3 - throw_range = 6 - origin_tech = "biotech=4" - var/Uses = 1 // uses before it goes inert - var/enhanced = 0 //has it been enhanced before? - - attackby(obj/item/O as obj, mob/user as mob) - if(istype(O, /obj/item/weapon/slimesteroid2)) - if(enhanced == 1) - user << " This extract has already been enhanced!" - return ..() - if(Uses == 0) - user << " You can't enhance a used extract!" - return ..() - user <<"You apply the enhancer. It now has triple the amount of uses." - Uses = 3 - enhanced = 1 - del(O) - -/obj/item/slime_extract/New() - ..() - create_reagents(100) - -/obj/item/slime_extract/grey - name = "grey slime extract" - icon_state = "grey slime extract" - -/obj/item/slime_extract/gold - name = "gold slime extract" - icon_state = "gold slime extract" - -/obj/item/slime_extract/silver - name = "silver slime extract" - icon_state = "silver slime extract" - -/obj/item/slime_extract/metal - name = "metal slime extract" - icon_state = "metal slime extract" - -/obj/item/slime_extract/purple - name = "purple slime extract" - icon_state = "purple slime extract" - -/obj/item/slime_extract/darkpurple - name = "dark purple slime extract" - icon_state = "dark purple slime extract" - -/obj/item/slime_extract/orange - name = "orange slime extract" - icon_state = "orange slime extract" - -/obj/item/slime_extract/yellow - name = "yellow slime extract" - icon_state = "yellow slime extract" - -/obj/item/slime_extract/red - name = "red slime extract" - icon_state = "red slime extract" - -/obj/item/slime_extract/blue - name = "blue slime extract" - icon_state = "blue slime extract" - -/obj/item/slime_extract/darkblue - name = "dark blue slime extract" - icon_state = "dark blue slime extract" - -/obj/item/slime_extract/pink - name = "pink slime extract" - icon_state = "pink slime extract" - -/obj/item/slime_extract/green - name = "green slime extract" - icon_state = "green slime extract" - -/obj/item/slime_extract/lightpink - name = "light pink slime extract" - icon_state = "light pink slime extract" - -/obj/item/slime_extract/black - name = "black slime extract" - icon_state = "black slime extract" - -/obj/item/slime_extract/oil - name = "oil slime extract" - icon_state = "oil slime extract" - -/obj/item/slime_extract/adamantine - name = "adamantine slime extract" - icon_state = "adamantine slime extract" - -/obj/item/slime_extract/bluespace - name = "bluespace slime extract" - icon_state = "bluespace slime extract" - -/obj/item/slime_extract/pyrite - name = "pyrite slime extract" - icon_state = "pyrite slime extract" - -/obj/item/slime_extract/cerulean - name = "cerulean slime extract" - icon_state = "cerulean slime extract" - -/obj/item/slime_extract/sepia - name = "sepia slime extract" - icon_state = "sepia slime extract" - -/obj/item/slime_extract/rainbow - name = "rainbow slime extract" - icon_state = "rainbow slime extract" - -////Pet Slime Creation/// - -/obj/item/weapon/slimepotion - name = "docility potion" - desc = "A potent chemical mix that will nullify a slime's powers, causing it to become docile and tame." - icon = 'icons/obj/chemical.dmi' - icon_state = "bottle19" - - attack(mob/living/carbon/slime/M as mob, mob/user as mob) - if(!istype(M, /mob/living/carbon/slime))//If target is not a slime. - user << " The potion only works on baby slimes!" - return ..() - if(M.is_adult) //Can't tame adults - user << " Only baby slimes can be tamed!" - return..() - if(M.stat) - user << " The slime is dead!" - return..() - if(M.mind) - user << " The slime resists!" - return ..() - var/mob/living/simple_animal/slime/pet = new /mob/living/simple_animal/slime(M.loc) - pet.icon_state = "[M.colour] baby slime" - pet.icon_living = "[M.colour] baby slime" - pet.icon_dead = "[M.colour] baby slime dead" - pet.colour = "[M.colour]" - user <<"You feed the slime the potion, removing it's powers and calming it." - del(M) - var/newname = sanitize(copytext(input(user, "Would you like to give the slime a name?", "Name your new pet", "pet slime") as null|text,1,MAX_NAME_LEN)) - - if (!newname) - newname = "pet slime" - pet.name = newname - pet.real_name = newname - del(src) - -/obj/item/weapon/slimepotion2 - name = "advanced docility potion" - desc = "A potent chemical mix that will nullify a slime's powers, causing it to become docile and tame. This one is meant for adult slimes" - icon = 'icons/obj/chemical.dmi' - icon_state = "bottle19" - - attack(mob/living/carbon/slime/M as mob, mob/user as mob) - if(!istype(M, /mob/living/carbon/slime/))//If target is not a slime. - user << " The potion only works on slimes!" - return ..() - if(M.stat) - user << " The slime is dead!" - return..() - if(M.mind) - user << " The slime resists!" - return ..() - var/mob/living/simple_animal/adultslime/pet = new /mob/living/simple_animal/adultslime(M.loc) - pet.icon_state = "[M.colour] adult slime" - pet.icon_living = "[M.colour] adult slime" - pet.icon_dead = "[M.colour] baby slime dead" - pet.colour = "[M.colour]" - user <<"You feed the slime the potion, removing it's powers and calming it." - del(M) - var/newname = sanitize(copytext(input(user, "Would you like to give the slime a name?", "Name your new pet", "pet slime") as null|text,1,MAX_NAME_LEN)) - - if (!newname) - newname = "pet slime" - pet.name = newname - pet.real_name = newname - del(src) - - -/obj/item/weapon/slimesteroid - name = "slime steroid" - desc = "A potent chemical mix that will cause a slime to generate more extract." - icon = 'icons/obj/chemical.dmi' - icon_state = "bottle16" - - attack(mob/living/carbon/slime/M as mob, mob/user as mob) - if(!istype(M, /mob/living/carbon/slime))//If target is not a slime. - user << " The steroid only works on baby slimes!" - return ..() - if(M.is_adult) //Can't tame adults - user << " Only baby slimes can use the steroid!" - return..() - if(M.stat) - user << " The slime is dead!" - return..() - if(M.cores == 3) - user <<" The slime already has the maximum amount of extract!" - return..() - - user <<"You feed the slime the steroid. It now has triple the amount of extract." - M.cores = 3 - del(src) - -/obj/item/weapon/slimesteroid2 - name = "extract enhancer" - desc = "A potent chemical mix that will give a slime extract three uses." - icon = 'icons/obj/chemical.dmi' - icon_state = "bottle17" - - /*afterattack(obj/target, mob/user , flag) - if(istype(target, /obj/item/slime_extract)) - if(target.enhanced == 1) - user << " This extract has already been enhanced!" - return ..() - if(target.Uses == 0) - user << " You can't enhance a used extract!" - return ..() - user <<"You apply the enhancer. It now has triple the amount of uses." - target.Uses = 3 - target.enahnced = 1 - del(src)*/ - -/obj/effect/golemrune - anchored = 1 - desc = "a strange rune used to create golems. It glows when spirits are nearby." - name = "rune" - icon = 'icons/obj/rune.dmi' - icon_state = "golem" - unacidable = 1 - layer = TURF_LAYER - - New() - ..() - processing_objects.Add(src) - - process() - var/mob/dead/observer/ghost - for(var/mob/dead/observer/O in src.loc) - if(!O.client) continue - if(O.mind && O.mind.current && O.mind.current.stat != DEAD) continue - ghost = O - break - if(ghost) - icon_state = "golem2" - else - icon_state = "golem" - - attack_hand(mob/living/user as mob) - var/mob/dead/observer/ghost - for(var/mob/dead/observer/O in src.loc) - if(!O.client) continue - if(O.mind && O.mind.current && O.mind.current.stat != DEAD) continue - ghost = O - break - if(!ghost) - user << "The rune fizzles uselessly. There is no spirit nearby." - return - var/mob/living/carbon/human/G = new(src.loc) - G.set_species("Golem") - G.key = ghost.key - G << "You are an adamantine golem. You move slowly, but are highly resistant to heat and cold as well as blunt trauma. You are unable to wear clothes, but can still use most tools. Serve [user], and assist them in completing their goals at any cost." - del (src) - - - proc/announce_to_ghosts() - for(var/mob/dead/observer/G in player_list) - if(G.client) - var/area/A = get_area(src) - if(A) - G << "Golem rune created in [A.name]." - -/mob/living/carbon/slime/has_eyes() - return 0 - -//////////////////////////////Old shit from metroids/RoRos, and the old cores, would not take much work to re-add them//////////////////////// - -/* -// Basically this slime Core catalyzes reactions that normally wouldn't happen anywhere -/obj/item/slime_core - name = "slime extract" - desc = "Goo extracted from a slime. Legends claim these to have \"magical powers\"." - icon = 'icons/mob/slimes.dmi' - icon_state = "slime extract" - force = 1.0 - w_class = 1.0 - throwforce = 1.0 - throw_speed = 2 - throw_range = 6 - origin_tech = "biotech=4" - var/POWERFLAG = 0 // sshhhhhhh - var/Flush = 30 - var/Uses = 5 // uses before it goes inert - -/obj/item/slime_core/New() - ..() - create_reagents(100) - POWERFLAG = rand(1,10) - Uses = rand(7, 25) - //flags |= NOREACT -/* - spawn() - Life() - - proc/Life() - while(src) - sleep(25) - Flush-- - if(Flush <= 0) - reagents.clear_reagents() - Flush = 30 -*/ - - - -/obj/item/weapon/reagent_containers/food/snacks/egg/slime - name = "slime egg" - desc = "A small, gelatinous egg." - icon = 'icons/mob/mob.dmi' - icon_state = "slime egg-growing" - bitesize = 12 - origin_tech = "biotech=4" - var/grown = 0 - -/obj/item/weapon/reagent_containers/food/snacks/egg/slime/New() - ..() - reagents.add_reagent("nutriment", 4) - reagents.add_reagent("slimejelly", 1) - spawn(rand(1200,1500))//the egg takes a while to "ripen" - Grow() - -/obj/item/weapon/reagent_containers/food/snacks/egg/slime/proc/Grow() - grown = 1 - icon_state = "slime egg-grown" - processing_objects.Add(src) - return - -/obj/item/weapon/reagent_containers/food/snacks/egg/slime/proc/Hatch() - processing_objects.Remove(src) - var/turf/T = get_turf(src) - src.visible_message(" The [name] pulsates and quivers!") - spawn(rand(50,100)) - src.visible_message(" The [name] bursts open!") - new/mob/living/carbon/slime(T) - del(src) - - -/obj/item/weapon/reagent_containers/food/snacks/egg/slime/process() - var/turf/location = get_turf(src) - var/datum/gas_mixture/environment = location.return_air() - if (environment.phoron > MOLES_PHORON_VISIBLE)//phoron exposure causes the egg to hatch - src.Hatch() - -/obj/item/weapon/reagent_containers/food/snacks/egg/slime/attackby(obj/item/weapon/W as obj, mob/user as mob) - if(istype( W, /obj/item/toy/crayon )) - return - else - ..() -*/ ->>>>>>> dev + ..() \ No newline at end of file From cb25b524ab62e681e58e56a1194a6467b2c69f12 Mon Sep 17 00:00:00 2001 From: Kelenius Date: Wed, 4 Feb 2015 01:39:30 +0300 Subject: [PATCH 3/4] Gives slimes a HUD and an ability to choose face --- code/_onclick/hud/hud.dm | 2 + code/_onclick/hud/other_mobs.dm | 68 +++++++++++++++++++ .../mob/living/carbon/metroid/emote.dm | 30 +++++++- 3 files changed, 99 insertions(+), 1 deletion(-) diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index ab37fa4867..3f00db9ce0 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -241,6 +241,8 @@ datum/hud/New(mob/owner) brain_hud(ui_style) else if(isalien(mymob)) larva_hud() + else if(isslime(mymob)) + slime_hud() else if(isAI(mymob)) ai_hud() else if(isrobot(mymob)) diff --git a/code/_onclick/hud/other_mobs.dm b/code/_onclick/hud/other_mobs.dm index cd19e78d7e..cd5a859715 100644 --- a/code/_onclick/hud/other_mobs.dm +++ b/code/_onclick/hud/other_mobs.dm @@ -33,3 +33,71 @@ mymob.client.screen = null mymob.client.screen += list(blobpwrdisplay, blobhealthdisplay) + +/datum/hud/proc/slime_hud(ui_style = 'icons/mob/screen1_Midnight.dmi') + + src.adding = list() + + var/obj/screen/using + + using = new /obj/screen() + using.name = "act_intent" + using.set_dir(SOUTHWEST) + using.icon = ui_style + using.icon_state = "intent_"+mymob.a_intent + using.screen_loc = ui_zonesel + using.layer = 20 + src.adding += using + action_intent = using + + //intent small hud objects + var/icon/ico + + ico = new(ui_style, "black") + ico.MapColors(0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, -1,-1,-1,-1) + ico.DrawBox(rgb(255,255,255,1),1,ico.Height()/2,ico.Width()/2,ico.Height()) + using = new /obj/screen( src ) + using.name = "help" + using.icon = ico + using.screen_loc = ui_zonesel + using.layer = 21 + src.adding += using + help_intent = using + + ico = new(ui_style, "black") + ico.MapColors(0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, -1,-1,-1,-1) + ico.DrawBox(rgb(255,255,255,1),ico.Width()/2,ico.Height()/2,ico.Width(),ico.Height()) + using = new /obj/screen( src ) + using.name = "disarm" + using.icon = ico + using.screen_loc = ui_zonesel + using.layer = 21 + src.adding += using + disarm_intent = using + + ico = new(ui_style, "black") + ico.MapColors(0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, -1,-1,-1,-1) + ico.DrawBox(rgb(255,255,255,1),ico.Width()/2,1,ico.Width(),ico.Height()/2) + using = new /obj/screen( src ) + using.name = "grab" + using.icon = ico + using.screen_loc = ui_zonesel + using.layer = 21 + src.adding += using + grab_intent = using + + ico = new(ui_style, "black") + ico.MapColors(0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, -1,-1,-1,-1) + ico.DrawBox(rgb(255,255,255,1),1,1,ico.Width()/2,ico.Height()/2) + using = new /obj/screen( src ) + using.name = "harm" + using.icon = ico + using.screen_loc = ui_zonesel + using.layer = 21 + src.adding += using + hurt_intent = using + + mymob.client.screen = null + mymob.client.screen += src.adding + + return \ No newline at end of file diff --git a/code/modules/mob/living/carbon/metroid/emote.dm b/code/modules/mob/living/carbon/metroid/emote.dm index 829b9dcf1e..a6ea5498cd 100644 --- a/code/modules/mob/living/carbon/metroid/emote.dm +++ b/code/modules/mob/living/carbon/metroid/emote.dm @@ -8,6 +8,8 @@ if(findtext(act,"s",-1) && !findtext(act,"_",-2))//Removes ending s's unless they are prefixed with a '_' act = copytext(act,1,length(act)) + var/updateicon = 0 + switch(act) //Alphabetical please if ("me") if(silent) @@ -58,8 +60,32 @@ message = "The [src.name] vibrates!" m_type = 1 + if("nomood") + mood = null + updateicon = 1 + + if("pout") + mood = "pout" + updateicon = 1 + + if("sad") + mood = "sad" + updateicon = 1 + + if("angry") + mood = "angry" + updateicon = 1 + + if("frown") + mood = "mischevous" + updateicon = 1 + + if("smile") + mood = ":3" + updateicon = 1 + if ("help") //This is an exception - src << "Help for slime emotes. You can use these emotes with say \"*emote\":\n\nbounce, custom, jiggle, light, moan, shiver, sway, twitch, vibrate" + src << "Help for slime emotes. You can use these emotes with say \"*emote\":\n\nbounce, custom, jiggle, light, moan, shiver, sway, twitch, vibrate. You can also set your face with: \n\nnomood, pout, sad, angry, frown, smile" else src << "\blue Unusable emote '[act]'. Say *help for a list." @@ -70,4 +96,6 @@ else for(var/mob/O in hearers(src, null)) O.show_message(message, m_type) + if(updateicon) + regenerate_icons() return \ No newline at end of file From 669f226fb28e380219d5383c99aa3dd59d2d020f Mon Sep 17 00:00:00 2001 From: Kelenius Date: Wed, 4 Feb 2015 02:07:14 +0300 Subject: [PATCH 4/4] Changes slime stun probabilities I swear I did this already --- code/_onclick/other_mobs.dm | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/code/_onclick/other_mobs.dm b/code/_onclick/other_mobs.dm index 8d49ffd91b..496553558d 100644 --- a/code/_onclick/other_mobs.dm +++ b/code/_onclick/other_mobs.dm @@ -131,23 +131,24 @@ if ("help") // We just poke the other M.visible_message("[src] gently pokes [M]!", "[src] gently pokes you!") if ("disarm") // We stun the target, with the intention to feed - var/stunprob = 0 + var/stunprob = 1 var/power = max(0, min(10, (powerlevel + rand(0, 3)))) if (powerlevel > 0 && !istype(A, /mob/living/carbon/slime)) if(ishuman(M)) var/mob/living/carbon/human/H = M - if(H.species.flags & IS_SYNTHETIC || (H.species.siemens_coefficient<0.5)) + if(H.species.flags & IS_SYNTHETIC) return + stunprob *= H.species.siemens_coefficient switch(power * 10) - if(0) stunprob = 10 - if(1 to 2) stunprob = 20 - if(3 to 4) stunprob = 30 - if(5 to 6) stunprob = 40 - if(7 to 8) stunprob = 60 - if(9) stunprob = 70 - if(10) stunprob = 95 + if(0) stunprob *= 10 + if(1 to 2) stunprob *= 20 + if(3 to 4) stunprob *= 30 + if(5 to 6) stunprob *= 40 + if(7 to 8) stunprob *= 60 + if(9) stunprob *= 70 + if(10) stunprob *= 95 if(prob(stunprob)) powerlevel = max(0, powerlevel-3)