mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-25 09:31:30 +00:00
First pass on major conversion of xenomorphs to a human subspecies. Additional condensing of various redundant mob verbs. Converted larva and diona to their own class, collapsed the rest of xenomorphs into a human species, other stuff. Completely removed attack_alien(). Still have to reimplement some of the lost behavior for human/alien. Reapplies lost attack_alien() functionality other than tackling/caressing. Further alien/humanoid cleanup and xenospawn fix-ups. Also uncommented caste verbs. Removed half-finished abilities system since species.dm handles it. All xenomorphs functionality should be working now, other than the HUD, tackling and the xenomorph balance issues. Added icons for xenomorph castes, moved broadcast languages into datums, removed alien_talk and robot_talk vars. Merged with organ removal code. Reapplied verbs to simple_animals/slimes. Updated species definitions to have appropriate organs. Readded tackle as a human verb. Borer changes regarding brain removal. Working on moving the human HUD to the species datum a bit. Mixed results. Moved Cortical Link to a language, added borer husks. Tidied up the HUD stuff. Still need to make it rebuild properly when species is changed, but this will do for no Compile fix, forgot the DME. Fixed up ventcrawl, added new organ mechanics for dionaea. Fixed up some overlooked sections causing mobs without brains to die immediately. Fixed up plasma generation for queens, bugs with organs, force_organ issues with set_species().
440 lines
14 KiB
Plaintext
440 lines
14 KiB
Plaintext
#define DEFAULT_PRESSURE_DELTA 10000
|
|
|
|
#define EXTERNAL_PRESSURE_BOUND ONE_ATMOSPHERE
|
|
#define INTERNAL_PRESSURE_BOUND 0
|
|
#define PRESSURE_CHECKS 1
|
|
|
|
#define PRESSURE_CHECK_EXTERNAL 1
|
|
#define PRESSURE_CHECK_INTERNAL 2
|
|
|
|
#undefine
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump
|
|
icon = 'icons/atmos/vent_pump.dmi'
|
|
icon_state = "map_vent"
|
|
|
|
name = "Air Vent"
|
|
desc = "Has a valve and pump attached to it"
|
|
use_power = 1
|
|
idle_power_usage = 150 //internal circuitry, friction losses and stuff
|
|
active_power_usage = 7500 //This also doubles as a measure of how powerful the pump is, in Watts. 7500 W ~ 10 HP
|
|
|
|
connect_types = list(1,2) //connects to regular and supply pipes
|
|
|
|
var/area/initial_loc
|
|
level = 1
|
|
var/area_uid
|
|
var/id_tag = null
|
|
|
|
var/on = 0
|
|
var/pump_direction = 1 //0 = siphoning, 1 = releasing
|
|
|
|
var/last_power_draw = 0
|
|
|
|
var/external_pressure_bound = EXTERNAL_PRESSURE_BOUND
|
|
var/internal_pressure_bound = INTERNAL_PRESSURE_BOUND
|
|
|
|
var/pressure_checks = PRESSURE_CHECKS
|
|
//1: Do not pass external_pressure_bound
|
|
//2: Do not pass internal_pressure_bound
|
|
//3: Do not pass either
|
|
|
|
// Used when handling incoming radio signals requesting default settings
|
|
var/external_pressure_bound_default = EXTERNAL_PRESSURE_BOUND
|
|
var/internal_pressure_bound_default = INTERNAL_PRESSURE_BOUND
|
|
var/pressure_checks_default = PRESSURE_CHECKS
|
|
|
|
var/welded = 0 // Added for aliens -- TLE
|
|
|
|
var/frequency = 1439
|
|
var/datum/radio_frequency/radio_connection
|
|
|
|
var/radio_filter_out
|
|
var/radio_filter_in
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/on
|
|
on = 1
|
|
icon_state = "map_vent_out"
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/siphon
|
|
pump_direction = 0
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/siphon/on
|
|
on = 1
|
|
icon_state = "map_vent_in"
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/New()
|
|
..()
|
|
air_contents.volume = ATMOS_DEFAULT_VOLUME_PUMP
|
|
|
|
icon = null
|
|
initial_loc = get_area(loc)
|
|
if (initial_loc.master)
|
|
initial_loc = initial_loc.master
|
|
area_uid = initial_loc.uid
|
|
if (!id_tag)
|
|
assign_uid()
|
|
id_tag = num2text(uid)
|
|
if(ticker && ticker.current_state == 3)//if the game is running
|
|
src.initialize()
|
|
src.broadcast_status()
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/high_volume
|
|
name = "Large Air Vent"
|
|
power_channel = EQUIP
|
|
active_power_usage = 15000 //15 kW ~ 20 HP
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/high_volume/New()
|
|
..()
|
|
air_contents.volume = ATMOS_DEFAULT_VOLUME_PUMP + 800
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/engine
|
|
name = "Engine Core Vent"
|
|
power_channel = ENVIRON
|
|
active_power_usage = 15000 //15 kW ~ 20 HP
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/engine/New()
|
|
..()
|
|
air_contents.volume = ATMOS_DEFAULT_VOLUME_PUMP + 500 //meant to match air injector
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/update_icon(var/safety = 0)
|
|
if(!check_icon_cache())
|
|
return
|
|
if (!node)
|
|
on = 0
|
|
|
|
overlays.Cut()
|
|
|
|
var/vent_icon = "vent"
|
|
|
|
var/turf/T = get_turf(src)
|
|
if(!istype(T))
|
|
return
|
|
|
|
if(T.intact && node && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe))
|
|
vent_icon += "h"
|
|
|
|
if(welded)
|
|
vent_icon += "weld"
|
|
else if(!powered())
|
|
vent_icon += "off"
|
|
else
|
|
vent_icon += "[on ? "[pump_direction ? "out" : "in"]" : "off"]"
|
|
|
|
overlays += icon_manager.get_atmos_icon("device", , , vent_icon)
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/update_underlays()
|
|
if(..())
|
|
underlays.Cut()
|
|
var/turf/T = get_turf(src)
|
|
if(!istype(T))
|
|
return
|
|
if(T.intact && node && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe))
|
|
return
|
|
else
|
|
if(node)
|
|
add_underlay(T, node, dir, node.icon_connect_type)
|
|
else
|
|
add_underlay(T,, dir)
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/hide()
|
|
update_icon()
|
|
update_underlays()
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/proc/can_pump()
|
|
if(stat & (NOPOWER|BROKEN))
|
|
return 0
|
|
if(!on)
|
|
return 0
|
|
if(welded)
|
|
return 0
|
|
return 1
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/process()
|
|
..()
|
|
|
|
if (!node)
|
|
on = 0
|
|
if(!can_pump())
|
|
update_use_power(0) //usually we get here because a player turned a pump off - definitely want to update.
|
|
last_power_draw = 0
|
|
last_flow_rate = 0
|
|
return 0
|
|
|
|
var/datum/gas_mixture/environment = loc.return_air()
|
|
|
|
var/power_draw = -1
|
|
|
|
//Figure out the target pressure difference
|
|
var/pressure_delta = get_pressure_delta(environment)
|
|
//src.visible_message("DEBUG >>> [src]: pressure_delta = [pressure_delta]")
|
|
|
|
if((environment.temperature || air_contents.temperature) && pressure_delta > 0.5)
|
|
if(pump_direction) //internal -> external
|
|
var/output_volume = environment.volume * environment.group_multiplier
|
|
var/air_temperature = environment.temperature? environment.temperature : air_contents.temperature
|
|
var/transfer_moles = pressure_delta*output_volume/(air_temperature * R_IDEAL_GAS_EQUATION)
|
|
//src.visible_message("DEBUG >>> [src]: output_volume = [output_volume]L; air_temperature = [air_temperature]K; transfer_moles = [transfer_moles] mol")
|
|
|
|
power_draw = pump_gas(src, air_contents, environment, transfer_moles, active_power_usage)
|
|
else //external -> internal
|
|
var/output_volume = air_contents.volume + (network? network.volume : 0)
|
|
var/air_temperature = air_contents.temperature? air_contents.temperature : environment.temperature
|
|
var/transfer_moles = pressure_delta*output_volume/(air_temperature * R_IDEAL_GAS_EQUATION)
|
|
|
|
//limit flow rate from turfs
|
|
transfer_moles = min(transfer_moles, environment.total_moles*air_contents.volume/environment.volume) //group_multiplier gets divided out here
|
|
|
|
power_draw = pump_gas(src, environment, air_contents, transfer_moles, active_power_usage)
|
|
|
|
if (power_draw < 0)
|
|
last_power_draw = 0
|
|
last_flow_rate = 0
|
|
//update_use_power(0)
|
|
use_power = 0 //don't force update - easier on CPU
|
|
else
|
|
last_power_draw = handle_power_draw(power_draw)
|
|
if(network)
|
|
network.update = 1
|
|
|
|
return 1
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/proc/get_pressure_delta(datum/gas_mixture/environment)
|
|
var/pressure_delta = DEFAULT_PRESSURE_DELTA
|
|
var/environment_pressure = environment.return_pressure()
|
|
|
|
if(pump_direction) //internal -> external
|
|
if(pressure_checks & PRESSURE_CHECK_EXTERNAL)
|
|
pressure_delta = min(pressure_delta, external_pressure_bound - environment_pressure) //increasing the pressure here
|
|
if(pressure_checks & PRESSURE_CHECK_INTERNAL)
|
|
pressure_delta = min(pressure_delta, air_contents.return_pressure() - internal_pressure_bound) //decreasing the pressure here
|
|
else //external -> internal
|
|
if(pressure_checks & PRESSURE_CHECK_EXTERNAL)
|
|
pressure_delta = min(pressure_delta, environment_pressure - external_pressure_bound) //decreasing the pressure here
|
|
if(pressure_checks & PRESSURE_CHECK_INTERNAL)
|
|
pressure_delta = min(pressure_delta, internal_pressure_bound - air_contents.return_pressure()) //increasing the pressure here
|
|
|
|
return pressure_delta
|
|
|
|
//Radio remote control
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/proc/set_frequency(new_frequency)
|
|
radio_controller.remove_object(src, frequency)
|
|
frequency = new_frequency
|
|
if(frequency)
|
|
radio_connection = radio_controller.add_object(src, frequency,radio_filter_in)
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/proc/broadcast_status()
|
|
if(!radio_connection)
|
|
return 0
|
|
|
|
var/datum/signal/signal = new
|
|
signal.transmission_method = 1 //radio signal
|
|
signal.source = src
|
|
|
|
signal.data = list(
|
|
"area" = src.area_uid,
|
|
"tag" = src.id_tag,
|
|
"device" = "AVP",
|
|
"power" = on,
|
|
"direction" = pump_direction?("release"):("siphon"),
|
|
"checks" = pressure_checks,
|
|
"internal" = internal_pressure_bound,
|
|
"external" = external_pressure_bound,
|
|
"timestamp" = world.time,
|
|
"sigtype" = "status",
|
|
"power_draw" = last_power_draw,
|
|
"flow_rate" = last_flow_rate,
|
|
)
|
|
|
|
if(!initial_loc.air_vent_names[id_tag])
|
|
var/new_name = "[initial_loc.name] Vent Pump #[initial_loc.air_vent_names.len+1]"
|
|
initial_loc.air_vent_names[id_tag] = new_name
|
|
src.name = new_name
|
|
initial_loc.air_vent_info[id_tag] = signal.data
|
|
|
|
radio_connection.post_signal(src, signal, radio_filter_out)
|
|
|
|
return 1
|
|
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/initialize()
|
|
..()
|
|
|
|
//some vents work his own spesial way
|
|
radio_filter_in = frequency==1439?(RADIO_FROM_AIRALARM):null
|
|
radio_filter_out = frequency==1439?(RADIO_TO_AIRALARM):null
|
|
if(frequency)
|
|
set_frequency(frequency)
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/receive_signal(datum/signal/signal)
|
|
if(stat & (NOPOWER|BROKEN))
|
|
return
|
|
//log_admin("DEBUG \[[world.timeofday]\]: /obj/machinery/atmospherics/unary/vent_pump/receive_signal([signal.debug_print()])")
|
|
if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command"))
|
|
return 0
|
|
|
|
if(signal.data["purge"] != null)
|
|
pressure_checks &= ~1
|
|
pump_direction = 0
|
|
|
|
if(signal.data["stabalize"] != null)
|
|
pressure_checks |= 1
|
|
pump_direction = 1
|
|
|
|
if(signal.data["power"] != null)
|
|
on = text2num(signal.data["power"])
|
|
|
|
if(signal.data["power_toggle"] != null)
|
|
on = !on
|
|
|
|
if(signal.data["checks"] != null)
|
|
if (signal.data["checks"] == "default")
|
|
pressure_checks = pressure_checks_default
|
|
else
|
|
pressure_checks = text2num(signal.data["checks"])
|
|
|
|
if(signal.data["checks_toggle"] != null)
|
|
pressure_checks = (pressure_checks?0:3)
|
|
|
|
if(signal.data["direction"] != null)
|
|
pump_direction = text2num(signal.data["direction"])
|
|
|
|
if(signal.data["set_internal_pressure"] != null)
|
|
if (signal.data["set_internal_pressure"] == "default")
|
|
internal_pressure_bound = internal_pressure_bound_default
|
|
else
|
|
internal_pressure_bound = between(
|
|
0,
|
|
text2num(signal.data["set_internal_pressure"]),
|
|
ONE_ATMOSPHERE*50
|
|
)
|
|
|
|
if(signal.data["set_external_pressure"] != null)
|
|
if (signal.data["set_external_pressure"] == "default")
|
|
external_pressure_bound = external_pressure_bound_default
|
|
else
|
|
external_pressure_bound = between(
|
|
0,
|
|
text2num(signal.data["set_external_pressure"]),
|
|
ONE_ATMOSPHERE*50
|
|
)
|
|
|
|
if(signal.data["adjust_internal_pressure"] != null)
|
|
internal_pressure_bound = between(
|
|
0,
|
|
internal_pressure_bound + text2num(signal.data["adjust_internal_pressure"]),
|
|
ONE_ATMOSPHERE*50
|
|
)
|
|
|
|
if(signal.data["adjust_external_pressure"] != null)
|
|
|
|
|
|
external_pressure_bound = between(
|
|
0,
|
|
external_pressure_bound + text2num(signal.data["adjust_external_pressure"]),
|
|
ONE_ATMOSPHERE*50
|
|
)
|
|
|
|
if(signal.data["init"] != null)
|
|
name = signal.data["init"]
|
|
return
|
|
|
|
if(signal.data["status"] != null)
|
|
spawn(2)
|
|
broadcast_status()
|
|
return //do not update_icon
|
|
|
|
//log_admin("DEBUG \[[world.timeofday]\]: vent_pump/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]")
|
|
spawn(2)
|
|
broadcast_status()
|
|
update_icon()
|
|
return
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/attackby(obj/item/W, mob/user)
|
|
if(istype(W, /obj/item/weapon/weldingtool))
|
|
var/obj/item/weapon/weldingtool/WT = W
|
|
if (WT.remove_fuel(0,user))
|
|
user << "\blue Now welding the vent."
|
|
if(do_after(user, 20))
|
|
if(!src || !WT.isOn()) return
|
|
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
|
|
if(!welded)
|
|
user.visible_message("[user] welds the vent shut.", "You weld the vent shut.", "You hear welding.")
|
|
welded = 1
|
|
update_icon()
|
|
else
|
|
user.visible_message("[user] unwelds the vent.", "You unweld the vent.", "You hear welding.")
|
|
welded = 0
|
|
update_icon()
|
|
else
|
|
user << "\blue The welding tool needs to be on to start this task."
|
|
else
|
|
user << "\blue You need more welding fuel to complete this task."
|
|
return 1
|
|
else
|
|
..()
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/examine()
|
|
set src in oview(1)
|
|
..()
|
|
if (get_dist(usr, src) <= 1)
|
|
usr << "A small gauge in the corner reads [round(last_flow_rate, 0.1)] L/s; [round(last_power_draw)] W"
|
|
else
|
|
usr << "You are too far away to read the gauge."
|
|
if(welded)
|
|
usr << "It seems welded shut."
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/power_change()
|
|
var/old_stat = stat
|
|
..()
|
|
if(old_stat != stat)
|
|
update_icon()
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
|
if (!istype(W, /obj/item/weapon/wrench))
|
|
return ..()
|
|
if (!(stat & NOPOWER) && on)
|
|
user << "\red You cannot unwrench this [src], turn it off first."
|
|
return 1
|
|
var/turf/T = src.loc
|
|
if (node && node.level==1 && isturf(T) && T.intact)
|
|
user << "\red You must remove the plating first."
|
|
return 1
|
|
var/datum/gas_mixture/int_air = return_air()
|
|
var/datum/gas_mixture/env_air = loc.return_air()
|
|
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
|
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
|
add_fingerprint(user)
|
|
return 1
|
|
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
|
user << "\blue You begin to unfasten \the [src]..."
|
|
if (do_after(user, 40))
|
|
user.visible_message( \
|
|
"[user] unfastens \the [src].", \
|
|
"\blue You have unfastened \the [src].", \
|
|
"You hear ratchet.")
|
|
new /obj/item/pipe(loc, make_from=src)
|
|
del(src)
|
|
|
|
/obj/machinery/atmospherics/unary/vent_pump/Del()
|
|
if(initial_loc)
|
|
initial_loc.air_vent_info -= id_tag
|
|
initial_loc.air_vent_names -= id_tag
|
|
..()
|
|
return
|
|
|
|
/*
|
|
Alt-click to vent crawl - Monkeys, aliens, slimes and mice.
|
|
This is a little buggy but somehow that just seems to plague ventcrawl.
|
|
I am sorry, I don't know why.
|
|
*/
|
|
// Commenting this out for now, it's not critical, stated to be buggy, and seems like
|
|
// a really clumsy way of doing this. ~Z
|
|
/*/obj/machinery/atmospherics/unary/vent_pump/AltClick(var/mob/living/ML)
|
|
if(istype(ML))
|
|
var/list/ventcrawl_verbs = list(/mob/living/carbon/monkey/verb/ventcrawl, /mob/living/carbon/alien/verb/ventcrawl, /mob/living/carbon/slime/verb/ventcrawl,/mob/living/simple_animal/mouse/verb/ventcrawl)
|
|
if(length(ML.verbs & ventcrawl_verbs)) // alien queens have this removed, an istype would be complicated
|
|
ML.handle_ventcrawl(src)
|
|
return
|
|
..()*/ |