From 1266df1f3d403ee8fab02c62b2bb2f779596af14 Mon Sep 17 00:00:00 2001 From: Tigercat2000 Date: Mon, 11 May 2015 06:28:44 -0700 Subject: [PATCH] Generic ventcrawling + Bugfixes This commit makes the ventcrawling system operate independant of ventcrawling verbs. Every type of /mob/living now has a ventcrawling variable, which allows them to interact with the ventcrawling system if set to 1 or 2. The AltClickOn() defines for each ventcrawling mob have been removed, and replaced with a single AltClick() define on ventcrawl machinery. --- code/ATMOSPHERICS/atmospherics.dm | 6 + code/_onclick/ventcrawl.dm | 37 ------ code/modules/mob/abilities.dm | 35 +---- code/modules/mob/living/carbon/alien/alien.dm | 1 + .../living/carbon/alien/humanoid/empress.dm | 2 +- .../mob/living/carbon/alien/humanoid/queen.dm | 2 +- .../modules/mob/living/carbon/alien/powers.dm | 5 - code/modules/mob/living/carbon/carbon.dm | 121 ++++++++++-------- .../mob/living/carbon/metroid/powers.dm | 9 +- .../modules/mob/living/carbon/monkey/diona.dm | 9 +- .../mob/living/carbon/monkey/monkey.dm | 1 + .../mob/living/carbon/monkey/powers.dm | 5 - code/modules/mob/living/carbon/species.dm | 5 +- code/modules/mob/living/living_defines.dm | 1 + code/modules/mob/living/login.dm | 13 +- .../modules/mob/living/simple_animal/borer.dm | 7 +- .../living/simple_animal/friendly/mouse.dm | 8 +- .../simple_animal/friendly/spiderbot.dm | 8 +- code/modules/mob/transform_procs.dm | 7 + paradise.dme | 3 - 20 files changed, 108 insertions(+), 177 deletions(-) delete mode 100644 code/_onclick/ventcrawl.dm delete mode 100644 code/modules/mob/living/carbon/alien/powers.dm delete mode 100644 code/modules/mob/living/carbon/monkey/powers.dm diff --git a/code/ATMOSPHERICS/atmospherics.dm b/code/ATMOSPHERICS/atmospherics.dm index dbd10396c83..600c98f3ef6 100644 --- a/code/ATMOSPHERICS/atmospherics.dm +++ b/code/ATMOSPHERICS/atmospherics.dm @@ -184,5 +184,11 @@ obj/machinery/atmospherics/proc/check_connect_types_construction(obj/machinery/a spawn(1) user.canmove = 1 +/obj/machinery/atmospherics/AltClick(var/mob/living/L) + if(is_type_in_list(src, ventcrawl_machinery)) + L.handle_ventcrawl(src) + return + ..() + /obj/machinery/atmospherics/proc/can_crawl_through() return 1 \ No newline at end of file diff --git a/code/_onclick/ventcrawl.dm b/code/_onclick/ventcrawl.dm deleted file mode 100644 index f80b0933a71..00000000000 --- a/code/_onclick/ventcrawl.dm +++ /dev/null @@ -1,37 +0,0 @@ -var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump, /obj/machinery/atmospherics/unary/vent_scrubber) - -/mob/living/carbon/slime/AltClickOn(var/atom/A) - if(is_type_in_list(A,ventcrawl_machinery)) - src.ventcrawl(A) - return - ..(A) - -/mob/living/carbon/monkey/AltClickOn(var/atom/A) - if(is_type_in_list(A,ventcrawl_machinery)) - src.ventcrawl(A) - return - ..(A) - -/mob/living/simple_animal/borer/AltClickOn(var/atom/A) - if(is_type_in_list(A,ventcrawl_machinery)) - src.ventcrawl(A) - return - ..(A) - -/mob/living/simple_animal/mouse/AltClickOn(var/atom/A) - if(is_type_in_list(A,ventcrawl_machinery)) - src.ventcrawl(A) - return - ..(A) - -/mob/living/simple_animal/spiderbot/AltClickOn(var/atom/A) - if(is_type_in_list(A,ventcrawl_machinery)) - src.ventcrawl(A) - return - ..(A) - -/mob/living/carbon/alien/AltClickOn(var/atom/A) - if(is_type_in_list(A,ventcrawl_machinery)) - src.ventcrawl(A) - return - ..(A) \ No newline at end of file diff --git a/code/modules/mob/abilities.dm b/code/modules/mob/abilities.dm index 83aa4362f29..7ab35a7a73d 100644 --- a/code/modules/mob/abilities.dm +++ b/code/modules/mob/abilities.dm @@ -2,37 +2,4 @@ Creature-level abilities. */ -/var/global/list/ability_verbs = list( ) - -/* -/mob/living/carbon/human/slime/proc/slimepeople_ventcrawl() // Slime people ventcrawling commented out - - set category = "Abilities" - set name = "Ventcrawl (Slime People)" - set desc = "The ability to crawl through vents if naked and not holding anything." - - - if(istype(usr,/mob/living/carbon/human/slime)) - var/mob/living/carbon/human/slime/M = usr - // Check if the client has a mob and if the mob is valid and alive. - if(M.stat==2) - M << "\red You must be corporeal and alive to do that." - return 0 - - //Handcuff check. - if(M.restrained()) - M << "\red You cannot do this while restrained." - return 0 - - if(M.handcuffed) - M << "\red You cannot do this while cuffed." - return 0 - - if(M.contents.len != 0) - M << "\red You need to be naked and have nothing in your hands to ventcrawl." - return 0 - - M.handle_ventcrawl() - else - src << "This should not be happening. At all." -*/ +/var/global/list/ability_verbs = list( ) \ No newline at end of file diff --git a/code/modules/mob/living/carbon/alien/alien.dm b/code/modules/mob/living/carbon/alien/alien.dm index a2e7be0928d..d6cf5225b29 100644 --- a/code/modules/mob/living/carbon/alien/alien.dm +++ b/code/modules/mob/living/carbon/alien/alien.dm @@ -33,6 +33,7 @@ var/large = 0 var/heat_protection = 0.5 var/leaping = 0 + ventcrawler = 2 /mob/living/carbon/alien/New() verbs += /mob/living/carbon/verb/mob_sleep diff --git a/code/modules/mob/living/carbon/alien/humanoid/empress.dm b/code/modules/mob/living/carbon/alien/humanoid/empress.dm index dd99aa3fe86..6e10ad90d9c 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/empress.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/empress.dm @@ -10,6 +10,7 @@ move_delay_add = 3 max_plasma = 1000 large = 1 + ventcrawler = 0 /mob/living/carbon/alien/humanoid/empress/large name = "alien empress" @@ -47,7 +48,6 @@ real_name = src.name verbs.Add(/mob/living/carbon/alien/humanoid/proc/corrosive_acid,/mob/living/carbon/alien/humanoid/proc/resin) - verbs -= /mob/living/carbon/alien/verb/ventcrawl ..() /mob/living/carbon/alien/humanoid/empress diff --git a/code/modules/mob/living/carbon/alien/humanoid/queen.dm b/code/modules/mob/living/carbon/alien/humanoid/queen.dm index 85f898640ab..c90ba2c2b58 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/queen.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/queen.dm @@ -8,6 +8,7 @@ heal_rate = 5 plasma_rate = 20 large = 1 + ventcrawler = 0 /mob/living/carbon/alien/humanoid/queen/New() var/datum/reagents/R = new/datum/reagents(100) @@ -24,7 +25,6 @@ real_name = src.name verbs.Add(/mob/living/carbon/alien/humanoid/proc/corrosive_acid,/mob/living/carbon/alien/humanoid/proc/neurotoxin,/mob/living/carbon/alien/humanoid/proc/resin) - verbs -= /mob/living/carbon/alien/verb/ventcrawl ..() diff --git a/code/modules/mob/living/carbon/alien/powers.dm b/code/modules/mob/living/carbon/alien/powers.dm deleted file mode 100644 index c735c43adf8..00000000000 --- a/code/modules/mob/living/carbon/alien/powers.dm +++ /dev/null @@ -1,5 +0,0 @@ -/mob/living/carbon/alien/verb/ventcrawl(var/atom/pipe) // -- TLE - set name = "Crawl Through Vent(Alien)" - set desc = "Enter an air vent and crawl through the pipe system." - set category = "Alien" - handle_ventcrawl(pipe) \ No newline at end of file diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 5da86e83455..238088c0c7a 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -268,70 +268,79 @@ mob/living /mob/living/carbon/proc/setDNA(var/datum/dna/newDNA) dna = newDNA -/mob/living/carbon/can_use_vents() - return + +var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump, /obj/machinery/atmospherics/unary/vent_scrubber) /mob/living/proc/handle_ventcrawl(var/atom/clicked_on) // -- TLE -- Merged by Carn - diary << "[src] is ventcrawling." - if(!stat) - if(!lying) + if(!Adjacent(clicked_on)) + return -/* - if(clicked_on) - world << "We start with [clicked_on], and [clicked_on.type]" -*/ - var/obj/machinery/atmospherics/unary/vent_found + var/IsVentcrawler = 1 + if(!ventcrawler) + IsVentcrawler = 0 + if(ishuman(src)) + var/mob/living/carbon/human/H = src + if(!H.species.ventcrawler) IsVentcrawler = 1 - if(clicked_on && Adjacent(clicked_on)) - vent_found = clicked_on - if(!istype(vent_found) || !vent_found.can_crawl_through()) - vent_found = null + if(!IsVentcrawler) return + + if(stat) + src << "You must be conscious to do this!" + return + + if(lying) + src << "You can't vent crawl while you're stunned!" + return + + var/obj/machinery/atmospherics/unary/vent_found + + if(clicked_on) + vent_found = clicked_on + if(!istype(vent_found) || !vent_found.can_crawl_through()) + vent_found = null - if(!vent_found) - for(var/obj/machinery/atmospherics/machine in range(1,src)) - if(is_type_in_list(machine, ventcrawl_machinery)) - vent_found = machine + if(!vent_found) + for(var/obj/machinery/atmospherics/machine in range(1,src)) + if(is_type_in_list(machine, ventcrawl_machinery)) + vent_found = machine - if(!vent_found.can_crawl_through()) - vent_found = null - - if(vent_found) - break + if(!vent_found.can_crawl_through()) + vent_found = null if(vent_found) - if(vent_found.network && (vent_found.network.normal_members.len || vent_found.network.line_members.len)) + break - src << "You begin climbing into the ventilation system..." - if(!do_after(src, 45)) + if(vent_found) + if(vent_found.network && (vent_found.network.normal_members.len || vent_found.network.line_members.len)) + visible_message("[src] begins climbing into the ventilation system...", \ + "You begin climbing into the ventilation system...") + + if(!do_after(src, 45)) + return + + if(!client) + return + + if(iscarbon(src) && contents.len && ventcrawler < 2)//It must have atleast been 1 to get this far + for(var/obj/item/I in contents) + var/failed = 0 + if(istype(I, /obj/item/weapon/implant)) + continue + else + failed++ + + if(failed) + src << "You can't crawl around in the ventilation ducts with items!" return - if(!client) - return - - if(contents.len && !isrobot(src)) - for(var/obj/item/carried_item in contents)//If the ventcrawler got on objects. - if(!(isInTypes(carried_item, canEnterVentWith))) - src << "You can't be carrying items or have items equipped when vent crawling!" - return - - visible_message("[src] scrambles into the ventilation ducts!", "You climb into the ventilation system.") - - loc = vent_found - add_ventcrawl(vent_found) - - else - src << "This vent is not connected to anything." - - else - src << "You must be standing on or beside an air vent to enter it." - - else - src << "You can't vent crawl while you're stunned!" + visible_message("[src] scrambles into the ventilation ducts!", "You climb into the ventilation system.") + src.loc = vent_found + add_ventcrawl(vent_found) else - src << "You must be conscious to do this!" - return + src << "This ventilation duct is not connected to anything!" + /mob/living/proc/add_ventcrawl(obj/machinery/atmospherics/starting_machine) var/datum/pipe_network/network = starting_machine.return_network(starting_machine) @@ -352,6 +361,18 @@ mob/living pipes_shown.len = 0 +//OOP +/atom/proc/update_pipe_vision() + return + +/mob/living/update_pipe_vision() + if(pipes_shown.len) + if(!istype(loc, /obj/machinery/atmospherics)) + remove_ventcrawl() + else + if(istype(loc, /obj/machinery/atmospherics)) + add_ventcrawl(loc) + /mob/living/carbon/clean_blood() . = ..() if(ishuman(src)) diff --git a/code/modules/mob/living/carbon/metroid/powers.dm b/code/modules/mob/living/carbon/metroid/powers.dm index 23733bb9b87..15fdb60349f 100644 --- a/code/modules/mob/living/carbon/metroid/powers.dm +++ b/code/modules/mob/living/carbon/metroid/powers.dm @@ -225,11 +225,4 @@ else src << "I am not ready to reproduce yet..." else - src << "I am not old enough to reproduce yet..." - -/mob/living/carbon/slime/verb/ventcrawl(var/atom/pipe) - set name = "Crawl through Vent" - set desc = "Enter an air vent and crawl through the pipe system." - set category = "Slime" - if(Victim) return - handle_ventcrawl(pipe) \ 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/monkey/diona.dm b/code/modules/mob/living/carbon/monkey/diona.dm index 97599c956fa..9a0612d0a30 100644 --- a/code/modules/mob/living/carbon/monkey/diona.dm +++ b/code/modules/mob/living/carbon/monkey/diona.dm @@ -10,6 +10,7 @@ icon_state = "nymph1" var/list/donors = list() var/ready_evolve = 0 + ventcrawler = 1 /mob/living/carbon/monkey/diona/New() @@ -17,7 +18,6 @@ gender = NEUTER greaterform = "Diona" add_language("Rootspeak") - verbs -= /mob/living/carbon/monkey/verb/ventcrawl /mob/living/carbon/monkey/diona/attack_hand(mob/living/carbon/human/M as mob) @@ -50,13 +50,6 @@ src.verbs += /mob/living/carbon/monkey/diona/proc/merge -//Verbs after this point. -/mob/living/carbon/monkey/diona/verb/dionaventcrawl() - set name = "Crawl through Vent" - set desc = "Enter an air vent and crawl through the pipe system." - set category = "Diona" - handle_ventcrawl() - /mob/living/carbon/monkey/diona/proc/merge() set category = "Diona" diff --git a/code/modules/mob/living/carbon/monkey/monkey.dm b/code/modules/mob/living/carbon/monkey/monkey.dm index fac2f461346..b07e9e0c5a2 100644 --- a/code/modules/mob/living/carbon/monkey/monkey.dm +++ b/code/modules/mob/living/carbon/monkey/monkey.dm @@ -15,6 +15,7 @@ var/list/uni_append = list(0x12C,0x4E2) // Same as above for DNA2. var/update_muts = 1 // Monkey gene must be set at start. var/alien = 0 //Used for reagent metabolism. + ventcrawler = 2 /mob/living/carbon/monkey/tajara name = "farwa" diff --git a/code/modules/mob/living/carbon/monkey/powers.dm b/code/modules/mob/living/carbon/monkey/powers.dm deleted file mode 100644 index 1ed34a6b73c..00000000000 --- a/code/modules/mob/living/carbon/monkey/powers.dm +++ /dev/null @@ -1,5 +0,0 @@ -/mob/living/carbon/monkey/verb/ventcrawl(var/atom/pipe) - set name = "Crawl through Vent" - set desc = "Enter an air vent and crawl through the pipe system." - set category = "Monkey" - handle_ventcrawl(pipe) diff --git a/code/modules/mob/living/carbon/species.dm b/code/modules/mob/living/carbon/species.dm index 7c8db2a9430..aa6ef4cb054 100644 --- a/code/modules/mob/living/carbon/species.dm +++ b/code/modules/mob/living/carbon/species.dm @@ -47,6 +47,8 @@ var/max_hurt_damage = 9 // Max melee damage dealt + 5 if hulk var/list/default_genes = list() + var/ventcrawler = 0 //Determines if the mob can go through the vents. + var/flags = 0 // Various specific features. var/bloodflags=0 var/bodyflags=0 @@ -559,11 +561,12 @@ bodyflags = HAS_SKIN_COLOR bloodflags = BLOOD_SLIME + //ventcrawler = 1 //ventcrawling commented out + has_organ = list( "brain" = /obj/item/organ/brain/slime ) - /datum/species/grey name = "Grey" icobase = 'icons/mob/human_races/r_grey.dmi' diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index 1a683b9e183..f20b3e51dab 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -47,5 +47,6 @@ var/floating = 0 var/nightvision = 0 + var/ventcrawler = 0 //0 No vent crawling, 1 vent crawling in the nude, 2 vent crawling always var/list/icon/pipes_shown = list() var/last_played_vent \ No newline at end of file diff --git a/code/modules/mob/living/login.dm b/code/modules/mob/living/login.dm index f487188ac80..66abaefee4b 100644 --- a/code/modules/mob/living/login.dm +++ b/code/modules/mob/living/login.dm @@ -7,10 +7,15 @@ //If they're SSD, remove it so they can wake back up. player_logged = 0 - //login during ventcrawl - if(istype(loc, /obj/machinery/atmospherics)) //attach us back into the pipes - remove_ventcrawl() - add_ventcrawl(loc) + //Vents + if(ishuman(src)) + var/mob/living/carbon/human/H + if(H.species.ventcrawler) + src << "You can ventcrawl! Use alt+click on vents to quickly travel about the station." + if(ventcrawler) + src << "You can ventcrawl! Use alt+click on vents to quickly travel about the station." + //Should update regardless of if we can ventcrawl, since we can end up in pipes in other ways. + update_pipe_vision() //Round specific stuff like hud updates if(ticker && ticker.mode) diff --git a/code/modules/mob/living/simple_animal/borer.dm b/code/modules/mob/living/simple_animal/borer.dm index e9e80db0dd4..17eee2662d4 100644 --- a/code/modules/mob/living/simple_animal/borer.dm +++ b/code/modules/mob/living/simple_animal/borer.dm @@ -51,6 +51,7 @@ small = 1 density = 0 pass_flags = PASSTABLE + ventcrawler = 2 var/used_dominate var/chemicals = 10 // Chemicals used for reproduction and spitting neurotoxin. @@ -456,12 +457,6 @@ mob/living/simple_animal/borer/proc/detatch() host_brain.real_name = M.real_name host.status_flags |= PASSEMOTES -/mob/living/simple_animal/borer/verb/ventcrawl(var/atom/pipe) - set name = "Crawl through vent (borer)" - set desc = "Enter an air vent and crawl through the pipe system." - set category = "Alien" - handle_ventcrawl(pipe) - /mob/living/simple_animal/borer/can_use_vents() return diff --git a/code/modules/mob/living/simple_animal/friendly/mouse.dm b/code/modules/mob/living/simple_animal/friendly/mouse.dm index 65b6447696e..40eb01184c3 100644 --- a/code/modules/mob/living/simple_animal/friendly/mouse.dm +++ b/code/modules/mob/living/simple_animal/friendly/mouse.dm @@ -29,6 +29,7 @@ maxbodytemp = 323 //Above 50 Degrees Celcius universal_speak = 0 can_hide = 1 + ventcrawler = 2 /mob/living/simple_animal/mouse/Life() ..() @@ -69,13 +70,6 @@ if(client) client.time_died_as_mouse = world.time -//copy paste from alien/larva, if that func is updated please update this one also -/mob/living/simple_animal/mouse/verb/ventcrawl(var/atom/pipe) - set name = "Crawl through Vent" - set desc = "Enter an air vent and crawl through the pipe system." - set category = "Mouse" - handle_ventcrawl(pipe) - //make mice fit under tables etc? this was hacky, and not working /* /mob/living/simple_animal/mouse/Move(var/dir) diff --git a/code/modules/mob/living/simple_animal/friendly/spiderbot.dm b/code/modules/mob/living/simple_animal/friendly/spiderbot.dm index 195d2212436..d59fa20ffc1 100644 --- a/code/modules/mob/living/simple_animal/friendly/spiderbot.dm +++ b/code/modules/mob/living/simple_animal/friendly/spiderbot.dm @@ -41,6 +41,7 @@ small = 1 speak_emote = list("beeps","clicks","chirps") can_hide = 1 + ventcrawler = 2 /mob/living/simple_animal/spiderbot/attackby(var/obj/item/O as obj, var/mob/user as mob, params) @@ -217,13 +218,6 @@ robogibs(src.loc, viruses) src.Destroy() return - -//copy paste from alien/larva, if that func is updated please update this one also -/mob/living/simple_animal/spiderbot/verb/ventcrawl(var/atom/pipe) - set name = "Crawl through Vent" - set desc = "Enter an air vent and crawl through the pipe system." - set category = "Spiderbot" - handle_ventcrawl(pipe) //Cannibalized from the parrot mob. ~Zuhayr /mob/living/simple_animal/spiderbot/verb/drop_held_item() diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index 4c708c8e92e..4a17773d012 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -228,6 +228,8 @@ callHook("borgify", list(O)) + O.update_pipe_vision() + O.Namepick() spawn(0)//To prevent the proc from returning null. @@ -262,6 +264,7 @@ new_xeno.key = key new_xeno << "You are now an alien." + new_xeno.update_pipe_vision() spawn(0)//To prevent the proc from returning null. del(src) return @@ -297,6 +300,7 @@ new_slime.key = key new_slime << "You are now a slime. Skreee!" + new_slime.update_pipe_vision() spawn(0)//To prevent the proc from returning null. del(src) return @@ -319,6 +323,7 @@ new_corgi.key = key new_corgi << "You are now a Corgi. Yap Yap!" + new_corgi.update_pipe_vision() spawn(0)//To prevent the proc from returning null. del(src) return @@ -353,6 +358,7 @@ new_mob << "You suddenly feel more... animalistic." + new_mob.update_pipe_vision() spawn() del(src) return @@ -371,6 +377,7 @@ new_mob.key = key new_mob.a_intent = "harm" new_mob << "You feel more... animalistic" + new_mob.update_pipe_vision() del(src) diff --git a/paradise.dme b/paradise.dme index 1bf34f25e1d..b57d4abe248 100644 --- a/paradise.dme +++ b/paradise.dme @@ -47,7 +47,6 @@ #include "code\_onclick\other_mobs.dm" #include "code\_onclick\overmind.dm" #include "code\_onclick\telekinesis.dm" -#include "code\_onclick\ventcrawl.dm" #include "code\_onclick\hud\_defines.dm" #include "code\_onclick\hud\ai.dm" #include "code\_onclick\hud\alien.dm" @@ -1214,7 +1213,6 @@ #include "code\modules\mob\living\carbon\alien\life.dm" #include "code\modules\mob\living\carbon\alien\login.dm" #include "code\modules\mob\living\carbon\alien\logout.dm" -#include "code\modules\mob\living\carbon\alien\powers.dm" #include "code\modules\mob\living\carbon\alien\say.dm" #include "code\modules\mob\living\carbon\alien\humanoid\alien_powers.dm" #include "code\modules\mob\living\carbon\alien\humanoid\emote.dm" @@ -1286,7 +1284,6 @@ #include "code\modules\mob\living\carbon\monkey\life.dm" #include "code\modules\mob\living\carbon\monkey\login.dm" #include "code\modules\mob\living\carbon\monkey\monkey.dm" -#include "code\modules\mob\living\carbon\monkey\powers.dm" #include "code\modules\mob\living\carbon\monkey\say.dm" #include "code\modules\mob\living\carbon\monkey\update_icons.dm" #include "code\modules\mob\living\silicon\death.dm"