-
Notifications
You must be signed in to change notification settings - Fork 4
Developer Docs
VEManager is a mod to handle the creation and modification of Visual Environments. VEManager uses Global Events which can be dispatched from any other mod (external) or module (internal). These events trigger the user functions set inside VEManager which are all explained below.
Color Codes: Events, NetEvent, Functions
VEManager:RegisterPreset
VEManager:EnablePreset
VEManager:DisablePreset
VEManager:PresetsLoaded
VEManager:SetVisibility
VEManager:UpdateVisibility
VEManager:FadeIn
VEManager:FadeTo
VEManager:FadeOut
VEManager:Lerp
__init__.lua | General
- RegisterVars() – Registers all set variables
- RegisterEvents() – Registers all set events
- RegisterModules() – Registers all enabled modules
__init__.lua | User Functions | g_VEManagerClient:
- RegisterPreset( id, preset ) – Decodes JSON preset into lua table
- id : preset name defined in preset JSON string
- preset : preset JSON string (through GetPreset() function)
- EnablePreset( id ) – Enables a preset and makes it visible
- DisablePreset( id ) – Disables a preset and makes it invisible
- SetVisibility( id, visibility ) – Set a preset to the given visibility and reloads the entity
- visibility : Float value
- UpdateVisibility( id, priority, visibilityFactor ) – Updates the VisualEnvironmentStates directly, allowing fluid realtime changes
- priority : VisualEnvironmentState priority
- visibilityFactor: Float value
- SetSingleValue( id, priority, class, property, value )– Allows updating of single visual state classes
- class: All properties listed in__as stringhttps://docs.veniceunleashed.net/vext/ref/client/type/visualenvironmentstate/
- property: All datatypes listed in as stringhttps://docs.veniceunleashed.net/vext/ref/client/type/visualenvironmentstate/
-
value: Dependant on datatype property
- example: (id, priority, 'outdoorLight ', ' sunColor ', Vec3)
- FadeTo( id, visibility, time ) – Fades preset to given visibility starting from 0
- FadeIn( id, time ) – FadeIn of a preset
- time: Duration in seconds
- FadeOut( id, time ) – FadeOut of a preset
- Lerp( id, value, time ) – Fades a preset to given visibility from any starting point
- Crossfade( id1, id2, time ) – Crossfades two presets
__init__.lua | Internal Functions | g_VEManagerClient:
- GetState( priority1, priority2, … ) – Returns VisualEnvironmentStates for given priorities
- Priority1: priority of first state you want to get
- Priority2: priority of second state you want to get (not required)
- … : every additional state priority (not required)
- InitializePresets() – Initializes/Creates preset entities from Entity Data
- Reload() – Reloads the entity (disables, reenables)
- LoadPresets() – Converts preset JSON strings to VisualEnvironmentEntityData and fills unset value with the default values
- GetDefaultValue() – Gets the default value for unset values
- CreateEntity() – Creates an Entity and returns it with given or random GUID
- UpdateLerp() – Handles Fading/Lerping
- OnUpdateInput() – Handles Hotkeys
- ParseValue() – Parses JSON string values to the correct property type
Modules that can be loaded with VEManager to expand its features while keeping its core features intact.
cinematictools.lua | General
Tool to edit VisualEnvironments live via WebUI and export presets as JSON string. Currently dependant on the DebugGUI mod and class to function.
cinematictools.lua | Internal Functions | g_CinematicTools:
- GenericSeperator( p_Str, p_Sep ) – Separates string and returns it as table
- p_Str: String to separate
- p_Sep: Separation Pattern (what to remove)
- GenericCallback( p_Path, p_Value ) – Updates the CinematicTools-VisualEnvironmentState
- p_Path: Path table
- p_Value: Value to be set
patches.lua | General
Patches components given in patchdatatable.lua, smoothens lights, adjusts lens flare sizes and other custom patches
patchdatatable.lua | General
Contains all tables and components to patch for the time module.
time.lua | General
Adds time handling to VEManager.
time.lua | Internal Functions | g_Time:
- OnPartitionLoad() – Runs patches and adds stars
- OnLevelLoaded() – Subscribes to time server and requests current time
- OnLevelDestroy() – Unsubscribes from time server and removes time
- RequestTime() – Handles time request
- RemoveTime() – Handles time resetting
- ServerSync( p_ServerDayTime, p_TotalServerTime ) – Handles sync received from server
- p_ServerDayTime: Current server in-game time
- p_TotalServerTime: Current total server in-game time
- AddTimeToClient and AddTimeToClient( p_StartingTime, p_IsStatic, p_LengthOfDayInSeconds ) – Handles server time add request
- Add( p_StartingTime, p_IsStatic, p_LengthOfDayInSeconds ) – Adds time to client
- p_StartingTime: Time to set to / start the day-night cycle in hours (24h system)
- p_IsStatic: Boolean (true/false)
- p_LengthOfDayInSeconds: Length of one in-game day in seconds
- Run() – Runs the day-night cycle through event updates
- SetSunPosition() – Calculates and Sets the Sun Pos according to the current time
Short functionality rundown:
Client receives Time:AddTimeToClient from server Add() finds all custom day-night presets automatically and adds them to the cycle or defaults to the default presets. Add() will also set the Visual Environments to the correct visibilities and the sun position with SetSunPosition() according to the given time using Run() once. If enabled the cloud speed will be adjusted with SetSingleValue() to the length of day. If not set to static Add() will trigger the Run() loop. Run() will do some math and set the Visual Environment visibilities to the correct visibility factors and apply them directly into the Visual Environment States via UpdateVisibility(). ServerSyncwill trigger ServerSync().
Contains the default presets for day-night, the CinematicTools preset and an example.
Time Server | General
The time server handles the initialization and syncing part of the day-night cycle.
__init__.lua | Time Server (to be put into separate file) Server\Modules\time-server.lua | Internal Functions | g_TimeServer:
- AddTime(p_StartingTime, p_LengthOfDayInMinutes) – Handles NetEvent Dispatch
- Run() – Server Time and Client Sync via Broadcast()
- Broadcast() – Sync broadcast via UDP
- OnPlayerRequest() – Sends current time to player on join
- PauseContinue() – Function to pause / continue the cycle
- DisableDynamicCycle() – Function to disable the cycle
- ChatCommands() – Contains chat commands
Short functionality rundown:
Server receives TimeServer:AddTime AddTime() dispatches Broadcast via Broadcast() starting g_Time:Add() on all clients. The server will now start to sync in the configured tickrate.
Config.lua | General
The VEManager config file.
DebugGUI.lua | General
The DebugGUI class used by CinematicTools.
Preset creation | for day-night (option will be added to cinematictools) for now manual change of certain values is needed
Dependency | Recommended
outdoorLight.sunRotationX = 0
outdoorLight.sunRotationY = 0
sky.sunSize = 0.01
sky.sunScale = 1.5
sky.cloudLayer1Altitude = 500000.0
sky.cloudLayer1TileFactor = 0.25
sky.cloudLayer1Rotation = 223.52900695801
sky.cloudLayer1SunLightIntensity = 0.1
sky.cloudLayer1SunLightPower = 0.1
sky.cloudLayer1AmbientLightIntensity = 0.1
sky.cloudLayer1Color = (0.1, 0.1, 0.1)
sky.cloudLayer1AlphaMul = 0.5
sky.cloudLayer2Altitude = 5000000.0
sky.cloudLayer2TileFactor = 0.60000002384186
sky.cloudLayer2Rotation = 237.07299804688
sky.cloudLayer2SunLightIntensity = 1.0
sky.cloudLayer2SunLightPower = 5.0
sky.cloudLayer2AmbientLightIntensity = 1
sky.cloudLayer2Color = 1:1:1:
sky.cloudLayer2AlphaMul = 0.3
tonemap.tonemapMethod = 2
wind.windDirection = 211.25799560547