File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ public UserSettings()
3434
3535 Theme ,
3636 UseBoldFont ,
37+ SmartScriptActionCloning ,
3738 AutoSaveInterval ,
3839 SidebarWidth ,
3940
@@ -87,6 +88,7 @@ public async Task SaveSettingsAsync()
8788
8889 public StringSetting Theme = new StringSetting ( General , "Theme" , "Default" ) ;
8990 public BoolSetting UseBoldFont = new BoolSetting ( General , "UseBoldFont" , false ) ;
91+ public BoolSetting SmartScriptActionCloning = new BoolSetting ( General , "SmartScriptActionCloning" , false ) ;
9092 public IntSetting AutoSaveInterval = new IntSetting ( General , "AutoSaveInterval" , 300 ) ;
9193 public IntSetting SidebarWidth = new IntSetting ( General , "SidebarWidth" , 250 ) ;
9294
Original file line number Diff line number Diff line change 1010using TSMapEditor . Models ;
1111using TSMapEditor . Models . Enums ;
1212using TSMapEditor . Rendering ;
13+ using TSMapEditor . Settings ;
1314using TSMapEditor . UI . Controls ;
1415using TSMapEditor . UI . CursorActions ;
1516using TSMapEditor . UI . Notifications ;
@@ -218,6 +219,23 @@ private void CloneAction()
218219 int index = lbActions . SelectedIndex + 1 ;
219220
220221 var clonedEntry = editedScript . Actions [ lbActions . SelectedIndex ] . Clone ( ) ;
222+
223+ // Smart script action cloning
224+ if ( UserSettings . Instance . SmartScriptActionCloning || Keyboard . IsShiftHeldDown ( ) || Keyboard . IsAltHeldDown ( ) )
225+ {
226+ var scriptActionType = map . EditorConfig . ScriptActions [ clonedEntry . Action ] ;
227+
228+ if ( scriptActionType . ParamType == TriggerParamType . Waypoint )
229+ {
230+ int indexOffset = Keyboard . IsAltHeldDown ( ) ? - 1 : 1 ;
231+
232+ if ( map . Waypoints . Exists ( wp => wp . Identifier == clonedEntry . Argument + indexOffset ) )
233+ {
234+ clonedEntry . Argument = clonedEntry . Argument + indexOffset ;
235+ }
236+ }
237+ }
238+
221239 editedScript . Actions . Insert ( index , clonedEntry ) ;
222240 EditScript ( editedScript ) ;
223241 lbActions . SelectedIndex = index ;
You can’t perform that action at this time.
0 commit comments