mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
[MIRROR] moves robot decals and animations to an ui (#11851)
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
d7653b0b93
commit
dca44a6098
@@ -4,7 +4,7 @@
|
||||
var/list/species_whitelist = list(),
|
||||
var/list/species_blacklist = list(),
|
||||
var/datum/tgui_state/state = GLOB.tgui_self_state)
|
||||
var/datum/tgui_module/appearance_changer/AC = new(src, src, check_species_whitelist, species_whitelist, species_blacklist)
|
||||
var/datum/tgui_module/appearance_changer/self_deleting/AC = new(src, src, check_species_whitelist, species_whitelist, species_blacklist)
|
||||
AC.flags = flags
|
||||
AC.tgui_interact(user, custom_state = state)
|
||||
|
||||
|
||||
@@ -491,50 +491,6 @@
|
||||
handle_light()
|
||||
update_icon()
|
||||
|
||||
/mob/living/silicon/robot/verb/toggle_robot_decals() // loads overlay UNDER lights.
|
||||
set category = "Abilities.Settings"
|
||||
set name = "Toggle Extra Decals"
|
||||
|
||||
if(!sprite_datum)
|
||||
return
|
||||
if(!LAZYLEN(sprite_datum.sprite_decals))
|
||||
to_chat(src, span_warning("This module does not support decals."))
|
||||
return
|
||||
|
||||
var/extra_message = "Enabled decals:\n"
|
||||
for(var/decal in robotdecal_on)
|
||||
extra_message += decal + "\n"
|
||||
|
||||
var/decal_to_toggle = tgui_input_list(src, "Please select which decal you want to toggle\n[extra_message]", "Decal Toggle", sprite_datum.sprite_decals)
|
||||
if(!decal_to_toggle)
|
||||
return
|
||||
|
||||
decal_to_toggle = lowertext(decal_to_toggle)
|
||||
|
||||
if(robotdecal_on.Find(decal_to_toggle))
|
||||
robotdecal_on -= decal_to_toggle
|
||||
to_chat(src, span_filter_notice("You disable your \"[decal_to_toggle]\" extra apperances."))
|
||||
else
|
||||
robotdecal_on += decal_to_toggle
|
||||
to_chat(src, span_filter_notice("You enable your \"[decal_to_toggle]\" extra apperances."))
|
||||
update_icon()
|
||||
|
||||
/mob/living/silicon/robot/verb/flick_robot_animation()
|
||||
set category = "Abilities.Settings"
|
||||
set name = "Flick Animation"
|
||||
|
||||
if(!sprite_datum)
|
||||
return
|
||||
if(!LAZYLEN(sprite_datum.sprite_animations))
|
||||
to_chat(src, span_warning("This module does not support animations."))
|
||||
return
|
||||
|
||||
var/animation_to_play = tgui_input_list(src, "Please select which decal you want to flick", "Flick Decal", sprite_datum.sprite_animations)
|
||||
if(!animation_to_play)
|
||||
return
|
||||
|
||||
flick("[sprite_datum.sprite_icon_state]-[animation_to_play]", src)
|
||||
|
||||
/mob/living/silicon/robot/verb/toggle_glowy_stomach()
|
||||
set category = "Abilities.Settings"
|
||||
set name = "Toggle Glowing Stomach & Accents"
|
||||
|
||||
66
code/modules/mob/living/silicon/robot/robot_ui_decals.dm
Normal file
66
code/modules/mob/living/silicon/robot/robot_ui_decals.dm
Normal file
@@ -0,0 +1,66 @@
|
||||
// Robot decal and animation control
|
||||
/datum/tgui_module/robot_ui_decals
|
||||
name = "Robot Decal & Animation Control"
|
||||
tgui_id = "RobotDecals"
|
||||
|
||||
/datum/tgui_module/robot_ui_decals/tgui_state(mob/user)
|
||||
return GLOB.tgui_self_state
|
||||
|
||||
/datum/tgui_module/robot_ui_decals/tgui_static_data()
|
||||
var/list/data = ..()
|
||||
|
||||
var/mob/living/silicon/robot/R = host
|
||||
|
||||
if(!R.sprite_datum)
|
||||
return data
|
||||
|
||||
data["all_decals"] = R.sprite_datum.sprite_decals
|
||||
data["all_animations"] = R.sprite_datum.sprite_animations
|
||||
|
||||
return data
|
||||
|
||||
/datum/tgui_module/robot_ui_decals/tgui_data()
|
||||
var/list/data = ..()
|
||||
|
||||
var/mob/living/silicon/robot/R = host
|
||||
data["active_decals"] = R.robotdecal_on
|
||||
|
||||
var/robot_theme = R.get_ui_theme()
|
||||
if(robot_theme)
|
||||
data["theme"] = robot_theme
|
||||
|
||||
return data
|
||||
|
||||
/datum/tgui_module/robot_ui_decals/tgui_act(action, params)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/mob/living/silicon/robot/R = host
|
||||
if(!R.sprite_datum)
|
||||
return FALSE
|
||||
|
||||
switch(action)
|
||||
if("toggle_decal")
|
||||
if(!LAZYLEN(R.sprite_datum.sprite_decals))
|
||||
return FALSE
|
||||
var/decal_to_toggle = lowertext(params["value"])
|
||||
if(!(decal_to_toggle in R.sprite_datum.sprite_decals))
|
||||
return FALSE
|
||||
if(R.robotdecal_on.Find(decal_to_toggle))
|
||||
R.robotdecal_on -= decal_to_toggle
|
||||
else
|
||||
R.robotdecal_on += decal_to_toggle
|
||||
R.update_icon()
|
||||
. = TRUE
|
||||
if("flick_animation")
|
||||
if(!LAZYLEN(R.sprite_datum.sprite_animations))
|
||||
return FALSE
|
||||
var/animation_to_flick = lowertext(params["value"])
|
||||
if(!(animation_to_flick in R.sprite_datum.sprite_animations))
|
||||
return FALSE
|
||||
R.cut_overlays()
|
||||
R.ImmediateOverlayUpdate()
|
||||
flick("[R.sprite_datum.sprite_icon_state]-[animation_to_flick]", R)
|
||||
R.update_icon()
|
||||
. = TRUE
|
||||
@@ -14,6 +14,7 @@
|
||||
if(isrobot(user))
|
||||
var/mob/living/silicon/robot/R = user
|
||||
R.selecting_module = FALSE
|
||||
qdel(src)
|
||||
|
||||
/datum/tgui_module/robot_ui_module/tgui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui)
|
||||
. = ..()
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
QDEL_NULL(idcard)
|
||||
if(laws)
|
||||
QDEL_NULL(laws)
|
||||
clear_subsystems()
|
||||
return ..()
|
||||
|
||||
/mob/living/silicon/proc/init_id()
|
||||
|
||||
@@ -46,6 +46,15 @@
|
||||
AH.register_alarm(src, /mob/living/silicon/proc/receive_alarm)
|
||||
queued_alarms[AH] = list() // Makes sure alarms remain listed in consistent order
|
||||
|
||||
/mob/living/silicon/proc/clear_subsystems()
|
||||
QDEL_NULL(alarm_monitor)
|
||||
QDEL_NULL(atmos_control)
|
||||
QDEL_NULL(crew_monitor)
|
||||
QDEL_NULL(crew_manifest)
|
||||
QDEL_NULL(law_manager)
|
||||
QDEL_NULL(power_monitor)
|
||||
QDEL_NULL(rcon)
|
||||
|
||||
/********************
|
||||
* Alarm Monitor *
|
||||
********************/
|
||||
@@ -108,3 +117,23 @@
|
||||
set name = "RCON"
|
||||
|
||||
rcon.tgui_interact(src)
|
||||
|
||||
/mob/living/silicon/robot
|
||||
var/datum/tgui_module/robot_ui_decals/decal_control
|
||||
|
||||
/mob/living/silicon/robot/init_subsystems()
|
||||
..()
|
||||
decal_control = new(src)
|
||||
|
||||
/mob/living/silicon/robot/clear_subsystems()
|
||||
QDEL_NULL(decal_control)
|
||||
..()
|
||||
|
||||
/mob/living/silicon/robot/verb/toggle_robot_decals()
|
||||
set category = "Abilities.Settings"
|
||||
set name = "Control Robot Decals & Animations"
|
||||
|
||||
if(!sprite_datum)
|
||||
return
|
||||
|
||||
decal_control.tgui_interact(src)
|
||||
|
||||
Reference in New Issue
Block a user