Bug Fix: Ascension Info Entity Removal In Game

by SLV Team 47 views
Bug Fix: Ascension Info Entity Removal in Game

Hey guys, let's dive into a pesky bug that's been causing some grief in the game. It revolves around the Ascension info entity and how it's being handled. This fix is crucial for keeping your Ascension levels visible and accessible, so you're always in the know about your progress. We'll break down the issue, the technical details, and, most importantly, how to fix it. Trust me, it's not as complex as it sounds!

The Problem: Ascension Info Entity's Unwanted Removal

So, what's the deal? Well, the game has a function called IMPL_remove_all_perks, located in data/scripts/perks/perk.lua. This function's job is to clear out certain entities from your player. The problem arises because the Ascension info entity, which is supposed to display your current Ascension levels, is getting caught in the crossfire and removed unintentionally. This is super annoying because it means you lose the visual cues of your progress, and no one wants that! Imagine grinding to level up, only to have the game forget to tell you about it. That's essentially what was happening, and that's not cool.

The Root Cause: A Misplaced Tag

What's causing this issue? The culprit is a tag – specifically, the perk_entity tag. The game targets and removes all child entities of the player that have this tag. The Ascension info entity is added as a child of the player. The problem lies in the fact that the Ascension info entity is incorrectly given the perk_entity tag. When IMPL_remove_all_perks is called, it sees the perk_entity tag and, poof, the Ascension info entity disappears. It's like accidentally labeling your house as 'garbage' and expecting the trash collectors to leave it alone. Not going to happen! The game is just following its instructions, but the instructions are based on a misunderstanding of what the Ascension info entity really is.

The Impact: Lost Information

The impact is pretty straightforward: you lose the visual representation of your Ascension levels. This might seem like a minor inconvenience, but it can be surprisingly disruptive. Ascension levels are a core part of the game's progression, and keeping track of your progress is crucial for making informed decisions about how to play. This bug effectively blinds you to your progress, making it harder to strategize and enjoy the game. It's like trying to navigate a dark room without a flashlight – doable, but way more frustrating and less effective.

Technical Deep Dive: Understanding the Code

Alright, let's get a little technical for a moment, and explore the code involved. Don't worry, I will try to keep it easy! It's super important to understand the code that causes the bug. Knowing what's going on under the hood helps us appreciate the solution even more. Let's break down the relevant parts.

IMPL_remove_all_perks: The Problematic Function

Here is the function, and it's found in data/scripts/perks/perk.lua: This function does exactly what the name suggests: it removes all perks from the player. It is designed to remove the perks the player has currently. The code iterates through the player's children and checks if each entity has the perk_entity tag. If an entity has this tag, it's removed. The design is intended to remove perks, but it's misunderstanding the Ascension info entity as a perk. So instead, the function accidentally removes the entity that displays your Ascension level.

The Perk.lua File: Where the Magic Happens

The perk.lua file is where all the logic for perks and related features is stored. This file is responsible for managing perks, which includes adding, removing, and displaying them. The IMPL_remove_all_perks function lives here, which is why it's the one that's causing the problem. Understanding the role of this file helps to identify how to fix the issue. It's like finding the right tool in a toolbox – you need to know where to look to make the repair. That file is the 'toolbox' for perks!

Data/scripts: The Core of the Game

This is the directory where the game's core scripts are stored. Files like perk.lua are critical for the game's functionality. The code in these scripts dictates how various game systems work. By changing these scripts, you can fix the bug, making sure that your Ascension info entity doesn't accidentally get removed.

The Solution: A Quick Fix and Correct Implementation

Now, for the good part: how to fix this! The solution is surprisingly simple, and that is awesome news for us. It involves the way the Ascension info entity is tagged and displayed. Let's go through the fix step-by-step.

Removing the Erroneous Tag

The most important thing to do is to remove the perk_entity tag from the Ascension info entity. This is the root of the problem. You remove the tag from the entity and, bam, the game no longer thinks the entity is a perk. By removing the tag, the IMPL_remove_all_perks function no longer targets the entity for removal. This simple change alone fixes the immediate issue. It's like taking the 'do not remove' sticker off of an item – you're telling the game it is not a perk!

Utilizing the UIIconComponent Correctly

For the UI icon to display correctly in the status bar (just like a perk), you only need the `is_perk=