mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-20 20:37:34 +01:00
Ventcrawl port from Bay12/VG (#852)
Original code from /vg/, port credit goes to Zuhayr.
This commit is contained in:
@@ -116,6 +116,9 @@
|
||||
|
||||
/mob/living/carbon/alien/proc/handle_regular_hud_updates()
|
||||
|
||||
if(is_ventcrawling == 0) // Stops sight returning to normal if inside a vent
|
||||
sight = species.vision_flags
|
||||
|
||||
if (stat == 2 || (XRAY in src.mutations))
|
||||
sight |= SEE_TURFS
|
||||
sight |= SEE_MOBS
|
||||
|
||||
@@ -1248,9 +1248,10 @@
|
||||
*/
|
||||
|
||||
else
|
||||
sight = species.vision_flags
|
||||
see_in_dark = species.darksight
|
||||
see_invisible = see_in_dark>2 ? SEE_INVISIBLE_LEVEL_ONE : SEE_INVISIBLE_LIVING
|
||||
if(is_ventcrawling == 0) // Stops sight returning to normal if inside a vent
|
||||
sight = species.vision_flags
|
||||
see_in_dark = species.darksight
|
||||
see_invisible = see_in_dark>2 ? SEE_INVISIBLE_LEVEL_ONE : SEE_INVISIBLE_LIVING
|
||||
|
||||
if(XRAY in mutations)
|
||||
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
handle_chemicals_in_body()
|
||||
handle_nutrition()
|
||||
|
||||
if(is_ventcrawling == 0) // Stops sight returning to normal if inside a vent
|
||||
sight = SEE_SELF
|
||||
|
||||
if (!client)
|
||||
handle_targets()
|
||||
if (!AIproc)
|
||||
@@ -58,7 +61,7 @@
|
||||
adjustToxLoss(200)
|
||||
else
|
||||
adjustToxLoss(30)
|
||||
|
||||
|
||||
updatehealth()
|
||||
|
||||
return //TODO: DEFERRED
|
||||
|
||||
@@ -410,9 +410,4 @@
|
||||
if(powerlevel > 10)
|
||||
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."
|
||||
..()
|
||||
nutrition = max(nutrition, get_max_nutrition())
|
||||
@@ -664,114 +664,6 @@ 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 isnull(get_inventory_slot(carried_item))
|
||||
|
||||
/mob/living/simple_animal/spiderbot/is_allowed_vent_crawl_item(var/obj/item/carried_item)
|
||||
if(carried_item == held_item)
|
||||
return 0
|
||||
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
|
||||
|
||||
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)
|
||||
for(var/obj/item/carried_item in contents)//If the monkey got on objects.
|
||||
if(is_allowed_vent_crawl_item(carried_item))
|
||||
continue
|
||||
src << "<span class='warning'>You can't be carrying items or have items equipped when vent crawling!</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."
|
||||
|
||||
|
||||
@@ -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