Library holograms

Library for creating and manipulating physics-less models AKA "Holograms".

Functions

addHalo( holos, colour, blurX, blurY, drawPasses, additive, ignoreZ ) Adds a halo to all the passed in holograms.
canSpawn() Returns true if the number of holograms spawned by the instance's owner is less then the max.
create( pos, ang, model, scale ) Creates a hologram.
getAll() Returns a table containing all hologram entities belonging to the current instance.
getGlobalCount() Gets the number of spawned holograms across all the instance owner's chips.
getInstanceCount() Gets the number of spawned holograms for the current instance.
getMaxHologramSize() Returns the maximum allowed absolute size for holograms (per axis).
getQuota() Returns the maximum number of holograms you can spawn across all Starfall instances.
removeAll() Removes all spawned holograms of the current instance.


Functions

holograms.addHalo( holos, colour, blurX, blurY, drawPasses, additive, ignoreZ )
Adds a halo to all the passed in holograms. A hologram can only have a single halo at a time. Halo rendering requires the permission DRAW_HALOS.

Environment:

Client

Parameters:

  • (Hologram | table) holos: A single hologram or an array of holograms to have a halo added to.
  • (Color) colour: The colour of the halo.
  • (number?) blurX: (Optional, default 2) The amount to blur horizontally, clamped between 0 and 10.
  • (number?) blurY: (Optional, default 2) The amount to blur vertically, clamped between 0 and 10.
  • (number?) drawPasses: (Optional, default 1) The amount of passes to make when drawing the halo. A higher value reduces blur. Clamped between 1 and 3.
  • (boolean?) additive: (Optional, default true) Whether the halo should be additively rendered.
  • (boolean?) ignoreZ: (Optional, default false) Whether the halo should be occluded by objects in the way or not.

Usage:

    -- Adds a very blurry yellow halo around the first hologram in holograms.getAll() 
    -- Note that halos are persistent until you call Hologram:removeHalo(). 
    -- Note also that additive should really be always true, otherwise you'll get an odd looking halo. 
    local Holos = holograms.getAll() 
    holograms.addHalo( Holos[ 1 ], Color( 255, 255, 0 ), 10, 10, 1, true, false ) 
     
    -- Alternatively, you can also add halos to multiple holograms at once. 
    -- This will add a sharp red halo to all holograms the chip has spawned. 
    local HaloParameters = holograms.addHalo( Holos, Color( 255, 0, 0 ), 1, 1, 1, true, false ) 
    -- After 1 second, make the halos draw through walls, and increase the blur. 
    timer.simple( 1, function() 
    	HaloParameters.IgnoreZ = true 
    	HaloParameters.BlurX = 5 
    	HaloParameters.BlurY = 5 
    end )

Return value:

    (Halo) A table with the following editable fields (case-insensitive): - Color - BlurX - BlurY - DrawPasses - Additive - IgnoreZ Editing any of these values will update the halo for all the holograms passed in originally.
holograms.canSpawn()
Returns true if the number of holograms spawned by the instance's owner is less then the max.

Environment:

Server

Return value:

    (boolean) True if you can spawn holograms, false otherwise.
holograms.create( pos, ang, model, scale )
Creates a hologram.

Environment:

Server

Parameters:

  • (Vector) pos: The initial position to give the hologram.
  • (Angle) ang: The initial angles to give the hologram.
  • (string?) model: (Optional) The initial model path to use for the given hologram.
  • (number | Vector | VMatrix?) scale: (Optional) The initial scale of the hologram. Defaults to 1.

Return value:

    (Hologram) The hologram entity.
holograms.getAll()
Returns a table containing all hologram entities belonging to the current instance. This is shared so you can get all holograms on the client too, though the results may differ depending on the local player's networked state and location in the world relative to each hologram.

Environment:

Shared

Return value:

    (table) An array of all holograms spawned for the current instance (and are visible to the local player if called on the client).
holograms.getGlobalCount()
Gets the number of spawned holograms across all the instance owner's chips.

Environment:

Server

Return value:

    (number) The total number of holograms spawned by the instance's owner.
holograms.getInstanceCount()
Gets the number of spawned holograms for the current instance.

Environment:

Server

Return value:

    (number) Number of spawned holograms under this instance.
holograms.getMaxHologramSize()
Returns the maximum allowed absolute size for holograms (per axis). This sets the upper-bound for scaling and render bounds.

Environment:

Shared
holograms.getQuota()
Returns the maximum number of holograms you can spawn across all Starfall instances.

Environment:

Server
holograms.removeAll()
Removes all spawned holograms of the current instance.

Environment:

Server

Valid XHTML 1.0!