Merge pull request #844 from tigercat2000/Ventrcrawl

Ventcrawl Overhaul
This commit is contained in:
ZomgPonies
2015-04-21 17:30:15 -04:00
17 changed files with 222 additions and 226 deletions
@@ -47,7 +47,7 @@
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/alien_ventcrawl
verbs -= /mob/living/carbon/alien/verb/ventcrawl
..()
/mob/living/carbon/alien/humanoid/empress
@@ -24,7 +24,7 @@
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/alien_ventcrawl
verbs -= /mob/living/carbon/alien/verb/ventcrawl
..()
@@ -1,5 +1,5 @@
/mob/living/carbon/alien/verb/alien_ventcrawl() // -- TLE
set name = "Crawl through vent (alien)"
/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()
handle_ventcrawl(pipe)
+73 -91
View File
@@ -1,3 +1,6 @@
mob/living
var/canEnterVentWith = "/obj/item/weapon/implant=0&/obj/item/clothing/mask/facehugger=0&/obj/item/device/radio/borg=0&/obj/machinery/camera=0"
/mob/living/carbon/Login()
..()
update_hud()
@@ -256,104 +259,83 @@
/mob/living/carbon/can_use_vents()
return
/mob/living/proc/handle_ventcrawl(var/obj/machinery/atmospherics/unary/vent_pump/vent_found = null, var/ignore_items = 0) // -- TLE -- Merged by Carn
if(stat)
src << "You must be conscious to do this!"
return
if(lying)
src << "You can't vent crawl while you're stunned!"
return
/mob/living/proc/handle_ventcrawl(var/atom/clicked_on) // -- TLE -- Merged by Carn
diary << "[src] is ventcrawling."
if(!stat)
if(!lying)
var/special_fail_msg = can_use_vents()
if(special_fail_msg)
src << "\red [special_fail_msg]"
return
/*
if(clicked_on)
world << "We start with [clicked_on], and [clicked_on.type]"
*/
var/obj/machinery/atmospherics/unary/vent_found
if(clicked_on && Adjacent(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.can_crawl_through())
vent_found = null
if(vent_found)
break
if(vent_found)
if(vent_found.network && (vent_found.network.normal_members.len || vent_found.network.line_members.len))
src << "You begin climbing into the ventilation system..."
if(!do_after(src, 45))
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 << "<SPAN CLASS='warning'>You can't be carrying items or have items equipped when vent crawling!</SPAN>"
return
visible_message("<B>[src] scrambles into the ventilation ducts!</B>", "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!"
if(vent_found) // one was passed in, probably from vent/AltClick()
if(vent_found.welded)
src << "That vent is welded shut."
return
if(!vent_found.Adjacent(src))
return // don't even acknowledge that
else
for(var/obj/machinery/atmospherics/unary/vent_pump/v in range(1,src))
if(!v.welded)
if(v.Adjacent(src))
vent_found = v
if(!vent_found)
src << "You'll need a non-welded vent to crawl into!"
return
src << "You must be conscious to do this!"
return
if(!vent_found.network || !vent_found.network.normal_members.len)
src << "This vent is not connected to anything."
return
/mob/living/proc/add_ventcrawl(obj/machinery/atmospherics/unary/starting_machine)
for(var/datum/pipeline/pipeline in starting_machine.network.line_members)
for(var/atom/A in (pipeline.members || pipeline.edges))
var/image/new_image = image(A, A.loc, dir = A.dir)
pipes_shown += new_image
client.images += new_image
var/list/vents = list()
for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in vent_found.network.normal_members)
if(temp_vent.welded)
continue
if(temp_vent in loc)
continue
var/turf/T = get_turf(temp_vent)
/mob/living/proc/remove_ventcrawl()
for(var/image/current_image in pipes_shown)
client.images -= current_image
if(!T || T.z != loc.z)
continue
pipes_shown.len = 0
var/i = 1
var/index = "[T.loc.name]\[[i]\]"
while(index in vents)
i++
index = "[T.loc.name]\[[i]\]"
vents[index] = temp_vent
if(!vents.len)
src << "\red There are no available vents to travel to, they could be welded."
return
var/obj/selection = input("Select a destination.", "Duct System") as null|anything in sortAssoc(vents)
if(!selection) return
if(!vent_found.Adjacent(src))
src << "Never mind, you left."
return
if(!ignore_items)
for(var/obj/item/carried_item in contents)//If the monkey got on objects.
if( !istype(carried_item, /obj/item/weapon/implant) && !istype(carried_item, /obj/item/clothing/mask/facehugger) )//If it's not an implant or a facehugger
src << "\red You can't be carrying items or have items equipped when vent crawling!"
return
if(isslime(src))
var/mob/living/carbon/slime/S = src
if(S.Victim)
src << "\red You'll have to let [S.Victim] go or finish eating \him first."
return
var/obj/machinery/atmospherics/unary/vent_pump/target_vent = vents[selection]
if(!target_vent)
return
for(var/mob/O in viewers(src, null))
O.show_message(text("<B>[src] scrambles into the ventillation ducts!</B>"), 1)
loc = target_vent
var/travel_time = round(get_dist(loc, target_vent.loc) / 2)
spawn(travel_time)
if(!target_vent) return
for(var/mob/O in hearers(target_vent,null))
O.show_message("You hear something squeezing through the ventilation ducts.",2)
sleep(travel_time)
if(!target_vent) return
if(target_vent.welded) //the vent can be welded while alien scrolled through the list or travelled.
target_vent = vent_found //travel back. No additional time required.
src << "\red The vent you were heading to appears to be welded."
loc = target_vent.loc
var/area/new_area = get_area(loc)
if(new_area)
new_area.Entered(src)
if(client)
client.eye = src
/mob/living/carbon/clean_blood()
. = ..()
@@ -104,7 +104,7 @@
adjustBruteLoss(-10)
adjustFireLoss(-10)
adjustCloneLoss(-10)
updatehealth()
if(Victim)
Victim.updatehealth()
@@ -227,9 +227,9 @@
else
src << "<i>I am not old enough to reproduce yet...</i>"
/mob/living/carbon/slime/verb/ventcrawl()
/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()
handle_ventcrawl(pipe)
@@ -1,5 +1,5 @@
/mob/living/carbon/monkey/verb/ventcrawl()
/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()
handle_ventcrawl(pipe)
@@ -44,3 +44,6 @@
var/silent = null //Can't talk. Value goes down every life proc.
var/floating = 0
var/nightvision = 0
var/list/icon/pipes_shown = list()
var/last_played_vent
@@ -456,11 +456,11 @@ 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()
/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()
handle_ventcrawl(pipe)
/mob/living/simple_animal/borer/can_use_vents()
return
@@ -70,58 +70,11 @@
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()
/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"
// if(!istype(V,/obj/machinery/atmoalter/siphs/fullairsiphon/air_vent))
// return
if(src.stat != CONSCIOUS) return
var/obj/machinery/atmospherics/unary/vent_pump/vent_found
var/welded = 0
for(var/obj/machinery/atmospherics/unary/vent_pump/v in range(1,src))
if(!v.welded)
vent_found = v
break
else
welded = 1
if(vent_found)
if(vent_found.network&&vent_found.network.normal_members.len)
var/list/vents = list()
for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in vent_found.network.normal_members)
if(temp_vent.loc == loc)
continue
vents.Add(temp_vent)
var/list/choices = list()
for(var/obj/machinery/atmospherics/unary/vent_pump/vent in vents)
if(vent.loc.z != loc.z)
continue
var/atom/a = get_turf(vent)
choices.Add(a.loc)
var/turf/startloc = loc
var/obj/selection = input("Select a destination.", "Duct System") in choices
var/selection_position = choices.Find(selection)
if(loc==startloc)
var/obj/target_vent = vents[selection_position]
if(target_vent)
/*
for(var/mob/O in oviewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message(text("<B>[src] scrambles into the ventillation ducts!</B>"), 1)
*/
loc = target_vent.loc
else
src << "\blue You need to remain still while entering a vent."
else
src << "\blue This vent is not connected to anything."
else if(welded)
src << "\red That vent is welded."
else
src << "\blue You must be standing on or beside an air vent to enter it."
return
handle_ventcrawl(pipe)
//make mice fit under tables etc? this was hacky, and not working
/*
@@ -140,7 +140,7 @@
for(var/mob/M in viewers(src, null))
if ((M.client && !( M.blinded )))
M.show_message("\red [user] gently taps [src] with the [O]. ")
/mob/living/simple_animal/spiderbot/emag_act(user as mob)
if (emagged)
user << "\red [src] is already overloaded - better run."
@@ -219,51 +219,11 @@
return
//copy paste from alien/larva, if that func is updated please update this one also
/mob/living/simple_animal/spiderbot/verb/ventcrawl()
/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"
// if(!istype(V,/obj/machinery/atmoalter/siphs/fullairsiphon/air_vent))
// return
var/obj/machinery/atmospherics/unary/vent_pump/vent_found
var/welded = 0
for(var/obj/machinery/atmospherics/unary/vent_pump/v in range(1,src))
if(!v.welded)
vent_found = v
break
else
welded = 1
if(vent_found)
if(vent_found.network&&vent_found.network.normal_members.len)
var/list/vents = list()
for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in vent_found.network.normal_members)
if(temp_vent.loc == loc)
continue
vents.Add(temp_vent)
var/list/choices = list()
for(var/obj/machinery/atmospherics/unary/vent_pump/vent in vents)
if(vent.loc.z != loc.z)
continue
var/atom/a = get_turf(vent)
choices.Add(a.loc)
var/turf/startloc = loc
var/obj/selection = input("Select a destination.", "Duct System") in choices
var/selection_position = choices.Find(selection)
if(loc==startloc)
var/obj/target_vent = vents[selection_position]
if(target_vent)
loc = target_vent.loc
else
src << "\blue You need to remain still while entering a vent."
else
src << "\blue This vent is not connected to anything."
else if(welded)
src << "\red That vent is welded."
else
src << "\blue You must be standing on or beside an air vent to enter it."
return
handle_ventcrawl(pipe)
//Cannibalized from the parrot mob. ~Zuhayr
/mob/living/simple_animal/spiderbot/verb/drop_held_item()