tModLoader Census - Town NPC Checklist

jopojelly

Retinazer
tModLoader
r3d7RwY.png

Census - Town NPC Checklist

Latest Download:
Mod Browser (in-game) - Direct link - Alt download Link
Open to collaboration on GitHub

Census - Town NPC Checklist modifies the housing panel to show missing townspeople.

A "✓" signifies that the conditions for spawning that npc have been fulfilled. An "X" means that conditions have not been fulfilled. An "?" means the game hasn't attempted to spawn a town npc yet, so the conditions are still unknown. "?" will change to "✓" or "X" once it is daytime and the game decides it is time to spawn a town npc. Hover over it to see the spawn conditions.

Townspeople spawn about 2 minutes after day begins, so the data shown might not be up to date until that check happens. (Either "?" or old info)

The server console command "TownProgress" can be used to check from the console.

Mods can add the conditions for their town easily, see the 2nd post below for instructions.

Feedback greatly appreciated.

Here is what it looks like in game, the mod adds the blue icons for town NPC not yet obtained. Hover to see spawn conditions:

There is also a Town NPC Locating Arrow feature. It is useful for finding a specific town npc more easily:

You can use server console commands to check the status from the server console:
sJuiulL.png

Planned Features:
  • Anything else? Suggestions?
  • ??
Changelog:
v0.3
  • Multiplayer support
v0.2
  • Town NPC Locating Arrow feature. (Configurable)
  • Update to tModLoader v0.11.3
v0.1
  • Initial release
Census.png
 
Last edited:
Mod Support

Census can't guess the conditions for spawning town NPC added by mods. Modders need to add code to their mod to inform Census the conditions for spawning the town npc. Without modders adding support, "Conditions unknown" will be reported to users who want to know how to spawn the town NPC.

How to add support for your mod
Adding support is easy, you just need to add some code to your Mod class that invokes Mod.Call on the Census mod. Make sure to follow the message format perfectly.
Current Messages Accepted:
Code:
"TownNPCCondition", int npcid, string condition
Code:
public override void PostSetupContent()
{
    Mod censusMod = ModLoader.GetMod("Census");
    if(censusMod != null)
    {
        // Here I am using Chat Tags to make my condition even more interesting.
        // If you localize your mod, pass in a localized string instead of just English.
        censusMod.Call("TownNPCCondition", NPCType("Example Person"), $"Have [i:{ItemType<Items.ExampleItem>()}] or [i:{ItemType<Items.Placeable.ExampleBlock>()}] in inventory and build a house out of [i:{ItemType<Items.Placeable.ExampleBlock>()}] and [i:{ItemType<Items.Placeable.ExampleWall>()}]");
        // Additional lines for additional town npc that your mod adds
        // Simpler example:
        // censusMod.Call("TownNPCCondition", NPCType("Simple"), "Defeat Duke Fishron");
    }
}
The description string can the chat tags system for color and items: http://terraria.wiki.gg/Chat#Tags
 
Last edited:
Never thought this is something I wanted until I saw it. One suggestion is to add filters/toggles. I can imagine that (once mods add support) having lots of mods can make the screen rather cluttered, so being able to sometimes just see the NPCs you have would be nice. Will definitely adds support for my own mod(s) soontm!
 
Damn this seems really useful for new players for both vanilla and modded, feels like a feature that vanilla terraria should have.
 
I found one little bug, I just wanted to let you know.... when I open the npc list, my defense info covers one of the npc's figured you would like to know
 
I found one little bug, I just wanted to let you know.... when I open the npc list, my defense info covers one of the npc's figured you would like to know
Can you show me a screenshot of this? I'm pretty sure defense isn't shown on the housing page.
 
Jopo, what would we do without you? You make such amazing qol mods, and I think everyone in the terraria community apriciates it so much.
 
This right here, this is something I've been waiting for for a long time. Kudos for yet another in a massively growing list of amazing QoL mods!

