Space Engineers

Space Engineers

WC Radar
BookBurner 30 May, 2023 @ 3:44am
neutral checks
hello again, could this enemy check

enemy = faction.IsEnemy(playerID);

be changed to something else? I noticed that it flags neutral ships as enemies. When this code is changed to some other kind of check

var localRep = MyAPIGateway.Session.Factions.GetReputationBetweenPlayerAndFaction(playerID, faction.FactionId);
if (localRep < -500) {
enemy = true;
}

it works as it I think should and neutral grids are marked with neutral icons and lines. It might be that IsEnemy returns true to all "non friendly" grids.
< >
Showing 1-5 of 5 comments
BDCarrillo  [developer] 14 Jun, 2023 @ 9:57pm 
(Thx steam for not notifying me of a discussion being started...) I'll have to look into this a bit more. The SE faction and reputation systems are really wonky, as you can have players within a faction that are enemies (due to reputation) where their faction mates may be neutral or friendly.

WC itself looks at the block to player relationship level when considering targets, and I certainly don't want to iterate blocks to average out any that may be owned by hostile factions vs neutral
BookBurner 15 Jun, 2023 @ 12:33am 
That is true, iterating blocks is not a way to go :D.

GetReputationBetweenPlayerAndFaction should not iterate over blocks though, it should just check the reputation between the wc radar user and the target's faction.
BDCarrillo  [developer] 15 Jun, 2023 @ 8:03am 
Ah, just as I guessed the difference is faction->faction vs player->faction vs player->block relations.

IsEnemy (if you have a faction) is: MySession.Static.Factions.GetRelationBetweenFactions(myFaction.FactionId, FactionId).Item1 == MyRelationsBetweenFactions.Enemies;

If you don't have a faction, it uses GetRelationBetweenPlayerAndFaction.

So those "neutrals" you were seeing may have been neutral to you personally by reputation, but are indeed enemies by faction.

WC uses player->block relation for target verification, and the WC hud uses player->faction. I'll take a look at the different results from those checks.
BDCarrillo  [developer] 23 Jun, 2023 @ 9:50am 
I've adopted your recommendation on the friendly/enemy/neutral checks. Thanks for the feedback and suggestion!
BookBurner 23 Jun, 2023 @ 9:55am 
glad to be of service, we really love your mod :))
< >
Showing 1-5 of 5 comments
Per page: 1530 50