Init
This commit is contained in:
304
content/world/entities/spawning/spawner-assets.fr.md
Normal file
304
content/world/entities/spawning/spawner-assets.fr.md
Normal file
@@ -0,0 +1,304 @@
|
||||
---
|
||||
title: Assets Spawner
|
||||
type: docs
|
||||
weight: 4
|
||||
---
|
||||
|
||||
Les assets spawner definissent comment et ou les NPCs apparaissent, incluant les marqueurs pour points de spawn statiques et les beacons pour spawning dynamique.
|
||||
|
||||
**Package:** `com.hypixel.hytale.server.spawning.assets`
|
||||
|
||||
## Marqueurs de Spawn
|
||||
|
||||
### Asset SpawnMarker
|
||||
|
||||
Les marqueurs sont des points de spawn statiques qui font apparaitre des NPCs avec timing de reapparition configurable.
|
||||
|
||||
**Emplacement Asset:** `NPC/Spawn/Markers/`
|
||||
|
||||
```yaml
|
||||
# NPC/Spawn/Markers/village_guard.json
|
||||
{
|
||||
"Id": "village_guard",
|
||||
"Model": "spawn_marker_hostile",
|
||||
"ExclusionRadius": 15.0,
|
||||
"MaxDropHeight": 2.0,
|
||||
"RealtimeRespawn": true,
|
||||
"ManualTrigger": false,
|
||||
"DeactivationDistance": 40.0,
|
||||
"DeactivationTime": 5.0,
|
||||
"NPCs": [
|
||||
{
|
||||
"Name": "guard_soldier",
|
||||
"Weight": 70.0,
|
||||
"RealtimeRespawnTime": 120.0
|
||||
},
|
||||
{
|
||||
"Name": "guard_captain",
|
||||
"Weight": 30.0,
|
||||
"RealtimeRespawnTime": 300.0
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Champs SpawnMarker
|
||||
|
||||
| Champ | Type | Defaut | Description |
|
||||
|-------|------|--------|-------------|
|
||||
| `Id` | String | Requis | Identifiant unique marqueur |
|
||||
| `Model` | String | Defaut config | Modele visuel en mode creatif |
|
||||
| `NPCs` | SpawnConfiguration[] | Requis | Liste NPC ponderee |
|
||||
| `ExclusionRadius` | Double | 0 | Rayon exclusion joueur |
|
||||
| `MaxDropHeight` | Double | 2.0 | Offset hauteur spawn max |
|
||||
| `RealtimeRespawn` | Boolean | false | Temps reel vs temps jeu |
|
||||
| `ManualTrigger` | Boolean | false | Necessiter activation manuelle |
|
||||
| `DeactivationDistance` | Double | 40.0 | Distance de desactivation |
|
||||
| `DeactivationTime` | Double | 5.0 | Secondes avant desactivation |
|
||||
|
||||
### SpawnConfiguration
|
||||
|
||||
Entree spawn NPC individuelle dans pool pondere:
|
||||
|
||||
```java
|
||||
public class SpawnConfiguration implements IWeightedElement {
|
||||
protected String npc; // Nom role NPC
|
||||
protected double weight; // Poids de spawn
|
||||
protected double realtimeRespawnTime; // Secondes (temps reel)
|
||||
protected Duration spawnAfterGameTime; // Duree (temps jeu)
|
||||
protected String flockDefinitionId; // Flock optionnel
|
||||
}
|
||||
```
|
||||
|
||||
```yaml
|
||||
{
|
||||
"Name": "forest_deer",
|
||||
"Weight": 50.0,
|
||||
"RealtimeRespawnTime": 60.0,
|
||||
"SpawnAfterGameTime": "PT1H",
|
||||
"Flock": "deer_herd"
|
||||
}
|
||||
```
|
||||
|
||||
### Timing de Reapparition
|
||||
|
||||
Choisir entre reapparition temps reel ou temps de jeu:
|
||||
|
||||
**Temps Reel:** Utilise `RealtimeRespawnTime` (secondes)
|
||||
```yaml
|
||||
{
|
||||
"RealtimeRespawn": true,
|
||||
"NPCs": [{ "RealtimeRespawnTime": 120.0 }]
|
||||
}
|
||||
```
|
||||
|
||||
**Temps de Jeu:** Utilise `SpawnAfterGameTime` (duree ISO 8601)
|
||||
```yaml
|
||||
{
|
||||
"RealtimeRespawn": false,
|
||||
"NPCs": [{ "SpawnAfterGameTime": "P1DT6H" }]
|
||||
}
|
||||
```
|
||||
|
||||
Format duree: `P[jours]DT[heures]H[minutes]M[secondes]S`
|
||||
|
||||
### Spawning de Flock
|
||||
|
||||
Faire apparaitre un groupe de NPCs autour du spawn principal:
|
||||
|
||||
```yaml
|
||||
{
|
||||
"Name": "wolf_alpha",
|
||||
"Flock": "wolf_pack"
|
||||
}
|
||||
```
|
||||
|
||||
La definition flock specifie les NPCs additionnels a spawn autour du principal.
|
||||
|
||||
## Beacons de Spawn
|
||||
|
||||
### BeaconNPCSpawn
|
||||
|
||||
Points de spawn dynamiques qui font apparaitre des NPCs dans un rayon.
|
||||
|
||||
**Emplacement Asset:** `NPC/Spawn/Beacons/`
|
||||
|
||||
```yaml
|
||||
# NPC/Spawn/Beacons/dungeon_spawner.json
|
||||
{
|
||||
"Id": "dungeon_spawner",
|
||||
"NPCRole": "skeleton_warrior",
|
||||
"SpawnWeight": 10,
|
||||
"MinGroupSize": 2,
|
||||
"MaxGroupSize": 5,
|
||||
"Environments": ["dungeon_dark"]
|
||||
}
|
||||
```
|
||||
|
||||
### Composant SpawnBeacon
|
||||
|
||||
Entites avec comportement beacon de spawn:
|
||||
|
||||
```java
|
||||
public class SpawnBeacon {
|
||||
// Configuration pour spawning beacon
|
||||
// Declenche spawning dans un rayon
|
||||
}
|
||||
```
|
||||
|
||||
### Systemes Beacon
|
||||
|
||||
```java
|
||||
// SpawnBeaconSystems traite les beacons actifs
|
||||
getEntityStoreRegistry().registerSystem(new SpawnBeaconSystems());
|
||||
|
||||
// BeaconSpatialSystem gere les requetes spatiales
|
||||
getEntityStoreRegistry().registerSystem(new BeaconSpatialSystem());
|
||||
```
|
||||
|
||||
## Configuration Spawn Mondial
|
||||
|
||||
### WorldNPCSpawn
|
||||
|
||||
Spawning ambiant base sur l'environnement.
|
||||
|
||||
**Emplacement Asset:** `NPC/Spawn/World/`
|
||||
|
||||
```yaml
|
||||
# NPC/Spawn/World/forest_fauna.json
|
||||
{
|
||||
"Id": "forest_fauna",
|
||||
"NPCRole": "rabbit",
|
||||
"SpawnWeight": 20,
|
||||
"MinGroupSize": 1,
|
||||
"MaxGroupSize": 3,
|
||||
"Environments": ["forest", "grassland"],
|
||||
"LightType": "Day",
|
||||
"MinLightLevel": 8
|
||||
}
|
||||
```
|
||||
|
||||
### Champs de Base NPCSpawn
|
||||
|
||||
| Champ | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `NPCRole` | String | Role NPC a spawner |
|
||||
| `SpawnWeight` | Integer | Poids probabilite spawn |
|
||||
| `MinGroupSize` | Integer | Minimum NPCs a spawner |
|
||||
| `MaxGroupSize` | Integer | Maximum NPCs a spawner |
|
||||
|
||||
### Filtrage par Environnement
|
||||
|
||||
Restreindre spawning a des environnements specifiques:
|
||||
|
||||
```yaml
|
||||
{
|
||||
"Environments": ["cave_dark", "dungeon"]
|
||||
}
|
||||
```
|
||||
|
||||
### Filtrage par Niveau de Lumiere
|
||||
|
||||
```yaml
|
||||
{
|
||||
"LightType": "Night",
|
||||
"MinLightLevel": 0,
|
||||
"MaxLightLevel": 7
|
||||
}
|
||||
```
|
||||
|
||||
Types de lumiere: `Any`, `Day`, `Night`
|
||||
|
||||
## Entite Marqueur de Spawn
|
||||
|
||||
### Composant SpawnMarkerEntity
|
||||
|
||||
Entite representant un marqueur de spawn dans le monde:
|
||||
|
||||
```java
|
||||
ComponentType<EntityStore, SpawnMarkerEntity> type =
|
||||
SpawningPlugin.get().getSpawnMarkerEntityComponentType();
|
||||
```
|
||||
|
||||
### Etat Bloc Marqueur
|
||||
|
||||
Les marqueurs de spawn peuvent etre places comme blocs:
|
||||
|
||||
```java
|
||||
public class SpawnMarkerBlockState {
|
||||
// Marqueur de spawn base bloc
|
||||
}
|
||||
|
||||
public class SpawnMarkerBlockReference {
|
||||
// Reference au bloc marqueur
|
||||
}
|
||||
```
|
||||
|
||||
## Interactions
|
||||
|
||||
### TriggerSpawnMarkersInteraction
|
||||
|
||||
Declencher manuellement des marqueurs de spawn via interaction:
|
||||
|
||||
```yaml
|
||||
# Interaction item ou bloc
|
||||
{
|
||||
"Type": "TriggerSpawnMarkers",
|
||||
"MarkerIds": ["ambush_1", "ambush_2"],
|
||||
"Radius": 50.0
|
||||
}
|
||||
```
|
||||
|
||||
Enregistre comme:
|
||||
```java
|
||||
getCodecRegistry(Interaction.CODEC).register(
|
||||
"TriggerSpawnMarkers",
|
||||
TriggerSpawnMarkersInteraction.class,
|
||||
TriggerSpawnMarkersInteraction.CODEC
|
||||
);
|
||||
```
|
||||
|
||||
## Utilisation de l'API
|
||||
|
||||
### Acceder aux Assets Marqueur de Spawn
|
||||
|
||||
```java
|
||||
// Obtenir asset marqueur
|
||||
SpawnMarker marker = SpawnMarker.getAssetMap().getAsset("village_guard");
|
||||
|
||||
// Obtenir configurations ponderees
|
||||
IWeightedMap<SpawnConfiguration> npcs = marker.getWeightedConfigurations();
|
||||
|
||||
// Obtenir NPC aleatoire depuis pool
|
||||
SpawnConfiguration selected = npcs.getRandom(random);
|
||||
String npcRole = selected.getNpc();
|
||||
```
|
||||
|
||||
### Acceder a la Suppression de Spawn
|
||||
|
||||
```java
|
||||
SpawnSuppression suppression = SpawnSuppression.getAssetMap().getAsset("safe_zone");
|
||||
double radius = suppression.getRadius();
|
||||
```
|
||||
|
||||
### Valider Asset Marqueur
|
||||
|
||||
```java
|
||||
// La validation se fait au demarrage du plugin
|
||||
// Avertit sur:
|
||||
// - Temps de reapparition manquants
|
||||
// - Parametres temps reel/jeu conflictuels
|
||||
// - Roles NPC invalides
|
||||
```
|
||||
|
||||
## Ordre de Chargement Assets
|
||||
|
||||
Les assets spawn ont des dependances:
|
||||
|
||||
```java
|
||||
// Les marqueurs chargent apres modeles et roles NPC
|
||||
HytaleAssetStore.builder(...)
|
||||
.loadsAfter(ModelAsset.class)
|
||||
.loadsAfter(NPCRole.class)
|
||||
.build();
|
||||
```
|
||||
Reference in New Issue
Block a user