diff --git a/code/__HELPERS/filters.dm b/code/__HELPERS/filters.dm index 3c73f1c7b4b..be41892c69f 100644 --- a/code/__HELPERS/filters.dm +++ b/code/__HELPERS/filters.dm @@ -8,7 +8,7 @@ GLOBAL_LIST_INIT(master_filter_info, list( "y" = 0, "icon" = ICON_NOT_SET, "render_source" = "", - "flags" = 0 + "flags" = NONE ), "flags" = list( "MASK_INVERSE" = MASK_INVERSE, @@ -30,14 +30,20 @@ GLOBAL_LIST_INIT(master_filter_info, list( "alpha" = 255 ) ), - // Not implemented, but if this isn't uncommented some windows will just error + // Not fully implemented, but if this isn't uncommented some windows will just error // Needs either a proper matrix editor, or just a hook to our existing one - // Issue is filterrific assumes variables will have the same value type if they share the same name, which this violates - // Gotta refactor this sometime "color" = list( "defaults" = list( "color" = matrix(), "space" = FILTER_COLOR_RGB + ), + "options" = list( + "space" = list( + "FILTER_COLOR_RGB" = FILTER_COLOR_RGB, + "FILTER_COLOR_HSV" = FILTER_COLOR_HSV, + "FILTER_COLOR_HSL" = FILTER_COLOR_HSL, + "FILTER_COLOR_HCY" = FILTER_COLOR_HCY + ) ) ), "displace" = list( @@ -46,7 +52,11 @@ GLOBAL_LIST_INIT(master_filter_info, list( "y" = 0, "size" = null, "icon" = ICON_NOT_SET, - "render_source" = "" + "render_source" = "", + "flags" = NONE + ), + "flags" = list( + "FILTER_OVERLAY" = FILTER_OVERLAY ) ), "drop_shadow" = list( @@ -70,10 +80,24 @@ GLOBAL_LIST_INIT(master_filter_info, list( "icon" = ICON_NOT_SET, "render_source" = "", "flags" = FILTER_OVERLAY, - "color" = "", + "color" = COLOR_WHITE, "transform" = null, "blend_mode" = BLEND_DEFAULT + ), + "flags" = list( + "FILTER_OVERLAY" = FILTER_OVERLAY, + ), + "options" = list( + "blend_mode" = list( + "BLEND_DEFAULT" = BLEND_DEFAULT, + "BLEND_OVERLAY" = BLEND_OVERLAY, + "BLEND_ADD" = BLEND_ADD, + "BLEND_SUBTRACT" = BLEND_SUBTRACT, + "BLEND_MULTIPLY" = BLEND_MULTIPLY, + "BLEND_INSET_OVERLAY" = BLEND_INSET_OVERLAY + ) ) + ), "motion_blur" = list( "defaults" = list( diff --git a/code/modules/admin/verbs/plane_debugger.dm b/code/modules/admin/verbs/plane_debugger.dm index 90c12c931d7..d983bf9eb96 100644 --- a/code/modules/admin/verbs/plane_debugger.dm +++ b/code/modules/admin/verbs/plane_debugger.dm @@ -154,14 +154,12 @@ this_relay["blend_mode"] = GLOB.blend_names["[relay.blend_mode]"] relays += list(this_relay) - for (var/filter_id in plane.filter_data) - var/list/filter = plane.filter_data[filter_id] + for (var/list/filter in plane.filter_data) if(!filter["render_source"]) continue var/list/filter_info = filter.Copy() - filter_info["name"] = filter_id - filter_info["our_ref"] = "[plane.plane]-[filter_id]" + filter_info["our_ref"] = "[plane.plane]-[filter_info["name"]]" filters += list(filter_info) this_plane["relays"] = relays diff --git a/tgui/packages/tgui/interfaces/Filteriffic.jsx b/tgui/packages/tgui/interfaces/Filteriffic.jsx index eb74398ed66..a82fecf8638 100644 --- a/tgui/packages/tgui/interfaces/Filteriffic.jsx +++ b/tgui/packages/tgui/interfaces/Filteriffic.jsx @@ -22,7 +22,6 @@ const FilterIntegerEntry = (props) => { const { act } = useBackend(); return ( { return ( <> { )); }; +const FilterOptionsEntry = (props) => { + const { name, value, filterName, filterType } = props; + const { act, data } = useBackend(); + const filterInfo = data.filter_info; + const options = filterInfo[filterType].options[name]; + return ( + value === options[x])} + options={Object.keys(options)} + onSelected={(value) => + act('modify_filter_value', { + name: filterName, + new_data: { + [name]: options[value], + }, + }) + } + /> + ); +}; + const FilterDataEntry = (props) => { - const { name, value, hasValue, filterName } = props; + const { name, value, hasValue, filterName, filterType } = props; const filterEntryTypes = { int: , @@ -184,6 +203,8 @@ const FilterDataEntry = (props) => { color: , icon: , flags: , + options: , + plug: 'Not Implemented', }; const filterEntryMap = { @@ -193,19 +214,32 @@ const FilterDataEntry = (props) => { render_source: 'string', flags: 'flags', size: 'float', - color: 'color', + color: { default: 'color', color: 'plug' }, offset: 'float', - radius: 'float', + radius: 'int', falloff: 'float', density: 'int', - threshold: 'float', + alpha: 'int', + threshold: { rays: 'float', bloom: 'color' }, factor: 'float', repeat: 'int', + space: 'options', + blend_mode: 'options', + transform: 'plug', }; + let filterInputType = filterEntryMap[name]; + // i hate javascript, this checks if its a dict + if (filterInputType !== undefined && filterInputType.constructor === Object) { + filterInputType = filterInputType[filterType] || filterInputType.default; + } + return ( - {filterEntryTypes[filterEntryMap[name]] || 'Not Found (This is an error)'}{' '} + + {filterEntryTypes[filterInputType] || + 'Not Found (This is an error)'}{' '} + {!hasValue && ( (Default) @@ -341,7 +375,11 @@ export const Filteriffic = (props) => { No filters ) : ( map(filters, (entry, key) => ( - + )) )}