DefineUpgradeButton (Harvest)

From OxeyeWiki

Jump to: navigation, search

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.
newBuilding 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