66 BuildableUnit ,
77 BuildMenuTypes ,
88 Gold ,
9- PlayerActions ,
109 UnitType ,
1110} from "../../../core/game/Game" ;
1211import { TileRef } from "../../../core/game/GameMap" ;
@@ -129,7 +128,7 @@ export class BuildMenu extends LitElement implements Layer {
129128 public eventBus : EventBus ;
130129 public uiState : UIState ;
131130 private clickedTile : TileRef ;
132- public playerActions : PlayerActions | null ;
131+ public playerBuildables : BuildableUnit [ ] | null ;
133132 private filteredBuildTable : BuildItemDisplay [ ] [ ] = buildTable ;
134133 public transformHandler : TransformHandler ;
135134
@@ -360,10 +359,10 @@ export class BuildMenu extends LitElement implements Layer {
360359 private _hidden = true ;
361360
362361 public canBuildOrUpgrade ( item : BuildItemDisplay ) : boolean {
363- if ( this . game ?. myPlayer ( ) === null || this . playerActions === null ) {
362+ if ( this . game ?. myPlayer ( ) === null || this . playerBuildables === null ) {
364363 return false ;
365364 }
366- const buildableUnits = this . playerActions ?. buildableUnits ?? [ ] ;
365+ const buildableUnits = this . playerBuildables ?? [ ] ;
367366 const unit = buildableUnits . filter ( ( u ) => u . type === item . unitType ) ;
368367 if ( unit . length === 0 ) {
369368 return false ;
@@ -372,7 +371,7 @@ export class BuildMenu extends LitElement implements Layer {
372371 }
373372
374373 public cost ( item : BuildItemDisplay ) : Gold {
375- for ( const bu of this . playerActions ?. buildableUnits ?? [ ] ) {
374+ for ( const bu of this . playerBuildables ?? [ ] ) {
376375 if ( bu . type === item . unitType ) {
377376 return bu . cost ;
378377 }
@@ -420,7 +419,7 @@ export class BuildMenu extends LitElement implements Layer {
420419 ( row ) => html `
421420 < div class ="build-row ">
422421 ${ row . map ( ( item ) => {
423- const buildableUnit = this . playerActions ?. buildableUnits . find (
422+ const buildableUnit = this . playerBuildables ? .find (
424423 ( bu ) => bu . type === item . unitType ,
425424 ) ;
426425 if ( buildableUnit === undefined ) {
@@ -493,9 +492,9 @@ export class BuildMenu extends LitElement implements Layer {
493492 private refresh ( ) {
494493 this . game
495494 . myPlayer ( )
496- ?. actions ( this . clickedTile , BuildMenuTypes )
497- . then ( ( actions ) => {
498- this . playerActions = actions ;
495+ ?. buildables ( this . clickedTile , BuildMenuTypes )
496+ . then ( ( buildables ) => {
497+ this . playerBuildables = buildables ;
499498 this . requestUpdate ( ) ;
500499 } ) ;
501500
0 commit comments