fix: error in spawn menu, fixed smoke not working

This commit is contained in:
Pax1601
2025-03-20 19:30:40 +01:00
parent b3e53d07dd
commit 99e742498d
2 changed files with 20 additions and 8 deletions

View File

@@ -306,7 +306,7 @@ export function SpawnContextMenu(props: {}) {
/>
);
})}
{blueprints.length === 0 && <span className={`
{blueprints?.length === 0 && <span className={`
text-gray-200
`}>No aircraft available</span>}
</div>
@@ -356,7 +356,7 @@ export function SpawnContextMenu(props: {}) {
/>
);
})}
{blueprints.length === 0 && <span className={`
{blueprints?.length === 0 && <span className={`
text-gray-200
`}>No helicopter available</span>}
</div>
@@ -409,7 +409,7 @@ export function SpawnContextMenu(props: {}) {
/>
);
})}
{blueprints.length === 0 && <span className={`
{blueprints?.length === 0 && <span className={`
text-gray-200
`}>No air defence unit available</span>}
</div>
@@ -462,7 +462,7 @@ export function SpawnContextMenu(props: {}) {
/>
);
})}
{blueprints.length === 0 && <span className={`
{blueprints?.length === 0 && <span className={`
text-gray-200
`}>No ground unit available</span>}
</div>
@@ -512,7 +512,7 @@ export function SpawnContextMenu(props: {}) {
/>
);
})}
{blueprints.length === 0 && <span className={`
{blueprints?.length === 0 && <span className={`
text-gray-200
`}>No navy unit available</span>}
</div>

View File

@@ -30,11 +30,17 @@ export function EffectSpawnMenu(props: { visible: boolean; compact: boolean; eff
type: props.effect,
explosionType,
});
else if (props.effect === "smoke")
else if (props.effect === "smoke") {
let colorName = "white";
if (smokeColor === colors.BLUE) colorName = "blue";
else if (smokeColor === colors.RED) colorName = "red";
else if (smokeColor === colors.GREEN) colorName = "green";
else if (smokeColor === colors.ORANGE) colorName = "orange";
getApp()?.getMap()?.setEffectRequestTable({
type: props.effect,
smokeColor,
smokeColor: colorName,
});
}
getApp().setState(OlympusState.SPAWN, SpawnSubState.SPAWN_EFFECT);
} else {
if (appState === OlympusState.SPAWN && appSubState === SpawnSubState.SPAWN_EFFECT) getApp().setState(OlympusState.IDLE);
@@ -129,7 +135,13 @@ export function EffectSpawnMenu(props: { visible: boolean; compact: boolean; eff
else if (explosionType === "White phosphorous") getApp().getServerManager().spawnExplosion(50, "phosphorous", props.latlng);
getApp().getMap().addExplosionMarker(props.latlng);
} else if (props.effect === "smoke") {
getApp().getServerManager().spawnSmoke(smokeColor, props.latlng);
/* Find the name of the color */
let colorName = "white";
if (smokeColor === colors.BLUE) colorName = "blue";
else if (smokeColor === colors.RED) colorName = "red";
else if (smokeColor === colors.GREEN) colorName = "green";
else if (smokeColor === colors.ORANGE) colorName = "orange";
getApp().getServerManager().spawnSmoke(colorName, props.latlng);
getApp()
.getMap()
.addSmokeMarker(props.latlng, smokeColor ?? colors.WHITE);