Files
Documentation/content/world/entities/spawning/local-spawning.fr.md
2026-01-20 20:33:59 +01:00

4.9 KiB

title, type, weight
title type weight
Spawning Local docs 3

Le spawning local gere le spawn de NPCs autour des joueurs, assurant que les zones de jeu actives ont une densite de creatures appropriee.

Package: com.hypixel.hytale.server.spawning.local

Architecture

Spawning Local
├── Composants
│   ├── LocalSpawnController - Controleur spawn joueur
│   ├── LocalSpawnBeacon - Point de spawn local
│   └── LocalSpawnState - Suivi etat spawn
└── Systemes
    ├── LocalSpawnSetupSystem - Initialiser spawning local
    ├── LocalSpawnControllerSystem - Traiter controleurs
    ├── LocalSpawnBeaconSystem - Traiter beacons
    └── LocalSpawnForceTriggerSystem - Declencheurs manuels

LocalSpawnController

Controle le spawning local autour d'un joueur:

public class LocalSpawnController implements Component<EntityStore> {
    private double timeToNextRunSeconds;

    public void setTimeToNextRunSeconds(double seconds);
    public boolean tickTimeToNextRunSeconds(float dt);
}

Acces au Composant

// Obtenir type de composant
ComponentType<EntityStore, LocalSpawnController> type =
    SpawningPlugin.get().getLocalSpawnControllerComponentType();

// Acceder sur entite joueur
LocalSpawnController controller = store.getComponent(playerRef, type);

Timing de Spawn

Le controleur utilise un delai configurable avant spawning:

// Delai initial configure dans SpawningPlugin
double joinDelay = SpawningPlugin.get().getLocalSpawnControllerJoinDelay();

Cela empeche le spawning immediat quand un joueur rejoint, laissant le temps au monde de charger.

LocalSpawnBeacon

Definit les points de spawn locaux autour des joueurs:

public class LocalSpawnBeacon {
    // Position et configuration pour spawns locaux
    // Cree dynamiquement base sur position joueur
}

Utilisation des Beacons

Les beacons de spawn locaux sont geres automatiquement:

  1. Crees autour des joueurs actifs
  2. Mis a jour quand joueurs bougent
  3. Supprimes quand joueurs quittent la zone

LocalSpawnState

Suit l'etat de spawn local:

public class LocalSpawnState {
    // Etat de spawn actuel pour un controleur local
    // Suit spawns actifs et cooldowns
}

Systemes

LocalSpawnSetupSystem

Initialise le spawning local pour les joueurs:

getEntityStoreRegistry().registerSystem(new LocalSpawnSetupSystem());

Ce systeme:

  • Attache LocalSpawnController aux nouveaux joueurs
  • Configure parametres de spawn initiaux
  • Configure les beacons de spawn

LocalSpawnControllerSystem

Traite les controleurs de spawn a chaque tick:

getEntityStoreRegistry().registerSystem(new LocalSpawnControllerSystem());

Ce systeme:

  • Decremente les timers de spawn
  • Verifie les conditions de spawn
  • Declenche jobs de spawn quand pret

LocalSpawnBeaconSystem

Gere les beacons de spawn locaux:

getEntityStoreRegistry().registerSystem(new LocalSpawnBeaconSystem());

Ce systeme:

  • Met a jour positions des beacons
  • Traite logique spawn beacon
  • Gere cycle de vie beacon

LocalSpawnForceTriggerSystem

Gere les declencheurs de spawn forces:

getEntityStoreRegistry().registerSystem(new LocalSpawnForceTriggerSystem());

Utilise pour:

  • Commandes debug
  • Spawning declenche par evenement
  • Population manuelle

Utilisation de l'API

Obtenir Controleur Spawn Local

ComponentType<EntityStore, LocalSpawnController> type =
    LocalSpawnController.getComponentType();

LocalSpawnController controller = store.getComponent(playerRef, type);
if (controller != null) {
    // Le joueur a le spawning local active
}

Forcer Mise a Jour Spawn

// Reset timer spawn pour declencher verification immediate
LocalSpawnController controller = store.getComponent(playerRef, type);
controller.setTimeToNextRunSeconds(0);

Verifier Pret pour Spawn

// Verifier si timer spawn ecoule
boolean ready = controller.tickTimeToNextRunSeconds(deltaTime);
if (ready) {
    // Temps de tenter spawning
}

Configuration

Delai de Connexion

Configurer le delai avant que spawning local demarre pour nouveaux joueurs:

double delay = SpawningPlugin.get().getLocalSpawnControllerJoinDelay();

Cela empeche:

  • Embuscades immediates au spawn
  • Submerger les nouveaux joueurs
  • Spawning avant chargement monde

Rayon de Spawn

Le spawning local utilise un rayon configure autour des joueurs:

// Le rayon de spawn determine a quelle distance du joueur les NPCs peuvent spawn
// Configure par definition de spawn

Integration avec Spawning Mondial

Le spawning local fonctionne avec le spawning mondial:

Systeme Portee Declencheur
Spawning Mondial Base chunk Chargement chunk
Spawning Local Centre joueur Proximite joueur

Les deux systemes:

  • Respectent la suppression de spawn
  • Utilisent le meme pool NPC
  • Partagent les limites de spawn