diff --git a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm index 203e17e1308..1f3aae999d4 100644 --- a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm +++ b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm @@ -10,6 +10,10 @@ obj/machinery/atmospherics/binary/passive_gate var/on = 0 var/target_pressure = ONE_ATMOSPHERE + var/frequency = 0 + var/id = null + var/datum/radio_frequency/radio_connection + update_icon() if(node1&&node2) icon_state = "intact_[on?("on"):("off")]" @@ -52,4 +56,133 @@ obj/machinery/atmospherics/binary/passive_gate network1.update = 1 if(network2) - network2.update = 1 \ No newline at end of file + network2.update = 1 + + + //Radio remote control + + proc + set_frequency(new_frequency) + radio_controller.remove_object(src, frequency) + frequency = new_frequency + if(frequency) + radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA) + + broadcast_status() + if(!radio_connection) + return 0 + + var/datum/signal/signal = new + signal.transmission_method = 1 //radio signal + signal.source = src + + signal.data = list( + "tag" = id, + "device" = "AGP", + "power" = on, + "target_output" = target_pressure, + "sigtype" = "status" + ) + + radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA) + + return 1 + + interact(mob/user as mob) + var/dat = {"Power: [on?"On":"Off"]
+ Desirable output pressure: + [round(target_pressure,0.1)]kPa | Change + "} + + user << browse("[src.name] control[dat]", "window=atmo_pump") + onclose(user, "atmo_pump") + + initialize() + ..() + if(frequency) + set_frequency(frequency) + + receive_signal(datum/signal/signal) + if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command")) + return 0 + + if("power" in signal.data) + on = text2num(signal.data["power"]) + + if("power_toggle" in signal.data) + on = !on + + if("set_output_pressure" in signal.data) + target_pressure = between( + 0, + text2num(signal.data["set_output_pressure"]), + ONE_ATMOSPHERE*50 + ) + + if("status" in signal.data) + spawn(2) + broadcast_status() + return //do not update_icon + + spawn(2) + broadcast_status() + update_icon() + return + + + + attack_hand(user as mob) + if(..()) + return + src.add_fingerprint(usr) + if(!src.allowed(user)) + user << "\red Access denied." + return + usr.machine = src + interact(user) + return + + Topic(href,href_list) + if(..()) return + if(href_list["power"]) + on = !on + if(href_list["set_press"]) + var/new_pressure = input(usr,"Enter new output pressure (0-4500kPa)","Pressure control",src.target_pressure) as num + src.target_pressure = max(0, min(4500, new_pressure)) + usr.machine = src + src.update_icon() + src.updateUsrDialog() + return + + power_change() + ..() + update_icon() + + + + attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) + if (!istype(W, /obj/item/weapon/wrench)) + return ..() + if (on) + user << "\red You cannot unwrench this [src], turn it off first." + return 1 + var/turf/T = src.loc + if (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) + diff --git a/code/ATMOSPHERICS/components/binary_devices/pump.dm b/code/ATMOSPHERICS/components/binary_devices/pump.dm index 8c57db80e0c..03c5ec3eee6 100644 --- a/code/ATMOSPHERICS/components/binary_devices/pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/pump.dm @@ -26,11 +26,9 @@ obj/machinery/atmospherics/binary/pump var/id = null var/datum/radio_frequency/radio_connection -/* - attack_hand(mob/user) - on = !on - update_icon() -*/ + on + on = 1 + icon_state = "intact_on" update_icon() if(node1&&node2) diff --git a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm index a2e33372898..c04a927fc48 100644 --- a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm @@ -16,8 +16,8 @@ obj/machinery/atmospherics/binary/volume_pump icon = 'icons/obj/atmospherics/volume_pump.dmi' icon_state = "intact_off" - name = "Gas pump" - desc = "A pump" + name = "Volumetric gas pump" + desc = "A volumetric pump" var/on = 0 var/transfer_rate = 200 @@ -26,6 +26,10 @@ obj/machinery/atmospherics/binary/volume_pump var/id = null var/datum/radio_frequency/radio_connection + on + on = 1 + icon_state = "intact_on" + update_icon() if(node1&&node2) icon_state = "intact_[on?("on"):("off")]" @@ -36,15 +40,23 @@ obj/machinery/atmospherics/binary/volume_pump icon_state = "exposed_2_off" else icon_state = "exposed_3_off" - on = 0 - return process() // ..() + if(stat & (NOPOWER|BROKEN)) + return if(!on) return 0 +// Pump mechanism just won't do anything if the pressure is too high/too low + + var/input_starting_pressure = air1.return_pressure() + var/output_starting_pressure = air2.return_pressure() + + if((input_starting_pressure < 0.01) || (output_starting_pressure > 9000)) + return 1 + var/transfer_ratio = max(1, transfer_rate/air1.volume) var/datum/gas_mixture/removed = air1.remove_ratio(transfer_ratio) @@ -85,6 +97,17 @@ obj/machinery/atmospherics/binary/volume_pump return 1 + interact(mob/user as mob) + var/dat = {"Power: [on?"On":"Off"]
+ Desirable output flow: + [round(transfer_rate,1)]l/s | Change + "} + + user << browse("[src.name] control[dat]", "window=atmo_pump") + onclose(user, "atmo_pump") + + + initialize() ..() @@ -114,4 +137,61 @@ obj/machinery/atmospherics/binary/volume_pump spawn(2) broadcast_status() - update_icon() \ No newline at end of file + update_icon() + + + attack_hand(user as mob) + if(..()) + return + src.add_fingerprint(usr) + if(!src.allowed(user)) + user << "\red Access denied." + return + usr.machine = src + interact(user) + return + + Topic(href,href_list) + if(..()) return + if(href_list["power"]) + on = !on + if(href_list["set_transfer_rate"]) + var/new_transfer_rate = input(usr,"Enter new output volume (0-200l/s)","Flow control",src.transfer_rate) as num + src.transfer_rate = max(0, min(200, new_transfer_rate)) + usr.machine = src + src.update_icon() + src.updateUsrDialog() + return + + power_change() + ..() + update_icon() + + + + 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 (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) + diff --git a/code/ATMOSPHERICS/components/unary/heat_exchanger.dm b/code/ATMOSPHERICS/components/unary/heat_exchanger.dm index 9001bcb4236..7d03ad98838 100644 --- a/code/ATMOSPHERICS/components/unary/heat_exchanger.dm +++ b/code/ATMOSPHERICS/components/unary/heat_exchanger.dm @@ -63,4 +63,27 @@ if(abs(other_old_temperature-partner.air_contents.temperature) > 1) partner.network.update = 1 - return 1 \ No newline at end of file + return 1 + + attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) + if (!istype(W, /obj/item/weapon/wrench)) + return ..() + var/turf/T = src.loc + if (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) \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/unary/vent_pump.dm b/code/ATMOSPHERICS/components/unary/vent_pump.dm index 191f8d37d1a..c4c9b50e59e 100644 --- a/code/ATMOSPHERICS/components/unary/vent_pump.dm +++ b/code/ATMOSPHERICS/components/unary/vent_pump.dm @@ -8,7 +8,6 @@ level = 1 var/area_uid var/id_tag = null - power_channel = ENVIRON var/on = 0 var/pump_direction = 1 //0 = siphoning, 1 = releasing @@ -29,6 +28,18 @@ var/radio_filter_out var/radio_filter_in + on + on = 1 + icon_state = "out" + + siphon + pump_direction = 0 + icon_state = "off" + + on + on = 1 + icon_state = "in" + New() var/area/A = get_area(loc) if (A.master) diff --git a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm index 012ee2cc96c..6b14c0cd149 100644 --- a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm +++ b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm @@ -226,7 +226,7 @@ return power_change() - if(powered(ENVIRON)) + if(powered(power_channel)) stat &= ~NOPOWER else stat |= NOPOWER diff --git a/code/ATMOSPHERICS/components/valve.dm b/code/ATMOSPHERICS/components/valve.dm index bcb962857cd..fea94457df0 100644 --- a/code/ATMOSPHERICS/components/valve.dm +++ b/code/ATMOSPHERICS/components/valve.dm @@ -17,6 +17,10 @@ obj/machinery/atmospherics/valve var/datum/pipe_network/network_node1 var/datum/pipe_network/network_node2 + open + open = 1 + icon_state = "valve1" + update_icon(animation) if(animation) flick("valve[src.open][!src.open]",src) diff --git a/code/ATMOSPHERICS/pipes.dm b/code/ATMOSPHERICS/pipes.dm index f124356bffd..0ce901eba94 100644 --- a/code/ATMOSPHERICS/pipes.dm +++ b/code/ATMOSPHERICS/pipes.dm @@ -309,6 +309,19 @@ obj/machinery/atmospherics/pipe level = 1 icon_state = "intact-f" + simple/yellow + name="Pipe" + color="yellow" + icon_state = "" + + simple/yellow/visible + level = 2 + icon_state = "intact-y" + + simple/yellow/hidden + level = 1 + icon_state = "intact-y-f" + simple/insulated @@ -331,7 +344,7 @@ obj/machinery/atmospherics/pipe name = "Pressure Tank" desc = "A large vessel containing pressurized gas." - volume = 1620 //in liters, 0.9 meters by 0.9 meters by 2 meters + volume = 2000 //in liters, 1 meters by 1 meters by 2 meters dir = SOUTH initialize_directions = SOUTH @@ -864,6 +877,11 @@ obj/machinery/atmospherics/pipe color="gray" icon_state = "" + manifold/yellow + name="Air supply pipe" + color="yellow" + icon_state = "" + manifold/scrubbers/visible level = 2 icon_state = "manifold-r" @@ -896,302 +914,7 @@ obj/machinery/atmospherics/pipe level = 1 icon_state = "manifold-f" - manifold4w - icon = 'pipe_manifold.dmi' - icon_state = "manifold4w-f" - - name = "4-way pipe manifold" - desc = "A manifold composed of regular pipes" - - volume = 140 - - dir = SOUTH - initialize_directions = EAST|NORTH|WEST|SOUTH - - var/obj/machinery/atmospherics/node1 - var/obj/machinery/atmospherics/node2 - var/obj/machinery/atmospherics/node3 - var/obj/machinery/atmospherics/node4 - - level = 1 - - hide(var/i) - if(level == 1 && istype(loc, /turf/simulated)) - invisibility = i ? 101 : 0 - update_icon() - - pipeline_expansion() - return list(node1, node2, node3, node4) - - process() - if(!parent) - ..() - else - machines.Remove(src) -/* - if(!node1) - parent.mingle_with_turf(loc, 70) - if(!nodealert) - //world << "Missing node from [src] at [src.x],[src.y],[src.z]" - nodealert = 1 - else if(!node2) - parent.mingle_with_turf(loc, 70) - if(!nodealert) - //world << "Missing node from [src] at [src.x],[src.y],[src.z]" - nodealert = 1 - else if(!node3) - parent.mingle_with_turf(loc, 70) - if(!nodealert) - //world << "Missing node from [src] at [src.x],[src.y],[src.z]" - nodealert = 1 - else if (nodealert) - nodealert = 0 -*/ - Del() - if(node1) - node1.disconnect(src) - if(node2) - node2.disconnect(src) - if(node3) - node3.disconnect(src) - if(node4) - node4.disconnect(src) - - ..() - - disconnect(obj/machinery/atmospherics/reference) - if(reference == node1) - if(istype(node1, /obj/machinery/atmospherics/pipe)) - del(parent) - node1 = null - - if(reference == node2) - if(istype(node2, /obj/machinery/atmospherics/pipe)) - del(parent) - node2 = null - - if(reference == node3) - if(istype(node3, /obj/machinery/atmospherics/pipe)) - del(parent) - node3 = null - - if(reference == node4) - if(istype(node4, /obj/machinery/atmospherics/pipe)) - del(parent) - node3 = null - - update_icon() - - ..() - - update_icon() - overlays = new() - if(node1&&node2&&node3&&node4) - var/C = "" - switch(color) - if ("red") C = "-r" - if ("blue") C = "-b" - if ("cyan") C = "-c" - if ("green") C = "-g" - if ("yellow") C = "-y" - if ("purple") C = "-p" - icon_state = "manifold4w[C][invisibility ? "-f" : ""]" - - else - icon_state = "manifold4w_ex" - var/icon/con = new/icon('pipe_manifold.dmi',"manifold4w_con") - - if(node1) - overlays += new/image(con,dir=1) - if(node2) - overlays += new/image(con,dir=2) - if(node3) - overlays += new/image(con,dir=4) - if(node4) - overlays += new/image(con,dir=8) - - if(!node1 && !node2 && !node3 && !node4) - del(src) - return - - initialize() - for(var/obj/machinery/atmospherics/target in get_step(src,1)) - if(target.initialize_directions & get_dir(target,src)) - node1 = target - break - - for(var/obj/machinery/atmospherics/target in get_step(src,2)) - if(target.initialize_directions & get_dir(target,src)) - node2 = target - break - - for(var/obj/machinery/atmospherics/target in get_step(src,4)) - if(target.initialize_directions & get_dir(target,src)) - node3 = target - break - - for(var/obj/machinery/atmospherics/target in get_step(src,8)) - if(target.initialize_directions & get_dir(target,src)) - node4 = target - break - - var/turf/T = src.loc // hide if turf is not intact - hide(T.intact) - //update_icon() - update_icon() - - manifold4w/scrubbers - name="Scrubbers pipe" - color="red" - icon_state = "" - - manifold4w/supply - name="Air supply pipe" - color="blue" - icon_state = "" - - manifold4w/supplymain - name="Main air supply pipe" - color="purple" - icon_state = "" - - manifold4w/general - name="Air supply pipe" - color="gray" - icon_state = "" - - manifold4w/scrubbers/visible - level = 2 - icon_state = "manifold4w-r" - - manifold4w/scrubbers/hidden - level = 1 - icon_state = "manifold4w-r-f" - - manifold4w/supply/visible - level = 2 - icon_state = "manifold4w-b" - - manifold4w/supply/hidden - level = 1 - icon_state = "manifold4w-b-f" - - manifold4w/supplymain/visible - level = 2 - icon_state = "manifold4w-p" - - manifold4w/supplymain/hidden - level = 1 - icon_state = "manifold4w-p-f" - - manifold4w/general/visible - level = 2 - icon_state = "manifold4w" - - manifold4w/general/hidden - level = 1 - icon_state = "manifold4w-f" - - cap - name = "pipe endcap" - desc = "An endcap for pipes" - icon = 'pipes.dmi' - icon_state = "cap" - level = 2 - - volume = 35 - - dir = SOUTH - initialize_directions = NORTH - - var/obj/machinery/atmospherics/node - - New() - ..() - switch(dir) - if(SOUTH) - initialize_directions = NORTH - if(NORTH) - initialize_directions = SOUTH - if(WEST) - initialize_directions = EAST - if(EAST) - initialize_directions = WEST - - hide(var/i) - if(level == 1 && istype(loc, /turf/simulated)) - invisibility = i ? 101 : 0 - update_icon() - - pipeline_expansion() - return list(node) - - process() - if(!parent) - ..() - else - machines.Remove(src) -/* - if(!node1) - parent.mingle_with_turf(loc, 70) - if(!nodealert) - //world << "Missing node from [src] at [src.x],[src.y],[src.z]" - nodealert = 1 - else if(!node2) - parent.mingle_with_turf(loc, 70) - if(!nodealert) - //world << "Missing node from [src] at [src.x],[src.y],[src.z]" - nodealert = 1 - else if(!node3) - parent.mingle_with_turf(loc, 70) - if(!nodealert) - //world << "Missing node from [src] at [src.x],[src.y],[src.z]" - nodealert = 1 - else if (nodealert) - nodealert = 0 -*/ - Del() - if(node) - node.disconnect(src) - - ..() - - disconnect(obj/machinery/atmospherics/reference) - if(reference == node) - if(istype(node, /obj/machinery/atmospherics/pipe)) - del(parent) - node = null - - update_icon() - - ..() - - update_icon() - overlays = new() - - icon_state = "cap[invisibility ? "-f" : ""]" - return - - initialize() - for(var/obj/machinery/atmospherics/target in get_step(src, dir)) - if(target.initialize_directions & get_dir(target,src)) - node = target - break - - var/turf/T = src.loc // hide if turf is not intact - hide(T.intact) - //update_icon() - update_icon() - - visible - level = 2 - icon_state = "cap" - - hidden - level = 1 - icon_state = "cap-f" - -obj/machinery/atmospherics/pipe/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) + manifold4w icon = 'pipe_manifold.dmi' icon_state = "manifold4w-f" name = "4-way pipe manifold" desc = "A manifold composed of regular pipes" volume = 140 dir = SOUTH initialize_directions = EAST|NORTH|WEST|SOUTH var/obj/machinery/atmospherics/node1 var/obj/machinery/atmospherics/node2 var/obj/machinery/atmospherics/node3 var/obj/machinery/atmospherics/node4 level = 1 hide(var/i) if(level == 1 && istype(loc, /turf/simulated)) invisibility = i ? 101 : 0 update_icon() pipeline_expansion() return list(node1, node2, node3, node4) process() if(!parent) ..() else machines.Remove(src)/* if(!node1) parent.mingle_with_turf(loc, 70) if(!nodealert) //world << "Missing node from [src] at [src.x],[src.y],[src.z]" nodealert = 1 else if(!node2) parent.mingle_with_turf(loc, 70) if(!nodealert) //world << "Missing node from [src] at [src.x],[src.y],[src.z]" nodealert = 1 else if(!node3) parent.mingle_with_turf(loc, 70) if(!nodealert) //world << "Missing node from [src] at [src.x],[src.y],[src.z]" nodealert = 1 else if (nodealert) nodealert = 0*/ Del() if(node1) node1.disconnect(src) if(node2) node2.disconnect(src) if(node3) node3.disconnect(src) if(node4) node4.disconnect(src) ..() disconnect(obj/machinery/atmospherics/reference) if(reference == node1) if(istype(node1, /obj/machinery/atmospherics/pipe)) del(parent) node1 = null if(reference == node2) if(istype(node2, /obj/machinery/atmospherics/pipe)) del(parent) node2 = null if(reference == node3) if(istype(node3, /obj/machinery/atmospherics/pipe)) del(parent) node3 = null if(reference == node4) if(istype(node4, /obj/machinery/atmospherics/pipe)) del(parent) node3 = null update_icon() ..() update_icon() overlays = new() if(node1&&node2&&node3&&node4) var/C = "" switch(color) if ("red") C = "-r" if ("blue") C = "-b" if ("cyan") C = "-c" if ("green") C = "-g" if ("yellow") C = "-y" if ("purple") C = "-p" icon_state = "manifold4w[C][invisibility ? "-f" : ""]" else icon_state = "manifold4w_ex" var/icon/con = new/icon('pipe_manifold.dmi',"manifold4w_con") if(node1) overlays += new/image(con,dir=1) if(node2) overlays += new/image(con,dir=2) if(node3) overlays += new/image(con,dir=4) if(node4) overlays += new/image(con,dir=8) if(!node1 && !node2 && !node3 && !node4) del(src) return initialize() for(var/obj/machinery/atmospherics/target in get_step(src,1)) if(target.initialize_directions & get_dir(target,src)) node1 = target break for(var/obj/machinery/atmospherics/target in get_step(src,2)) if(target.initialize_directions & get_dir(target,src)) node2 = target break for(var/obj/machinery/atmospherics/target in get_step(src,4)) if(target.initialize_directions & get_dir(target,src)) node3 = target break for(var/obj/machinery/atmospherics/target in get_step(src,8)) if(target.initialize_directions & get_dir(target,src)) node4 = target break var/turf/T = src.loc // hide if turf is not intact hide(T.intact) //update_icon() update_icon() manifold4w/scrubbers name="Scrubbers pipe" color="red" icon_state = "" manifold4w/supply name="Air supply pipe" color="blue" icon_state = "" manifold4w/supplymain name="Main air supply pipe" color="purple" icon_state = "" manifold4w/general name="Air supply pipe" color="gray" icon_state = "" manifold4w/scrubbers/visible level = 2 icon_state = "manifold4w-r" manifold4w/scrubbers/hidden level = 1 icon_state = "manifold4w-r-f" manifold4w/supply/visible level = 2 icon_state = "manifold4w-b" manifold4w/supply/hidden level = 1 icon_state = "manifold4w-b-f" manifold4w/supplymain/visible level = 2 icon_state = "manifold4w-p" manifold4w/supplymain/hidden level = 1 icon_state = "manifold4w-p-f" manifold4w/general/visible level = 2 icon_state = "manifold4w" manifold4w/general/hidden level = 1 icon_state = "manifold4w-f" cap name = "pipe endcap" desc = "An endcap for pipes" icon = 'pipes.dmi' icon_state = "cap" level = 2 volume = 35 dir = SOUTH initialize_directions = NORTH var/obj/machinery/atmospherics/node New() ..() switch(dir) if(SOUTH) initialize_directions = NORTH if(NORTH) initialize_directions = SOUTH if(WEST) initialize_directions = EAST if(EAST) initialize_directions = WEST hide(var/i) if(level == 1 && istype(loc, /turf/simulated)) invisibility = i ? 101 : 0 update_icon() pipeline_expansion() return list(node) process() if(!parent) ..() else machines.Remove(src)/* if(!node1) parent.mingle_with_turf(loc, 70) if(!nodealert) //world << "Missing node from [src] at [src.x],[src.y],[src.z]" nodealert = 1 else if(!node2) parent.mingle_with_turf(loc, 70) if(!nodealert) //world << "Missing node from [src] at [src.x],[src.y],[src.z]" nodealert = 1 else if(!node3) parent.mingle_with_turf(loc, 70) if(!nodealert) //world << "Missing node from [src] at [src.x],[src.y],[src.z]" nodealert = 1 else if (nodealert) nodealert = 0*/ Del() if(node) node.disconnect(src) ..() disconnect(obj/machinery/atmospherics/reference) if(reference == node) if(istype(node, /obj/machinery/atmospherics/pipe)) del(parent) node = null update_icon() ..() update_icon() overlays = new() icon_state = "cap[invisibility ? "-f" : ""]" return initialize() for(var/obj/machinery/atmospherics/target in get_step(src, dir)) if(target.initialize_directions & get_dir(target,src)) node = target break var/turf/T = src.loc // hide if turf is not intact hide(T.intact) //update_icon() update_icon() visible level = 2 icon_state = "cap" hidden level = 1 icon_state = "cap-f" manifold/yellow/visible level = 2 icon_state = "manifold-y" manifold/yellow/hidden level = 1 icon_state = "manifold-y-f"obj/machinery/atmospherics/pipe/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) if (istype(src, /obj/machinery/atmospherics/pipe/tank)) return ..() if (istype(src, /obj/machinery/atmospherics/pipe/vent)) diff --git a/code/WorkInProgress/carn/debug_locnull.dm b/code/WorkInProgress/carn/debug_locnull.dm new file mode 100644 index 00000000000..5d6a378a760 --- /dev/null +++ b/code/WorkInProgress/carn/debug_locnull.dm @@ -0,0 +1,7 @@ +/client/verb/find_atoms_in_null() + if(!holder) return + var/msg + for(var/atom/A) + if(A.loc == null) + msg += "\ref[A] [A.type] - [A]\n" + world.log << msg \ No newline at end of file diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 57cadffa6bd..d1d8d6d20ec 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -75,12 +75,6 @@ var/health_threshold_crit = 0 var/health_threshold_dead = -100 - var/organ_health_multiplier = 1 - var/organ_regeneration_multiplier = 1 - - var/bones_can_break = 0 - var/limbs_can_break = 0 - var/revival_pod_plants = 1 var/revival_cloning = 1 var/revival_brain_life = -1 @@ -383,14 +377,6 @@ config.metroid_delay = value if("animal_delay") config.animal_delay = value - if("organ_health_multiplier") - config.organ_health_multiplier = value / 100 - if("organ_regeneration_multiplier") - config.organ_regeneration_multiplier = value / 100 - if("bones_can_break") - config.bones_can_break = value - if("limbs_can_break") - config.limbs_can_break = value else diary << "Unknown setting in configuration: '[name]'" @@ -512,7 +498,7 @@ if (M.config_tag && M.config_tag == mode_name) return M del(M) - return null + return new /datum/game_mode/extended() /datum/configuration/proc/get_runnable_modes() var/list/datum/game_mode/runnable_modes = new diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index 4eef830f1b4..ce798d05e12 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -244,6 +244,7 @@ client body += "" body += "" body += "" + body += "" body += "" body += "" if(ishuman(D)) @@ -546,6 +547,22 @@ client if(usr.client) usr.client.cmd_assume_direct_control(MOB) + else if (href_list["make_skeleton"]) + if(!href_list["make_skeleton"]) + return + var/mob/MOB = locate(href_list["make_skeleton"]) + if(!MOB) + return + if(!ismob(MOB)) + return + if(!src.holder) + return + + if(ishuman(MOB)) + world << "derp" + var/mob/living/carbon/human/HUMANMOB = MOB + HUMANMOB.makeSkeleton() + else if (href_list["delall"]) if(!href_list["delall"]) return diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 7f58a1742db..cda459be5f1 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -1153,17 +1153,17 @@ datum/mind ..() mind.assigned_role = "Shade" -/mob/living/simple_animal/constructbuilder/mind_initialize() +/mob/living/simple_animal/construct/builder/mind_initialize() ..() mind.assigned_role = "Artificer" mind.special_role = "Cultist" -/mob/living/simple_animal/constructwraith/mind_initialize() +/mob/living/simple_animal/construct/wraith/mind_initialize() ..() mind.assigned_role = "Wraith" mind.special_role = "Cultist" -/mob/living/simple_animal/constructarmoured/mind_initialize() +/mob/living/simple_animal/construct/armoured/mind_initialize() ..() mind.assigned_role = "Juggernaut" mind.special_role = "Cultist" diff --git a/code/datums/organs/organ.dm b/code/datums/organs/organ.dm index ba7b1bf014c..81b45f51287 100644 --- a/code/datums/organs/organ.dm +++ b/code/datums/organs/organ.dm @@ -1,6 +1,8 @@ +//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33 + /datum/organ var/name = "organ" - var/mob/living/carbon/human/owner = null + var/mob/owner = null ///datum/organ/proc/process() // return 0 @@ -8,8 +10,5 @@ ///datum/organ/proc/receive_chem(chemical as obj) // return 0 - proc/process() - return 0 - proc/receive_chem(chemical as obj) - return 0 \ No newline at end of file + diff --git a/code/datums/organs/organ_external.dm b/code/datums/organs/organ_external.dm index 14713d81592..b5c67d5496b 100644 --- a/code/datums/organs/organ_external.dm +++ b/code/datums/organs/organ_external.dm @@ -1,661 +1,142 @@ -/**************************************************** - EXTERNAL ORGANS -****************************************************/ /datum/organ/external name = "external" var/icon_name = null var/body_part = null - - var/damage_state = "00" + var/brutestate = 0 + var/burnstate = 0 var/brute_dam = 0 var/burn_dam = 0 var/max_damage = 0 - var/max_size = 0 - var/tmp/list/obj/item/weapon/implant/implant - - var/display_name - var/list/wounds = list() - var/number_wounds = 0 // cache the number of wounds, which is NOT wounds.len! - - var/tmp/perma_injury = 0 - var/tmp/perma_dmg = 0 - var/tmp/destspawn = 0 //Has it spawned the broken limb? - var/tmp/amputated = 0 // Whether this has been cleanly amputated, thus causing no pain - var/min_broken_damage = 30 - - var/datum/organ/external/parent - var/list/datum/organ/external/children - - var/damage_msg = "\red You feel an intense pain" - - var/status = 0 - var/broken_description - var/open = 0 - var/stage = 0 - - proc/take_damage(brute, burn, sharp, used_weapon = null, list/forbidden_limbs = list()) - // TODO: this proc needs to be rewritten toa not update damages directly - if((brute <= 0) && (burn <= 0)) - return 0 - if(status & ORGAN_DESTROYED) - return 0 - if(status & ORGAN_ROBOT) - brute *= 0.66 //~2/3 damage for ROBOLIMBS - burn *= 0.66 //~2/3 damage for ROBOLIMBS - - //if(owner && !(status & ORGAN_ROBOT)) - // owner.pain(display_name, (brute+burn)*3, 1, burn > brute) - - if(sharp) - var/nux = brute * rand(10,15) - if(config.limbs_can_break && brute_dam >= max_damage * config.organ_health_multiplier) - if(prob(5 * brute)) - status |= ORGAN_DESTROYED - droplimb() - return - - else if(prob(nux)) - createwound( CUT, brute ) - if(!(status & ORGAN_ROBOT)) - owner << "You feel something wet on your [display_name]" - - else if(brute > 20) - if(config.limbs_can_break && brute_dam >= max_damage * config.organ_health_multiplier) - if(prob(5 * brute)) - status |= ORGAN_DESTROYED - droplimb() - return - - // If the limbs can break, make sure we don't exceed the maximum damage a limb can take before breaking - if((brute_dam + burn_dam + brute + burn) < max_damage || !config.limbs_can_break) - if(brute) - brute_dam += brute - if( (prob(brute*2) && !sharp) || sharp ) - createwound( CUT, brute ) - else if(!sharp) - createwound( BRUISE, brute ) - if(burn) - burn_dam += burn - createwound( BURN, burn ) - else - var/can_inflict = max_damage * config.organ_health_multiplier - (brute_dam + burn_dam) //How much damage can we actually cause? - if(can_inflict) - if (brute > 0 && burn > 0) - brute = can_inflict/2 - burn = can_inflict/2 - var/ratio = brute / (brute + burn) - brute_dam += ratio * can_inflict - burn_dam += (1 - ratio) * can_inflict - else - if (brute > 0) - brute = can_inflict - brute_dam += brute - createwound(BRUISE, brute) - else - burn = can_inflict - burn_dam += burn - createwound(BRUISE, brute) - else if(!(status & ORGAN_ROBOT)) - var/passed_dam = (brute + burn) - can_inflict //Getting how much overdamage we have. - var/list/datum/organ/external/possible_points = list() - if(parent) - possible_points += parent - if(children) - possible_points += children - if(forbidden_limbs.len) - possible_points -= forbidden_limbs - if(!possible_points.len) - message_admins("Oh god WHAT! [owner]'s [src] was unable to find an organ to pass overdamage too!") - else - var/datum/organ/external/target = pick(possible_points) - if(brute) - target.take_damage(passed_dam, 0, sharp, used_weapon, forbidden_limbs + src) - else - target.take_damage(0, passed_dam, sharp, used_weapon, forbidden_limbs + src) - else - droplimb(1) //Robot limbs just kinda fail at full damage. - - - if(status & ORGAN_BROKEN) - owner.emote("scream") - - owner.updatehealth() - - // sync the organ's damage with its wounds - src.update_damages() - - var/result = update_icon() - return result - - - - proc/heal_damage(brute, burn, internal = 0, robo_repair = 0) - if(status & ORGAN_ROBOT && !robo_repair) - return - - // heal damage on the individual wounds - for(var/datum/wound/W in wounds) - if(brute == 0 && burn == 0) - break - - // heal brute damage - if(W.damage_type == CUT || W.damage_type == BRUISE) - brute = W.heal_damage(brute) - else if(W.damage_type == BURN) - burn = W.heal_damage(burn) - - // sync organ damage with wound damages - update_damages() - - if(internal) - status &= ~ORGAN_BROKEN - perma_injury = 0 - - // sync the organ's damage with its wounds - src.update_damages() - - owner.updatehealth() - var/result = update_icon() - return result - - proc/update_damages() - number_wounds = 0 - brute_dam = 0 - burn_dam = 0 - status &= ~ORGAN_BLEEDING - for(var/datum/wound/W in wounds) - if(W.damage_type == CUT || W.damage_type == BRUISE) - brute_dam += W.damage - else if(W.damage_type == BURN) - burn_dam += W.damage - - if(!W.bandaged && W.damage > 4) - status |= ORGAN_BLEEDING - - number_wounds += W.amount - - proc/update_wounds() - for(var/datum/wound/W in wounds) - // wounds can disappear after 10 minutes at the earliest - if(W.damage == 0 && W.created + 10 * 10 * 60 <= world.time) - wounds -= W - // let the GC handle the deletion of the wound - if(W.is_treated()) - // slow healing - var/amount = 0.2 - if(W.bandaged) amount++ - if(W.salved) amount++ - if(W.disinfected) amount++ - // amount of healing is spread over all the wounds - W.heal_damage((amount * W.amount * config.organ_regeneration_multiplier) / (5*owner.number_wounds+1)) - - // sync the organ's damage with its wounds - src.update_damages() - - - proc/get_damage() //returns total damage - return max(brute_dam + burn_dam - perma_injury, perma_injury) //could use health? - - proc/get_damage_brute() - return max(brute_dam+perma_injury, perma_injury) - - proc/get_damage_fire() - return burn_dam - - process() - // process wounds, doing healing etc., only do this every 4 ticks to save processing power - if(owner.life_tick % 4 == 0) - update_wounds() - if(status & ORGAN_DESTROYED) - if(!destspawn && config.limbs_can_break) - droplimb() - return - if(!(status & ORGAN_BROKEN)) - perma_dmg = 0 - if(parent) - if(parent.status & ORGAN_DESTROYED) - status |= ORGAN_DESTROYED - owner.update_body(1) - return - if(config.bones_can_break && brute_dam > min_broken_damage * config.organ_health_multiplier && !(status & ORGAN_ROBOT)) - if(!(status & ORGAN_BROKEN)) - owner.visible_message("\red You hear a loud cracking sound coming from \the [owner].","\red Something feels like it shattered in your [display_name]!","You hear a sickening crack.") - owner.emote("scream") - status |= ORGAN_BROKEN - broken_description = pick("broken","fracture","hairline fracture") - perma_injury = brute_dam - return - -// new damage icon system -// returns just the brute/burn damage code - proc/damage_state_text() - if(status & ORGAN_DESTROYED) - return "--" - - var/tburn = 0 - var/tbrute = 0 - - if(burn_dam ==0) - tburn =0 - else if (burn_dam < (max_damage * 0.25 / 2)) - tburn = 1 - else if (burn_dam < (max_damage * 0.75 / 2)) - tburn = 2 - else - tburn = 3 - - if (brute_dam == 0) - tbrute = 0 - else if (brute_dam < (max_damage * 0.25 / 2)) - tbrute = 1 - else if (brute_dam < (max_damage * 0.75 / 2)) - tbrute = 2 - else - tbrute = 3 - return "[tbrute][tburn]" - - -// new damage icon system -// adjusted to set damage_state to brute/burn code only (without r_name0 as before) - proc/update_icon() - var/n_is = damage_state_text() - if (n_is != damage_state) - damage_state = n_is - owner.update_body(1) - return 1 - return 0 - - proc/droplimb(var/override = 0,var/no_explode = 0) - if(override) - status |= ORGAN_DESTROYED - if(status & ORGAN_DESTROYED) - if(status & ORGAN_SPLINTED) - status &= ~ORGAN_SPLINTED - if(implant) - for(var/implants in implant) - del(implants) - //owner.unlock_medal("Lost something?", 0, "Lose a limb.", "easy") - - // If any organs are attached to this, destroy them - for(var/datum/organ/external/O in owner.organs) - if(O.parent == src) - O.droplimb(1) - - var/obj/item/weapon/organ/H - switch(body_part) - if(UPPER_TORSO) - owner.gib() - if(LOWER_TORSO) - owner << "\red You are now sterile." - if(HEAD) - H = new /obj/item/weapon/organ/head(owner.loc, owner) - if(ishuman(owner)) - if(owner.gender == FEMALE) - H.icon_state = "head_f_l" - H.overlays += owner.generate_head_icon() - H:transfer_identity(owner) - H.pixel_x = -10 - H.pixel_y = 6 - H.name = "[owner.real_name]'s head" - - owner.u_equip(owner.glasses) - owner.u_equip(owner.head) - owner.u_equip(owner.ears) - owner.u_equip(owner.wear_mask) - - owner.regenerate_icons() - - owner.death() - if(ARM_RIGHT) - H = new /obj/item/weapon/organ/r_arm(owner.loc, owner) - if(ismonkey(owner)) - H.icon_state = "r_arm_l" - if(ARM_LEFT) - H = new /obj/item/weapon/organ/l_arm(owner.loc, owner) - if(ismonkey(owner)) - H.icon_state = "l_arm_l" - if(LEG_RIGHT) - H = new /obj/item/weapon/organ/r_leg(owner.loc, owner) - if(ismonkey(owner)) - H.icon_state = "r_leg_l" - if(LEG_LEFT) - H = new /obj/item/weapon/organ/l_leg(owner.loc, owner) - if(ismonkey(owner)) - H.icon_state = "l_leg_l" - if(HAND_RIGHT) - H = new /obj/item/weapon/organ/r_hand(owner.loc, owner) - if(ismonkey(owner)) - H.icon_state = "r_hand_l" - owner.u_equip(owner.gloves) - if(HAND_LEFT) - H = new /obj/item/weapon/organ/l_hand(owner.loc, owner) - if(ismonkey(owner)) - H.icon_state = "l_hand_l" - owner.u_equip(owner.gloves) - if(FOOT_RIGHT) - H = new /obj/item/weapon/organ/r_foot/(owner.loc, owner) - if(ismonkey(owner)) - H.icon_state = "r_foot_l" - owner.u_equip(owner.shoes) - if(FOOT_LEFT) - H = new /obj/item/weapon/organ/l_foot(owner.loc, owner) - if(ismonkey(owner)) - H.icon_state = "l_foot_l" - owner.u_equip(owner.shoes) - if(ismonkey(owner)) - H.icon = 'monkey.dmi' - var/lol = pick(cardinal) - step(H,lol) - destspawn = 1 - if(status & ORGAN_ROBOT) - owner.visible_message("\red \The [owner]'s [display_name] explodes violently!",\ - "\red Your [display_name] explodes!",\ - "You hear an explosion followed by a scream!") - if(!no_explode) - explosion(get_turf(owner),-1,-1,2,3) - var/datum/effect/effect/system/spark_spread/spark_system = new /datum/effect/effect/system/spark_spread() - spark_system.set_up(5, 0, src) - spark_system.attach(src) - spark_system.start() - spawn(10) - del(spark_system) - else - owner.visible_message("\red [owner.name]'s [display_name] flies off in an arc.",\ - "Your [display_name] goes flying off!",\ - "You hear a terrible sound of ripping tendons and flesh.") - - // force the icon to rebuild - owner.regenerate_icons() - - proc/createwound(var/type = CUT, var/damage) - if(hasorgans(owner)) - var/wound_type - var/size = min( max( 1, damage/10 ) , 6) - - // first check whether we can widen an existing wound - if(wounds.len > 0 && prob(25)) - if((type == CUT || type == BRUISE) && damage >= 5) - var/datum/wound/W = pick(wounds) - if(W.amount == 1 && W.started_healing()) - W.open_wound() - owner.visible_message("\red The wound on [owner.name]'s [display_name] widens with a nasty ripping voice.",\ - "\red The wound on your [display_name] widens with a nasty ripping voice.",\ - "You hear a nasty ripping noise, as if flesh is being torn apart.") - - return - - if(damage == 0) return - - // the wound we will create - var/datum/wound/W - - switch(type) - if(CUT) - src.status |= ORGAN_BLEEDING - var/list/size_names = list(/datum/wound/cut, /datum/wound/deep_cut, /datum/wound/flesh_wound, /datum/wound/gaping_wound, /datum/wound/big_gaping_wound, /datum/wound/massive_wound) - wound_type = size_names[size] - - W = new wound_type(damage) - - if(BRUISE) - var/list/size_names = list(/datum/wound/bruise/tiny_bruise, /datum/wound/bruise/small_bruise, /datum/wound/bruise/moderate_bruise, /datum/wound/bruise/large_bruise, /datum/wound/bruise/huge_bruise, /datum/wound/bruise/monumental_bruise) - wound_type = size_names[size] - - W = new wound_type(damage) - if(BURN) - var/list/size_names = list(/datum/wound/moderate_burn, /datum/wound/large_burn, /datum/wound/severe_burn, /datum/wound/deep_burn, /datum/wound/carbonised_area) - wound_type = size_names[size] - - W = new wound_type(damage) - - - - // check whether we can add the wound to an existing wound - for(var/datum/wound/other in wounds) - if(other.desc == W.desc) - // okay, add it! - other.damage += W.damage - other.amount += 1 - W = null // to signify that the wound was added - break - - // if we couldn't add the wound to another wound, ignore - if(W) - wounds += W - - proc/emp_act(severity) - if(!(status & ORGAN_ROBOT)) - return - if(prob(30*severity)) - take_damage(4(4-severity), 0, 1, used_weapon = "EMP") - else - droplimb(1) - - proc/getDisplayName() - switch(name) - if("l_leg") - return "left leg" - if("r_leg") - return "right leg" - if("l_arm") - return "left arm" - if("r_arm") - return "right arm" - if("l_foot") - return "left foot" - if("r_foot") - return "right foot" - if("l_hand") - return "left hand" - if("r_hand") - return "right hand" - else - return name +// var/bandaged = 0 +// var/wound_size = 0 +// var/max_size = 0 /datum/organ/external/chest name = "chest" icon_name = "chest" - display_name = "chest" max_damage = 150 - min_broken_damage = 75 body_part = UPPER_TORSO -/datum/organ/external/groin - name = "groin" - icon_name = "diaper" - display_name = "groin" - max_damage = 115 - min_broken_damage = 70 - body_part = LOWER_TORSO - /datum/organ/external/head name = "head" icon_name = "head" - display_name = "head" - max_damage = 75 - min_broken_damage = 40 + max_damage = 125 body_part = HEAD - var/disfigured = 0 /datum/organ/external/l_arm name = "l_arm" - display_name = "left arm" icon_name = "l_arm" max_damage = 75 - min_broken_damage = 30 body_part = ARM_LEFT /datum/organ/external/l_leg name = "l_leg" - display_name = "left leg" icon_name = "l_leg" max_damage = 75 - min_broken_damage = 30 body_part = LEG_LEFT /datum/organ/external/r_arm name = "r_arm" - display_name = "right arm" icon_name = "r_arm" max_damage = 75 - min_broken_damage = 30 body_part = ARM_RIGHT /datum/organ/external/r_leg name = "r_leg" - display_name = "right leg" icon_name = "r_leg" max_damage = 75 - min_broken_damage = 30 body_part = LEG_RIGHT +/*Leaving these here in case we want to use them later /datum/organ/external/l_foot - name = "l_foot" - display_name = "left foot" + name = "l foot" icon_name = "l_foot" - max_damage = 40 - min_broken_damage = 15 body_part = FOOT_LEFT /datum/organ/external/r_foot - name = "r_foot" - display_name = "right foot" + name = "r foot" icon_name = "r_foot" - max_damage = 40 - min_broken_damage = 15 body_part = FOOT_RIGHT /datum/organ/external/r_hand - name = "r_hand" - display_name = "right hand" + name = "r hand" icon_name = "r_hand" - max_damage = 40 - min_broken_damage = 15 body_part = HAND_RIGHT /datum/organ/external/l_hand - name = "l_hand" - display_name = "left hand" + name = "l hand" icon_name = "l_hand" - max_damage = 40 - min_broken_damage = 15 body_part = HAND_LEFT -/**************************************************** - EXTERNAL ORGAN ITEMS -****************************************************/ +/datum/organ/external/groin + name = "groin" + icon_name = "groin" + body_part = LOWER_TORSO +*/ -obj/item/weapon/organ - icon = 'human.dmi' +//Applies brute and burn damage to the organ. Returns 1 if the damage-icon states changed at all. +//Damage will not exceed max_damage using this proc +//Cannot apply negative damage +/datum/organ/external/proc/take_damage(brute, burn) + if(owner && owner.nodamage) return 0 //godmode + brute = max(brute,0) + burn = max(burn,0) -obj/item/weapon/organ/New(loc, mob/living/carbon/human/H) - ..(loc) - if(!istype(H)) - return - if(H.dna) - if(!blood_DNA) - blood_DNA = list() - blood_DNA[H.dna.unique_enzymes] = H.dna.b_type + var/can_inflict = max_damage - (brute_dam + burn_dam) + if(!can_inflict) return 0 - var/icon/I = new /icon(icon, icon_state) - - if (H.s_tone >= 0) - I.Blend(rgb(H.s_tone, H.s_tone, H.s_tone), ICON_ADD) + if((brute + burn) < can_inflict) + brute_dam += brute + burn_dam += burn else - I.Blend(rgb(-H.s_tone, -H.s_tone, -H.s_tone), ICON_SUBTRACT) - icon = I - -obj/item/weapon/organ/head - name = "head" - icon_state = "head_m_l" - var/mob/living/carbon/brain/brainmob - var/brain_op_stage = 0 - -obj/item/weapon/organ/head/New() - ..() - spawn(5) - if(brainmob && brainmob.client) - brainmob.client.screen.len = null //clear the hud - -obj/item/weapon/organ/head/proc/transfer_identity(var/mob/living/carbon/human/H)//Same deal as the regular brain proc. Used for human-->head - brainmob = new(src) - brainmob.name = H.real_name - brainmob.real_name = H.real_name - brainmob.dna = H.dna - if(H.mind) - H.mind.transfer_to(brainmob) - brainmob.container = src - -obj/item/weapon/organ/head/attackby(obj/item/weapon/W as obj, mob/user as mob) - if(istype(W,/obj/item/weapon/scalpel)) - switch(brain_op_stage) - if(0) - for(var/mob/O in (oviewers(brainmob) - user)) - O.show_message("\red [brainmob] is beginning to have \his head cut open with [src] by [user].", 1) - brainmob << "\red [user] begins to cut open your head with [src]!" - user << "\red You cut [brainmob]'s head open with [src]!" - - brain_op_stage = 1 - - if(2) - for(var/mob/O in (oviewers(brainmob) - user)) - O.show_message("\red [brainmob] is having \his connections to the brain delicately severed with [src] by [user].", 1) - brainmob << "\red [user] begins to cut open your head with [src]!" - user << "\red You cut [brainmob]'s head open with [src]!" - - brain_op_stage = 3.0 + if(brute > 0) + if(burn > 0) + brute = round( (brute/(brute+burn)) * can_inflict, 1 ) + burn = can_inflict - brute //gets whatever damage is left over + brute_dam += brute + burn_dam += burn else - ..() - else if(istype(W,/obj/item/weapon/circular_saw)) - switch(brain_op_stage) - if(1) - for(var/mob/O in (oviewers(brainmob) - user)) - O.show_message("\red [brainmob] has \his skull sawed open with [src] by [user].", 1) - brainmob << "\red [user] begins to saw open your head with [src]!" - user << "\red You saw [brainmob]'s head open with [src]!" - - brain_op_stage = 2 - if(3) - for(var/mob/O in (oviewers(brainmob) - user)) - O.show_message("\red [brainmob] has \his spine's connection to the brain severed with [src] by [user].", 1) - brainmob << "\red [user] severs your brain's connection to the spine with [src]!" - user << "\red You sever [brainmob]'s brain's connection to the spine with [src]!" - - user.attack_log += "\[[time_stamp()]\] Debrained [brainmob.name] ([brainmob.ckey]) with [src.name] (INTENT: [uppertext(user.a_intent)])" - brainmob.attack_log += "\[[time_stamp()]\] Debrained by [user.name] ([user.ckey]) with [src.name] (INTENT: [uppertext(user.a_intent)])" - log_admin("ATTACK: [brainmob] ([brainmob.ckey]) debrained [user] ([user.ckey]).") - message_admins("ATTACK: [brainmob] ([brainmob.ckey]) debrained [user] ([user.ckey]).") - - var/obj/item/brain/B = new(loc) - B.transfer_identity(brainmob) - - brain_op_stage = 4.0 + brute_dam += can_inflict + else + if(burn > 0) + burn_dam += can_inflict else - ..() - else - ..() + return 0 + return update_icon() -obj/item/weapon/organ/l_arm - name = "left arm" - icon_state = "l_arm_l" -obj/item/weapon/organ/l_foot - name = "left foot" - icon_state = "l_foot_l" -obj/item/weapon/organ/l_hand - name = "left hand" - icon_state = "l_hand_l" -obj/item/weapon/organ/l_leg - name = "left leg" - icon_state = "l_leg_l" -obj/item/weapon/organ/r_arm - name = "right arm" - icon_state = "r_arm_l" -obj/item/weapon/organ/r_foot - name = "right foot" - icon_state = "r_foot_l" -obj/item/weapon/organ/r_hand - name = "right hand" - icon_state = "r_hand_l" -obj/item/weapon/organ/r_leg - name = "right leg" - icon_state = "r_leg_l" \ No newline at end of file + +//Heals brute and burn damage for the organ. Returns 1 if the damage-icon states changed at all. +//Damage cannot go below zero. +//Cannot remove negative damage (i.e. apply damage) +/datum/organ/external/proc/heal_damage(brute, burn) + brute = max(brute, 0) + burn = max(burn, 0) + brute_dam = max(brute_dam - brute, 0) + burn_dam = max(burn_dam - burn, 0) + return update_icon() + + +//Returns total damage...kinda pointless really +/datum/organ/external/proc/get_damage() + return brute_dam + burn_dam + + +//Updates an organ's brute/burn states for use by updateDamageIcon() +//Returns 1 if we need to update overlays. 0 otherwise. +/datum/organ/external/proc/update_icon() + var/tbrute = round( (brute_dam/max_damage)*3, 1 ) + var/tburn = round( (burn_dam/max_damage)*3, 1 ) + if((tbrute != brutestate) || (tburn != burnstate)) + brutestate = tbrute + burnstate = tburn + return 1 + return 0 + +//Returns a display name for the organ +/datum/organ/external/proc/getDisplayName() + switch(name) + if("l_leg") return "left leg" + if("r_leg") return "right leg" + if("l_arm") return "left arm" + if("r_arm") return "right arm" + else return name diff --git a/code/datums/organs/organ_internal.dm b/code/datums/organs/organ_internal.dm index 2f1738bea2d..5d7fd2547bd 100644 --- a/code/datums/organs/organ_internal.dm +++ b/code/datums/organs/organ_internal.dm @@ -1,8 +1,15 @@ -/**************************************************** - INTERNAL ORGANS -****************************************************/ /datum/organ/internal name = "internal" + var/damage = 0 + var/max_damage = 100 + +/datum/organ/internal/skeleton + name = "spooky scary skeleton" + max_damage = 200 + +/datum/organ/internal/skin + name = "skin" + max_damage = 100 /datum/organ/internal/blood_vessels name = "blood vessels" diff --git a/code/datums/organs/wound.dm b/code/datums/organs/wound.dm deleted file mode 100644 index 1caf45b7587..00000000000 --- a/code/datums/organs/wound.dm +++ /dev/null @@ -1,196 +0,0 @@ - -/**************************************************** - WOUNDS -****************************************************/ -/datum/wound - // stages such as "cut", "deep cut", etc. - var/list/stages - // number representing the current stage - var/current_stage = 0 - - // description of the wound - var/desc = "" - - // amount of damage this wound causes - var/damage = 0 - - // amount of damage the current wound type requires(less means we need to apply the next healing stage) - var/min_damage = 0 - - // one of CUT, BRUISE, BURN - var/damage_type = CUT - - // whether this wound needs a bandage/salve to heal at all - var/needs_treatment = 0 - - // is the wound bandaged? - var/tmp/bandaged = 0 - // is the wound salved? - var/tmp/salved = 0 - // is the wound disinfected? - var/tmp/disinfected = 0 - var/tmp/created = 0 - - // number of wounds of this type - var/tmp/amount = 1 - - // helper lists - var/tmp/list/desc_list = list() - var/tmp/list/damage_list = list() - New(var/damage) - - created = world.time - - // reading from a list("stage" = damage) is pretty difficult, so build two separate - // lists from them instead - for(var/V in stages) - desc_list += V - damage_list += stages[V] - - src.damage = damage - - // initialize with the first stage - next_stage() - - // this will ensure the size of the wound matches the damage - src.heal_damage(0) - - // returns 1 if there's a next stage, 0 otherwise - proc/next_stage() - if(current_stage + 1 > src.desc_list.len) - return 0 - - current_stage++ - - src.min_damage = damage_list[current_stage] - src.desc = desc_list[current_stage] - return 1 - - // returns 1 if the wound has started healing - proc/started_healing() - return (current_stage > 1) - - // checks whether the wound has been appropriately treated - // always returns 1 for wounds that don't need to be treated - proc/is_treated() - if(!needs_treatment) return 1 - - if(damage_type == BRUISE || damage_type == CUT) - return bandaged - else if(damage_type == BURN) - return salved - - // heal the given amount of damage, and if the given amount of damage was more - // than what needed to be healed, return how much heal was left - proc/heal_damage(amount) - var/healed_damage = min(src.damage, amount) - amount -= healed_damage - src.damage -= healed_damage - - while(src.damage / src.amount < damage_list[current_stage] && current_stage < src.desc_list.len) - current_stage++ - desc = desc_list[current_stage] - - // return amount of healing still leftover, can be used for other wounds - return amount - - // opens the wound again - proc/open_wound() - if(current_stage > 1) - // e.g. current_stage is 2, then reset it to 0 and do next_stage(), bringing it to 1 - src.current_stage -= 2 - next_stage() - src.damage = src.min_damage + 5 - -/** CUTS **/ -/datum/wound/cut - // link wound descriptions to amounts of damage - stages = list("cut" = 5, "healing cut" = 2, "small scab" = 0) - -/datum/wound/deep_cut - stages = list("deep cut" = 15, "clotted cut" = 8, "scab" = 2, "fresh skin" = 0) - -/datum/wound/flesh_wound - stages = list("flesh wound" = 25, "blood soaked clot" = 15, "large scab" = 5, "fresh skin" = 0) - -/datum/wound/gaping_wound - stages = list("gaping wound" = 50, "large blood soaked clot" = 25, "large clot" = 15, "small angry scar" = 5, \ - "small straight scar" = 0) - -/datum/wound/big_gaping_wound - stages = list("big gaping wound" = 60, "gauze wrapped wound" = 50, "blood soaked bandage" = 25,\ - "large angry scar" = 10, "large straight scar" = 0) - - needs_treatment = 1 // this only heals when bandaged - -/datum/wound/massive_wound - stages = list("massive wound" = 70, "massive blood soaked bandage" = 40, "huge bloody mess" = 20,\ - "massive angry scar" = 10, "massive jagged scar" = 0) - - needs_treatment = 1 // this only heals when bandaged - -/** BRUISES **/ -/datum/wound/bruise - stages = list("monumental bruise" = 80, "huge bruise" = 50, "large bruise" = 30,\ - "moderate bruise" = 20, "small bruise" = 10, "tiny bruise" = 5) - - needs_treatment = 1 // this only heals when bandaged - damage_type = BRUISE - -/datum/wound/bruise/monumental_bruise - -// implement sub-paths by starting at a later stage -/datum/wound/bruise/huge_bruise - current_stage = 1 - -/datum/wound/bruise/large_bruise - current_stage = 2 - -/datum/wound/bruise/moderate_bruise - current_stage = 3 - needs_treatment = 0 - -/datum/wound/bruise/small_bruise - current_stage = 4 - needs_treatment = 0 - -/datum/wound/bruise/tiny_bruise - current_stage = 5 - needs_treatment = 0 - -/** BURNS **/ -/datum/wound/moderate_burn - stages = list("moderate burn" = 5, "moderate salved burn" = 2, "fresh skin" = 0) - - needs_treatment = 1 // this only heals when bandaged - - damage_type = BURN - -/datum/wound/large_burn - stages = list("large burn" = 15, "large salved burn" = 5, "fresh skin" = 0) - - needs_treatment = 1 // this only heals when bandaged - - damage_type = BURN - -/datum/wound/severe_burn - stages = list("severe burn" = 30, "severe salved burn" = 10, "burn scar" = 0) - - needs_treatment = 1 // this only heals when bandaged - - damage_type = BURN - -/datum/wound/deep_burn - stages = list("deep burn" = 40, "deep salved burn" = 15, "large burn scar" = 0) - - needs_treatment = 1 // this only heals when bandaged - - damage_type = BURN - - -/datum/wound/carbonised_area - stages = list("carbonised area" = 50, "treated carbonised area" = 20, "massive burn scar" = 0) - - needs_treatment = 1 // this only heals when bandaged - - damage_type = BURN \ No newline at end of file diff --git a/code/datums/spell.dm b/code/datums/spell.dm index a268df3ecca..734714e386c 100644 --- a/code/datums/spell.dm +++ b/code/datums/spell.dm @@ -68,13 +68,13 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin if(!istype(usr, /mob/living/carbon/human)) usr << "You aren't a human, Why are you trying to cast a human spell, silly non-human? Casting human spells is for humans." return 0 - if(!istype(usr:wear_suit, /obj/item/clothing/suit/wizrobe)) + if(!istype(usr:wear_suit, /obj/item/clothing/suit/wizrobe) && !istype(user:wear_suit, /obj/item/clothing/suit/space/rig/wizard)) usr << "I don't feel strong enough without my robe." return 0 if(!istype(usr:shoes, /obj/item/clothing/shoes/sandal)) usr << "I don't feel strong enough without my sandals." return 0 - if(!istype(usr:head, /obj/item/clothing/head/wizard)) + if(!istype(usr:head, /obj/item/clothing/head/wizard) && !istype(user:head, /obj/item/clothing/head/helmet/space/rig/wizard)) usr << "I don't feel strong enough without my hat." return 0 diff --git a/code/datums/supplypacks.dm b/code/datums/supplypacks.dm index 419169c29e7..b90c547067c 100755 --- a/code/datums/supplypacks.dm +++ b/code/datums/supplypacks.dm @@ -8,7 +8,7 @@ /datum/supply_packs var/name = null var/list/contains = list() - var/manifest + var/manifest = "" var/amount = null var/cost = null var/containertype = null @@ -18,7 +18,7 @@ var/contraband = 0 /datum/supply_packs/New() - manifest = "