Bob's Character classes


Adds character classes to the game.

9 months ago
0.16 - 1.1
94.8K

b Character names disappear when switching characters

4 years ago

Occasionally when switching characters the custom character name I give them will be reset to the default. It sometimes happens, sometimes doesn't. I'll update this if I find out when exactly it happens and when it doesn't.

4 years ago

Also one of my characters somehow disappeared from existence when switching characters while inside a Space Exploration rocket silo

4 years ago

Update: Custom character names are reset each time I switch away from a character.

4 years ago

Update: Custom character names are reset each time I switch away from a character.

4 years ago
(updated 4 years ago)

There are situations where characters can accidently be deleted if you switch during an inapropriate time, EG, if you use /editor to enter editor mode, your character is "Removed" from the game field, and restored upon typing /editor again, placed in your new location. If you switch characters while in this mode, the hidden character is deleted when you switch, because it exits editor mode.
I have put in a safeguard against this, where it will check if you're in editor mode, and then try to leave it before switching characters, but if other mods do similar trickery, my mod can't really detect if they've done something, and simply switch character. Normally whenever you have a character in a vehicle and try to switch, the game engine will cause the passenger character to be kicked out of the vehicle. Again, if Space Exploration does some sort of trickery to accomplish what it is trying to do, my mod might not be able to detect that, and breaks the state. You'd need to trigger space exploration's "Give me my character back" logic to restore it, which you probably can't do anymore, because you're not in the state that mod put you in.

As for the naming... the way my mod stores names is to by the entity's "unit number", all objects in the game world are entities, biters, buildings, characters, vehicles, and items on the floor. Every unit number is unique, and if you delete it and recreate it (which something like space exploration might be doing) then the recreated entity would have a new unit number, and therefore the name wouldn't be associated with that character anymore.

There's only 2 ways to keep track of an entity. Store a link to it (a referenced object), or store a unique piece of information about that entity. Since you may own multiple entities of the same prototype, the only unique information about the entity is it's unit number. (also, you can't reference a table using an object), and can't really store "non-relevant" information on an object itself, therefore the method I used was the only real viable option.

Verify for me, when my mod doesn't restore the name of a character, have any functions been performed on the character such as, it being removed from view (Outside of getting into a car, tank, train or spidertron) or changed in some way (EG, Minime mod deletes the character entity and recreates it with a new prototype which has graphics reduced in size)

3 years ago
(updated 3 years ago)

This is a bit of a necro, but this interaction has been driving me nuts. After a fair bit of testing using the jetpack from space exploration causes the name to be lost. It does change your sprite(prototype?) while you are are using it. Is there any way that you could store the name/icon of the current body separately, and then re-store it by the current ID as you switch away? It never loses the name of inactive bodies, only the one you are currently using.

3 years ago

as previously stated, the name is linked to the "Unit number".
if the entity is being replaced by another mod, then the original entity is DESTROYED, and can't be recovered. Therefore when you remove the jetpack to switch back, a new entity is created with a different unit number.

There's not really any other way to attach information to an entity, you can only really access and store certain values. Unit-number is the only real way to link to an entity other than a link to it... and the link is kind of cumbersome, can't be accessed from the entity itself (which is kind of important in the way my GUI works) and the link would still be lost when the entity is destroyed to be replaced with a jetpack variant.

Keep in mind, the name will still be there in the table, stored to be linked to a unit-number, but nothing will link to it anymore.

The short answer is... there's really nothing I can do about it.

3 years ago

Right, I get that, is there any way you could store the "current unit" name and icon separate from the unit number when switching into a body, then while playing as that body it gets destroyed/recreated as much as it would like, but then when you move out of the body you then re-store it by the new unit number?

3 years ago

I mean... is it possible? yes... it'd be a pain in the backside as there's currently no special treatment for storing the name of the currently active character, I'd have to write in a whole new set of functions just to handle that.

3 years ago

Fair enough. The mod (like so many of yours) is already amazing, and. I have no right to complain.

New response