User: 
Generate Lua code for the Trailmakers modding API based on the following prompt. Adhere strictly to these guidelines:

1. FUNCTION USAGE:
   - Use ONLY the Trailmakers modding functions (tm.*) and basic Lua functions supported by MoonSharp.
   - DO NOT use any Lua standard libraries or functions not supported by MoonSharp (e.g., io, os, debug, package, coroutine).
   - DO NOT invent or use any functions not explicitly listed in the Trailmakers API documentation.
   - Each tm.* function must be used exactly as documented, with the correct number and types of parameters.

2. CODE STRUCTURE:
   - Use 'function update()' ONLY for actions that need to happen continuously or repeatedly (e.g., checking player position, updating UI).
   - For one-time actions or initializations, place the code outside any function.
   - If the prompt requires a one-time action, do not use 'function update()'.
   - Keep the code concise and directly addressing the prompt requirements.

3. TRAILMAKERS-SPECIFIC FUNCTIONS (Use these precisely):
   - Logging: tm.os.Log(message) - Use for any console output.
   - Vectors: tm.vector3.Create(x, y, z) - Use for all 3D positions or directions.
   - Object Spawning: tm.physics.SpawnObject(position, name) - Use for spawning in-game objects.
   - Player Interaction: tm.players.* functions (e.g., tm.players.GetPlayerPosition(playerId)) - Use for player-related actions.
   - UI: tm.playerUI.* functions (e.g., tm.playerUI.AddUIButton(playerId, id, text, callback)) - Use for creating UI elements.
   - Audio: tm.audio.PlayAudioAtPosition(audioName, position, duration) - Use for playing sounds.
   - Input: tm.input.RegisterFunctionToKeyDownCallback(playerId, functionName, keyName) - Use for handling player input.

4. DATA TYPES (Use these correctly):
   - PlayerID: Always a number (0-7). Player 0 is always the host.
   - StructureID: Always a string.
   - ModVector3: Created using tm.vector3.Create(x, y, z).
   - ModQuaternion: Created using tm.quaternion.Create().
   - Use tonumber() or tostring() when type conversion is necessary.

5. TIME AND EVENTS:
   - For time-based actions, use tm.os.GetTime() or tm.os.SimulationTime().
   - For frame-time actions, use tm.os.GetModDeltaTime().

6. CODE STYLE AND BEST PRACTICES:
   - Use proper indentation (4 spaces) and correct Lua syntax.
   - Use local variables whenever possible to avoid global namespace pollution.
   - Initialize variables outside update() when they don't need to be reset every frame.
   - Add brief comments only if necessary to explain complex logic.
   - Always check if required parameters are not nil before using them in functions.

7. PERFORMANCE CONSIDERATIONS:
   - Avoid creating new objects (especially vectors) inside update() if possible. Initialize them outside and reuse.
   - Use tm.os.SetModTargetDeltaTime() to control update frequency if necessary.

8. ERROR HANDLING:
   - Use pcall() for operations that might fail, and log errors with tm.os.Log().

9. LIMITATIONS:
   - Remember that the mod runs on the server, so client-side concepts don't apply.
   - There's no concept of "frames" in the traditional sense; everything is based on update cycles.

10. RELEVANT FUNCTIONS:
    The following functions are particularly relevant to this prompt. Use these functions as needed:

tm.physics.SpawnObject: Spawn a spawnable at the position, e.g. PFB_Barrel Parameters: position (ModVector3): Position of the object, name (Spawnable): Name of the object. Can only be a default asset name (from the list returned by `tm.physics.SpawnableNames()`). See `Spawnable` type alias. Returns: ModGameObject.
tm.physics.SpawnCustomObjectRigidbody: Spawn a custom physics object Parameters: position (ModVector3): The position to spawn the object at, meshName (MeshName): The name of the mesh that the object will use. See `MeshName` type alias, textureName (TextureName): The name of the texture that the object will use. See `TextureName` type alias, isKinematic (boolean): Whether the object will be affected by physics or not, mass (number): The mass of the object. Units are `5kg`. Returns: ModGameObject.
tm.physics.SpawnCustomObject: Spawn a custom object Parameters: position (ModVector3): The position to spawn the object at, meshName (MeshName): The name of the mesh that the object will use. See `MeshName` type alias, textureName (TextureName): The name of the texture that the object will use. See `TextureName` type alias. Returns: ModGameObject.
tm.physics.SpawnCustomObjectConcave: Spawn a custom object with concave collision support Parameters: position (ModVector3): The position to spawn the object at, meshName (MeshName): The name of the mesh that the object will use. See `MeshName` type alias, textureName (TextureName): The name of the texture that the object will use. See `TextureName` type alias. Returns: ModGameObject.
tm.physics.SpawnBoxTrigger: Spawn a box trigger that will detect overlap but will not interact with physics Parameters: position (ModVector3): The position to spawn the Box Trigger at, size (ModVector3): The Box Trigger' size. Returns: ModGameObject.
tm.players.SpawnStructure: Spawn a structure for a player with given blueprint, position and rotation Parameters: playerId (PlayerID): Player to which the blueprint will belong. See `PlayerID` type alias, blueprint (TextureName): Name of the blueprint to spawn. See `TextureName` type alias, structureId (StructureID): ID that will be used to reference the structure. See `StructureID` type alias, position (ModVector3): Position of the spawned structure, rotation (ModVector3): Rotation of the spawned structure. Returns: nil.

    If a function is not listed here but is mentioned in the static guidelines above, you may use it if it's necessary for the prompt. However, prioritize using the functions listed here.

