private void HandleCameraKick(CameraKickEvent args) { if (!EntityManager.TryGetComponent(args.Euid, out CameraRecoilComponent recoil)) { _log.Warning($"Received a kick for euid {args.Euid}, but it is missing required components."); return; } if (!float.IsFinite(args.Recoil.X) || !float.IsFinite(args.Recoil.Y)) { _log.Error($"CameraRecoilComponent on entity {recoil.Owner} passed a NaN recoil value. Ignoring."); return; } // Use really bad math to "dampen" kicks when we're already kicked. var existing = recoil.CurrentKick.Length; var dampen = existing / KickMagnitudeMax; recoil.CurrentKick += args.Recoil * (1 - dampen); if (recoil.CurrentKick.Length > KickMagnitudeMax) { recoil.CurrentKick = recoil.CurrentKick.Normalized * KickMagnitudeMax; } recoil.LastKickTime = 0; }
public void Warning(string message, params object[] args) { if (Level > LogLevel.Warning) { return; } _sawmill.Warning(message, args); }
private void OnConstructionInit(EntityUid uid, ConstructionComponent construction, ComponentInit args) { if (GetCurrentGraph(uid, construction) is not { } graph) { _sawmill.Warning($"Prototype {EntityManager.GetComponent<MetaDataComponent>(construction.Owner).EntityPrototype?.ID}'s construction component has an invalid graph specified."); return; } if (GetNodeFromGraph(graph, construction.Node) is not { } node) { _sawmill.Warning($"Prototype {EntityManager.GetComponent<MetaDataComponent>(construction.Owner).EntityPrototype?.ID}'s construction component has an invalid node specified."); return; } ConstructionGraphEdge?edge = null; if (construction.EdgeIndex is {} edgeIndex) { if (GetEdgeFromNode(node, edgeIndex) is not { } currentEdge) { _sawmill.Warning($"Prototype {EntityManager.GetComponent<MetaDataComponent>(construction.Owner).EntityPrototype?.ID}'s construction component has an invalid edge index specified."); return; } edge = currentEdge; } if (construction.TargetNode is {} targetNodeId) { if (GetNodeFromGraph(graph, targetNodeId) is not { } targetNode) { _sawmill.Warning($"Prototype {EntityManager.GetComponent<MetaDataComponent>(construction.Owner).EntityPrototype?.ID}'s construction component has an invalid target node specified."); return; } UpdatePathfinding(uid, graph, node, targetNode, edge, construction); } }
private void CheckPathCasing(ResourcePath path) { if (!_checkCasing) { return; } // Run this inside the thread pool due to overhead. Task.Run(() => { var prevPath = GetPath(ResourcePath.Root); var diskPath = ResourcePath.Root; var mismatch = false; foreach (var segment in path.EnumerateSegments()) { var prevDir = new DirectoryInfo(prevPath); var found = false; foreach (var info in prevDir.EnumerateFileSystemInfos()) { if (!string.Equals(info.Name, segment, StringComparison.InvariantCultureIgnoreCase)) { // Not the dir info for this path segment, ignore it. continue; } if (!string.Equals(info.Name, segment, StringComparison.InvariantCulture)) { // Segments match insensitively but not the other way around. Bad. mismatch = true; } diskPath /= info.Name; prevPath = Path.Combine(prevPath, info.Name); found = true; break; } if (!found) { // File doesn't exist. Let somebody else throw the exception. return; } } if (mismatch) { _sawmill.Warning("Path '{0}' has mismatching case from file on disk ('{1}'). " + "This can cause loading failures on certain file system configurations " + "and should be corrected.", path, diskPath); } }); }
/// <summary> /// Inform the server that the client has a complete copy of the /// mapping, and alert other code that the handshake is over. /// </summary> /// <seealso cref="ClientHandshakeComplete"/> /// <seealso cref="NetworkInitialize"/> private void OnClientCompleteHandshake(INetManager net, INetChannel channel) { LogSzr.Debug("Letting server know we're good to go."); var handshake = net.CreateNetMessage <MsgMapStrClientHandshake>(); handshake.NeedsStrings = false; channel.SendMessage(handshake); if (ClientHandshakeComplete == null) { LogSzr.Warning("There's no handler attached to ClientHandshakeComplete."); } ClientHandshakeComplete?.Invoke(); }
/// <summary> /// Loads groups from the yaml file. Existing groups will not be overwritten. /// Call Clear() if you want to empty the container first. /// </summary> public void LoadGroups() { if (_resMan.UserData.Exists(_groupPath)) { _logger.Info($"Loading permGroups from UserData: {_groupPath}"); var file = _resMan.UserData.Open(_groupPath, FileMode.Open); LoadGroupYamlStream(file); return; } if (_resMan.TryContentFileRead(_groupPath, out var memoryStream)) { _logger.Info($"Loading permGroups from content: {_groupPath}"); LoadGroupYamlStream(memoryStream); return; } _logger.Warning($"Permission group file not found: {_groupPath}"); }
public void Warning(string message, params object[] args) { if (Level > LogLevel.Warning) { return; } if (message == "Tried to close a already closed pipe.") { if (_successfullyConnected) { _successfullyConnected = false; } else { return; } } _sawmill.Warning(message, args); }
private void InitOpenGL() { var vendor = GL.GetString(StringName.Vendor); var renderer = GL.GetString(StringName.Renderer); var version = GL.GetString(StringName.Version); var major = GL.GetInteger(GetPName.MajorVersion); var minor = GL.GetInteger(GetPName.MinorVersion); _sawmillOgl.Debug("OpenGL Vendor: {0}", vendor); _sawmillOgl.Debug("OpenGL Renderer: {0}", renderer); _sawmillOgl.Debug("OpenGL Version: {0}", version); var overrideVersion = ParseGLOverrideVersion(); if (overrideVersion != null) { (major, minor) = overrideVersion.Value; _sawmillOgl.Debug("OVERRIDING detected GL version to: {0}.{1}", major, minor); } DetectOpenGLFeatures(major, minor); SetupDebugCallback(); LoadVendorSettings(vendor, renderer, version); var glVersion = new OpenGLVersion((byte)major, (byte)minor, _isGLES, _isCore); DebugInfo = new ClydeDebugInfo(glVersion, renderer, vendor, version, overrideVersion != null); GL.Enable(EnableCap.Blend); if (_hasGLSrgb) { GL.Enable(EnableCap.FramebufferSrgb); CheckGlError(); } if (_hasGLPrimitiveRestart) { GL.Enable(EnableCap.PrimitiveRestart); CheckGlError(); GL.PrimitiveRestartIndex(PrimitiveRestartIndex); CheckGlError(); } if (!HasGLAnyVertexArrayObjects) { _sawmillOgl.Warning("NO VERTEX ARRAY OBJECTS! Things will probably go terribly, terribly wrong (no fallback path yet)"); } ResetBlendFunc(); CheckGlError(); // Primitive Restart's presence or lack thereof changes the amount of required memory. InitRenderingBatchBuffers(); _sawmillOgl.Debug("Loading stock textures..."); LoadStockTextures(); _sawmillOgl.Debug("Loading stock shaders..."); LoadStockShaders(); _sawmillOgl.Debug("Creating various GL objects..."); CreateMiscGLObjects(); _sawmillOgl.Debug("Setting up RenderHandle..."); _renderHandle = new RenderHandle(this); _sawmillOgl.Debug("Setting viewport and rendering splash..."); GL.Viewport(0, 0, ScreenSize.X, ScreenSize.Y); CheckGlError(); // Quickly do a render with _drawingSplash = true so the screen isn't blank. Render(); }