DefineUpgradeButton (Harvest)

From OxeyeWiki

(Difference between revisions)
Jump to: navigation, search
166 MMX (Talk | contribs)
(Created page with '{{HarvestMethod | defineUpgradeButton(oldBuilding, newBuilding) | Defines an upgrade button for 'upgradeBuildingId'. | {{MethodParam|oldBuilding|String|The building identifier na...')
Newer edit →

Revision as of 19:25, 2 December 2009

defineUpgradeButton(oldBuilding, newBuilding)

Defines an upgrade button for 'upgradeBuildingId'.

Parameter Expected Type Description
oldBuilding String The building identifier name of the building that is upgradable.
newBuildingu String The building identifier name of the building that it will be upgraded to.
Returns

Returns nothing.

Harvest Library

Example

harvest.defineUpgrade("SUPERSOLARPLANT", "Super-duper Solar Plant", "This is a really good solar plant.", 300, 100, 30.0, "SparkProducer")
harvest.defineUpgradeButton("SPARKPRODUCER", "SUPERSOLARPLANT")

local function runSuperSolarPlant(entity, params, deltaTime)
   params.timer = params.timer or 0
   params.timer = params.timer + deltaTime
   if params.timer > 0.5 then
      params.timer = params.timer - 0.5
      local id = entity:getId()
      harvest.spawnEnergySpark(id)
   end
end
hook.add("SUPERSOLARPLANT_Update", runSuperSolarPlant)

Resources

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox