1
0
Pārlūkot izejas kodu

add `actionApply`

Stephan Fuchs 6 mēneši atpakaļ
vecāks
revīzija
4a6ed33a4a

+ 1 - 0
sugarcube/src/actions/act.tw

@@ -52,6 +52,7 @@
 
 	<<if 'action' in _flags>>
 		<<set _flags = Object.assign({},_flags,setup.getGenericActionApplied(_flags.action))>>
+		<<set _act_contents += "<<actionApply '"+_flags.action+"'>>">>
 	<</if>>
 
 	<<if _flags.disabled or _flags.hidden>>

+ 15 - 0
sugarcube/src/actions/genericActions.tw

@@ -0,0 +1,15 @@
+:: genericActionsMacros[widget]
+<<widget 'actionApply'>>
+    <<set [_genericActionId] = _args>>
+    <<set _genericAction = setup.getGenericActionApplied(_genericActionId)>>
+    <<if _actionFameSettings = _genericAction.fame>>
+        <<for _actionFameKey, _actionFameEffect range _actionFameSettings>>
+            <<set [_actionFameLocation, _actionFameType] = _actionFameKey.split('.')>>
+            <<set _actionFameLocation ||= $location.region>>
+            <<fame _actionFameLocation _actionFameType _actionFameEffect>>
+        <</for>>
+    <</if>>
+    <<if _moodletId = _genericAction.moodlet>>
+        <<mood _moodletId>>
+    <</if>>
+<</widget>>