mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-16 05:02:42 +00:00
Ported ventcrawling from vg.
This commit is contained in:
@@ -381,8 +381,3 @@
|
||||
powerlevel = 10
|
||||
adjustToxLoss(-10)
|
||||
nutrition = max(nutrition, get_max_nutrition())
|
||||
|
||||
/mob/living/carbon/slime/cannot_use_vents()
|
||||
if(Victim)
|
||||
return "You cannot ventcrawl while feeding."
|
||||
..()
|
||||
|
||||
@@ -636,126 +636,10 @@ default behaviour is:
|
||||
resting = !resting
|
||||
src << "<span class='notice'>You are now [resting ? "resting" : "getting up"]</span>"
|
||||
|
||||
/mob/living/proc/is_allowed_vent_crawl_item(var/obj/item/carried_item)
|
||||
return (get_inventory_slot(carried_item) == 0)
|
||||
|
||||
/mob/living/simple_animal/spiderbot/is_allowed_vent_crawl_item(var/obj/item/carried_item)
|
||||
if(carried_item == held_item)
|
||||
return 0
|
||||
return ..()
|
||||
|
||||
//called when the mob receives a bright flash
|
||||
/mob/living/flash_eyes(intensity = FLASH_PROTECTION_MODERATE, override_blindness_check = FALSE, affect_silicon = FALSE, visual = FALSE, type = /obj/screen/fullscreen/flash)
|
||||
if(override_blindness_check || !(disabilities & BLIND))
|
||||
overlay_fullscreen("flash", type)
|
||||
spawn(25)
|
||||
if(src)
|
||||
clear_fullscreen("flash", 25)
|
||||
return 1
|
||||
|
||||
/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
|
||||
var/special_fail_msg = cannot_use_vents()
|
||||
if(special_fail_msg)
|
||||
src << "<span class='warning'>[special_fail_msg]</span>"
|
||||
return
|
||||
|
||||
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
|
||||
|
||||
if(!vent_found.network || !vent_found.network.normal_members.len)
|
||||
src << "This vent is not connected to anything."
|
||||
return
|
||||
|
||||
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)
|
||||
|
||||
if(!T || T.z != loc.z)
|
||||
continue
|
||||
|
||||
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)
|
||||
var/list/badItems = list()
|
||||
for(var/obj/item/carried_item in contents)//If the monkey got on objects.
|
||||
if(!is_allowed_vent_crawl_item(carried_item))
|
||||
badItems += carried_item.name
|
||||
if(badItems.len)
|
||||
src << "<span class='warning'>Your [english_list(badItems)] prevent[badItems.len == 1 ? "s" : ""] you from ventcrawling.</span>"
|
||||
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)
|
||||
|
||||
/mob/living/proc/cannot_use_vents()
|
||||
return "You can't fit into that vent."
|
||||
if(mob_size > MOB_SMALL)
|
||||
return "You can't fit into that vent."
|
||||
return null
|
||||
|
||||
/mob/living/proc/has_brain()
|
||||
return 1
|
||||
|
||||
@@ -1,13 +1,3 @@
|
||||
/mob/living/proc/ventcrawl()
|
||||
set name = "Crawl through Vent"
|
||||
set desc = "Enter an air vent and crawl through the pipe system."
|
||||
set category = "Abilities"
|
||||
|
||||
if(stat == DEAD || paralysis || weakened || stunned || restrained())
|
||||
return
|
||||
|
||||
handle_ventcrawl()
|
||||
|
||||
/mob/living/proc/hide()
|
||||
set name = "Hide"
|
||||
set desc = "Allows to hide beneath tables or certain items. Toggled on or off."
|
||||
|
||||
Reference in New Issue
Block a user