11. SPAWNABLE NAMES:
    The following spawnable names are relevant to this prompt:
    
    Use ONLY these EXACT names when spawning objects with tm.physics.SpawnObject(). Do not invent or modify any spawnable names.

12. AUDIO IDS:
    The following audio IDs are relevant to this prompt:
    
    Use ONLY these EXACT IDs when playing audio with tm.audio.PlayAudioAtPosition(). Do not invent or modify any audio IDs.

13. IMPORTANT:
    - If no relevant spawnable names or audio IDs are provided, do not invent or guess any. Use only the exact names and IDs listed above.
    - If the prompt requires a spawnable or audio that isn't listed, use a placeholder and add a comment indicating that the correct spawnable or audio ID should be used.

Examples of correct usage:

1. Spawning an object every 5 seconds (only if "PFB_Cube" is in the spawnable list):
   local nextSpawnTime = 0
   local spawnPosition = tm.vector3.Create(0, 10, 0)
   
   function update()
       local currentTime = tm.os.GetTime()
       if currentTime >= nextSpawnTime then
           tm.physics.SpawnObject(spawnPosition, "PFB_Cube")
           nextSpawnTime = currentTime + 5
           tm.os.Log("PFB_Cube spawned at " .. tostring(spawnPosition))
       end
   end

2. Responding to player input:
   local function onAPressed(playerId)
       local playerPosition = tm.players.GetPlayerPosition(playerId)
       tm.os.Log("Player " .. playerId .. " pressed A at position: " .. tostring(playerPosition))
   end
   
   tm.input.RegisterFunctionToKeyDownCallback(0, "onAPressed", "A")

3. Creating UI for a player:
   tm.playerUI.AddUIButton(0, "myButton", "Click me!", function(data)
       tm.os.Log("Button clicked by player " .. data.playerId)
   end)

Prompt: write a simple mod to spawn sheeps

Provide only the Lua code without any explanations or text outside the code block. Ensure the code is complete, concise, and directly addresses the prompt requirements using only the allowed Trailmakers modding functions and basic Lua. Do not include any additional comments or explanations unless they are crucial for understanding complex logic within the code.

User: 
Generate Lua code for the Trailmakers modding API based on the following prompt. Adhere strictly to these guidelines:

1. FUNCTION USAGE:
   - Use ONLY the Trailmakers modding functions (tm.*) and basic Lua functions supported by MoonSharp.
   - DO NOT use any Lua standard libraries or functions not supported by MoonSharp (e.g., io, os, debug, package, coroutine).
   - DO NOT invent or use any functions not explicitly listed in the Trailmakers API documentation.
   - Each tm.* function must be used exactly as documented, with the correct number and types of parameters.

2. CODE STRUCTURE:
   - Use 'function update()' ONLY for actions that need to happen continuously or repeatedly (e.g., checking player position, updating UI).
   - For one-time actions or initializations, place the code outside any function.
   - If the prompt requires a one-time action, do not use 'function update()'.
   - Keep the code concise and directly addressing the prompt requirements.

3. TRAILMAKERS-SPECIFIC FUNCTIONS (Use these precisely):
   - Logging: tm.os.Log(message) - Use for any console output.
   - Vectors: tm.vector3.Create(x, y, z) - Use for all 3D positions or directions.
   - Object Spawning: tm.physics.SpawnObject(position, name) - Use for spawning in-game objects.
   - Player Interaction: tm.players.* functions (e.g., tm.players.GetPlayerPosition(playerId)) - Use for player-related actions.
   - UI: tm.playerUI.* functions (e.g., tm.playerUI.AddUIButton(playerId, id, text, callback)) - Use for creating UI elements.
   - Audio: tm.audio.PlayAudioAtPosition(audioName, position, duration) - Use for playing sounds.
   - Input: tm.input.RegisterFunctionToKeyDownCallback(playerId, functionName, keyName) - Use for handling player input.

4. DATA TYPES (Use these correctly):
   - PlayerID: Always a number (0-7). Player 0 is always the host.
   - StructureID: Always a string.
   - ModVector3: Created using tm.vector3.Create(x, y, z).
   - ModQuaternion: Created using tm.quaternion.Create().
   - Use tonumber() or tostring() when type conversion is necessary.

5. TIME AND EVENTS:
   - For time-based actions, use tm.os.GetTime() or tm.os.SimulationTime().
   - For frame-time actions, use tm.os.GetModDeltaTime().

6. CODE STYLE AND BEST PRACTICES:
   - Use proper indentation (4 spaces) and correct Lua syntax.
   - Use local variables whenever possible to avoid global namespace pollution.
   - Initialize variables outside update() when they don't need to be reset every frame.
   - Add brief comments only if necessary to explain complex logic.
   - Always check if required parameters are not nil before using them in functions.

7. PERFORMANCE CONSIDERATIONS:
   - Avoid creating new objects (especially vectors) inside update() if possible. Initialize them outside and reuse.
   - Use tm.os.SetModTargetDeltaTime() to control update frequency if necessary.

8. ERROR HANDLING:
   - Use pcall() for operations that might fail, and log errors with tm.os.Log().

9. LIMITATIONS:
   - Remember that the mod runs on the server, so client-side concepts don't apply.
   - There's no concept of "frames" in the traditional sense; everything is based on update cycles.

10. RELEVANT FUNCTIONS:
    The following functions are particularly relevant to this prompt. Use these functions as needed:

tm.physics.SpawnObject: Spawn a spawnable at the position, e.g. PFB_Barrel Parameters: position (ModVector3): Position of the object, name (Spawnable): Name of the object. Can only be a default asset name (from the list returned by `tm.physics.SpawnableNames()`). See `Spawnable` type alias. Returns: ModGameObject.
tm.physics.SpawnCustomObjectRigidbody: Spawn a custom physics object Parameters: position (ModVector3): The position to spawn the object at, meshName (MeshName): The name of the mesh that the object will use. See `MeshName` type alias, textureName (TextureName): The name of the texture that the object will use. See `TextureName` type alias, isKinematic (boolean): Whether the object will be affected by physics or not, mass (number): The mass of the object. Units are `5kg`. Returns: ModGameObject.
tm.physics.SpawnCustomObject: Spawn a custom object Parameters: position (ModVector3): The position to spawn the object at, meshName (MeshName): The name of the mesh that the object will use. See `MeshName` type alias, textureName (TextureName): The name of the texture that the object will use. See `TextureName` type alias. Returns: ModGameObject.
tm.physics.SpawnCustomObjectConcave: Spawn a custom object with concave collision support Parameters: position (ModVector3): The position to spawn the object at, meshName (MeshName): The name of the mesh that the object will use. See `MeshName` type alias, textureName (TextureName): The name of the texture that the object will use. See `TextureName` type alias. Returns: ModGameObject.
tm.physics.SpawnBoxTrigger: Spawn a box trigger that will detect overlap but will not interact with physics Parameters: position (ModVector3): The position to spawn the Box Trigger at, size (ModVector3): The Box Trigger' size. Returns: ModGameObject.
tm.players.SpawnStructure: Spawn a structure for a player with given blueprint, position and rotation Parameters: playerId (PlayerID): Player to which the blueprint will belong. See `PlayerID` type alias, blueprint (TextureName): Name of the blueprint to spawn. See `TextureName` type alias, structureId (StructureID): ID that will be used to reference the structure. See `StructureID` type alias, position (ModVector3): Position of the spawned structure, rotation (ModVector3): Rotation of the spawned structure. Returns: nil.

    If a function is not listed here but is mentioned in the static guidelines above, you may use it if it's necessary for the prompt. However, prioritize using the functions listed here.

11. SPAWNABLE NAMES:
    The following spawnable names are relevant to this prompt:
    
    Use ONLY these EXACT names when spawning objects with tm.physics.SpawnObject(). Do not invent or modify any spawnable names.

12. AUDIO IDS:
    The following audio IDs are relevant to this prompt:
    
    Use ONLY these EXACT IDs when playing audio with tm.audio.PlayAudioAtPosition(). Do not invent or modify any audio IDs.

13. IMPORTANT:
    - If no relevant spawnable names or audio IDs are provided, do not invent or guess any. Use only the exact names and IDs listed above.
    - If the prompt requires a spawnable or audio that isn't listed, use a placeholder and add a comment indicating that the correct spawnable or audio ID should be used.

Examples of correct usage:

1. Spawning an object every 5 seconds (only if "PFB_Cube" is in the spawnable list):
   local nextSpawnTime = 0
   local spawnPosition = tm.vector3.Create(0, 10, 0)
   
   function update()
       local currentTime = tm.os.GetTime()
       if currentTime >= nextSpawnTime then
           tm.physics.SpawnObject(spawnPosition, "PFB_Cube")
           nextSpawnTime = currentTime + 5
           tm.os.Log("PFB_Cube spawned at " .. tostring(spawnPosition))
       end
   end

2. Responding to player input:
   local function onAPressed(playerId)
       local playerPosition = tm.players.GetPlayerPosition(playerId)
       tm.os.Log("Player " .. playerId .. " pressed A at position: " .. tostring(playerPosition))
   end
   
   tm.input.RegisterFunctionToKeyDownCallback(0, "onAPressed", "A")

3. Creating UI for a player:
   tm.playerUI.AddUIButton(0, "myButton", "Click me!", function(data)
       tm.os.Log("Button clicked by player " .. data.playerId)
   end)

Prompt: write a simple mod to spawn sheeps

Provide only the Lua code without any explanations or text outside the code block. Ensure the code is complete, concise, and directly addresses the prompt requirements using only the allowed Trailmakers modding functions and basic Lua. Do not include any additional comments or explanations unless they are crucial for understanding complex logic within the code.

Assistant: