LUADOC - Farming Simulator 19

Farm

Description
Permission types.
Parent
Object
Functions

addHandTool

Description
Add ownership of given handtool
Definition
addHandTool()

addUser

Description
Add a new user to the farm. This adds it to the players and active players list. And also gives default permissions.
Definition
addUser()

calculateDailyLoanInterest

Description
Calculate the daily loan interest
Definition
calculateDailyLoanInterest()
Return Values
floatdailyloan interest

changeBalance

Description
Add or remove money from the farm
Definition
changeBalance(number amount)
Arguments
numberamountAmount to add (positive) or remove (negative)

demoteUser

Description
Demote a user from farm manager.
Definition
demoteUser()

getActiveUsers

Description
Get a list of active users. Useful for using their connection ID
Definition
getActiveUsers()

getBalance

Description
Get the current account balance of the farm.
Definition
getBalance()
Return Values
floatAccountbalance

getColor

Description
Get the farm color
Definition
getColor()
Return Values
table{r,g,b}

getEquity

Description
Get the total equity (farmlands + placeables) of the farm
Definition
getEquity()

getFarmhouse

Description
Get the farmhouse associated with the farm.
Definition
getFarmhouse()
Return Values
tablefarmhouseor nil

getHandTools

Description
Get a list of filenames for accessible handtools
Definition
getHandTools()

getIsContractingFor

Description
Get whether this farm is contracting for given farm
Definition
getIsContractingFor()

getLoan

Description
Get the current loan of the farm.
Definition
getLoan()
Return Values
floatLoan

getNumActivePlayers

Description
Get the number of players in the farm that are currently online
Definition
getNumActivePlayers()

getNumPlayers

Description
Get the number of players in the farm
Definition
getNumPlayers()

getSleepCamera

Description
Get the sleep camera.
Definition
getSleepCamera()
Return Values
integerCameraor 0 if no farmhouse.

getSpawnPoint

Description
Get the spawnpoint associated with the farm(house).
Definition
getSpawnPoint()
Return Values
integerspawnpointnode or the career spawnpoint node.

getUserPermissions

Description
Get the farm permissions of a user.
Definition
getUserPermissions(userId User)
Arguments
userIdUserID
Return Values
tablePermissionhash table {permission=}

hasHandtool

Description
Get whether this farm owns given handtool
Definition
hasHandtool()

isUserFarmManager

Description
Determine if a user is a manager of this farm.
Definition
isUserFarmManager(userId User)
Arguments
userIdUserID
Return Values
boolTrueif the user is a manager of this farm, false otherwise

loadFromXMLFile

Description
Load the farm from the savegame
Definition
loadFromXMLFile()

merge

Description
Merge another farm into this farm. Used for creating an SP game from an MP game. (this is mutating)
Definition
merge(table other)
Arguments
tableotherAnother Farm

new

Description
Create a new farm. Do not call directly! Only use the farm manager and createFarm()
Definition
new()

onUserJoinGame

Description
Called when a user joins the game. Active users is updated, and for spectator. a new user might be added. Server only.
Definition
onUserJoinGame()

onUserQuitGame

Description
Called when a user quits the game. The active user list is updated. Server only.
Definition
onUserQuitGame()

promoteUser

Description
Promote a user to farm manager.
Definition
promoteUser()

removeHandTool

Description
Remove ownership of given handtool
Definition
removeHandTool()

removeUser

Description
Remove a user from the farm.
Definition
removeUser()

resetToSingleplayer

Description
Reset the farm to a singleplayer state by removing all players and adding a new single player with all permissions
Definition
resetToSingleplayer()

saveToXMLFile

Description
Save the farm to the savegame
Definition
saveToXMLFile()

setInitialEconomy

Description
Definition
setInitialEconomy()

setIsContractingFor

Description
Update contracting status
Definition
setIsContractingFor(noSendEvent boolean)
Arguments
noSendEventbooleanSend no event, forces setting of actual value without server feedback

setUserPermission

Description
Set a user's permission in this farm.
Definition
setUserPermission(userId User, string permission, bool hasPermission)
Arguments
userIdUserID
stringpermissionPermission key from Farm.PERMISSION
boolhasPermissionTrue if the permission is to be granted, false to be denied

updateLastNickname

Description
Definition
updateLastNickname()

updateMaxLoan

Description
Re-calculate the maximum loan
Definition
updateMaxLoan()