DefineUpgradeButton (Harvest)
From OxeyeWiki
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. |
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)