add hidechaticon
This commit is contained in:
@@ -17,6 +17,7 @@ export interface RisuModule{
|
||||
trigger?: triggerscript[]
|
||||
id: string
|
||||
lowLevelAccess?: boolean
|
||||
hideIcon?: boolean
|
||||
}
|
||||
|
||||
export async function exportModule(module:RisuModule){
|
||||
|
||||
@@ -826,6 +826,7 @@ export interface character{
|
||||
}>
|
||||
defaultVariables?:string
|
||||
lowLevelAccess?:boolean
|
||||
hideChatIcon?:boolean
|
||||
}
|
||||
|
||||
|
||||
@@ -873,6 +874,7 @@ export interface groupChat{
|
||||
nickname?:string
|
||||
defaultVariables?:string
|
||||
lowLevelAccess?:boolean
|
||||
hideChatIcon?:boolean
|
||||
}
|
||||
|
||||
export interface botPreset{
|
||||
|
||||
@@ -3,6 +3,7 @@ import { DataBase, type Chat, type character, type groupChat } from "./storage/d
|
||||
import { isEqual } from "lodash";
|
||||
import type { simpleCharacterArgument } from "./parser";
|
||||
import { sleep } from "./util";
|
||||
import { getModules } from "./process/modules";
|
||||
|
||||
function updateSize(){
|
||||
SizeStore.set({
|
||||
@@ -39,6 +40,11 @@ export const CurrentVariablePointer = writable({} as {[key:string]: string|numbe
|
||||
export const OpenRealmStore = writable(false)
|
||||
export const ShowRealmFrameStore = writable('')
|
||||
export const PlaygroundStore = writable(0)
|
||||
export const HideIconStore = writable(false)
|
||||
let lastGlobalEnabledModules: string[] = []
|
||||
let lastChatEnabledModules: string[] = []
|
||||
let moduleHideIcon = false
|
||||
let characterHideIcon = false
|
||||
|
||||
function createSimpleCharacter(char:character|groupChat){
|
||||
if((!char) || char.type === 'group'){
|
||||
@@ -133,6 +139,11 @@ async function preInit(){
|
||||
if(data.showMemoryLimit !== get(CurrentShowMemoryLimit)){
|
||||
CurrentShowMemoryLimit.set(data.showMemoryLimit)
|
||||
}
|
||||
if(!isEqual(data.enabledModules, lastGlobalEnabledModules)){
|
||||
lastGlobalEnabledModules = data.enabledModules
|
||||
onModuleUpdate()
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
selectedCharID.subscribe((id) => {
|
||||
@@ -144,6 +155,11 @@ async function preInit(){
|
||||
updateCurrentChat()
|
||||
let db = get(DataBase)
|
||||
let charId = get(selectedCharID)
|
||||
if(char.hideChatIcon !== characterHideIcon){
|
||||
characterHideIcon = char.hideChatIcon
|
||||
HideIconStore.set(characterHideIcon || moduleHideIcon)
|
||||
}
|
||||
|
||||
if(charId === -1 || charId > db.characters.length){
|
||||
return
|
||||
}
|
||||
@@ -165,6 +181,12 @@ async function preInit(){
|
||||
}
|
||||
}
|
||||
|
||||
if(!isEqual(lastChatEnabledModules, chat?.modules)){
|
||||
lastChatEnabledModules = chat?.modules
|
||||
onModuleUpdate()
|
||||
return
|
||||
}
|
||||
|
||||
const variablePointer = get(CurrentVariablePointer)
|
||||
const currentState = structuredClone(chat?.scriptstate)
|
||||
|
||||
@@ -174,6 +196,20 @@ async function preInit(){
|
||||
})
|
||||
}
|
||||
|
||||
function onModuleUpdate(){
|
||||
const m = getModules([
|
||||
...lastGlobalEnabledModules, ...lastChatEnabledModules
|
||||
])
|
||||
|
||||
let moduleHideIcon = false
|
||||
m.forEach((module) => {
|
||||
if(module.hideIcon){
|
||||
moduleHideIcon = true
|
||||
}
|
||||
})
|
||||
|
||||
HideIconStore.set(characterHideIcon || moduleHideIcon)
|
||||
}
|
||||
|
||||
updateSize()
|
||||
window.addEventListener("resize", updateSize);
|
||||
|
||||
Reference in New Issue
Block a user