/*Fog Plugin - DMS2 - November 99 - by Sébastien DENEUX*/ typeof class=S;; var configPath="locked/conf/fog/";;/*path used to save current fog state and reload it when restarting server*/ var fogEnable=1;; /*-------------*/ fun saveConf(o)= let strcatn configPath::(substr this.fileDMI 0 (strfind "." this.fileDMI 1))::"_"::(ObName o)::".conf"::nil -> configFileName in _storepack strbuild ("state"::(itoa fogEnable)::nil)::nil configFileName; 0;; /*-------------*/ fun activate(o,from,cli,action,param,reply)= if !strcmp action (strcat (ObName o) ".enableFogS") then ( UsendCli this nil (ObUi o) "setFog" "1"; set fogEnable=1; saveConf o ) else if !strcmp action (strcat (ObName o) ".disableFogS") then ( UsendCli this nil (ObUi o) "setFog" "0"; set fogEnable=0; saveConf o ) else nil;; /*-------------*/ fun cbcomm(ui,cli,action,param,o)= if !strcmp action "fog?" then UsendCli this cli (ObUi o) "setFog" itoa fogEnable else nil;; /*-------------*/ fun newOb(o)= if !strcmp hd UgetParam ObUi o "keepDynamicChanges" "1" then let strextr _getpack _checkpack strcatn configPath::(substr this.fileDMI 0 (strfind "." this.fileDMI 1))::"_"::(ObName o)::".conf"::nil -> l in let getInfo l "state" -> tmp in if !strcmp tmp "0" then set fogEnable=0 else if !strcmp tmp "1" then nil else (if !strcmp hd UgetParam ObUi o "initState" "0" then set fogEnable=0 else nil; saveConf o) else if !strcmp hd UgetParam ObUi o "initState" "0" then set fogEnable=0 else nil; UcbComm this ObUi o mkfun5 @cbcomm o; ObRegisterAction o (strcatn (ObName o)::".enableFogS"::nil) @activate; ObRegisterAction o (strcatn (ObName o)::".disableFogS"::nil) @activate; 0;; /*-------------*/ fun IniPlug(file)= set class=getInfo strextr _getpack _checkpack file "name"; PlugRegister class @newOb nil; 0;;