mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-26 13:46:53 +01:00
icon smoothing + misc upgrades (#3807)
* e * update appearance * more * fixes * final * there we go * fix dme * fix dme * add files * Update atom_vv.dm * Update rack.dm * Update rack.dm * Update rack.dm * Update atoms.dm * Update bench.dm * Create ColorMatrixEditor.js * Update Filteriffic.js Co-authored-by: fake_vm_user <fake_vm_user> Co-authored-by: Captain277 <agentraven16@gmail.com>
This commit is contained in:
co-authored by
fake_vm_user <fake_vm_user>
Captain277
parent
39c8dc4e60
commit
98c7630faa
@@ -0,0 +1,129 @@
|
||||
INITIALIZE_IMMEDIATE(/atom/movable/screen/color_matrix_proxy_view)
|
||||
|
||||
/atom/movable/screen/color_matrix_proxy_view
|
||||
name = "color_matrix_proxy_view"
|
||||
del_on_map_removal = FALSE
|
||||
layer = OBJ_PLANE
|
||||
plane = OBJ_PLANE
|
||||
|
||||
var/list/plane_masters = list()
|
||||
|
||||
/// The client that is watching this view
|
||||
var/client/client
|
||||
|
||||
/atom/movable/screen/color_matrix_proxy_view/Initialize(mapload)
|
||||
. = ..()
|
||||
|
||||
assigned_map = "color_matrix_proxy_[REF(src)]"
|
||||
set_position(1, 1)
|
||||
|
||||
/atom/movable/screen/color_matrix_proxy_view/Destroy()
|
||||
for (var/plane_master in plane_masters)
|
||||
client?.screen -= plane_master
|
||||
qdel(plane_master)
|
||||
|
||||
client?.clear_map(assigned_map)
|
||||
|
||||
client = null
|
||||
plane_masters = null
|
||||
|
||||
return ..()
|
||||
|
||||
/atom/movable/screen/color_matrix_proxy_view/proc/register_to_client(client/client)
|
||||
QDEL_LIST(plane_masters)
|
||||
|
||||
src.client = client
|
||||
|
||||
if (!client)
|
||||
return
|
||||
|
||||
for (var/plane_master_type in subtypesof(/atom/movable/screen/plane_master)) // - /atom/movable/screen/plane_master/blackness)
|
||||
var/atom/movable/screen/plane_master/plane_master = new plane_master_type()
|
||||
plane_master.screen_loc = "[assigned_map]:CENTER"
|
||||
client?.screen |= plane_master
|
||||
|
||||
plane_masters += plane_master
|
||||
|
||||
client?.register_map_obj(src)
|
||||
|
||||
/datum/color_matrix_editor
|
||||
var/client/owner
|
||||
var/datum/weakref/target
|
||||
var/atom/movable/screen/color_matrix_proxy_view/proxy_view
|
||||
var/list/current_color
|
||||
var/closed
|
||||
|
||||
/datum/color_matrix_editor/New(user, atom/_target = null)
|
||||
owner = CLIENT_FROM_VAR(user)
|
||||
if(islist(_target?.color))
|
||||
current_color = _target.color
|
||||
else if(istext(_target?.color))
|
||||
current_color = color_hex2color_matrix(_target.color)
|
||||
else
|
||||
current_color = color_matrix_identity()
|
||||
proxy_view = new
|
||||
if(_target)
|
||||
target = WEAKREF(_target)
|
||||
proxy_view.appearance = image(_target)
|
||||
else
|
||||
proxy_view.appearance = image('icons/misc/colortest.dmi', "colors")
|
||||
|
||||
proxy_view.color = current_color
|
||||
proxy_view.register_to_client(owner)
|
||||
|
||||
/datum/color_matrix_editor/Destroy(force, ...)
|
||||
QDEL_NULL(proxy_view)
|
||||
return ..()
|
||||
|
||||
/datum/color_matrix_editor/ui_state(mob/user)
|
||||
return GLOB.admin_state
|
||||
|
||||
/datum/color_matrix_editor/ui_static_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["mapRef"] = proxy_view.assigned_map
|
||||
|
||||
return data
|
||||
|
||||
/datum/color_matrix_editor/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["currentColor"] = current_color
|
||||
|
||||
return data
|
||||
|
||||
/datum/color_matrix_editor/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "ColorMatrixEditor")
|
||||
ui.open()
|
||||
|
||||
/datum/color_matrix_editor/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
switch(action)
|
||||
if("transition_color")
|
||||
current_color = params["color"]
|
||||
animate(proxy_view, time = 4, color = current_color)
|
||||
if("confirm")
|
||||
on_confirm()
|
||||
SStgui.close_uis(src)
|
||||
|
||||
/datum/color_matrix_editor/ui_close(mob/user)
|
||||
. = ..()
|
||||
closed = TRUE
|
||||
|
||||
/datum/color_matrix_editor/proc/on_confirm()
|
||||
var/atom/target_atom = target?.resolve()
|
||||
if(istype(target_atom))
|
||||
target_atom.vv_edit_var("color", current_color)
|
||||
|
||||
/datum/color_matrix_editor/proc/wait()
|
||||
while(!closed)
|
||||
stoplag(1)
|
||||
|
||||
/client/proc/open_color_matrix_editor(atom/in_atom)
|
||||
var/datum/color_matrix_editor/editor = new /datum/color_matrix_editor(src, in_atom)
|
||||
editor.ui_interact(mob)
|
||||
editor.wait()
|
||||
. = editor.current_color
|
||||
qdel(editor)
|
||||
@@ -0,0 +1,102 @@
|
||||
/datum/filter_editor
|
||||
var/atom/target
|
||||
|
||||
/datum/filter_editor/New(atom/target)
|
||||
src.target = target
|
||||
|
||||
/datum/filter_editor/ui_state(mob/user)
|
||||
return GLOB.admin_state
|
||||
|
||||
/datum/filter_editor/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "Filteriffic")
|
||||
ui.open()
|
||||
|
||||
/datum/filter_editor/ui_static_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["filter_info"] = GLOB.master_filter_info
|
||||
return data
|
||||
|
||||
/datum/filter_editor/ui_data()
|
||||
var/list/data = list()
|
||||
data["target_name"] = target.name
|
||||
data["target_filter_data"] = target.filter_data
|
||||
return data
|
||||
|
||||
/datum/filter_editor/ui_act(action, list/params)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("add_filter")
|
||||
var/target_name = params["name"]
|
||||
while(target.filter_data && target.filter_data[target_name])
|
||||
target_name = "[target_name]-dupe"
|
||||
target.add_filter(target_name, params["priority"], list("type" = params["type"]))
|
||||
. = TRUE
|
||||
if("remove_filter")
|
||||
target.remove_filter(params["name"])
|
||||
. = TRUE
|
||||
if("rename_filter")
|
||||
var/list/filter_data = target.filter_data[params["name"]]
|
||||
target.remove_filter(params["name"])
|
||||
target.add_filter(params["new_name"], filter_data["priority"], filter_data)
|
||||
. = TRUE
|
||||
if("edit_filter")
|
||||
target.remove_filter(params["name"])
|
||||
target.add_filter(params["name"], params["priority"], params["new_filter"])
|
||||
. = TRUE
|
||||
if("change_priority")
|
||||
var/new_priority = params["new_priority"]
|
||||
target.change_filter_priority(params["name"], new_priority)
|
||||
. = TRUE
|
||||
if("transition_filter_value")
|
||||
target.transition_filter(params["name"], 4, params["new_data"])
|
||||
. = TRUE
|
||||
if("modify_filter_value")
|
||||
var/list/old_filter_data = target.filter_data[params["name"]]
|
||||
var/list/new_filter_data = old_filter_data.Copy()
|
||||
for(var/entry in params["new_data"])
|
||||
new_filter_data[entry] = params["new_data"][entry]
|
||||
for(var/entry in new_filter_data)
|
||||
if(entry == GLOB.master_filter_info[old_filter_data["type"]]["defaults"][entry])
|
||||
new_filter_data.Remove(entry)
|
||||
target.remove_filter(params["name"])
|
||||
target.add_filter(params["name"], old_filter_data["priority"], new_filter_data)
|
||||
. = TRUE
|
||||
if("modify_color_value")
|
||||
var/new_color = input(usr, "Pick new filter color", "Filteriffic Colors!") as color|null
|
||||
if(new_color)
|
||||
target.transition_filter(params["name"], 4, list("color" = new_color))
|
||||
. = TRUE
|
||||
if("modify_icon_value")
|
||||
var/icon/new_icon = input("Pick icon:", "Icon") as null|icon
|
||||
if(new_icon)
|
||||
target.filter_data[params["name"]]["icon"] = new_icon
|
||||
target.update_filters()
|
||||
. = TRUE
|
||||
if("mass_apply")
|
||||
if(!check_rights(R_FUN))
|
||||
to_chat(usr, SPAN_DANGER("Stay in your lane, jannie."))
|
||||
return
|
||||
var/target_path = text2path(params["path"])
|
||||
if(!target_path)
|
||||
return
|
||||
var/filters_to_copy = target.filters
|
||||
var/filter_data_to_copy = target.filter_data
|
||||
var/count = 0
|
||||
for(var/thing in world.contents)
|
||||
if(istype(thing, target_path))
|
||||
var/atom/thing_at = thing
|
||||
thing_at.filters = filters_to_copy
|
||||
thing_at.filter_data = filter_data_to_copy
|
||||
count += 1
|
||||
message_admins("LOCAL CLOWN [usr.ckey] JUST MASS FILTER EDITED [count] WITH PATH OF [params["path"]]!")
|
||||
log_admin("LOCAL CLOWN [usr.ckey] JUST MASS FILTER EDITED [count] WITH PATH OF [params["path"]]!")
|
||||
|
||||
/client/proc/open_filter_editor(atom/in_atom)
|
||||
if(holder)
|
||||
holder.filteriffic = new /datum/filter_editor(in_atom)
|
||||
holder.filteriffic.ui_interact(mob)
|
||||
Reference in New Issue
Block a user