ScrapComputers Lua API Documentation

website·Indexed 29 days ago

https://scrapcomputers.dev

Documentation for the ScrapComputers computer API and Addon API, featuring Lua modules for JSON, SHA256, AES256, MD5, Base64, Base91, LZ4 compression, and QR code generation. Includes specialized libraries for audio (MIDI, NBS), vector math (Vec2, Vec3), virtual displays, and hardware components like the Radar Warning Receiver and terminal.

Tokens
41.6K
Snippets
483
Records
562
Agent score
49%

What's inside ScrapComputers

  1. Overview of ascf-manager for Outline Fonts

    The ascf-manager is used to draw outline fonts (such as TTF and OTF), providing advantages over the standard FontManager (which uses bitmap fonts). Key features include support for font rotation, arbitrary font scaling, and the ability to convert color codes embedded within text into actual colors.
  2. Overview of ScrapComputers performance and features

    ScrapComputers is a mod for Scrap Mechanic that provides a high-performance Lua 5.1 virtual machine (LuaVM) written in Lua. It is designed for speed and visual quality, outperforming other computer mods in both execution speed and display rendering. Key features include raytraced cameras with advanced lighting, the ability to play video for security systems or recordings, and a flexible API that allows users to develop games and simulations directly within the mod.
  3. Overview of the LanguageManager

    The LanguageManager handles the language settings for all graphical parts of a mod. It supports any language, provided the characters are supported by the Scrap Mechanic fonts. Translations are stored as a collection of key-value pairs (strings) and are processed through string.format.
  4. Overview of ScrapComputers Language Management

    ScrapComputers uses a LanguageManager to translate Graphical User Interfaces (GUIs). It supports any Latin-based language or languages already supported by Scrap Mechanic.

    By default, the language setting is Automatic, which matches the player's game language. Supported automatic languages include: Brazilian Portuguese, Chinese, English, French, German, Italian, Japanese, Korean, Polish, Russian, and Spanish. If a custom language is added that is not on this list, players must manually change the language setting for each world, as cross-world syncing is not currently supported.

  5. LuaVM performance improvements for large strings

    The LuaVM (Yueliang interpreter) has been optimized to handle long strings more efficiently. This specifically resolves slowdowns previously encountered when processing large image data (e.g., 256x256 images) that were stored as single long strings.
  6. CollisionEvent structure reference

    The CollisionEvent structure provides detailed information about a collision event:

    • other (string): The type of the other object that collided.
    • posiiton (Vec3): The position where the collision occurred.
    • selfPointVelocity (Vec3): The velocity of the component at the time of collision.
    • otherPointVelocity (Vec3): The velocity of the other object at the time of collision.
    • normal (Vec3): The normal vector between the component and the collision object.
  7. Computer V3 system features

    The computer system has been rebuilt from the ground up with the following features:

    • A fully functional filesystem with directory support.
    • A high-performance VM with improved execution speed.
    • Final bytecode build options.
    • Upgraded syntax highlighting.
    • Integrated password manager and encryption for source code privacy.
    • Improved error reporting and examples.
  8. Understand the PixelRayResult structure

    The PixelRayResult provides data about a specific pixel's raycast. In 'unsafe' mode, it is returned as userdata. In 'safe' mode, it is returned as a table with the following properties:

    • directionWorld: World direction
    • fraction: Raycast fraction
    • normalLocal/normalWorld: Local and world normals
    • originWorld: World origin
    • pointLocal/pointWorld: Local and world hit points
    • type: The type of object hit
    • valid: Boolean indicating if the hit is valid
    • material: Ground material (for terrain)
    • color: Color of the userdata object (if applicable)
  9. Survival and Crashlander support in ScrapComputers V3

    ScrapComputers V3 introduces full support for Survival mode and Crashlander. This includes modded Craftbot recipes, custom crafting for Crashlander, and specific survival-related behaviors for certain components.