Also, if I may suggest something that may or may not really fit in the mod but would be incredibly useful regardless...
Perhaps having one of those "accessory visibility" icons on NPC pictures that could be clicked off to "evict" the NPC (making them despawn with the Travelling Merchant style depart message once offscreen) and not be able to return until you re-click the icon. Perhaps with a voting system for servers so one person can't just evict every NPC.
It'd be great for massive modpacks where you may end up with a lot of NPCs you don't have a use for and don't want to build 60 houses to house them all, but also don't want a bunch of them wandering around your town homeless. (of course, moving NPCs to different housing manually doesn't have a vote system, even on servers, and things like King Statues are a thing, so it's not like trolling by moving/killing off NPCs is a new thing on servers.)

Also, since you're changing the behaviour of the NPC housing menu, why not go full-throttle and change how NPC housing works too? Specifically, it'd be nice if manually-assigned NPCs (i.e. when you put them in a house and their banner gets a gold outline) would "remember" that house location if they die/are evicted/etc, and when searching for a house, will first check the same spot that they were assigned to. If it's not a valid house or otherwise occupied, they try to move into a different house. If it becomes empty again, they then try to move back into their manually-assigned house automatically.

Both of these things would probably be a whole lot of work, assuming they're even possible, but they would be massively useful QoL features and would really make housing NPCs less of an absolute micromanagey pain. I figure if they would fit in any mod, it would be this one.
 
This right here, this is something I've been waiting for for a long time. Kudos for yet another in a massively growing list of amazing QoL mods!

Also, if I may suggest something that may or may not really fit in the mod but would be incredibly useful regardless...
Perhaps having one of those "accessory visibility" icons on NPC pictures that could be clicked off to "evict" the NPC (making them despawn with the Travelling Merchant style depart message once offscreen) and not be able to return until you re-click the icon. Perhaps with a voting system for servers so one person can't just evict every NPC.
It'd be great for massive modpacks where you may end up with a lot of NPCs you don't have a use for and don't want to build 60 houses to house them all, but also don't want a bunch of them wandering around your town homeless. (of course, moving NPCs to different housing manually doesn't have a vote system, even on servers, and things like King Statues are a thing, so it's not like trolling by moving/killing off NPCs is a new thing on servers.)

Also, since you're changing the behaviour of the NPC housing menu, why not go full-throttle and change how NPC housing works too? Specifically, it'd be nice if manually-assigned NPCs (i.e. when you put them in a house and their banner gets a gold outline) would "remember" that house location if they die/are evicted/etc, and when searching for a house, will first check the same spot that they were assigned to. If it's not a valid house or otherwise occupied, they try to move into a different house. If it becomes empty again, they then try to move back into their manually-assigned house automatically.

Both of these things would probably be a whole lot of work, assuming they're even possible, but they would be massively useful QoL features and would really make housing NPCs less of an absolute micromanagey pain. I figure if they would fit in any mod, it would be this one.
Thanks, I'll look into this, don't know if the first one can be done cleanly. The second one is a vanilla feature already I'm pretty sure. If you manually assign a house the flag becomes gold and only that npc can move back into that house.
 
Thanks, I'll look into this, don't know if the first one can be done cleanly. The second one is a vanilla feature already I'm pretty sure. If you manually assign a house the flag becomes gold and only that npc can move back into that house.
Now that you mention it, I think that is... Although I think it's somewhat inconsistent, but that may be due to this: I do know for a fact, whether it's intended or not, that when NPCs respawn, they often lose the gold border even if they move back into the same house, meaning unless you manually assign them again, the next time they respawn will be random.

On an unrelated note, something that may be a bit easier to implement (again not really sure if it fits with this mod, but again would be very useful for NPC management) is an "invisible" (perhaps visible with Wire Vision so you don't lose it completely) 1x1 wall furniture item which marks a house as unsuitable, so you can have your own room which happens to meet requirements without an NPC trying to move in. I've seen mods add furniture that instantly makes a house suitable even if it's really small or doesn't meet other requirements, so this should be doable I would imagine. It bothers me needing to leave out lights or a chair or a table in my personal room to avoid Jimmy McMerchant from deciding to crash at my place.
 
I've found a bug. Two alive NPC's will often overlap two unavailable ones.

I think it might not always be two exactly, but I am not sure.

Tgo3q5i.png


Other than that. Thank you for this amazing mod. Super helpful!
 
Back
Top Bottom