Browse Source

Merge pull request #821 from Areloch/MiscFixes20220620

Misc Fixes 2022/06/20
Brian Roberts 3 years ago
parent
commit
a08543d5dd

+ 13 - 0
Templates/BaseGame/game/data/Prototyping/shapes/Player/Playerbot.tscript

@@ -10,3 +10,16 @@ singleton TSShapeConstructor(Playerbotdae)
    removeRedundantMats = "0";
    removeRedundantMats = "0";
    animFPS = "2";
    animFPS = "2";
 };
 };
+
+function Playerbotdae::onLoad(%this)
+{
+   %this.addSequence("ambient", "Root", "0", "30", "1", "0");
+   %this.addSequence("ambient", "Run", "31", "50", "1", "0");
+   %this.addSequence("ambient", "Back", "51", "70", "1", "0");
+   %this.addSequence("ambient", "Side", "71", "90", "1", "0");
+   %this.addSequence("ambient", "Crouch_Root", "91", "120", "1", "0");
+   %this.addSequence("ambient", "Look", "121", "122", "1", "0");
+   %this.setSequenceCyclic("Look", "0");
+   %this.setSequenceBlend("Look", "0", "", "0");
+   %this.setSequenceBlend("Look", "1", "ambient", "121");
+}

+ 26 - 16
Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript

@@ -110,7 +110,7 @@ function OptionsMenu::onOpen(%this)
    OptionsMenuCategoryList.setAsActiveMenuList();
    OptionsMenuCategoryList.setAsActiveMenuList();
    
    
    $activeMenuButtonContainer-->button1.set("btn_back", "R", "Reset", "OptionsMenu.resetToDefaults();");
    $activeMenuButtonContainer-->button1.set("btn_back", "R", "Reset", "OptionsMenu.resetToDefaults();");
-   $activeMenuButtonContainer-->button1.disable();
+   $activeMenuButtonContainer-->button2.disable();
    $activeMenuButtonContainer-->button3.set("", "Space", "Apply", "OptionsMenu.apply();");
    $activeMenuButtonContainer-->button3.set("", "Space", "Apply", "OptionsMenu.apply();");
    $activeMenuButtonContainer-->button4.set("btn_a", "", "Select", "OptionsMenu.select();");
    $activeMenuButtonContainer-->button4.set("btn_a", "", "Select", "OptionsMenu.select();");
    $activeMenuButtonContainer-->button5.set("btn_b", "Escape", "Back", %this @ ".navigation.popPage();");
    $activeMenuButtonContainer-->button5.set("btn_b", "Escape", "Back", %this @ ".navigation.popPage();");
@@ -130,7 +130,6 @@ function OptionsMenu::canClose(%this)
    if(OptionsMenuSettingsList.isActiveMenuList())
    if(OptionsMenuSettingsList.isActiveMenuList())
    {
    {
    OptionsMenuCategoryList.setAsActiveMenuList();
    OptionsMenuCategoryList.setAsActiveMenuList();
-      %this.updateSelectButton();
       return false;
       return false;
    }
    }
    else
    else
@@ -168,19 +167,6 @@ function OptionsMenu::select(%this)
    if(OptionsMenuCategoryList.isActiveMenuList())
    if(OptionsMenuCategoryList.isActiveMenuList())
    {
    {
       OptionsMenuSettingsList.setAsActiveMenuList();
       OptionsMenuSettingsList.setAsActiveMenuList();
-      %this.updateSelectButton();
-   }
-}
-
-function OptionsMenu::updateSelectButton(%this)
-{
-   if(OptionsMenuCategoryList.isActiveMenuList())
-   {
-      %this-->selectButton.setHidden(false);
-   }
-   else if(OptionsMenuSettingsList.isActiveMenuList())
-   {
-      %this-->selectButton.setHidden(true);
    }
    }
 }
 }
 
 
