1+ import { CombatHUD } from './ui/combat-hud.mjs' ;
2+
13export const SYSTEM = 'projectfu' ;
24
35export const SETTINGS = Object . freeze ( {
@@ -27,6 +29,7 @@ export const SETTINGS = Object.freeze({
2729 optionCombatHudReordering : 'optionCombatHudReordering' ,
2830 optionCombatHudShowOrderNumbers : 'optionCombatHudShowOrderNumbers' ,
2931 optionCombatHudActorOrdering : 'optionCombatHudActorOrdering' ,
32+ optionCombatHudDraggedPosition : 'optionCombatHudDraggedPosition' ,
3033} ) ;
3134
3235export const registerSystemSettings = async function ( ) {
@@ -175,16 +178,15 @@ export const registerSystemSettings = async function () {
175178 name : game . i18n . localize ( 'FU.ExperimentalCombatHudSettings' ) ,
176179 hint : game . i18n . localize ( 'FU.ExperimentalCombatHudSettingsHint' ) ,
177180 label : game . i18n . localize ( 'FU.ExperimentalCombatHudSettingsLabel' ) ,
178- scope : 'world ' ,
181+ scope : 'client ' ,
179182 icon : 'fas fa-book' ,
180- restricted : true ,
181183 type : CombatHudSettings ,
182184 } ) ;
183185
184186 game . settings . register ( SYSTEM , SETTINGS . experimentalCombatHud , {
185187 name : game . i18n . localize ( 'FU.ExperimentalCombatHud' ) ,
186188 hint : game . i18n . localize ( 'FU.ExperimentalCombatHudHint' ) ,
187- scope : 'world ' ,
189+ scope : 'client ' ,
188190 config : false ,
189191 type : Boolean ,
190192 default : false ,
@@ -194,7 +196,7 @@ export const registerSystemSettings = async function () {
194196 game . settings . register ( SYSTEM , SETTINGS . optionCombatHudOpacity , {
195197 name : game . i18n . localize ( 'FU.CombatHudOpacity' ) ,
196198 hint : game . i18n . localize ( 'FU.CombatHudOpacityHint' ) ,
197- scope : 'local ' ,
199+ scope : 'client ' ,
198200 config : false ,
199201 type : Number ,
200202 default : 100 ,
@@ -204,7 +206,7 @@ export const registerSystemSettings = async function () {
204206 game . settings . register ( SYSTEM , SETTINGS . optionCombatHudWidth , {
205207 name : game . i18n . localize ( 'FU.CombatHudWidth' ) ,
206208 hint : game . i18n . localize ( 'FU.CombatHudWidthHint' ) ,
207- scope : 'local ' ,
209+ scope : 'client ' ,
208210 config : false ,
209211 type : Number ,
210212 default : 100 ,
@@ -214,7 +216,7 @@ export const registerSystemSettings = async function () {
214216 game . settings . register ( SYSTEM , SETTINGS . optionCombatHudPosition , {
215217 name : game . i18n . localize ( 'FU.CombatHudPosition' ) ,
216218 hint : game . i18n . localize ( 'FU.CombatHudPositionHint' ) ,
217- scope : 'local ' ,
219+ scope : 'client ' ,
218220 config : false ,
219221 type : String ,
220222 default : 'bottom' ,
@@ -228,7 +230,7 @@ export const registerSystemSettings = async function () {
228230 game . settings . register ( SYSTEM , SETTINGS . optionCombatHudPortrait , {
229231 name : game . i18n . localize ( 'FU.CombatHudPortrait' ) ,
230232 hint : game . i18n . localize ( 'FU.CombatHudPortraitHint' ) ,
231- scope : 'world ' ,
233+ scope : 'client ' ,
232234 config : false ,
233235 type : String ,
234236 default : 'actor' ,
@@ -241,15 +243,15 @@ export const registerSystemSettings = async function () {
241243
242244 game . settings . register ( SYSTEM , SETTINGS . optionCombatHudCompact , {
243245 name : "CombatHudCompact" ,
244- scope : 'local ' ,
246+ scope : 'client ' ,
245247 config : false ,
246248 type : Boolean ,
247249 default : false ,
248250 } ) ;
249251
250252 game . settings . register ( SYSTEM , SETTINGS . optionCombatHudMinimized , {
251253 name : "CombatHudMinimized" ,
252- scope : 'local ' ,
254+ scope : 'client ' ,
253255 config : false ,
254256 type : Boolean ,
255257 default : false ,
@@ -258,7 +260,7 @@ export const registerSystemSettings = async function () {
258260 game . settings . register ( SYSTEM , SETTINGS . optionCombatHudShowEffects , {
259261 name : game . i18n . localize ( 'FU.CombatHudShowEffects' ) ,
260262 hint : game . i18n . localize ( 'FU.CombatHudShowEffectsHint' ) ,
261- scope : 'local ' ,
263+ scope : 'client ' ,
262264 config : false ,
263265 type : Boolean ,
264266 default : true ,
@@ -267,7 +269,7 @@ export const registerSystemSettings = async function () {
267269 game . settings . register ( SYSTEM , SETTINGS . optionCombatHudEffectsMarqueeDuration , {
268270 name : game . i18n . localize ( 'FU.CombatHudEffectsMarqueeDuration' ) ,
269271 hint : game . i18n . localize ( 'FU.CombatHudEffectsMarqueeDurationHint' ) ,
270- scope : 'local ' ,
272+ scope : 'client ' ,
271273 config : false ,
272274 type : Number ,
273275 default : 15 ,
@@ -276,7 +278,7 @@ export const registerSystemSettings = async function () {
276278 game . settings . register ( SYSTEM , SETTINGS . optionCombatHudEffectsMarqueeMode , {
277279 name : game . i18n . localize ( 'FU.CombatHudEffectsMarqueeMode' ) ,
278280 hint : game . i18n . localize ( 'FU.CombatHudEffectsMarqueeModeHint' ) ,
279- scope : 'local ' ,
281+ scope : 'client ' ,
280282 config : false ,
281283 type : String ,
282284 default : 'alternate' ,
@@ -289,7 +291,7 @@ export const registerSystemSettings = async function () {
289291 game . settings . register ( SYSTEM , SETTINGS . optionCombatHudReordering , {
290292 name : game . i18n . localize ( 'FU.CombatHudReordering' ) ,
291293 hint : game . i18n . localize ( 'FU.CombatHudReorderingHint' ) ,
292- scope : 'global ' ,
294+ scope : 'world ' ,
293295 config : false ,
294296 type : Boolean ,
295297 default : false ,
@@ -299,21 +301,32 @@ export const registerSystemSettings = async function () {
299301 game . settings . register ( SYSTEM , SETTINGS . optionCombatHudShowOrderNumbers , {
300302 name : game . i18n . localize ( 'FU.CombatHudShowOrderNumbers' ) ,
301303 hint : game . i18n . localize ( 'FU.CombatHudShowOrderNumbersHint' ) ,
302- scope : 'global ' ,
304+ scope : 'client ' ,
303305 config : false ,
304306 type : Boolean ,
305307 default : false ,
306- restricted : true ,
307308 } ) ;
308309
309310 game . settings . register ( SYSTEM , SETTINGS . optionCombatHudActorOrdering , {
310311 name : game . i18n . localize ( 'FU.CombatHudActorOrdering' ) ,
311312 hint : game . i18n . localize ( 'FU.CombatHudActorOrderingHint' ) ,
312- scope : 'global ' ,
313+ scope : 'world ' ,
313314 config : false ,
314315 type : Array ,
315316 default : [ ] ,
316317 restricted : true ,
318+ onChange : value => {
319+ CombatHUD . update ( ) ;
320+ }
321+ } ) ;
322+
323+ game . settings . register ( SYSTEM , SETTINGS . optionCombatHudDraggedPosition , {
324+ name : game . i18n . localize ( 'FU.CombatHudDraggedPosition' ) ,
325+ hint : game . i18n . localize ( 'FU.CombatHudDraggedPositionHint' ) ,
326+ scope : 'client' ,
327+ config : false ,
328+ type : Object ,
329+ default : { } ,
317330 } ) ;
318331} ;
319332
@@ -380,33 +393,58 @@ class CombatHudSettings extends FormApplication {
380393 optionCombatHudEffectsMarqueeMode : game . settings . get ( SYSTEM , SETTINGS . optionCombatHudEffectsMarqueeMode ) ,
381394 optionCombatHudReordering : game . settings . get ( SYSTEM , SETTINGS . optionCombatHudReordering ) ,
382395 optionCombatHudShowOrderNumbers : game . settings . get ( SYSTEM , SETTINGS . optionCombatHudShowOrderNumbers ) ,
396+ isGM : game . user . isGM ,
383397 }
384398 }
385399
386400 async _updateObject ( event , formData ) {
387- const {
388- experimentalCombatHud,
389- optionCombatHudOpacity,
390- optionCombatHudWidth,
391- optionCombatHudPosition,
392- optionCombatHudPortrait,
393- optionCombatHudShowEffects,
394- optionCombatHudEffectsMarqueeDuration,
395- optionCombatHudEffectsMarqueeMode,
396- optionCombatHudReordering,
397- optionCombatHudShowOrderNumbers,
398- } = expandObject ( formData ) ;
399-
400- game . settings . set ( SYSTEM , SETTINGS . experimentalCombatHud , experimentalCombatHud ) ;
401- game . settings . set ( SYSTEM , SETTINGS . optionCombatHudOpacity , optionCombatHudOpacity ) ;
402- game . settings . set ( SYSTEM , SETTINGS . optionCombatHudWidth , optionCombatHudWidth ) ;
403- game . settings . set ( SYSTEM , SETTINGS . optionCombatHudPosition , optionCombatHudPosition ) ;
404- game . settings . set ( SYSTEM , SETTINGS . optionCombatHudPortrait , optionCombatHudPortrait ) ;
405- game . settings . set ( SYSTEM , SETTINGS . optionCombatHudShowEffects , optionCombatHudShowEffects ) ;
406- game . settings . set ( SYSTEM , SETTINGS . optionCombatHudEffectsMarqueeDuration , optionCombatHudEffectsMarqueeDuration ) ;
407- game . settings . set ( SYSTEM , SETTINGS . optionCombatHudEffectsMarqueeMode , optionCombatHudEffectsMarqueeMode ) ;
408- game . settings . set ( SYSTEM , SETTINGS . optionCombatHudReordering , optionCombatHudReordering ) ;
409- game . settings . set ( SYSTEM , SETTINGS . optionCombatHudShowOrderNumbers , optionCombatHudShowOrderNumbers ) ;
401+ if ( game . user . isGM ) {
402+ const {
403+ experimentalCombatHud,
404+ optionCombatHudOpacity,
405+ optionCombatHudWidth,
406+ optionCombatHudPosition,
407+ optionCombatHudPortrait,
408+ optionCombatHudShowEffects,
409+ optionCombatHudEffectsMarqueeDuration,
410+ optionCombatHudEffectsMarqueeMode,
411+ optionCombatHudReordering,
412+ optionCombatHudShowOrderNumbers,
413+ } = expandObject ( formData ) ;
414+
415+ game . settings . set ( SYSTEM , SETTINGS . experimentalCombatHud , experimentalCombatHud ) ;
416+ game . settings . set ( SYSTEM , SETTINGS . optionCombatHudOpacity , optionCombatHudOpacity ) ;
417+ game . settings . set ( SYSTEM , SETTINGS . optionCombatHudWidth , optionCombatHudWidth ) ;
418+ game . settings . set ( SYSTEM , SETTINGS . optionCombatHudPosition , optionCombatHudPosition ) ;
419+ game . settings . set ( SYSTEM , SETTINGS . optionCombatHudPortrait , optionCombatHudPortrait ) ;
420+ game . settings . set ( SYSTEM , SETTINGS . optionCombatHudShowEffects , optionCombatHudShowEffects ) ;
421+ game . settings . set ( SYSTEM , SETTINGS . optionCombatHudEffectsMarqueeDuration , optionCombatHudEffectsMarqueeDuration ) ;
422+ game . settings . set ( SYSTEM , SETTINGS . optionCombatHudEffectsMarqueeMode , optionCombatHudEffectsMarqueeMode ) ;
423+ game . settings . set ( SYSTEM , SETTINGS . optionCombatHudReordering , optionCombatHudReordering ) ;
424+ game . settings . set ( SYSTEM , SETTINGS . optionCombatHudShowOrderNumbers , optionCombatHudShowOrderNumbers ) ;
425+ } else {
426+ const {
427+ experimentalCombatHud,
428+ optionCombatHudOpacity,
429+ optionCombatHudWidth,
430+ optionCombatHudPosition,
431+ optionCombatHudPortrait,
432+ optionCombatHudShowEffects,
433+ optionCombatHudEffectsMarqueeDuration,
434+ optionCombatHudEffectsMarqueeMode,
435+ optionCombatHudShowOrderNumbers,
436+ } = expandObject ( formData ) ;
437+
438+ game . settings . set ( SYSTEM , SETTINGS . experimentalCombatHud , experimentalCombatHud ) ;
439+ game . settings . set ( SYSTEM , SETTINGS . optionCombatHudOpacity , optionCombatHudOpacity ) ;
440+ game . settings . set ( SYSTEM , SETTINGS . optionCombatHudWidth , optionCombatHudWidth ) ;
441+ game . settings . set ( SYSTEM , SETTINGS . optionCombatHudPosition , optionCombatHudPosition ) ;
442+ game . settings . set ( SYSTEM , SETTINGS . optionCombatHudPortrait , optionCombatHudPortrait ) ;
443+ game . settings . set ( SYSTEM , SETTINGS . optionCombatHudShowEffects , optionCombatHudShowEffects ) ;
444+ game . settings . set ( SYSTEM , SETTINGS . optionCombatHudEffectsMarqueeDuration , optionCombatHudEffectsMarqueeDuration ) ;
445+ game . settings . set ( SYSTEM , SETTINGS . optionCombatHudEffectsMarqueeMode , optionCombatHudEffectsMarqueeMode ) ;
446+ game . settings . set ( SYSTEM , SETTINGS . optionCombatHudShowOrderNumbers , optionCombatHudShowOrderNumbers ) ;
447+ }
410448
411449 const isCustomTrackerActive = game . settings . get ( SYSTEM , SETTINGS . experimentalCombatTracker ) ;
412450 if ( ! isCustomTrackerActive && experimentalCombatHud ) {
@@ -420,6 +458,6 @@ class CombatHudSettings extends FormApplication {
420458 }
421459 }
422460
423- await SettingsConfig . reloadConfirm ( { world : true } ) ;
461+ await SettingsConfig . reloadConfirm ( { world : game . user . isGM } ) ;
424462 }
425463}
0 commit comments