use of org.terasology.engine.network.NetworkMode in project Terasology by MovingBlocks.
the class AutoCreateSystem method postBegin.
@Override
public void postBegin() {
Set<Prefab> existingGlobals = Sets.newHashSet();
NetworkMode mode = networkSystem.getMode();
for (EntityRef entity : entityManager.getEntitiesWith(AutoCreateComponent.class)) {
existingGlobals.add(entity.getParentPrefab());
}
for (Prefab prefab : prefabManager.listPrefabs(AutoCreateComponent.class)) {
AutoCreateComponent comp = prefab.getComponent(AutoCreateComponent.class);
if (!existingGlobals.contains(prefab) && (comp.createClientSide || mode.isAuthority())) {
entityManager.create(prefab);
}
}
}
use of org.terasology.engine.network.NetworkMode in project Terasology by MovingBlocks.
the class DiscordRPCSystem method setPartyState.
private void setPartyState() {
final NetworkMode networkMode = networkSystem.getMode();
String mode = "Playing Online";
if (networkMode == NetworkMode.DEDICATED_SERVER) {
mode = "Hosting";
} else if (networkMode == NetworkMode.NONE) {
mode = "Playing Solo";
DiscordRPCSubSystem.setPartyInfo(1, 1);
}
DiscordRPCSubSystem.setState(mode);
if (networkMode != NetworkMode.NONE) {
/* The player is playing online or hosting a game */
DiscordRPCSubSystem.setPartyInfo(onlinePlayers, 99);
}
}
Aggregations