mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-24 04:27:35 +01:00
Merge branch 'master' of https://github.com/ParadiseSS13/Paradise into lavaland_megafauna
# Conflicts: # code/__DEFINES/misc.dm # code/game/dna/genes/goon_powers.dm # code/game/dna/genes/vg_powers.dm # code/game/objects/effects/overlays.dm # code/game/objects/structures/crates_lockers/closets.dm # code/game/objects/structures/crates_lockers/closets/statue.dm # code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm # icons/mob/back.dmi # icons/obj/storage.dmi
This commit is contained in:
+51
-50
@@ -778,63 +778,64 @@
|
||||
if(!user)
|
||||
return
|
||||
|
||||
var/list/data = list(
|
||||
"locked" = is_locked(user),
|
||||
"isOperating" = operating,
|
||||
"externalPower" = main_status,
|
||||
"powerCellStatus" = cell ? cell.percent() : null,
|
||||
"chargeMode" = chargemode,
|
||||
"chargingStatus" = charging,
|
||||
"totalLoad" = round(lastused_equip + lastused_light + lastused_environ),
|
||||
"coverLocked" = coverlocked,
|
||||
"siliconUser" = istype(user, /mob/living/silicon),
|
||||
"malfStatus" = get_malf_status(user),
|
||||
|
||||
"powerChannels" = list(
|
||||
list(
|
||||
"title" = "Equipment",
|
||||
"powerLoad" = round(lastused_equip),
|
||||
"status" = equipment,
|
||||
"topicParams" = list(
|
||||
"auto" = list("eqp" = 3),
|
||||
"on" = list("eqp" = 2),
|
||||
"off" = list("eqp" = 1)
|
||||
)
|
||||
),
|
||||
list(
|
||||
"title" = "Lighting",
|
||||
"powerLoad" = round(lastused_light),
|
||||
"status" = lighting,
|
||||
"topicParams" = list(
|
||||
"auto" = list("lgt" = 3),
|
||||
"on" = list("lgt" = 2),
|
||||
"off" = list("lgt" = 1)
|
||||
)
|
||||
),
|
||||
list(
|
||||
"title" = "Environment",
|
||||
"powerLoad" = round(lastused_environ),
|
||||
"status" = environ,
|
||||
"topicParams" = list(
|
||||
"auto" = list("env" = 3),
|
||||
"on" = list("env" = 2),
|
||||
"off" = list("env" = 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
// update the ui if it exists, returns null if no ui is passed/found
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
// the ui does not exist, so we'll create a new one
|
||||
ui = new(user, src, ui_key, "apc.tmpl", "[area.name] - APC", 510, data["siliconUser"] ? 535 : 460)
|
||||
// When the UI is first opened this is the data it will use
|
||||
ui.set_initial_data(data)
|
||||
ui = new(user, src, ui_key, "apc.tmpl", "[area.name] - APC", 510, issilicon(user) ? 535 : 460)
|
||||
ui.open()
|
||||
// Auto update every Master Controller tick
|
||||
ui.set_auto_update(1)
|
||||
|
||||
/obj/machinery/power/apc/ui_data(mob/user, datum/topic_state/state = default_state)
|
||||
var/data[0]
|
||||
data["locked"] = is_locked(user)
|
||||
data["isOperating"] = operating
|
||||
data["externalPower"] = main_status
|
||||
data["powerCellStatus"] = cell ? cell.percent() : null
|
||||
data["chargeMode"] = chargemode
|
||||
data["chargingStatus"] = charging
|
||||
data["totalLoad"] = round(lastused_equip + lastused_light + lastused_environ)
|
||||
data["coverLocked"] = coverlocked
|
||||
data["siliconUser"] = istype(user, /mob/living/silicon)
|
||||
data["malfStatus"] = get_malf_status(user)
|
||||
|
||||
var/powerChannels[0]
|
||||
powerChannels[++powerChannels.len] = list(
|
||||
"title" = "Equipment",
|
||||
"powerLoad" = round(lastused_equip),
|
||||
"status" = equipment,
|
||||
"topicParams" = list(
|
||||
"auto" = list("eqp" = 3),
|
||||
"on" = list("eqp" = 2),
|
||||
"off" = list("eqp" = 1)
|
||||
)
|
||||
)
|
||||
powerChannels[++powerChannels.len] = list(
|
||||
"title" = "Lighting",
|
||||
"powerLoad" = round(lastused_light),
|
||||
"status" = lighting,
|
||||
"topicParams" = list(
|
||||
"auto" = list("lgt" = 3),
|
||||
"on" = list("lgt" = 2),
|
||||
"off" = list("lgt" = 1)
|
||||
)
|
||||
)
|
||||
powerChannels[++powerChannels.len] = list(
|
||||
"title" = "Environment",
|
||||
"powerLoad" = round(lastused_environ),
|
||||
"status" = environ,
|
||||
"topicParams" = list(
|
||||
"auto" = list("env" = 3),
|
||||
"on" = list("env" = 2),
|
||||
"off" = list("env" = 1)
|
||||
)
|
||||
)
|
||||
|
||||
data["powerChannels"] = powerChannels
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/power/apc/proc/report()
|
||||
return "[area.name] : [equipment]/[lighting]/[environ] ([lastused_equip+lastused_light+lastused_environ]) : [cell? cell.percent() : "N/C"] ([charging])"
|
||||
|
||||
|
||||
+195
-165
@@ -1,211 +1,241 @@
|
||||
|
||||
/obj/machinery/power/generator
|
||||
name = "thermoelectric generator"
|
||||
desc = "It's a high efficiency thermoelectric generator."
|
||||
icon_state = "teg"
|
||||
density = 1
|
||||
anchored = 0
|
||||
density = 1
|
||||
use_power = 0
|
||||
|
||||
use_power = 1
|
||||
idle_power_usage = 100 //Watts, I hope. Just enough to do the computer and display things.
|
||||
|
||||
var/obj/machinery/atmospherics/binary/circulator/circ1
|
||||
var/obj/machinery/atmospherics/binary/circulator/circ2
|
||||
var/obj/machinery/atmospherics/binary/circulator/cold_circ
|
||||
var/obj/machinery/atmospherics/binary/circulator/hot_circ
|
||||
|
||||
var/cold_dir = WEST
|
||||
var/hot_dir = EAST
|
||||
|
||||
var/lastgen = 0
|
||||
var/lastgenlev = -1
|
||||
|
||||
var/image/overlay_image
|
||||
|
||||
var/power_multiplier = 1 // This is so admins can tweak how good it is to find a good balance for effort -> power
|
||||
var/powercap = 500000 //Not a hard cap, but outputs above this have a 10% chance to cause the TeG to lose half it's power.
|
||||
|
||||
var/lastcirc = "00"
|
||||
|
||||
/obj/machinery/power/generator/New()
|
||||
..()
|
||||
update_desc()
|
||||
|
||||
/obj/machinery/power/generator/proc/update_desc()
|
||||
desc = initial(desc) + " Its cold circulator is located on the [dir2text(cold_dir)] side, and its heat circulator is located on the [dir2text(hot_dir)] side."
|
||||
|
||||
/obj/machinery/power/generator/Destroy()
|
||||
disconnect()
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/generator/proc/disconnect()
|
||||
if(cold_circ)
|
||||
cold_circ.generator = null
|
||||
if(hot_circ)
|
||||
hot_circ.generator = null
|
||||
if(powernet)
|
||||
disconnect_from_network()
|
||||
|
||||
spawn(1)
|
||||
reconnect()
|
||||
/obj/machinery/power/generator/initialize()
|
||||
..()
|
||||
connect()
|
||||
|
||||
/obj/machinery/power/generator/proc/connect()
|
||||
connect_to_network()
|
||||
|
||||
var/obj/machinery/atmospherics/binary/circulator/circpath = /obj/machinery/atmospherics/binary/circulator
|
||||
cold_circ = locate(circpath) in get_step(src, cold_dir)
|
||||
hot_circ = locate(circpath) in get_step(src, hot_dir)
|
||||
|
||||
//generators connect in dir and reverse_dir(dir) directions
|
||||
//mnemonic to determine circulator/generator directions: the cirulators orbit clockwise around the generator
|
||||
//so a circulator to the NORTH of the generator connects first to the EAST, then to the WEST
|
||||
//and a circulator to the WEST of the generator connects first to the NORTH, then to the SOUTH
|
||||
//note that the circulator's outlet dir is it's always facing dir, and it's inlet is always the reverse
|
||||
/obj/machinery/power/generator/proc/reconnect()
|
||||
circ1 = null
|
||||
circ2 = null
|
||||
if(src.loc && anchored)
|
||||
if(src.dir & (EAST|WEST))
|
||||
circ1 = locate(/obj/machinery/atmospherics/binary/circulator) in get_step(src,EAST)
|
||||
circ2 = locate(/obj/machinery/atmospherics/binary/circulator) in get_step(src,WEST)
|
||||
if(cold_circ && cold_circ.side == cold_dir)
|
||||
cold_circ.generator = src
|
||||
cold_circ.update_icon()
|
||||
else
|
||||
cold_circ = null
|
||||
|
||||
if(circ1 && circ2)
|
||||
if(circ1.dir != SOUTH || circ2.dir != NORTH)
|
||||
circ1 = null
|
||||
circ2 = null
|
||||
if(hot_circ && hot_circ.side == hot_dir)
|
||||
hot_circ.generator = src
|
||||
hot_circ.update_icon()
|
||||
else
|
||||
hot_circ = null
|
||||
|
||||
else if(src.dir & (NORTH|SOUTH))
|
||||
circ1 = locate(/obj/machinery/atmospherics/binary/circulator) in get_step(src,NORTH)
|
||||
circ2 = locate(/obj/machinery/atmospherics/binary/circulator) in get_step(src,SOUTH)
|
||||
|
||||
if(circ1 && circ2 && (circ1.dir != EAST || circ2.dir != WEST))
|
||||
circ1 = null
|
||||
circ2 = null
|
||||
|
||||
/obj/machinery/power/generator/proc/updateicon()
|
||||
if(isnull(src.overlay_image))
|
||||
src.overlay_image = image('icons/obj/power.dmi')
|
||||
|
||||
overlays.Cut()
|
||||
if(!(stat & (NOPOWER|BROKEN)))
|
||||
power_change()
|
||||
update_icon()
|
||||
updateDialog()
|
||||
|
||||
/obj/machinery/power/generator/power_change()
|
||||
if(!anchored)
|
||||
stat |= NOPOWER
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/machinery/power/generator/update_icon()
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
overlays.Cut()
|
||||
else
|
||||
overlays.Cut()
|
||||
|
||||
if(lastgenlev != 0)
|
||||
src.overlay_image.icon_state = "teg-op[lastgenlev]"
|
||||
overlays += src.overlay_image
|
||||
overlays += image('icons/obj/power.dmi', "teg-op[lastgenlev]")
|
||||
|
||||
/obj/machinery/power/generator/process()
|
||||
if(!circ1 || !circ2 || !anchored || stat & (BROKEN|NOPOWER))
|
||||
overlays += image('icons/obj/power.dmi', "teg-oc[lastcirc]")
|
||||
|
||||
/obj/machinery/power/generator/process()
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
|
||||
if(!cold_circ || !hot_circ)
|
||||
return
|
||||
|
||||
lastgen = 0
|
||||
|
||||
if(powernet)
|
||||
|
||||
//log_debug("cold_circ and hot_circ pass")
|
||||
|
||||
var/datum/gas_mixture/cold_air = cold_circ.return_transfer_air()
|
||||
var/datum/gas_mixture/hot_air = hot_circ.return_transfer_air()
|
||||
|
||||
//log_debug("hot_air = [hot_air]; cold_air = [cold_air];")
|
||||
|
||||
if(cold_air && hot_air)
|
||||
|
||||
//log_debug("hot_air = [hot_air] temperature = [hot_air.temperature]; cold_air = [cold_air] temperature = [hot_air.temperature];")
|
||||
|
||||
//log_debug("coldair and hotair pass")
|
||||
var/cold_air_heat_capacity = cold_air.heat_capacity()
|
||||
var/hot_air_heat_capacity = hot_air.heat_capacity()
|
||||
|
||||
var/delta_temperature = hot_air.temperature - cold_air.temperature
|
||||
|
||||
//log_debug("delta_temperature = [delta_temperature]; cold_air_heat_capacity = [cold_air_heat_capacity]; hot_air_heat_capacity = [hot_air_heat_capacity]")
|
||||
|
||||
if(delta_temperature > 0 && cold_air_heat_capacity > 0 && hot_air_heat_capacity > 0)
|
||||
var/efficiency = 0.65
|
||||
|
||||
var/energy_transfer = delta_temperature * hot_air_heat_capacity * cold_air_heat_capacity / (hot_air_heat_capacity + cold_air_heat_capacity)
|
||||
|
||||
var/heat = energy_transfer * (1 - efficiency)
|
||||
lastgen = energy_transfer * efficiency
|
||||
|
||||
//log_debug("lastgen = [lastgen]; heat = [heat]; delta_temperature = [delta_temperature]; hot_air_heat_capacity = [hot_air_heat_capacity]; cold_air_heat_capacity = [cold_air_heat_capacity];")
|
||||
|
||||
hot_air.temperature = hot_air.temperature - energy_transfer / hot_air_heat_capacity
|
||||
cold_air.temperature = cold_air.temperature + heat / cold_air_heat_capacity
|
||||
|
||||
//log_debug("POWER: [lastgen] W generated at [efficiency * 100]% efficiency and sinks sizes [cold_air_heat_capacity], [hot_air_heat_capacity]")
|
||||
|
||||
add_avail(lastgen)
|
||||
// update icon overlays only if displayed level has changed
|
||||
|
||||
if(hot_air)
|
||||
var/datum/gas_mixture/hot_circ_air1 = hot_circ.air1
|
||||
hot_circ_air1.merge(hot_air)
|
||||
|
||||
if(cold_air)
|
||||
var/datum/gas_mixture/cold_circ_air1 = cold_circ.air1
|
||||
cold_circ_air1.merge(cold_air)
|
||||
|
||||
var/genlev = max(0, min( round(11 * lastgen / 100000), 11))
|
||||
var/circ = "[cold_circ && cold_circ.last_pressure_delta > 0 ? "1" : "0"][hot_circ && hot_circ.last_pressure_delta > 0 ? "1" : "0"]"
|
||||
if((genlev != lastgenlev) || (circ != lastcirc))
|
||||
lastgenlev = genlev
|
||||
lastcirc = circ
|
||||
update_icon()
|
||||
|
||||
updateDialog()
|
||||
|
||||
var/datum/gas_mixture/air1 = circ1.return_transfer_air()
|
||||
var/datum/gas_mixture/air2 = circ2.return_transfer_air()
|
||||
lastgen = 0
|
||||
|
||||
if(air1 && air2)
|
||||
var/air1_heat_capacity = air1.heat_capacity()
|
||||
var/air2_heat_capacity = air2.heat_capacity()
|
||||
var/delta_temperature = abs(air2.temperature - air1.temperature)
|
||||
|
||||
if(delta_temperature > 0 && air1_heat_capacity > 0 && air2_heat_capacity > 0)
|
||||
var/efficiency = 0.65
|
||||
var/energy_transfer = delta_temperature*air2_heat_capacity*air1_heat_capacity/(air2_heat_capacity+air1_heat_capacity)
|
||||
var/heat = energy_transfer*(1-efficiency)
|
||||
lastgen = energy_transfer*efficiency*0.05*power_multiplier
|
||||
|
||||
if(air2.temperature > air1.temperature)
|
||||
air2.temperature = air2.temperature - energy_transfer/air2_heat_capacity
|
||||
air1.temperature = air1.temperature + heat/air1_heat_capacity
|
||||
else
|
||||
air2.temperature = air2.temperature + heat/air2_heat_capacity
|
||||
air1.temperature = air1.temperature - energy_transfer/air1_heat_capacity
|
||||
|
||||
//Transfer the air
|
||||
if(air1)
|
||||
circ1.air2.merge(air1)
|
||||
if(air2)
|
||||
circ2.air2.merge(air2)
|
||||
|
||||
//Update the gas networks
|
||||
if(circ1.parent2)
|
||||
circ1.parent2.update = 1
|
||||
if(circ2.parent2)
|
||||
circ2.parent2.update = 1
|
||||
|
||||
// update icon overlays and power usage only if displayed level has changed
|
||||
if(lastgen > powercap && prob(10))
|
||||
var/datum/effect/system/spark_spread/s = new /datum/effect/system/spark_spread
|
||||
s.set_up(3, 1, src)
|
||||
s.start()
|
||||
lastgen *= 0.5
|
||||
var/genlev = max(0, min( round(11*lastgen / powercap), 11))
|
||||
if(lastgen > 100 && genlev == 0)
|
||||
genlev = 1
|
||||
if(genlev != lastgenlev)
|
||||
lastgenlev = genlev
|
||||
updateicon()
|
||||
add_avail(lastgen)
|
||||
|
||||
/obj/machinery/power/generator/attack_ai(mob/user)
|
||||
if(stat & (BROKEN|NOPOWER)) return
|
||||
return attack_hand(user)
|
||||
|
||||
/obj/machinery/power/generator/attack_ghost(mob/user)
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
interact(user)
|
||||
|
||||
/obj/machinery/power/generator/attack_hand(mob/user)
|
||||
if(..())
|
||||
user << browse(null, "window=teg")
|
||||
return
|
||||
interact(user)
|
||||
|
||||
/obj/machinery/power/generator/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
|
||||
if(istype(W, /obj/item/weapon/wrench))
|
||||
anchored = !anchored
|
||||
to_chat(user, "\blue You [anchored ? "secure" : "unsecure"] the bolts holding [src] to the floor.")
|
||||
use_power = anchored
|
||||
reconnect()
|
||||
if(!anchored)
|
||||
disconnect()
|
||||
power_change()
|
||||
else
|
||||
connect()
|
||||
playsound(loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
to_chat(user, "<span class='notice'>You [anchored ? "secure" : "unsecure"] the bolts holding [src] to the floor.</span>")
|
||||
else if(istype(W, /obj/item/device/multitool))
|
||||
if(cold_dir == WEST)
|
||||
cold_dir = EAST
|
||||
hot_dir = WEST
|
||||
else
|
||||
cold_dir = WEST
|
||||
hot_dir = EAST
|
||||
connect()
|
||||
to_chat(user, "<span class='notice'>You reverse the generator's circulator settings. The cold circulator is now on the [dir2text(cold_dir)] side, and the heat circulator is now on the [dir2text(hot_dir)] side.</span>")
|
||||
update_desc()
|
||||
else
|
||||
..()
|
||||
..()
|
||||
|
||||
/obj/machinery/power/generator/proc/get_menu(include_link = 1)
|
||||
var/t = ""
|
||||
if(!powernet)
|
||||
t += "<span class='bad'>Unable to connect to the power network!</span>"
|
||||
t += "<BR><A href='?src=[UID()];check=1'>Retry</A>"
|
||||
else if(cold_circ && hot_circ)
|
||||
var/datum/gas_mixture/cold_circ_air1 = cold_circ.air1
|
||||
var/datum/gas_mixture/cold_circ_air2 = cold_circ.air2
|
||||
var/datum/gas_mixture/hot_circ_air1 = hot_circ.air1
|
||||
var/datum/gas_mixture/hot_circ_air2 = hot_circ.air2
|
||||
|
||||
/obj/machinery/power/generator/attack_hand(mob/user)
|
||||
add_fingerprint(user)
|
||||
if(stat & (BROKEN|NOPOWER) || !anchored) return
|
||||
interact(user)
|
||||
t += "<div class='statusDisplay'>"
|
||||
|
||||
t += "Output: [round(lastgen)] W"
|
||||
|
||||
t += "<BR>"
|
||||
|
||||
t += "<B><font color='blue'>Cold loop</font></B><BR>"
|
||||
t += "Temperature Inlet: [round(cold_circ_air2.temperature, 0.1)] K / Outlet: [round(cold_circ_air1.temperature, 0.1)] K<BR>"
|
||||
t += "Pressure Inlet: [round(cold_circ_air2.return_pressure(), 0.1)] kPa / Outlet: [round(cold_circ_air1.return_pressure(), 0.1)] kPa<BR>"
|
||||
|
||||
t += "<B><font color='red'>Hot loop</font></B><BR>"
|
||||
t += "Temperature Inlet: [round(hot_circ_air2.temperature, 0.1)] K / Outlet: [round(hot_circ_air1.temperature, 0.1)] K<BR>"
|
||||
t += "Pressure Inlet: [round(hot_circ_air2.return_pressure(), 0.1)] kPa / Outlet: [round(hot_circ_air1.return_pressure(), 0.1)] kPa<BR>"
|
||||
|
||||
t += "</div>"
|
||||
else
|
||||
t += "<span class='bad'>Unable to locate all parts!</span>"
|
||||
t += "<BR><A href='?src=[UID()];check=1'>Retry</A>"
|
||||
if(include_link)
|
||||
t += "<BR><A href='?src=[UID()];close=1'>Close</A>"
|
||||
|
||||
return t
|
||||
|
||||
/obj/machinery/power/generator/interact(mob/user)
|
||||
if( (get_dist(src, user) > 1 ) && (!istype(user, /mob/living/silicon/ai)))
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=teg")
|
||||
return
|
||||
|
||||
user.set_machine(src)
|
||||
|
||||
var/t = "<PRE><B>Thermo-Electric Generator</B><HR>"
|
||||
|
||||
if(circ1 && circ2)
|
||||
t += "Output : [round(lastgen)] W<BR><BR>"
|
||||
|
||||
t += "<B>Primary Circulator (top or right)</B><BR>"
|
||||
t += "Inlet Pressure: [round(circ1.air1.return_pressure(), 0.1)] kPa<BR>"
|
||||
t += "Inlet Temperature: [round(circ1.air1.temperature, 0.1)] K<BR>"
|
||||
t += "Outlet Pressure: [round(circ1.air2.return_pressure(), 0.1)] kPa<BR>"
|
||||
t += "Outlet Temperature: [round(circ1.air2.temperature, 0.1)] K<BR>"
|
||||
|
||||
t += "<B>Secondary Circulator (bottom or left)</B><BR>"
|
||||
t += "Inlet Pressure: [round(circ2.air1.return_pressure(), 0.1)] kPa<BR>"
|
||||
t += "Inlet Temperature: [round(circ2.air1.temperature, 0.1)] K<BR>"
|
||||
t += "Outlet Pressure: [round(circ2.air2.return_pressure(), 0.1)] kPa<BR>"
|
||||
t += "Outlet Temperature: [round(circ2.air2.temperature, 0.1)] K<BR>"
|
||||
|
||||
else
|
||||
t += "Unable to connect to circulators.<br>"
|
||||
t += "Ensure both are in position and wrenched into place."
|
||||
|
||||
t += "<BR>"
|
||||
t += "<HR>"
|
||||
t += "<A href='?src=[UID()]'>Refresh</A> <A href='?src=[UID()];close=1'>Close</A>"
|
||||
|
||||
user << browse(t, "window=teg;size=460x300")
|
||||
onclose(user, "teg")
|
||||
var/datum/browser/popup = new(user, "teg", "Thermo-Electric Generator", 460, 300)
|
||||
popup.set_content(get_menu())
|
||||
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
|
||||
popup.open()
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/power/generator/Topic(href, href_list)
|
||||
..()
|
||||
if(..())
|
||||
return 0
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=teg")
|
||||
usr.unset_machine()
|
||||
return 0
|
||||
|
||||
updateDialog()
|
||||
if( href_list["check"] )
|
||||
if(!powernet || !cold_circ || !hot_circ)
|
||||
connect()
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/power/generator/power_change()
|
||||
..()
|
||||
updateicon()
|
||||
|
||||
|
||||
/obj/machinery/power/generator/verb/rotate_clock()
|
||||
set category = "Object"
|
||||
set name = "Rotate Generator (Clockwise)"
|
||||
set src in view(1)
|
||||
|
||||
if(usr.stat || usr.restrained() || anchored)
|
||||
return
|
||||
|
||||
src.dir = turn(src.dir, 90)
|
||||
|
||||
/obj/machinery/power/generator/verb/rotate_anticlock()
|
||||
set category = "Object"
|
||||
set name = "Rotate Generator (Counterclockwise)"
|
||||
set src in view(1)
|
||||
|
||||
if(usr.stat || usr.restrained() || anchored)
|
||||
return
|
||||
|
||||
src.dir = turn(src.dir, -90)
|
||||
update_icon()
|
||||
@@ -1,143 +0,0 @@
|
||||
/obj/machinery/power/generator_type2
|
||||
name = "thermoelectric generator"
|
||||
desc = "It's a high efficiency thermoelectric generator."
|
||||
icon_state = "teg"
|
||||
anchored = 1
|
||||
density = 1
|
||||
use_power = 0
|
||||
|
||||
var/obj/machinery/atmospherics/unary/generator_input/input1
|
||||
var/obj/machinery/atmospherics/unary/generator_input/input2
|
||||
|
||||
var/lastgen = 0
|
||||
var/lastgenlev = -1
|
||||
|
||||
var/image/overlay_image
|
||||
|
||||
/obj/machinery/power/generator_type2/New()
|
||||
..()
|
||||
spawn(5)
|
||||
input1 = locate(/obj/machinery/atmospherics/unary/generator_input) in get_step(src,turn(dir, 90))
|
||||
input2 = locate(/obj/machinery/atmospherics/unary/generator_input) in get_step(src,turn(dir, -90))
|
||||
if(!input1 || !input2)
|
||||
stat |= BROKEN
|
||||
updateicon()
|
||||
|
||||
|
||||
/obj/machinery/power/generator_type2/proc/updateicon()
|
||||
|
||||
if(isnull(src.overlay_image))
|
||||
src.overlay_image = image('icons/obj/power.dmi')
|
||||
|
||||
overlays.Cut()
|
||||
if(!(stat & (NOPOWER|BROKEN)))
|
||||
|
||||
if(lastgenlev != 0)
|
||||
src.overlay_image.icon_state = "teg-op[lastgenlev]"
|
||||
overlays += src.overlay_image
|
||||
|
||||
#define GENRATE 800 // generator output coefficient from Q
|
||||
|
||||
|
||||
/obj/machinery/power/generator_type2/process()
|
||||
if(!input1 || !input2)
|
||||
return
|
||||
|
||||
var/datum/gas_mixture/air1 = input1.return_exchange_air()
|
||||
var/datum/gas_mixture/air2 = input2.return_exchange_air()
|
||||
|
||||
|
||||
lastgen = 0
|
||||
|
||||
if(air1 && air2)
|
||||
var/datum/gas_mixture/hot_air = air1
|
||||
var/datum/gas_mixture/cold_air = air2
|
||||
if(hot_air.temperature < cold_air.temperature)
|
||||
hot_air = air2
|
||||
cold_air = air1
|
||||
|
||||
var/hot_air_heat_capacity = hot_air.heat_capacity()
|
||||
var/cold_air_heat_capacity = cold_air.heat_capacity()
|
||||
|
||||
var/delta_temperature = hot_air.temperature - cold_air.temperature
|
||||
|
||||
if(delta_temperature > 1 && cold_air_heat_capacity > 0.01 && hot_air_heat_capacity > 0.01)
|
||||
var/efficiency = (1 - cold_air.temperature/hot_air.temperature)*0.65 //65% of Carnot efficiency
|
||||
|
||||
var/energy_transfer = delta_temperature*hot_air_heat_capacity*cold_air_heat_capacity/(hot_air_heat_capacity+cold_air_heat_capacity)
|
||||
|
||||
var/heat = energy_transfer*(1-efficiency)
|
||||
lastgen = energy_transfer*efficiency
|
||||
|
||||
hot_air.temperature = hot_air.temperature - energy_transfer/hot_air_heat_capacity
|
||||
cold_air.temperature = cold_air.temperature + heat/cold_air_heat_capacity
|
||||
|
||||
// to_chat(world, "POWER: [lastgen] W generated at [efficiency*100]% efficiency and sinks sizes [cold_air_heat_capacity], [hot_air_heat_capacity]")
|
||||
|
||||
input1.parent.update = 1
|
||||
input2.parent.update = 1
|
||||
|
||||
add_avail(lastgen)
|
||||
// update icon overlays only if displayed level has changed
|
||||
|
||||
var/genlev = max(0, min( round(11*lastgen / 100000), 11))
|
||||
if(genlev != lastgenlev)
|
||||
lastgenlev = genlev
|
||||
updateicon()
|
||||
|
||||
src.updateDialog()
|
||||
|
||||
|
||||
/obj/machinery/power/generator_type2/attack_ai(mob/user)
|
||||
if(stat & (BROKEN|NOPOWER)) return
|
||||
interact(user)
|
||||
|
||||
|
||||
/obj/machinery/power/generator_type2/attack_hand(mob/user)
|
||||
add_fingerprint(user)
|
||||
if(stat & (BROKEN|NOPOWER)) return
|
||||
interact(user)
|
||||
|
||||
|
||||
/obj/machinery/power/generator_type2/interact(mob/user)
|
||||
if( (get_dist(src, user) > 1 ) && (!istype(user, /mob/living/silicon/ai)))
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=teg")
|
||||
return
|
||||
|
||||
user.set_machine(src)
|
||||
|
||||
var/t = "<PRE><B>Thermo-Electric Generator</B><HR>"
|
||||
|
||||
t += "Output : [round(lastgen)] W<BR><BR>"
|
||||
|
||||
t += "<B>Cold loop</B><BR>"
|
||||
t += "Temperature: [round(input1.air_contents.temperature, 0.1)] K<BR>"
|
||||
t += "Pressure: [round(input1.air_contents.return_pressure(), 0.1)] kPa<BR>"
|
||||
|
||||
t += "<B>Hot loop</B><BR>"
|
||||
t += "Temperature: [round(input2.air_contents.temperature, 0.1)] K<BR>"
|
||||
t += "Pressure: [round(input2.air_contents.return_pressure(), 0.1)] kPa<BR>"
|
||||
|
||||
t += "<BR><HR><A href='?src=[UID()];close=1'>Close</A>"
|
||||
|
||||
t += "</PRE>"
|
||||
user << browse(t, "window=teg;size=460x300")
|
||||
onclose(user, "teg")
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/power/generator_type2/Topic(href, href_list)
|
||||
..()
|
||||
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=teg")
|
||||
usr.unset_machine()
|
||||
return 0
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/power/generator_type2/power_change()
|
||||
..()
|
||||
updateicon()
|
||||
@@ -321,7 +321,15 @@
|
||||
if(IsBroken())
|
||||
return
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "pacman.tmpl", src.name, 500, 560)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/ui_data(mob/user, datum/topic_state/state = default_state)
|
||||
var/data[0]
|
||||
|
||||
data["active"] = active
|
||||
if(istype(user, /mob/living/silicon/ai))
|
||||
data["is_ai"] = 1
|
||||
@@ -329,6 +337,7 @@
|
||||
data["is_ai"] = 1
|
||||
else
|
||||
data["is_ai"] = 0
|
||||
|
||||
data["output_set"] = power_output
|
||||
data["output_max"] = max_power_output
|
||||
data["output_safe"] = max_safe_output
|
||||
@@ -342,12 +351,7 @@
|
||||
data["fuel_usage"] = active ? round((power_output / time_per_sheet) * 1000) : 0
|
||||
data["fuel_type"] = sheet_name
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "pacman.tmpl", src.name, 500, 560)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
return data
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/Topic(href, href_list)
|
||||
if(..())
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/obj/structure/particle_accelerator/fuel_chamber
|
||||
name = "EM Acceleration Chamber"
|
||||
desc_holder = "This is where the Alpha particles are accelerated to <b><i>radical speeds</i></b>."
|
||||
desc_holder = "This part is where the Alpha particles are accelerated to <b><i>radical speeds</i></b>."
|
||||
icon = 'icons/obj/machines/particle_accelerator.dmi'
|
||||
icon_state = "fuel_chamber"
|
||||
reference = "fuel_chamber"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box
|
||||
name = "Particle Accelerator Control Console"
|
||||
desc = "This controls the density of the particles."
|
||||
desc = "This part controls the density of the particles."
|
||||
icon = 'icons/obj/machines/particle_accelerator.dmi'
|
||||
icon_state = "control_box"
|
||||
reference = "control_box"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter
|
||||
name = "EM Containment Grid"
|
||||
desc_holder = "This launchs the Alpha particles, might not want to stand near this end."
|
||||
desc_holder = "This part launches the Alpha particles. You might not want to stand near this end."
|
||||
icon = 'icons/obj/machines/particle_accelerator.dmi'
|
||||
icon_state = "none"
|
||||
var/fire_delay = 50
|
||||
@@ -26,16 +26,16 @@
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/proc/set_delay(var/delay)
|
||||
if(delay && delay >= 0)
|
||||
src.fire_delay = delay
|
||||
fire_delay = delay
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/proc/emit_particle(var/strength = 0)
|
||||
if((src.last_shot + src.fire_delay) <= world.time)
|
||||
src.last_shot = world.time
|
||||
if((last_shot + fire_delay) <= world.time)
|
||||
last_shot = world.time
|
||||
var/obj/effect/accelerated_particle/A = null
|
||||
var/turf/T = get_step(src,dir)
|
||||
var/turf/T = get_step(src, dir)
|
||||
switch(strength)
|
||||
if(0)
|
||||
A = new/obj/effect/accelerated_particle/weak(T, dir)
|
||||
@@ -46,6 +46,6 @@
|
||||
if(3)
|
||||
A = new/obj/effect/accelerated_particle/powerful(T, dir)
|
||||
if(A)
|
||||
A.dir = src.dir
|
||||
A.dir = dir
|
||||
return 1
|
||||
return 0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/obj/structure/particle_accelerator/power_box
|
||||
name = "Particle Focusing EM Lens"
|
||||
desc_holder = "This uses electromagnetic waves to focus the Alpha-Particles."
|
||||
desc_holder = "This part uses electromagnetic waves to focus the Alpha particles."
|
||||
icon = 'icons/obj/machines/particle_accelerator.dmi'
|
||||
icon_state = "power_box"
|
||||
reference = "power_box"
|
||||
|
||||
+15
-13
@@ -363,8 +363,21 @@
|
||||
if(stat & BROKEN)
|
||||
return
|
||||
|
||||
// this is the data which will be sent to the ui
|
||||
|
||||
// update the ui if it exists, returns null if no ui is passed/found
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
// the ui does not exist, so we'll create a new() one
|
||||
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
|
||||
ui = new(user, src, ui_key, "smes.tmpl", "SMES Power Storage Unit", 540, 380)
|
||||
// open the new ui window
|
||||
ui.open()
|
||||
// auto update every Master Controller tick
|
||||
ui.set_auto_update(1)
|
||||
|
||||
/obj/machinery/power/smes/ui_data(mob/user, datum/topic_state/state = default_state)
|
||||
var/data[0]
|
||||
|
||||
data["nameTag"] = name_tag
|
||||
data["storedCapacity"] = round(100.0*charge/capacity, 0.1)
|
||||
data["charging"] = inputting
|
||||
@@ -383,18 +396,7 @@
|
||||
else
|
||||
data["outputting"] = 0 // smes is not outputting
|
||||
|
||||
// update the ui if it exists, returns null if no ui is passed/found
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if(!ui)
|
||||
// the ui does not exist, so we'll create a new() one
|
||||
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
|
||||
ui = new(user, src, ui_key, "smes.tmpl", "SMES Power Storage Unit", 540, 380)
|
||||
// when the ui is first opened this is the data it will use
|
||||
ui.set_initial_data(data)
|
||||
// open the new ui window
|
||||
ui.open()
|
||||
// auto update every Master Controller tick
|
||||
ui.set_auto_update(1)
|
||||
return data
|
||||
|
||||
/obj/machinery/power/smes/Topic(href, href_list)
|
||||
if(..())
|
||||
|
||||
@@ -389,8 +389,14 @@
|
||||
ui_interact(user)
|
||||
|
||||
/obj/machinery/power/solar_control/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "solar_control.tmpl", name, 490, 420)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
|
||||
var/data = list()
|
||||
/obj/machinery/power/solar_control/ui_data(mob/user, datum/topic_state/state = default_state)
|
||||
var/data[0]
|
||||
|
||||
data["generated"] = round(lastgen)
|
||||
data["angle"] = cdir
|
||||
@@ -403,12 +409,7 @@
|
||||
data["connected_panels"] = connected_panels.len
|
||||
data["connected_tracker"] = (connected_tracker ? 1 : 0)
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "solar_control.tmpl", name, 490, 420)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
return data
|
||||
|
||||
/obj/machinery/power/solar_control/attackby(I as obj, user as mob, params)
|
||||
if(istype(I, /obj/item/weapon/screwdriver))
|
||||
@@ -535,4 +536,4 @@
|
||||
|
||||
/obj/item/weapon/paper/solar
|
||||
name = "paper- 'Going green! Setup your own solar array instructions.'"
|
||||
info = "<h1>Welcome</h1><p>At greencorps we love the environment, and space. With this package you are able to help mother nature and produce energy without any usage of fossil fuel or plasma! Singularity energy is dangerous while solar energy is safe, which is why it's better. Now here is how you setup your own solar array.</p><p>You can make a solar panel by wrenching the solar assembly onto a cable node. Adding a glass panel, reinforced or regular glass will do, will finish the construction of your solar panel. It is that easy!</p><p>Now after setting up 19 more of these solar panels you will want to create a solar tracker to keep track of our mother nature's gift, the sun. These are the same steps as before except you insert the tracker equipment circuit into the assembly before performing the final step of adding the glass. You now have a tracker! Now the last step is to add a computer to calculate the sun's movements and to send commands to the solar panels to change direction with the sun. Setting up the solar computer is the same as setting up any computer, so you should have no trouble in doing that. You do need to put a wire node under the computer, and the wire needs to be connected to the tracker.</p><p>Congratulations, you should have a working solar array. If you are having trouble, here are some tips. Make sure all solar equipment are on a cable node, even the computer. You can always deconstruct your creations if you make a mistake.</p><p>That's all to it, be safe, be green!</p>"
|
||||
info = "<h1>Welcome</h1><p>At greencorps we love the environment, and space. With this package you are able to help mother nature and produce energy without any usage of fossil fuel or plasma! Singularity energy is dangerous while solar energy is safe, which is why it's better. Now here is how you setup your own solar array.</p><p>You can make a solar panel by wrenching the solar assembly onto a cable node. Adding a glass panel, reinforced or regular glass will do, will finish the construction of your solar panel. It is that easy!</p><p>Now after setting up 19 more of these solar panels you will want to create a solar tracker to keep track of our mother nature's gift, the sun. These are the same steps as before except you insert the tracker equipment circuit into the assembly before performing the final step of adding the glass. You now have a tracker! Now the last step is to add a computer to calculate the sun's movements and to send commands to the solar panels to change direction with the sun. Setting up the solar computer is the same as setting up any computer, so you should have no trouble in doing that. You do need to put a wire node under the computer, and the wire needs to be connected to the tracker.</p><p>Congratulations, you should have a working solar array. If you are having trouble, here are some tips. Make sure all solar equipment are on a cable node, even the computer. You can always deconstruct your creations if you make a mistake.</p><p>That's all to it, be safe, be green!</p>"
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
if(ishuman(mob))
|
||||
//Hilariously enough, running into a closet should make you get hit the hardest.
|
||||
var/mob/living/carbon/human/H = mob
|
||||
H.hallucination += max(50, min(300, DETONATION_HALLUCINATION * sqrt(1 / (get_dist(mob, src) + 1)) ) )
|
||||
H.AdjustHallucinate(max(50, min(300, DETONATION_HALLUCINATION * sqrt(1 / (get_dist(mob, src) + 1)))))
|
||||
var/rads = DETONATION_RADS * sqrt( 1 / (get_dist(mob, src) + 1) )
|
||||
mob.apply_effect(rads, IRRADIATE)
|
||||
|
||||
@@ -192,7 +192,7 @@
|
||||
var/obj/item/organ/internal/eyes/eyes = l.get_int_organ(/obj/item/organ/internal/eyes)
|
||||
if(!istype(eyes))
|
||||
continue
|
||||
l.hallucination = max(0, min(200, l.hallucination + power * config_hallucination_power * sqrt( 1 / max(1,get_dist(l, src)) ) ) )
|
||||
l.Hallucinate(min(200, l.hallucination + power * config_hallucination_power * sqrt( 1 / max(1,get_dist(l, src)))))
|
||||
|
||||
for(var/mob/living/l in range(src, round((power / 100) ** 0.25)))
|
||||
var/rads = (power / 10) * sqrt( 1 / max(get_dist(l, src),1) )
|
||||
@@ -262,6 +262,13 @@
|
||||
|
||||
// This is purely informational UI that may be accessed by AIs or robots
|
||||
/obj/machinery/power/supermatter_shard/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "supermatter_crystal.tmpl", "Supermatter Crystal", 500, 300)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
|
||||
/obj/machinery/power/supermatter_shard/ui_data(mob/user, datum/topic_state/state = default_state)
|
||||
var/data[0]
|
||||
|
||||
data["integrity_percentage"] = round(get_integrity())
|
||||
@@ -280,12 +287,7 @@
|
||||
else
|
||||
data["detonating"] = 0
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "supermatter_crystal.tmpl", "Supermatter Crystal", 500, 300)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
return data
|
||||
|
||||
/obj/machinery/power/supermatter_shard/proc/transfer_energy()
|
||||
for(var/obj/machinery/power/rad_collector/R in rad_collectors)
|
||||
|
||||
Reference in New Issue
Block a user