Forum Replies Created
Viewing 5 posts - 1 through 5 (of 5 total)
-
AuthorPosts
-
11.12.2024 at 16:48 #1156
Example: Syntax Highlighting with “HTML Editor Syntax Highlighter”
This is an example of how to display code with proper syntax highlighting using the “HTML Editor Syntax Highlighter” plugin.
JavaScript Example
function sayHello() { console.log("Hello, World!"); } sayHello();
HTML Example
Syntax Highlighter Test Welcome to Syntax Highlighting!
Enjoy properly formatted and highlighted code blocks!
CSS Example
body { background-color: #f4f4f4; font-family: Arial, sans-serif; } h1 { color: #333; text-align: center; }
PHP Example
11.12.2024 at 16:43 #1150afwafwfaaw
awfawfawfaw
wafawfawf11.12.2024 at 16:36 #1144awdawdawdadwad
adwadawdprotected void TEST(FA);
27.11.2024 at 22:31 #877actually its:
class BoatAutopilotComponentClass : ScriptComponentClass { }; class BoatAutopilotComponent : ScriptComponent { protected vector m_vTargetPosition; protected float m_fMaxSpeed = 2.0; // Maximum speed for smoother movement protected float m_fCurrentSpeed = 0.0; // Start at zero for acceleration protected float m_fAcceleration = 0.5; // Adjust to control acceleration rate protected float m_fSlowdownDistance = 20.0; // Distance at which to start slowing down protected float m_fDelay = 5.0; // Delay in seconds before movement starts protected float m_fElapsedTime = 0.0; // Timer to track delay override void OnPostInit(IEntity owner) { Print("BoatAutopilotComponent initialized with smoother movement"); // Set a specific target position in water for testing m_vTargetPosition = Vector(200, 0, 200); // Replace with actual water coordinates PrintFormat("New target position: %1", m_vTargetPosition); // Start a timer to call the UpdateMovement method every 0.05 seconds for smoother updates GetGame().GetCallqueue().CallLater(UpdateMovement, 50, true, owner); } // UpdateMovement is called every 0.05 seconds for smoother frame updates void UpdateMovement(IEntity owner) { // Increment the elapsed time by 0.05 seconds m_fElapsedTime += 0.05; // Check if the delay period has passed if (m_fElapsedTime < m_fDelay) { Print("Waiting for delay before starting movement..."); return; // Exit early if still within the delay period } // Calculate the distance to the target float distanceToTarget = vector.Distance(owner.GetOrigin(), m_vTargetPosition); // If the boat is close to the target, pick a new target if (distanceToTarget < 5.0) { SetNewTargetPosition(owner); return; } // Smooth acceleration and deceleration if (distanceToTarget < m_fSlowdownDistance) { // Slow down as we approach the target m_fCurrentSpeed = Math.Clamp(m_fCurrentSpeed - m_fAcceleration * 0.05, 0.5, m_fMaxSpeed); } else { // Accelerate up to max speed m_fCurrentSpeed = Math.Clamp(m_fCurrentSpeed + m_fAcceleration * 0.05, 0.0, m_fMaxSpeed); } PrintFormat("Boat moving at speed: %1", m_fCurrentSpeed); // Move the boat toward the target position MoveTowardsTarget(owner, m_fCurrentSpeed * 0.05); // Use time slice for smooth movement } protected void SetNewTargetPosition(IEntity owner) { // Set a new specific target position in water m_vTargetPosition = Vector(200, 0, 200); // Adjust as needed PrintFormat("New target position: %1", m_vTargetPosition); // Reset speed to start smooth acceleration for the new target m_fCurrentSpeed = 0.0; } protected void MoveTowardsTarget(IEntity owner, float timeSlice) { vector currentPos = owner.GetOrigin(); vector direction = vector.Direction(currentPos, m_vTargetPosition).Normalized(); // Calculate the new position by moving in small increments toward the target vector newPosition = currentPos + (direction * m_fCurrentSpeed * timeSlice); // Update the boat's position owner.SetOrigin(newPosition); PrintFormat("Current Position: %1, Moving towards: %2", currentPos, m_vTargetPosition); } };
27.11.2024 at 20:13 #784AAAAAAAAAA
-
AuthorPosts
Viewing 5 posts - 1 through 5 (of 5 total)