File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
src/TSMapEditor/UI/Windows Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -517,6 +517,36 @@ private ScriptActionEntry CreateNewScriptActionEntry(int actionId)
517517
518518 switch ( scriptActionType . ParamType )
519519 {
520+ case TriggerParamType . Quarry :
521+ if ( editedScript != null )
522+ {
523+ // Check if the script action already has an attack quarry action. If yes, default to "attack anything".
524+ if ( editedScript . Actions . Exists ( ae =>
525+ {
526+ var otherScriptActionType = map . EditorConfig . ScriptActions . GetValueOrDefault ( actionId ) ;
527+ if ( otherScriptActionType != null && otherScriptActionType . ParamType == TriggerParamType . Quarry )
528+ {
529+ return true ;
530+ }
531+
532+ return false ;
533+ } ) )
534+ {
535+ entry . Argument = 1 ; // QUARRY_ANY (attack anything)
536+ break ;
537+ }
538+
539+ // Default to a quarry type existing in the name of the action.
540+ for ( int i = 0 ; i < scriptActionType . PresetOptions . Count ; i ++ )
541+ {
542+ if ( editedScript . Name . Contains ( scriptActionType . PresetOptions [ i ] . Text , StringComparison . OrdinalIgnoreCase ) )
543+ {
544+ entry . Argument = i ;
545+ break ;
546+ }
547+ }
548+ }
549+ break ;
520550 case TriggerParamType . Waypoint :
521551 Waypoint wp = map . GetFirstUnusedWaypoint ( ) ;
522552 if ( wp != null )
You can’t perform that action at this time.
0 commit comments