Advertisement
davedumas0

utilites.lua

Nov 15th, 2024
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1.  
  2. -- Utilities Class for APICO Modding
  3. local Utilities = {}
  4.  
  5. -- Function to get the player's current position
  6. function Utilities:getPlayerPosition()
  7.     local position = api_get_player_position()
  8.     if position then
  9.         return { x = position.x, y = position.y }
  10.     else
  11.         api_log("Utilities", "Failed to retrieve player position.")
  12.         return nil
  13.     end
  14. end
  15.  
  16. function define_obj(id, name, catagory, tooltip, isBed, has_shadow, destTool, depth, spriteLoc)
  17.     local obj = {
  18.     id = id,
  19.     name = name,
  20.     category = catagory,
  21.     tooltip = tooltip,
  22.     bed = isBed, -- this allows it to be used as a bed
  23.     has_shadow = has_shadow,
  24.     tools = {destTool},
  25.     depth = depth -- this sets the layering of the player + the object
  26.     }
  27.     api_define_object(obj, spriteLoc, nil)
  28.   end
  29.  
  30. return Utilities
  31.  
  32.  
  33.  
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement