mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-03 13:32:17 +00:00
second pass over the SC/FISHER code, incl. bitflags and PDAs (#78330)
## About The Pull Request makes `COMSIG_HIT_BY_SABOTEUR` return a bitflag in order to close #78297 (i am very sorry) fixes #78298 extends flashlight disabling to modular computers incl. PDAs because somehow i forgot that they had flashlights. ## Why It's Good For The Game my code sucks and i should make it suck less, actually ## Changelog i don't think i get to put a code improvement tag if it's not playerfacing and it's my own fault 🆑 fix: Flares and candles no longer sound like flashlights when being turned on. fix: Getting shot by an SC/FISHER now disables PDA lights for consistency's sake. /🆑 --------- Co-authored-by: Hatterhat <Hatterhat@users.noreply.github.com>
This commit is contained in:
@@ -65,6 +65,8 @@
|
||||
|
||||
///If the computer has a flashlight/LED light built-in.
|
||||
var/has_light = FALSE
|
||||
/// If the computer's flashlight/LED light has forcibly disabled for a temporary amount of time.
|
||||
COOLDOWN_DECLARE(disabled_time)
|
||||
/// How far the computer's light can reach, is not editable by players.
|
||||
var/comp_light_luminosity = 3
|
||||
/// The built-in light's color, editable by players.
|
||||
@@ -127,6 +129,7 @@
|
||||
UpdateDisplay()
|
||||
if(has_light)
|
||||
add_item_action(/datum/action/item_action/toggle_computer_light)
|
||||
RegisterSignal(src, COMSIG_HIT_BY_SABOTEUR, PROC_REF(on_saboteur))
|
||||
if(inserted_disk)
|
||||
inserted_disk = new inserted_disk(src)
|
||||
if(internal_cell)
|
||||
@@ -657,7 +660,7 @@
|
||||
|
||||
/obj/item/modular_computer/ui_action_click(mob/user, actiontype)
|
||||
if(istype(actiontype, /datum/action/item_action/toggle_computer_light))
|
||||
toggle_flashlight()
|
||||
toggle_flashlight(user)
|
||||
return
|
||||
|
||||
return ..()
|
||||
@@ -668,14 +671,32 @@
|
||||
* Called from ui_act(), does as the name implies.
|
||||
* It is separated from ui_act() to be overwritten as needed.
|
||||
*/
|
||||
/obj/item/modular_computer/proc/toggle_flashlight()
|
||||
/obj/item/modular_computer/proc/toggle_flashlight(mob/user)
|
||||
if(!has_light)
|
||||
return FALSE
|
||||
if(!COOLDOWN_FINISHED(src, disabled_time))
|
||||
balloon_alert(user, "disrupted!")
|
||||
return FALSE
|
||||
set_light_on(!light_on)
|
||||
update_appearance()
|
||||
update_item_action_buttons(force = TRUE) //force it because we added an overlay, not changed its icon
|
||||
return TRUE
|
||||
|
||||
/**
|
||||
* Disables the computer's flashlight/LED light, if it has one, for a given disrupt_duration.
|
||||
*
|
||||
* Called when sent COMSIG_HIT_BY_SABOTEUR.
|
||||
*/
|
||||
/obj/item/modular_computer/proc/on_saboteur(datum/source, disrupt_duration)
|
||||
SIGNAL_HANDLER
|
||||
if(!has_light)
|
||||
return
|
||||
set_light_on(FALSE)
|
||||
update_appearance()
|
||||
update_item_action_buttons(force = TRUE) //force it because we added an overlay, not changed its icon
|
||||
COOLDOWN_START(src, disabled_time, disrupt_duration)
|
||||
return COMSIG_SABOTEUR_SUCCESS
|
||||
|
||||
/**
|
||||
* Sets the computer's light color, if it has a light.
|
||||
*
|
||||
|
||||
@@ -374,7 +374,7 @@
|
||||
.["comp_light_color"] = robo.lamp_color
|
||||
|
||||
//Makes the flashlight button affect the borg rather than the tablet
|
||||
/obj/item/modular_computer/pda/silicon/toggle_flashlight()
|
||||
/obj/item/modular_computer/pda/silicon/toggle_flashlight(mob/user)
|
||||
if(!silicon_owner || QDELETED(silicon_owner))
|
||||
return FALSE
|
||||
if(iscyborg(silicon_owner))
|
||||
|
||||
Reference in New Issue
Block a user