Skip to content

Commit

Permalink
New TEG sprites (#18085)
Browse files Browse the repository at this point in the history
* amogus

* Revert "amogus"

This reverts commit ebaa99c.

* T E Gee

:D

* adjusts sprites slightly

TEGs taller now, I though they looked too short b4

* makes pipe connection nicer

* Emissive Devices

yep

* suggested changes

Moved update_icon() call out of atmos/process, which was calling it multiple times a second, and into return_transfer_air() which is the only place where the critical variable is redefined.

* readds conflicted changes

* bruh

* SteelSlayer Suggestion

Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>

* removes duplicate proc

Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>
  • Loading branch information
kugamo and SteelSlayer authored Jul 2, 2022
1 parent 8dc53fc commit 9a8d6da
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
can_unwrench = 1
var/side_inverted = 0

var/light_range_on = 1
var/light_power_on = 0.1 //just dont want it to be culled by byond.

/obj/machinery/atmospherics/binary/circulator/detailed_examine()
return "This generates electricity, depending on the difference in temperature between each side of the machine. The meter in \
the center of the machine gives an indicator of how much electricity is being generated."
Expand Down Expand Up @@ -44,6 +47,7 @@
if(output_starting_pressure >= input_starting_pressure - 10)
//Need at least 10 KPa difference to overcome friction in the mechanism
last_pressure_delta = 0
update_icon()
return null

//Calculate necessary moles to transfer using PV = nRT
Expand All @@ -52,7 +56,9 @@

var/transfer_moles = pressure_delta * outlet.volume/(inlet.temperature * R_IDEAL_GAS_EQUATION)

last_pressure_delta = pressure_delta
if(last_pressure_delta != pressure_delta)
last_pressure_delta = pressure_delta
update_icon()

//log_debug("pressure_delta = [pressure_delta]; transfer_moles = [transfer_moles];")

Expand All @@ -66,10 +72,7 @@

else
last_pressure_delta = 0

/obj/machinery/atmospherics/binary/circulator/process_atmos()
..()
update_icon()
update_icon()

/obj/machinery/atmospherics/binary/circulator/proc/get_inlet_air()
if(side_inverted==0)
Expand Down Expand Up @@ -108,17 +111,46 @@
to_chat(user, "<span class='notice'>You reverse the circulator's valve settings. The inlet of the circulator is now on the [get_inlet_side(dir)] side.</span>")
desc = "A gas circulator pump and heat exchanger. Its input port is on the [get_inlet_side(dir)] side, and its output port is on the [get_outlet_side(dir)] side."

/obj/machinery/atmospherics/binary/circulator/update_icon()
/obj/machinery/atmospherics/binary/circulator/update_icon() //this gets called everytime atmos is updated in the circulator (alot)
..()
underlays.Cut()
cut_overlays()

if(stat & (BROKEN|NOPOWER))
icon_state = "circ[side]-p"
else if(last_pressure_delta > 0)
if(last_pressure_delta > ONE_ATMOSPHERE)
icon_state = "circ[side]-run"
underlays += emissive_appearance(icon,"emit[side]-run")
else
icon_state = "circ[side]-slow"
underlays += emissive_appearance(icon,"emit[side]-slow")
else
icon_state = "circ[side]-off"
underlays += emissive_appearance(icon,"emit[side]-off")

if(!side_inverted)
add_overlay(mutable_appearance(icon,"in_up"))
else
add_overlay(mutable_appearance(icon,"in_down"))

if(node2)
var/image/new_pipe_overlay = image(icon, "connected")
new_pipe_overlay.color = node2.pipe_color
add_overlay(new_pipe_overlay)
else
add_overlay(mutable_appearance(icon, "disconnected"))

return 1

/obj/machinery/atmospherics/binary/circulator/power_change()
. = ..()
if(stat & (BROKEN|NOPOWER))
set_light(0)
else
set_light(light_range_on, light_power_on)
update_icon()

/obj/machinery/atmospherics/binary/circulator/update_underlays()
. = ..()
update_icon()
31 changes: 21 additions & 10 deletions code/modules/power/generator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
var/lastgenlev = -1
var/lastcirc = "00"

var/light_range_on = 1
var/light_power_on = 0.1 //just dont want it to be culled by byond.

/obj/machinery/power/generator/Initialize(mapload)
. = ..()
update_desc()
Expand All @@ -36,6 +39,10 @@
if(powernet)
disconnect_from_network()

/obj/machinery/power/generator/Initialize()
. = ..()
connect()

/obj/machinery/power/generator/proc/connect()
connect_to_network()

Expand All @@ -60,21 +67,29 @@
updateDialog()

/obj/machinery/power/generator/power_change()
. = ..()
if(!anchored)
stat |= NOPOWER
if((stat & (BROKEN|NOPOWER)))
set_light(0)
else
..()
set_light(light_range_on, light_power_on)
update_icon()


/obj/machinery/power/generator/update_icon()
if(stat & (NOPOWER|BROKEN))
overlays.Cut()
cut_overlays()
underlays.Cut()
return
else
overlays.Cut()

cut_overlays()
if(lastgenlev != 0)
overlays += image('icons/obj/power.dmi', "teg-op[lastgenlev]")
add_overlay(mutable_appearance('icons/obj/power.dmi', "teg-op[lastgenlev]"))
underlays += emissive_appearance(icon, "teg-op[lastgenlev]")

overlays += image('icons/obj/power.dmi', "teg-oc[lastcirc]")
add_overlay(mutable_appearance('icons/obj/power.dmi', "teg-oc[lastcirc]"))
underlays += emissive_appearance(icon, "teg-oc[lastcirc]")

/obj/machinery/power/generator/process()
if(stat & (NOPOWER|BROKEN))
Expand Down Expand Up @@ -230,7 +245,3 @@
if(!powernet || !cold_circ || !hot_circ)
connect()
return TRUE

/obj/machinery/power/generator/power_change()
..()
update_icon()
Binary file modified icons/obj/atmospherics/circulator.dmi
Binary file not shown.
Binary file modified icons/obj/pipe-item.dmi
Binary file not shown.
Binary file modified icons/obj/power.dmi
Binary file not shown.

0 comments on commit 9a8d6da

Please sign in to comment.