UNPKG

@skyrim-platform/papyrus-util

Version:

TypeScript library for the PapyrusUtil Skyrim modding utility

106 lines (101 loc) 6.12 kB
/* ============================================== Typescript definitions for v4.2 ============================================== This file was automatically generated by Papyrus-2-Typescript.exe https://github.com/CarlosLeyvaAyala/Papyrus-2-Typescript The program has no way to know the intention of the humans that made the scripts, so it's always advisable to manually check all generated files to make sure everything is declared as it should. Take note the program assumes this script exists in some subfolder to the folder where `skyrimPlatform.ts` is found, otherwise you'll get "Cannot find module..." type of errors. If you want to have this script in some other place, just change the relative path of each `import`. */ import * as sp from "skyrimPlatform"; var sn = sp.MiscUtil; /** Cell scanning functions */ // Scans the current cell of the given CenterOn for an object of the given form type ID within radius and returns an array for all that // and (optionally) also has the given keyword if changed from default none. Setting radius higher than 0.0 will restrict the // search distance from around CenterOn, 0.0 will search entire cell the object is in. // NOTE: Keyword searches seem a little unpredictable so be sure to test if your usage of it works before using the results. export var ScanCellObjects = function (formType, CenterOn, radius, HasKeyword) { if (radius === void 0) { radius = 0.0; } if (HasKeyword === void 0) { HasKeyword = null; } return sn.ScanCellObjects(formType, CenterOn, radius, HasKeyword); }; // Scans the current cell of the given CenterOn for an actor within the given radius and returns an array for all actors that are // currently alive and (optionally) has the given keyword if changed from default none. Setting radius higher than 0.0 will restrict the // search distance from around CenterOn, 0.0 will search entire cell the object is in. // NOTE: Keyword searches seem a little unpredictable so be sure to test if your usage of it works before using the results. export var ScanCellNPCs = function (CenterOn, radius, HasKeyword, IgnoreDead) { if (radius === void 0) { radius = 0.0; } if (HasKeyword === void 0) { HasKeyword = null; } if (IgnoreDead === void 0) { IgnoreDead = true; } return sn.ScanCellNPCs(CenterOn, radius, HasKeyword, IgnoreDead); }; // Same as ScanCellNPCs(), however it filters the return by a given faction and (optionally) their rank in that faction. export var ScanCellNPCsByFaction = function (FindFaction, CenterOn, radius, minRank, maxRank, IgnoreDead) { if (radius === void 0) { radius = 0.0; } if (minRank === void 0) { minRank = 0; } if (maxRank === void 0) { maxRank = 127; } if (IgnoreDead === void 0) { IgnoreDead = true; } return sn.ScanCellNPCsByFaction(FindFaction, CenterOn, radius, minRank, maxRank, IgnoreDead); }; /** Camera functions */ // Toggle freefly camera. export var ToggleFreeCamera = function (stopTime) { if (stopTime === void 0) { stopTime = false; } return sn.ToggleFreeCamera(stopTime); }; // Set freefly cam speed. export var SetFreeCameraSpeed = function (speed) { return sn.SetFreeCameraSpeed(speed); }; // Set current freefly cam state & set the speed if enabling export var SetFreeCameraState = function (enable, speed) { if (speed === void 0) { speed = 10.0; } return sn.SetFreeCameraState(enable, speed); }; /** File related functions */ // Get an array of files in a given parent directory that have the given extension. // directory is relative to the root Skyrim folder (where skyrim.exe is) and is non-recursive. // directory = "." to get all files in root Skyrim folder // directory = "data/meshes" to get all files in the <root>/data/meshes folder // extension = ".nif" to get all .nif mesh files. // (default) extension="*" to get all files export var FilesInFolder = function (directory, extension) { if (extension === void 0) { extension = "*"; } return sn.FilesInFolder(directory, extension); }; // Get an array of folders in a given parent directory // Same rules and examples as above FilesInFolder apply to the directory rule here. export var FoldersInFolder = function (directory) { return sn.FoldersInFolder(directory); }; // Check if a given file exists relative to root Skyrim directory. Example: FileExists("data/meshes/example.nif") export var FileExists = function (fileName) { return sn.FileExists(fileName); }; // Read string from file. Do not read large files! export var ReadFromFile = function (fileName) { return sn.ReadFromFile(fileName); }; // Write string to file. export var WriteToFile = function (fileName, text, append, timestamp) { if (append === void 0) { append = true; } if (timestamp === void 0) { timestamp = false; } return sn.WriteToFile(fileName, text, append, timestamp); }; /** Misc */ // Print text to console. export var PrintConsole = function (text) { return sn.PrintConsole(text); }; // Get race's editor ID. export var GetRaceEditorID = function (raceForm) { return sn.GetRaceEditorID(raceForm); }; // Get race's editor ID. export var GetActorRaceEditorID = function (actorRef) { return sn.GetActorRaceEditorID(actorRef); }; // Set HUD on / off - NOT CURRENT WORKING IN SKYRIM SPECIAL EDITION export var SetMenus = function (enabled) { return sn.SetMenus(enabled); }; // Get node rotation // REMOVED v2.9: Useless, only does a part of the job. // float function GetNodeRotation(ObjectReference obj, string nodeName, bool firstPerson, int rotationIndex) global native export var GetNodeRotation = function (obj, nodeName, firstPerson, rotationIndex) { return sn.GetNodeRotation(obj, nodeName, firstPerson, rotationIndex); }; // LEGACY v3.3 - Added Ignoredead parameter to function, aliased for backwards compatability with v3.2. export var ScanCellActors = function (CenterOn, radius, HasKeyword) { if (radius === void 0) { radius = 5000.0; } if (HasKeyword === void 0) { HasKeyword = null; } return sn.ScanCellActors(CenterOn, radius, HasKeyword); };