@@ -763,7 +749,8 @@ function populateGamepadSettingsList()
 //
 //
 function OptionsMenuList::activateRow(%this)
 function OptionsMenuList::activateRow(%this)
 {
 {
-   OptionsMenuSettingsList.setFirstResponder();
+   //OptionsMenuSettingsList.setFirstResponder();
+   OptionsMenuSettingsList.setAsActiveMenuList();
 }
 }
 
 
 function OptionsMenuSettingsList::setRowEnabled(%this, %row, %status)
 function OptionsMenuSettingsList::setRowEnabled(%this, %row, %status)
@@ -798,6 +785,29 @@ function OptionsMenuSettingsList::addOptionRow(%this, %label, %targetPrefVar, %o
    
    
    %option.targetPrefVar = %targetPrefVar; //create a var-option association
    %option.targetPrefVar = %targetPrefVar; //create a var-option association
    
    
+   if(%defaultValue $= "")
+   {
+      %unappliedPrefIndex = OptionsMenu.unappliedChanges.getIndexFromKey(%targetPrefVar);
+      if(%unappliedPrefIndex != -1)
+      {
+            %value = OptionsMenu.unappliedChanges.getValue(%unappliedPrefIndex);
+            %defaultValue = strreplace(%value, "\"", "");
+      }
+   
+      if(%defaultValue $= "")
+      {
+         %sanitizedVar = strReplace(%targetPrefVar, "[", "");
+         %sanitizedVar = strReplace(%sanitizedVar, "]", "");
+         %sanitizedVar = strReplace(%sanitizedVar, ",", "_");
+         %defaultValue = getVariable(%sanitizedVar);
+      }
+   }
+   
+   if(%defaultValue $= "Off" || %defaultValue $= "No")
+      %defaultValue = "0";
+   if(%defaultValue $= "On" || %defaultValue $= "Yes")
+      %defaultValue = "1";
+   
    %option.setListSetting(%label, %optionsList, %wrapOptions, %callback, %enabled, %description, %defaultValue);
    %option.setListSetting(%label, %optionsList, %wrapOptions, %callback, %enabled, %description, %defaultValue);
 
 
    %this.add(%option);
    %this.add(%option);

+ 1 - 1
Templates/BaseGame/game/data/UI/guis/pauseMenu.gui

@@ -17,7 +17,7 @@ $guiContent = new GuiControl(PauseMenu) {
       isContainer = "1";
       isContainer = "1";
       canSaveDynamicFields = "1";
       canSaveDynamicFields = "1";
    };
    };
-   new GuiControl() {
+   new GuiControl(PauseMenuButtons) {
       position = "162 125";
       position = "162 125";
       extent = "700 518";
       extent = "700 518";
       horizSizing = "center";
       horizSizing = "center";

+ 38 - 33
Templates/BaseGame/game/data/UI/guis/pauseMenu.tscript

@@ -7,8 +7,16 @@ function PauseMenu::onWake(%this)
       sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ 0 ] );
       sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ 0 ] );
    }
    }
    
    
-   PauseMenuList.hidden = false;
+   PauseButtonHolder.setActive();
+   PauseMenuInputHandler.setFirstResponder();
+   
+   %this.resizePages = true;
    
    
+   %this.setRootPage(PauseMenuButtons);
+}
+
+function PauseMenuButtons::onOpen(%this)
+{
    PauseMenuList.clear();
    PauseMenuList.clear();
    
    
    if($Tools::loaded && EditorIsActive())
    if($Tools::loaded && EditorIsActive())
@@ -21,13 +29,39 @@ function PauseMenu::onWake(%this)
    %this.addPauseMenuButton("Exit to Desktop", "pauseMenuExitToDesktop();"); 
    %this.addPauseMenuButton("Exit to Desktop", "pauseMenuExitToDesktop();"); 
    
    
    PauseMenuList.setAsActiveMenuList();
    PauseMenuList.setAsActiveMenuList();
-   PauseButtonHolder.setActive();
-   PauseMenuInputHandler.setFirstResponder();
    
    
-   %this.resizePages = true;
+   $activeMenuButtonContainer-->button1.disable();
+   $activeMenuButtonContainer-->button2.disable();
+   $activeMenuButtonContainer-->button3.disable();
+   $activeMenuButtonContainer-->button4.set("btn_a", "", "OK", "PauseMenuList.activate();");
+   $activeMenuButtonContainer-->button5.set("btn_b", "Escape", "Back", "Canvas.popDialog();");
 }
 }
 
 
