@@ -488,14 +488,25 @@ public void UpdateState(BoundUserInterfaceState state)
488488 OutputEjectButton . Disabled = castState . OutputContainerInfo is null ;
489489 OutputEjectButtonClassic . Disabled = castState . OutputContainerInfo is null ;
490490
491- CreateBottleButton . Disabled = castState . OutputContainerInfo ? . Reagents == null ;
492- CreateBottleButtonClassic . Disabled = castState . OutputContainerInfo ? . Reagents == null ;
491+ var output = castState . OutputContainerInfo ;
492+ var bottleFull = output ? . Reagents != null && output . CurrentVolume >= output . MaxVolume ;
493+ var pillFull = output ? . PillEntities != null && output . CurrentVolume >= output . MaxVolume ;
494+ var patchFull = output ? . PatchEntities != null && output . CurrentVolume >= output . MaxVolume ;
495+
496+ CreateBottleButton . Disabled = castState . OutputContainerInfo ? . Reagents == null || bottleFull ;
497+ CreateBottleButtonClassic . Disabled = castState . OutputContainerInfo ? . Reagents == null || bottleFull ;
498+ CreateBottleButton . ToolTip = ! CreateBottleButton . Disabled ? null : bottleFull ? Loc . GetString ( "chem-master-window-create-bottle-full-tooltip" ) : Loc . GetString ( "chem-master-window-create-bottle-tooltip" ) ;
499+ CreateBottleButtonClassic . ToolTip = ! CreateBottleButtonClassic . Disabled ? null : bottleFull ? Loc . GetString ( "chem-master-window-create-bottle-full-tooltip" ) : Loc . GetString ( "chem-master-window-create-bottle-tooltip" ) ;
493500
494- CreatePillButton . Disabled = castState . OutputContainerInfo ? . PillEntities == null ;
495- CreatePillButtonClassic . Disabled = castState . OutputContainerInfo ? . PillEntities == null ;
501+ CreatePillButton . Disabled = castState . OutputContainerInfo ? . PillEntities == null || pillFull ;
502+ CreatePillButtonClassic . Disabled = castState . OutputContainerInfo ? . PillEntities == null || pillFull ;
503+ CreatePillButton . ToolTip = ! CreatePillButton . Disabled ? null : pillFull ? Loc . GetString ( "chem-master-window-create-pill-full-tooltip" ) : Loc . GetString ( "chem-master-window-create-pill-tooltip" ) ;
504+ CreatePillButtonClassic . ToolTip = ! CreatePillButtonClassic . Disabled ? null : pillFull ? Loc . GetString ( "chem-master-window-create-pill-full-tooltip" ) : Loc . GetString ( "chem-master-window-create-pill-tooltip" ) ;
496505
497- CreatePatchButton . Disabled = castState . OutputContainerInfo ? . PatchEntities == null ;
498- CreatePatchButtonClassic . Disabled = castState . OutputContainerInfo ? . PatchEntities == null ;
506+ CreatePatchButton . Disabled = castState . OutputContainerInfo ? . PatchEntities == null || patchFull ;
507+ CreatePatchButtonClassic . Disabled = castState . OutputContainerInfo ? . PatchEntities == null || patchFull ;
508+ CreatePatchButton . ToolTip = ! CreatePatchButton . Disabled ? null : patchFull ? Loc . GetString ( "chem-master-window-create-patch-full-tooltip" ) : Loc . GetString ( "chem-master-window-create-patch-tooltip" ) ;
509+ CreatePatchButtonClassic . ToolTip = ! CreatePatchButtonClassic . Disabled ? null : patchFull ? Loc . GetString ( "chem-master-window-create-patch-full-tooltip" ) : Loc . GetString ( "chem-master-window-create-patch-tooltip" ) ;
499510
500511 var valveText = Loc . GetString ( castState . ValveOpen
501512 ? "chem-master-window-valve-open"
@@ -585,12 +596,12 @@ private void UpdatePanelInfo(ChemMasterBoundUserInterfaceState state)
585596 // Modern layout containers
586597 BuildContainerUI ( InputContainerInfo , state . InputContainerInfo , true , modernMode : true ) ;
587598 BuildContainerUI ( OutputContainerInfo , state . OutputContainerInfo , false , modernMode : true , "chem-master-window-no-output-container-loaded-text" ) ;
588- BuildContainerUI ( OutputInputContainerInfo , state . InputContainerInfo , false , modernMode : false , "chem-master-window-no-input-container-loaded-text" ) ;
599+ BuildOutputLeftContainer ( OutputInputContainerInfo , state , modernMode : false ) ;
589600
590601 // Classic layout containers
591602 BuildContainerUI ( InputContainerInfoClassic , state . InputContainerInfo , true , modernMode : false ) ;
592603 BuildContainerUI ( OutputContainerInfoClassic , state . OutputContainerInfo , false , modernMode : false , "chem-master-window-no-output-container-loaded-text" ) ;
593- BuildContainerUI ( OutputInputContainerInfoClassic , state . InputContainerInfo , false , modernMode : false , "chem-master-window-no-input-container-loaded-text" ) ;
604+ BuildOutputLeftContainer ( OutputInputContainerInfoClassic , state , modernMode : false ) ;
594605
595606 BufferInfo . Children . Clear ( ) ;
596607 BufferInfoClassic . Children . Clear ( ) ;
@@ -664,6 +675,38 @@ void AddBufferHeader(BoxContainer target)
664675 UpdateReagentPrototypes ( SearchBar . Text ) ;
665676 }
666677
678+ private void BuildOutputLeftContainer ( Control control , ChemMasterBoundUserInterfaceState state , bool modernMode )
679+ {
680+ if ( state . DrawSource == ChemMasterDrawSource . Internal )
681+ {
682+ // Show buffer contents when packaging from buffer
683+ control . Children . Clear ( ) ;
684+ if ( ! state . BufferReagents . Any ( ) )
685+ {
686+ control . Children . Add ( new Label { Text = Loc . GetString ( "chem-master-window-buffer-empty-text" ) } ) ;
687+ return ;
688+ }
689+ control . Children . Add ( new BoxContainer
690+ {
691+ Orientation = LayoutOrientation . Horizontal ,
692+ Children =
693+ {
694+ new Label { Text = $ "{ Loc . GetString ( "chem-master-window-buffer-label" ) } " } ,
695+ new Label { Text = $ "{ state . BufferCurrentVolume } u", StyleClasses = { StyleClass . LabelWeak } }
696+ }
697+ } ) ;
698+ var rowCount = 0 ;
699+ foreach ( var ( reagent , quantity ) in state . BufferReagents )
700+ {
701+ _prototypeManager . TryIndex ( reagent . Prototype , out ReagentPrototype ? proto ) ;
702+ var name = proto ? . LocalizedName ?? Loc . GetString ( "chem-master-window-unknown-reagent-text" ) ;
703+ control . Children . Add ( BuildReagentRow ( default , rowCount ++ , name , reagent , quantity , true , false , modernMode ) ) ;
704+ }
705+ return ;
706+ }
707+ BuildContainerUI ( control , state . InputContainerInfo , false , modernMode , "chem-master-window-no-input-container-loaded-text" ) ;
708+ }
709+
667710 private void BuildContainerUI ( Control control , ContainerInfo ? info , bool addReagentButtons , bool modernMode , string emptyLoc = "chem-master-window-no-container-loaded-text" )
668711 {
669712 control . Children . Clear ( ) ;
0 commit comments