Garry's Mod

Garry's Mod

307 ratings
CalcView Priority System
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Tool
Addon Tags: Fun, Scenic
File Size
Posted
Updated
6.282 KB
23 Jan, 2023 @ 8:38am
23 Jan, 2023 @ 12:01pm
2 Change Notes ( view )

Subscribe to download
CalcView Priority System

In 1 collection by Mercury, 80Hg
Mods that use CalcView Priority System
3 items
Description
C.V.P.S.
CVPS is a library/system that allows you to create CalcView hook camera manipulation mods without every camera mod breaking the other one,
while also allowing you to have Layered CalcViews on top of the highest priority "Base" CalcView. (Useful for viewbob, breathing, etc.)



This is achieved by running only the highest priority CalcView hook and then adding to it the returned data from all the "Layered" ones.

The point of this library is to allow devs to create camera mods that do not interfere with each other in jarring ways.

For Developers
The library is contained inside a global table named "CalcViewPS" and runs a hook called "CalcViewPS_Initialized" when it has loaded.

ENUMs CalcViewPS.PerspectiveENUM = { FIRSTPERSON = 1, THIRDPERSON = 2, TOPDOWN = 3, ISOMETRIC = 4, OTHER = 5 } Argument Explanations name - Unique string ID for the hook func - The function to be ran if the hook is of the highest priority, or is a layered hook. Works like normal CalcView, function must return a table like a normal CalcView hook would. In the case of the hook being layered, the hook should not be layering the returned values on top of the provided base position, angles and FOV. The library already takes care of the layering. priority - The priority number the hook should have. The higher it is, the bigger the chance it will be the "camera" that is running. Value is clamped to be between -100000 and 100000 perspective - The perspective ENUM for the hook. Layered hooks will only be applied if they have the same perspective ENUM as the current running Base hook. This can be one of the ENUMs above or a number. Functions CalcViewPS.Add(name, func, priority, perspective) - Adds a "Base" hook to the queue with the specified priority. CalcViewPS.AddToTop(name, func, perspective) - Adds a "Base" hook to the queue above the current highest priority hook. (Priority 9000 if one does not exist.) CalcViewPS.AddToBottom(name, func, perspective) - Adds a "Base" hook to the queue below the current lowest priority hook. (Priority -9000 if one does not exist.) CalcViewPS.AddLayered(name, func, perspective) - Adds a "Layered" hook to the table, which will be layered on top of the current running "Base" hook. CalcViewPS.Remove(name) - Removes "Base" hook with the specified id from the queue CalcViewPS.RemoveLayered(name) - Removes "Layered" hook with the specified id from the layered hooks table. CalcViewPS.GetLowestPriority() - Returns the lowest priority number that is present in the current "Base" hook queue. CalcViewPS.GetLowestPriorityHook() - Returns the table of the lowest priority "Base" hook in the queue. Returns nil if no hooks exist. CalcViewPS.GetHighestPriority() - Returns the highest priority number that is present in the current "Base" hook queue. CalcViewPS.GetLowestPriority() - Returns the table of the highest priority "Base" hook in the queue. Returns nil if no hooks exist.

Support Links
[ko-fi.com]
[ko-fi.com]
26 Comments
чинчопа 12 Sep @ 10:42am 
What commands and codes can I use to simulate aiming on a weapon? And how i do that? help please!!!
captain gurt 17 Jun @ 3:58pm 
thanks for the quick response. after a little bit of fiddling with possible culprit mods, it seems to have been "Shmovment" that was causing the issue. very unfortunate
Mercury, 80Hg  [author] 17 Jun @ 2:43pm 
I would consider any camera mod that changes "drawviewer" functionality to be an incompatibility.
General rule is this: If it's a camera mod and it's not using this, then it has a 99.9% chance of being incompatible.
captain gurt 17 Jun @ 2:37pm 
are there any known compatibility errors? for me, any mods that use this system do work but don't actually have a visible player model during the animations (examples: Animated Ladder Climbing and Hard Landing / Safety Roll). the animations do play in third person, it's just that the player's body is not rendered during animations in first person
えTeyora Lacisaト 14 Apr @ 8:17pm 
add settings in menu pls. I want to set up priority of view for addons
RatOrder 28 Jan @ 12:20pm 
Yeah, can you enable headbob from this? Also, I have no idea, just asking in case y'all have this issue too, this mod seems to conflict with first person view mods, causing the screen to go black. No idea if this is the cause, so ignore it if it isn't, but just saying. Kind of annoying, as I want to be able to use first person body.
Nuclear Swag 29 Sep, 2023 @ 2:12am 
how do i enable head bob
Nuclear Swag 28 Sep, 2023 @ 11:37pm 
do you got a tutorial on youtube for this mod
oil 8 Aug, 2023 @ 11:50am 
are you going to continue making the parkour mod?
Mercury, 80Hg  [author] 12 Jun, 2023 @ 9:05am 
Not really. Vacations, work, and a new GPU have been taking up all my time.