@@ -4,6 +4,10 @@ import { ExpressionContext, Expressions } from '../../../expressions/expressions
44import { ResourcePipeline , ResourceRequest } from '../../../pipelines/resource-pipeline.mjs' ;
55import { RuleActionDataModel } from './rule-action-data-model.mjs' ;
66import { SETTINGS } from '../../../settings.js' ;
7+ import { CommonSections } from '../../../checks/common-sections.mjs' ;
8+ import { ChatSectionOrder } from '../../../checks/default-section-order.mjs' ;
9+ import { Pipeline } from '../../../pipelines/pipeline.mjs' ;
10+ import { Flags } from '../../../helpers/flags.mjs' ;
711
812const fields = foundry . data . fields ;
913
@@ -48,12 +52,18 @@ export class UpdateResourceRuleAction extends RuleActionDataModel {
4852 const request = new ResourceRequest ( context . sourceInfo , targets , this . resource , amount ) ;
4953 request . fromOrigin ( context . origin ) ;
5054
55+ const targetAction = ResourcePipeline . getTargetedAction ( request ) ;
56+ if ( selected . length === 1 && selected [ 0 ] === context . character ) {
57+ targetAction . forActor ( context . character . actor ) ;
58+ }
59+
5160 if ( context . config ) {
52- const targetAction = ResourcePipeline . getTargetedAction ( request ) ;
53- if ( selected . length === 1 && selected [ 0 ] === context . character ) {
54- targetAction . forActor ( context . character . actor ) ;
55- }
5661 context . config . addTargetedAction ( targetAction ) ;
62+ } else if ( context . renderData ) {
63+ let flags = Pipeline . initializedFlags ( Flags . ChatMessage . Source , context . sourceInfo ) ;
64+ flags = Pipeline . setFlag ( flags , Flags . ChatMessage . Item , context . item . uuid ) ;
65+ context . renderData . flags = flags ;
66+ CommonSections . chatActions ( context . renderData . sections , [ targetAction ] , flags , ChatSectionOrder . actions ) ;
5767 }
5868
5969 if ( game . settings . get ( SYSTEM , SETTINGS . automationApplyDamage ) ) {
0 commit comments