Opened 10 years ago

Last modified 4 years ago

#2706 closed enhancement

[PATCH] Allow individual entities to upgrade to other entities — at Version 1

Reported by: wraitii Owned by:
Priority: Nice to Have Milestone: Alpha 21
Component: UI & Simulation Keywords: patch
Cc: Patch:

Description (last modified by wraitii)

(this is not a duplicate of #1919 though the behavior can be similar)

The attached patch implements an "Upgrade" component which allows to upgrade individual entities to other entities. It allows any entity to transform into any other. Usage examples would be: upgrading individual units to their advanced or elite form, upgrading individual towers. It is not meant to upgrade all of a buildings' type (ie a wall strength technology for example).

It checks for entity limit counts and updates them appropriately, and can check for buildRestrictions.

It can take a required technology or use the upgraded template's default. It can take a cost and a "time" to upgrade (those two currently can't be derived form the upgraded template but that could be added). It supports multiple possible upgrades (though they are mutually exclusive). It supports having a custom icon and a custom tooltip information. It also supports using {civ}.

It currently does not pass all data (such as trainingqueue, experience…) to the new entity. It reimburses the player fully if the upgrade is cancelled or the building destroyed, to mimic foundations.

Attached patch also changes the "Long wall->Gate" transformation to use this system and removes obsolete code.

This patch implements a generic helper to replace entities' template which #1919 could use.

Change History (4)

by wraitii, 10 years ago

Attachment: UpgradeComponent.patch added

by wraitii, 10 years ago

Attachment: UpgradeComponent.2.patch added

Updated.

comment:1 by wraitii, 10 years ago

Description: modified (diff)

I have moved the "CanTransform" check and the actual replacing to a Transform.js helper file, that Pack.js component also uses (and made the logic slightly better).

I think I've taken into account all of sanderd17 and leper's style remarks (except for the name of the component, I don't really see Transform as better than Upgrade as the most descriptive name would be ReplaceTemplate or something).

I've added the ability to transfer the garrisoning but not the production queue yet.

by wraitii, 10 years ago

Attachment: UpgradeComponent.3.patch added

RC

Note: See TracTickets for help on using tickets.