+function PauseMenuButtons::addPauseMenuButton(%this, %buttonText, %buttonCallback)
+{
+   %newButton = new GuiButtonCtrl() {
+      text = %buttonText;
+      groupNum = "-1";
+      buttonType = "PushButton";
+      useMouseEvents = "0";
+      position = "0 0";
+      extent = "400 55";
+      minExtent = "8 2";
+      horizSizing = "right";
+      vertSizing = "bottom";
+      profile = "GuiMenuButtonProfile";
+      visible = "1";
+      active = "1";
+      command = %buttonCallback;
+      tooltipProfile = "GuiToolTipProfile";
+      hovertime = "1000";
+      isContainer = "0";
+      canSave = "1";
+      canSaveDynamicFields = "0";
+   };
 
 
+   PauseMenuList.add(%newButton);
+}
 function PauseMenu::onSleep(%this)
 function PauseMenu::onSleep(%this)
 {
 {
    if($Server::ServerType $= "SinglePlayer")
    if($Server::ServerType $= "SinglePlayer")
@@ -54,35 +88,6 @@ function pauseMenuExitToDesktop()
 
 
 function PauseButtonHolder::onWake(%this)
 function PauseButtonHolder::onWake(%this)
 {
 {
-   %this-->button1.disable();
-   %this-->button2.disable();
-   %this-->button3.disable();
-   %this-->button4.set("btn_a", "", "OK", "PauseMenuList.activate();");
-   %this-->button4.set("btn_b", "Escape", "Back", "Canvas.popDialog();");
-}
 
 
-function PauseMenu::addPauseMenuButton(%this, %buttonText, %buttonCallback)
-{
-   %newButton = new GuiButtonCtrl() {
-      text = %buttonText;
-      groupNum = "-1";
-      buttonType = "PushButton";
-      useMouseEvents = "0";
-      position = "0 0";
-      extent = "400 55";
-      minExtent = "8 2";
-      horizSizing = "right";
-      vertSizing = "bottom";
-      profile = "GuiMenuButtonProfile";
-      visible = "1";
-      active = "1";
-      command = %buttonCallback;
-      tooltipProfile = "GuiToolTipProfile";
-      hovertime = "1000";
-      isContainer = "0";
-      canSave = "1";
-      canSaveDynamicFields = "0";
-   };
    
    
-   PauseMenuList.add(%newButton);
 }
 }

+ 5 - 2
Templates/BaseGame/game/data/UI/scripts/menuNavigation.tscript

@@ -175,8 +175,11 @@ function UINavigation::popPage(%this, %callback)
    }
    }
    
    
    %newTopPage = %this.getCurrentPage();
    %newTopPage = %this.getCurrentPage();
-   if(%newTopPage.isMethod("onOpen"))
-      %newTopPage.call("onOpen");
+   if(isObject(%newTopPage))
+   {
+   	  if(%newTopPage.isMethod("onOpen"))
+         %newTopPage.call("onOpen");
+   }
    
    
    if(%callback !$= "")
    if(%callback !$= "")
    eval(%callback);
    eval(%callback);

+ 1 - 1
Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditorActions.ed.tscript

@@ -318,7 +318,7 @@ function ShapeEditor::doAddSequence( %this, %seqName, %from, %start, %end )
 
 
 function ActionAddSequence::doit( %this )
 function ActionAddSequence::doit( %this )
 {
 {
-   if(ShapeEditorPlugin.selectedAssetDef $= "")
+   if(ShapeEditorPlugin.selectedAssetDef $= "" || !AssetDatabase.isDeclaredAsset(%this.seqName))
    {
    {
       // If adding this sequence from an existing sequence, make a backup copy of
       // If adding this sequence from an existing sequence, make a backup copy of
       // the existing sequence first, so we can edit the start/end frames later
       // the existing sequence first, so we can edit the start/end frames later