mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-11 15:14:27 +01:00
Refactors one ventcrawl proc and fixes a bug (#24215)
* Refactoring and fixing a bug * GDN review * Contra review
This commit is contained in:
@@ -342,7 +342,7 @@ Pipelines + Other Objects -> Pipe network
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/proc/can_crawl_through()
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/atmospherics/proc/change_color(new_color)
|
||||
//only pass valid pipe colors please ~otherwise your pipe will turn invisible
|
||||
|
||||
@@ -443,15 +443,15 @@
|
||||
|
||||
GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/vent_pump, /obj/machinery/atmospherics/unary/vent_scrubber))
|
||||
|
||||
/mob/living/handle_ventcrawl(atom/clicked_on) // -- TLE -- Merged by Carn
|
||||
/mob/living/handle_ventcrawl(atom/clicked_on) // Why is this proc even in carbon.dm ...
|
||||
if(!Adjacent(clicked_on))
|
||||
return
|
||||
|
||||
var/ventcrawlerlocal = 0
|
||||
var/ventcrawlerlocal = VENTCRAWLER_NONE
|
||||
if(ventcrawler)
|
||||
ventcrawlerlocal = ventcrawler
|
||||
|
||||
if(!ventcrawlerlocal)
|
||||
if(ventcrawlerlocal == VENTCRAWLER_NONE) // You can't ventcrawl.
|
||||
return
|
||||
|
||||
if(stat)
|
||||
@@ -465,9 +465,11 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
|
||||
if(has_buckled_mobs())
|
||||
to_chat(src, "<span class='warning'>You can't vent crawl with other creatures on you!</span>")
|
||||
return
|
||||
|
||||
if(buckled)
|
||||
to_chat(src, "<span class='warning'>You can't vent crawl while buckled!</span>")
|
||||
return
|
||||
|
||||
if(ishuman(src))
|
||||
var/mob/living/carbon/human/H = src
|
||||
if(H.w_uniform && istype(H.w_uniform, /obj/item/clothing/under/rank/engineering/atmospheric_technician/contortionist))//IMMA SPCHUL SNOWFLAKE
|
||||
@@ -484,55 +486,54 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
|
||||
|
||||
|
||||
if(!vent_found)
|
||||
for(var/obj/machinery/atmospherics/machine in range(1,src))
|
||||
for(var/obj/machinery/atmospherics/machine in range(1, src))
|
||||
if(is_type_in_list(machine, GLOB.ventcrawl_machinery) && machine.can_crawl_through())
|
||||
vent_found = machine
|
||||
break
|
||||
|
||||
if(vent_found)
|
||||
if(vent_found.parent && (vent_found.parent.members.len || vent_found.parent.other_atmosmch))
|
||||
visible_message("<span class='notice'>[src] begins climbing into the ventilation system...</span>", \
|
||||
"<span class='notice'>You begin climbing into the ventilation system...</span>")
|
||||
|
||||
if(!do_after(src, 45, target = src))
|
||||
return
|
||||
|
||||
if(has_buckled_mobs())
|
||||
to_chat(src, "<span class='warning'>You can't vent crawl with other creatures on you!</span>")
|
||||
return
|
||||
|
||||
if(buckled)
|
||||
to_chat(src, "<span class='warning'>You cannot crawl into a vent while buckled to something!</span>")
|
||||
return
|
||||
|
||||
if(!client)
|
||||
return
|
||||
|
||||
if(iscarbon(src) && contents.len && ventcrawlerlocal < 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/bio_chip))
|
||||
continue
|
||||
if(istype(I, /obj/item/reagent_containers/patch))
|
||||
continue
|
||||
if(I.flags & ABSTRACT)
|
||||
continue
|
||||
else
|
||||
failed++
|
||||
|
||||
if(failed)
|
||||
to_chat(src, "<span class='warning'>You can't crawl around in the ventilation ducts with items!</span>")
|
||||
return
|
||||
|
||||
visible_message("<b>[src] scrambles into the ventilation ducts!</b>", "You climb into the ventilation system.")
|
||||
var/old_loc = loc
|
||||
loc = vent_found
|
||||
Moved(old_loc, get_dir(old_loc, loc), FALSE)
|
||||
add_ventcrawl(vent_found)
|
||||
|
||||
else
|
||||
if(!vent_found)
|
||||
to_chat(src, "<span class='warning'>This ventilation duct is not connected to anything!</span>")
|
||||
return
|
||||
|
||||
if(!vent_found.parent || !(length(vent_found.parent.members) || vent_found.parent.other_atmosmch))
|
||||
return
|
||||
|
||||
visible_message("<span class='notice'>[src] begins climbing into the ventilation system...</span>", \
|
||||
"<span class='notice'>You begin climbing into the ventilation system...</span>")
|
||||
|
||||
if(!do_after(src, 4.5 SECONDS, target = src))
|
||||
return
|
||||
|
||||
if(!client)
|
||||
return
|
||||
|
||||
if(!vent_found.can_crawl_through())
|
||||
to_chat(src, "<span class='warning'>You can't vent crawl through that!</span>")
|
||||
return
|
||||
|
||||
if(has_buckled_mobs())
|
||||
to_chat(src, "<span class='warning'>You can't vent crawl with other creatures on you!</span>")
|
||||
return
|
||||
|
||||
if(buckled)
|
||||
to_chat(src, "<span class='warning'>You cannot crawl into a vent while buckled to something!</span>")
|
||||
return
|
||||
|
||||
if(iscarbon(src) && length(contents) && ventcrawlerlocal < VENTCRAWLER_ALWAYS) // If we're here you can only ventcrawl while completely nude
|
||||
for(var/obj/item/I in contents)
|
||||
if(istype(I, /obj/item/bio_chip))
|
||||
continue
|
||||
if(istype(I, /obj/item/reagent_containers/patch))
|
||||
continue
|
||||
if(I.flags & ABSTRACT)
|
||||
continue
|
||||
|
||||
to_chat(src, "<span class='warning'>You can't crawl around in the ventilation ducts with items!</span>")
|
||||
return
|
||||
|
||||
visible_message("<b>[src] scrambles into the ventilation ducts!</b>", "You climb into the ventilation system.")
|
||||
forceMove(vent_found)
|
||||
add_ventcrawl(vent_found)
|
||||
|
||||
/mob/living/proc/add_ventcrawl(obj/machinery/atmospherics/starting_machine, obj/machinery/atmospherics/target_move)
|
||||
if(!istype(starting_machine) || !starting_machine.returnPipenet(target_move) || !starting_machine.can_see_pipes())
|
||||
|
||||
Reference in New Issue
Block a user