mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-08 22:33:24 +00:00
Adding functionality to pull the 'description' field from specials and show a tooltip, describing what the special does.
This commit is contained in:
@@ -12,6 +12,7 @@ import { STATS_FORMATTING } from '../shipyard/StatsFormatting';
|
|||||||
* @returns {Object} The react components
|
* @returns {Object} The react components
|
||||||
*/
|
*/
|
||||||
export function specialToolTip(translate, blueprint, grp, m, specialName) {
|
export function specialToolTip(translate, blueprint, grp, m, specialName) {
|
||||||
|
const description = [];
|
||||||
const effects = [];
|
const effects = [];
|
||||||
if (!blueprint || !blueprint.features) {
|
if (!blueprint || !blueprint.features) {
|
||||||
return undefined;
|
return undefined;
|
||||||
@@ -19,6 +20,15 @@ export function specialToolTip(translate, blueprint, grp, m, specialName) {
|
|||||||
if (m) {
|
if (m) {
|
||||||
// We also add in any benefits from specials that aren't covered above
|
// We also add in any benefits from specials that aren't covered above
|
||||||
if (m.blueprint) {
|
if (m.blueprint) {
|
||||||
|
if (specialName) {
|
||||||
|
if (Modifications.specials[specialName].description) {
|
||||||
|
description.push(
|
||||||
|
<div className={'success'} style={{ maxWidth: 350, padding: 5, marginBottom: 10 }}>
|
||||||
|
{Modifications.specials[specialName].description}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
for (const feature in Modifications.modifierActions[specialName]) {
|
for (const feature in Modifications.modifierActions[specialName]) {
|
||||||
// if (!blueprint.features[feature] && !m.mods.feature) {
|
// if (!blueprint.features[feature] && !m.mods.feature) {
|
||||||
const featureDef = Modifications.modifications[feature];
|
const featureDef = Modifications.modifications[feature];
|
||||||
@@ -53,6 +63,7 @@ export function specialToolTip(translate, blueprint, grp, m, specialName) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
{description}
|
||||||
<table width='100%'>
|
<table width='100%'>
|
||||||
<tbody>
|
<tbody>
|
||||||
{effects}
|
{effects}
|
||||||
|
|||||||
Reference in New Issue
Block a user