Skip to content

Commit

Permalink
[MIRROR] Fixes the EMP Barsign sprite not displaying [MDB IGNORE] (#2…
Browse files Browse the repository at this point in the history
…4951) (#583)

* Fixes the EMP Barsign sprite not displaying (#79599)

## About The Pull Request

The logic that sets the icon_state had an error in it. When the sign got
emp'd, they'd get the `NOPOWER` flag which was causing them to get the
`empty` `icon_state` instead of that of the emped barsign.

This just fixes that by adding a conditional check for `EMPED`, and also
resprites the emissive lightmask for the emped barsign to match the
individual signs that make up its sprite, where previously it was just a
static square.

Also added it to the barsigns unit tests because I can see someone
breaking this again.

## Why It's Good For The Game

Fixes bug where emped barsigns would show the turned off sprite instead
of their animated sprite. Also improves the light mask:

Note: this is in complete darkness. The colored backdrops of the signs
are not supposed to be emissive.

<details> <summary>Before </summary>

![dreamseeker_jiXgQtteGK](https://github.com/tgstation/tgstation/assets/13398309/4c576c3d-8758-4ce8-b1b5-00d0fb341f38)

</details>

<details> <summary>After </summary>

![dreamseeker_tCu8YSTJuZ](https://github.com/tgstation/tgstation/assets/13398309/10c328c9-8e99-47c7-98a4-e6f66c4e5eee)

</details>

![dreamseeker_Lu3TfIzkWO](https://github.com/tgstation/tgstation/assets/13398309/c7251cc0-84ab-432d-85e9-2b93b94b63e4)

## Changelog

:cl:
fix: emped bar signs will now display the correct sprite
image: added a more detailed lightmask for the emp bar sign sprite
/:cl:

---------











* Fixes the EMP Barsign sprite not displaying

---------

Co-authored-by: SkyratBot <[email protected]>
Co-authored-by: Bloop <[email protected]>
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@ users.noreply.github.com>
Co-authored-by: John Willard <53777086+JohnFulpWillard@ users.noreply.github.com>
Co-authored-by: SyncIt21 <110812394+SyncIt21@ users.noreply.github.com>
Co-authored-by: orange man <61334995+comfyorange@ users.noreply.github.com>
Co-authored-by: Profakos <profakos@ gmail.com>
Co-authored-by: Changelogs <action@ github.com>
Co-authored-by: Jacquerel <hnevard@ gmail.com>
Co-authored-by: Andrew <mt.forspam@ gmail.com>
Co-authored-by: DaCoolBoss <142358580+DaCoolBoss@ users.noreply.github.com>
  • Loading branch information
12 people authored Nov 13, 2023
1 parent 552f08d commit ade0726
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions code/game/machinery/barsigns.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/barsign, 32)
update_appearance()

/obj/machinery/barsign/update_icon_state()
if(!(machine_stat & (NOPOWER|BROKEN)) && chosen_sign && chosen_sign.icon_state)
if(!(machine_stat & BROKEN) && (!(machine_stat & NOPOWER) || machine_stat & EMPED) && chosen_sign && chosen_sign.icon_state)
icon_state = chosen_sign.icon_state
else
icon_state = "empty"
Expand All @@ -60,7 +60,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/barsign, 32)
/obj/machinery/barsign/update_overlays()
. = ..()

if(machine_stat & (NOPOWER|BROKEN))
if(((machine_stat & NOPOWER) && !(machine_stat & EMPED)) || (machine_stat & BROKEN))
return

if(chosen_sign && chosen_sign.light_mask)
Expand Down
21 changes: 21 additions & 0 deletions code/modules/unit_tests/barsigns.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,24 @@
TEST_FAIL("[sign_type] does not have a unique name.")

existing_names += sign.name

/**
* Test that an emped barsign displays correctly
*/
/datum/unit_test/barsigns_emp

/datum/unit_test/barsigns_emp/Run()
var/obj/machinery/barsign/testing_sign = allocate(/obj/machinery/barsign)
var/datum/barsign/hiddensigns/empbarsign/emp_bar_sign = /datum/barsign/hiddensigns/empbarsign

testing_sign.emp_act(EMP_HEAVY)

// make sure we get the correct chosen_sign set
if(!istype(testing_sign.chosen_sign, emp_bar_sign))
TEST_FAIL("[testing_sign] got EMPed but did not get its chosen_sign set correctly.")

// make sure the sign's icon_state actually got set
var/expected_icon_state = initial(emp_bar_sign.icon_state)
if(testing_sign.icon_state != expected_icon_state)
TEST_FAIL("[testing_sign]'s icon_state was [testing_sign.icon_state] when it should have been [expected_icon_state].")

Binary file modified icons/obj/machines/barsigns.dmi
Binary file not shown.

0 comments on commit ade0726

Please sign in to comment.