The main damaging systems of Core Keeper in v1.1.2.10, AttackSystem and AttackPlayerSystem use a FactionCD component as part of the can hit flow.
FactionCD also exposes a way to "befriend" in game factions with a FactionCD.SetBefriendedFaction(FactionID faction, bool befriend) method.
Currently FactionID is an enum with the following possibilities.
Larva
Caveling
Slime
Neutral
Player
OnlyAttacksPlayer
Bird
AttacksAllButNotAttacked
MoldInfected
NatureCaveling
Merchant
SeaCaveling
AttacksAllButNotPlayer
SeaCreature
Scarab
LavaCreature
CanOnlyBeAttackedByPlayerOrExplosion
UnfriendlyAgainstAll
DesertCaveling
CrystalCreature
MushroomEnemy
CoreBoss
PlayerMinion
PassageEnemy
Explosion
Adding a FactionCD component befriended to FactionID.Explosion to an entity with HealthCD makes it immune to explosion damage.