mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 03:02:54 +00:00
Tweaks vent crawling.
The ability to ventcrawl is now checked by the /handle_ventcrawl() proc, making it possible to properly check before and after the do_after() call. Moves various checks into the base can_ventcrawl proc. Now lists the first object that prevents a mob from ventcrawling, making it easier to correct the exception list. Removes the issmall() check, instead checks if the crawling mob has the relevant verb. Fixes #14081.
This commit is contained in:
@@ -18,7 +18,15 @@ var/list/ventcrawl_machinery = list(
|
|||||||
/mob/var/next_play_vent = 0
|
/mob/var/next_play_vent = 0
|
||||||
|
|
||||||
/mob/living/proc/can_ventcrawl()
|
/mob/living/proc/can_ventcrawl()
|
||||||
return 0
|
if(!client)
|
||||||
|
return FALSE
|
||||||
|
if(!(/mob/living/proc/ventcrawl in verbs))
|
||||||
|
to_chat(src, "<span class='warning'>You don't possess the ability to ventcrawl!</span>")
|
||||||
|
return FALSE
|
||||||
|
if(incapacitated())
|
||||||
|
to_chat(src, "<span class='warning'>You cannot ventcrawl in your current state!</span>")
|
||||||
|
return FALSE
|
||||||
|
return ventcrawl_carry()
|
||||||
|
|
||||||
/mob/living/Login()
|
/mob/living/Login()
|
||||||
. = ..()
|
. = ..()
|
||||||
@@ -29,9 +37,9 @@ var/list/ventcrawl_machinery = list(
|
|||||||
|
|
||||||
/mob/living/carbon/slime/can_ventcrawl()
|
/mob/living/carbon/slime/can_ventcrawl()
|
||||||
if(Victim)
|
if(Victim)
|
||||||
src << "<span class='warning'>You cannot ventcrawl while feeding.</span>"
|
to_chat(src, "<span class='warning'>You cannot ventcrawl while feeding.</span>")
|
||||||
return 0
|
return FALSE
|
||||||
return 1
|
. = ..()
|
||||||
|
|
||||||
/mob/living/proc/is_allowed_vent_crawl_item(var/obj/item/carried_item)
|
/mob/living/proc/is_allowed_vent_crawl_item(var/obj/item/carried_item)
|
||||||
if(carried_item == ability_master)
|
if(carried_item == ability_master)
|
||||||
@@ -57,21 +65,18 @@ var/list/ventcrawl_machinery = list(
|
|||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
/mob/living/proc/ventcrawl_carry()
|
/mob/living/proc/ventcrawl_carry()
|
||||||
for(var/atom/A in src.contents)
|
for(var/atom/A in contents)
|
||||||
if(!is_allowed_vent_crawl_item(A))
|
if(!is_allowed_vent_crawl_item(A))
|
||||||
src << "<span class='warning'>You can't be carrying that when vent crawling! - [A.name]</span>"
|
to_chat(src, "<span class='warning'>You can't carry \the [A] while ventcrawling!</span>")
|
||||||
return 0
|
return FALSE
|
||||||
return 1
|
return TRUE
|
||||||
|
|
||||||
/mob/living/AltClickOn(var/atom/A)
|
/mob/living/AltClickOn(var/atom/A)
|
||||||
if(is_type_in_list(A,ventcrawl_machinery) && src.can_ventcrawl())
|
if(is_type_in_list(A,ventcrawl_machinery))
|
||||||
src.handle_ventcrawl(A)
|
handle_ventcrawl(A)
|
||||||
return 1
|
return 1
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
/mob/living/carbon/human/can_ventcrawl()
|
|
||||||
return issmall(src)
|
|
||||||
|
|
||||||
/mob/proc/start_ventcrawl()
|
/mob/proc/start_ventcrawl()
|
||||||
var/atom/pipe
|
var/atom/pipe
|
||||||
var/list/pipes = list()
|
var/list/pipes = list()
|
||||||
@@ -88,36 +93,16 @@ var/list/ventcrawl_machinery = list(
|
|||||||
if(canmove && pipe)
|
if(canmove && pipe)
|
||||||
return pipe
|
return pipe
|
||||||
|
|
||||||
/mob/living/carbon/slime/can_ventcrawl()
|
|
||||||
return 1
|
|
||||||
|
|
||||||
/mob/living/simple_animal/borer/can_ventcrawl()
|
|
||||||
return 1
|
|
||||||
|
|
||||||
/mob/living/simple_animal/borer/ventcrawl_carry()
|
|
||||||
return 1
|
|
||||||
|
|
||||||
/mob/living/simple_animal/mouse/can_ventcrawl()
|
|
||||||
return 1
|
|
||||||
|
|
||||||
/mob/living/simple_animal/spiderbot/can_ventcrawl()
|
|
||||||
return 1
|
|
||||||
|
|
||||||
/mob/living/carbon/alien/can_ventcrawl()
|
|
||||||
return 1
|
|
||||||
|
|
||||||
/mob/living/carbon/alien/ventcrawl_carry()
|
/mob/living/carbon/alien/ventcrawl_carry()
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
/mob/living/var/ventcrawl_layer = 3
|
/mob/living/var/ventcrawl_layer = 3
|
||||||
|
|
||||||
/mob/living/proc/handle_ventcrawl(var/atom/clicked_on)
|
/mob/living/proc/handle_ventcrawl(var/atom/clicked_on)
|
||||||
|
if(!can_ventcrawl())
|
||||||
if(!stat)
|
return
|
||||||
if(!lying)
|
|
||||||
|
|
||||||
var/obj/machinery/atmospherics/unary/vent_found
|
var/obj/machinery/atmospherics/unary/vent_found
|
||||||
|
|
||||||
if(clicked_on && Adjacent(clicked_on))
|
if(clicked_on && Adjacent(clicked_on))
|
||||||
vent_found = clicked_on
|
vent_found = clicked_on
|
||||||
if(!istype(vent_found) || !vent_found.can_crawl_through())
|
if(!istype(vent_found) || !vent_found.can_crawl_through())
|
||||||
@@ -162,11 +147,7 @@ var/list/ventcrawl_machinery = list(
|
|||||||
|
|
||||||
if(!do_after(src, 45, vent_found, 1, 1))
|
if(!do_after(src, 45, vent_found, 1, 1))
|
||||||
return
|
return
|
||||||
|
if(!can_ventcrawl())
|
||||||
if(!client)
|
|
||||||
return
|
|
||||||
|
|
||||||
if(!ventcrawl_carry())
|
|
||||||
return
|
return
|
||||||
|
|
||||||
visible_message("<B>[src] scrambles into the ventilation ducts!</B>", "You climb into the ventilation system.")
|
visible_message("<B>[src] scrambles into the ventilation ducts!</B>", "You climb into the ventilation system.")
|
||||||
@@ -180,13 +161,6 @@ var/list/ventcrawl_machinery = list(
|
|||||||
else
|
else
|
||||||
to_chat(src, "You must be standing on or beside an air vent to enter it.")
|
to_chat(src, "You must be standing on or beside an air vent to enter it.")
|
||||||
|
|
||||||
else
|
|
||||||
to_chat(src, "You can't vent crawl while you're stunned!")
|
|
||||||
|
|
||||||
else
|
|
||||||
to_chat(src, "You must be conscious to do this!")
|
|
||||||
return
|
|
||||||
|
|
||||||
/mob/living/proc/add_ventcrawl(obj/machinery/atmospherics/starting_machine)
|
/mob/living/proc/add_ventcrawl(obj/machinery/atmospherics/starting_machine)
|
||||||
is_ventcrawling = 1
|
is_ventcrawling = 1
|
||||||
//candrop = 0
|
//candrop = 0
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
set name = "Crawl through Vent"
|
set name = "Crawl through Vent"
|
||||||
set desc = "Enter an air vent and crawl through the pipe system."
|
set desc = "Enter an air vent and crawl through the pipe system."
|
||||||
set category = "Abilities"
|
set category = "Abilities"
|
||||||
if(incapacitated() || restrained())
|
|
||||||
return
|
|
||||||
var/pipe = start_ventcrawl()
|
var/pipe = start_ventcrawl()
|
||||||
if(pipe)
|
if(pipe)
|
||||||
handle_ventcrawl()
|
handle_ventcrawl()
|
||||||
|
|||||||
Reference in New Issue
Block a user