Summary

Hooks

Called after all map entities have been initialized; spawns the saved plants.
Called when the progress bar info is needed; shows the harvesting progress bar.
Spawns the plants saved for the current map with their seed item, growth and plant model.
Called when a player finishes harvesting a ripe plant; rolls and gives the harvest.
Called after Catwork saves its data; saves the plants.
Saves the position, angles, growth and seed item of every plant on the map.

Hooks

PLUGIN:ClockworkInitPostEntity()

server gamemodes/cwhl2rp/plugins/farming/plugin/sv_hooks.lua:7

Implements hook ClockworkInitPostEntity

Called after all map entities have been initialized; spawns the saved plants.

PLUGIN:GetProgressBarInfo()

client gamemodes/cwhl2rp/plugins/farming/plugin/cl_hooks.lua:6

Implements hook GetProgressBarInfo

Called when the progress bar info is needed; shows the harvesting progress bar.

Returns

  • Map Progress bar text, percentage and flash, or nil when no harvest is running

Spawns the plants saved for the current map with their seed item, growth and plant model.

Plants whose seed item no longer exists are skipped. Data saved before growth was stored as age and remaining holds the CurTime values spawn and grow of an earlier map, which are used as they are.

PLUGIN:PlayerHarvest(player, uniqueID)

server gamemodes/cwhl2rp/plugins/farming/plugin/sv_hooks.lua:25

Implements hook PlayerHarvest

Called when a player finishes harvesting a ripe plant; rolls and gives the harvest.

The roll is 1 to 100 plus up to 50 from the farming attribute. At 40 or more the player gets the seeds back (twice above 100) and from 50 one to four crops; below 40 the harvest fails. Either way the farming attribute progresses.

Parameters

  • player Player The player who harvested
  • uniqueID String Unique ID of the seed item the plant grew from; its Harvest field lists the seed and crop IDs

Implements hook PostSaveData

Called after Catwork saves its data; saves the plants.

Saves the position, angles, growth and seed item of every plant on the map.

The data goes to plugins/farming/<map>.

Defined in