Files
Bubberstation/code/modules/unit_tests/barsigns.dm
Bloop 6b259fee24 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

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

---------

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>
2023-11-12 12:47:07 -08:00

59 lines
1.9 KiB
Plaintext

/**
* Test if icon states for each datum actually exist in the DMI.
*/
/datum/unit_test/barsigns_icon
/datum/unit_test/barsigns_icon/Run()
var/obj/machinery/barsign_type = /obj/machinery/barsign
var/icon/barsign_icon = initial(barsign_type.icon)
var/list/barsign_icon_states = icon_states(barsign_icon)
// Check every datum real bar sign
for(var/sign_type in (subtypesof(/datum/barsign) - /datum/barsign/hiddensigns))
var/datum/barsign/sign = new sign_type()
if(!(sign.icon_state in barsign_icon_states))
TEST_FAIL("Icon state for [sign_type] does not exist in [barsign_icon].")
/**
* Check that bar signs have a name and desc, and that the name is unique.
*/
/datum/unit_test/barsigns_name
/datum/unit_test/barsigns_name/Run()
var/list/existing_names = list()
for(var/sign_type in subtypesof(/datum/barsign) - /datum/barsign/hiddensigns)
var/datum/barsign/sign = new sign_type()
if(!sign.name)
TEST_FAIL("[sign_type] does not have a name.")
if(!sign.desc)
TEST_FAIL("[sign_type] does not have a desc.")
if(sign.name in existing_names)
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].")