placementghosts now change when you change the targeted recipe
This commit is contained in:
@@ -320,6 +320,7 @@ namespace Content.Client.Construction
|
|||||||
private void RecipeSelected(ItemList.ItemListSelectedEventArgs obj)
|
private void RecipeSelected(ItemList.ItemListSelectedEventArgs obj)
|
||||||
{
|
{
|
||||||
_selected = (ConstructionPrototype) obj.ItemList[obj.ItemIndex].Metadata!;
|
_selected = (ConstructionPrototype) obj.ItemList[obj.ItemIndex].Metadata!;
|
||||||
|
if(_placementManager.IsActive && !_placementManager.Eraser) UpdateGhostPlacement();
|
||||||
PopulateInfo(_selected);
|
PopulateInfo(_selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,7 +345,7 @@ namespace Content.Client.Construction
|
|||||||
{
|
{
|
||||||
if (args.Pressed)
|
if (args.Pressed)
|
||||||
{
|
{
|
||||||
if (_selected == null) return;
|
if(_selected == null) return;
|
||||||
|
|
||||||
var constructSystem = EntitySystem.Get<ConstructionSystem>();
|
var constructSystem = EntitySystem.Get<ConstructionSystem>();
|
||||||
|
|
||||||
@@ -355,11 +356,7 @@ namespace Content.Client.Construction
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_placementManager.BeginPlacing(new PlacementInformation()
|
UpdateGhostPlacement();
|
||||||
{
|
|
||||||
IsTile = false,
|
|
||||||
PlacementOption = _selected.PlacementMode,
|
|
||||||
}, new ConstructionPlacementHijack(constructSystem, _selected));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -369,6 +366,21 @@ namespace Content.Client.Construction
|
|||||||
BuildButton.Pressed = args.Pressed;
|
BuildButton.Pressed = args.Pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateGhostPlacement()
|
||||||
|
{
|
||||||
|
if (_selected == null || _selected.Type != ConstructionType.Structure) return;
|
||||||
|
|
||||||
|
var constructSystem = EntitySystem.Get<ConstructionSystem>();
|
||||||
|
|
||||||
|
_placementManager.BeginPlacing(new PlacementInformation()
|
||||||
|
{
|
||||||
|
IsTile = false,
|
||||||
|
PlacementOption = _selected.PlacementMode,
|
||||||
|
}, new ConstructionPlacementHijack(constructSystem, _selected));
|
||||||
|
|
||||||
|
BuildButton.Pressed = true;
|
||||||
|
}
|
||||||
|
|
||||||
private void EraseButtonToggled(BaseButton.ButtonToggledEventArgs args)
|
private void EraseButtonToggled(BaseButton.ButtonToggledEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.Pressed) _placementManager.Clear();
|
if (args.Pressed) _placementManager.Clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user