Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
ModLoader.cs
浏览该文件的文档.
1using System.Xml.Linq;
2using Engine;
6
7namespace Game {
8 public abstract class ModLoader {
10
14 public virtual void __ModInitialize() { }
15
23 public virtual void GetModFiles(string extension, Action<string, Stream> action, out bool skip) {
24 skip = false;
25 }
26
35 public virtual void GetModFile(string filename, Action<Stream> stream, out bool skip, out bool fileFound) {
36 skip = false;
37 fileFound = false;
38 }
39
47 public virtual bool CompareModVersion(string currentVersion, string lastVersion) => true;
48
52 public virtual void ModDispose() { }
53
60 public virtual void ViewFogColor(float viewUnderWaterDepth, float viewUnderMagmaDepth, ref Color viewFogColor) { }
61
67 public virtual void CalculateLighting(ref float brightness) { }
68
77 public virtual void OnMinerHit(ComponentMiner miner,
78 ComponentBody componentBody,
79 Vector3 hitPoint,
80 Vector3 hitDirection,
81 ref float attackPower,
82 ref float playerProbability,
83 ref float creatureProbability,
84 out bool hitted) {
85 hitted = false;
86 }
87
91 public virtual void SetHitInterval(ComponentMiner miner, ref double hitInterval) { }
92
101 public virtual void IsLevelSufficientForTool(ComponentMiner miner, int toolValue, ref bool canUse, out bool skip) {
102 skip = false;
103 }
104
114 public virtual void OnMinerHit2(ComponentMiner componentMiner,
115 ComponentBody componentBody,
116 Vector3 hitPoint,
117 Vector3 hitDirection,
118 ref int durabilityReduction,
119 ref Attackment attackment) { }
120
129 public virtual void OnMinerDig(ComponentMiner miner, TerrainRaycastResult raycastResult, ref float digProgress, out bool digged) {
130 digged = false;
131 }
132
143 public virtual void BeforeMinerPlace(ComponentMiner componentMiner,
144 TerrainRaycastResult terrainRaycastResult,
145 int x,
146 int y,
147 int z,
148 BlockPlacementData placementData,
149 out bool placementNotAllowed) {
150 placementNotAllowed = false;
151 }
152
164 [Obsolete("该方法已过时,请使用OnMinerPlace重载")]
165 public virtual void OnMinerPlace(ComponentMiner miner,
166 TerrainRaycastResult raycastResult,
167 int x,
168 int y,
169 int z,
170 int value,
171 out bool placed) {
172 placed = false;
173 }
174
187 public virtual void OnMinerPlace(ComponentMiner miner,
188 TerrainRaycastResult raycastResult,
189 int x,
190 int y,
191 int z,
192 int value,
193 BlockPlacementData placementData,
194 out bool placed) {
195 placed = false;
196 }
197
204 public virtual bool SetRainAndSnowColor(ref Color rainColor, ref Color snowColor) => false;
205
209 public virtual void SetFurnitureDesignColor(FurnitureDesign design, Block block, int value, ref int faceTextureSlot, ref Color color) { }
210
221 [Obsolete("该方法已过时,请使用ProcessAttackment修改Attackment的击退和击晕属性")]
222 public virtual void AttackPowerParameter(ComponentBody target,
223 ComponentCreature attacker,
224 Vector3 hitPoint,
225 Vector3 hitDirection,
226 ref float impulseFactor,
227 ref float stunTimeFactor,
228 ref bool recalculate) { }
229
239 [Obsolete("使用另一个ClothingProcessSlotItems接口")]
240 public virtual bool ClothingProcessSlotItems(ComponentPlayer componentPlayer, Block block, int slotIndex, int value, int count) => false;
241
253 public virtual void ClothingSlotProcessCapacity(ComponentClothing componentClothing,
254 int slotIndex,
255 int blockValue,
256 ref bool notToProcessVanilla,
257 out int capacity) {
258 capacity = 0;
259 }
260
261 public virtual void SetClothes(ComponentClothing componentClothing, ClothingSlot slot, IEnumerable<int> clothes) { }
262
266 public virtual void OnEatPickable(ComponentEatPickableBehavior eatPickableBehavior, Pickable eatPickable, out bool dealed) {
267 dealed = false;
268 }
269
273 public virtual bool OnPlayerSpawned(PlayerData.SpawnMode spawnMode, ComponentPlayer componentPlayer, Vector3 position) => false;
274
280 public virtual void OnPlayerDead(PlayerData playerData) { }
281
292 [Obsolete("该方法已弃用,请使用ProcessAttackment", true)]
293 public virtual bool AttackBody(ComponentBody target,
294 ComponentCreature attacker,
295 Vector3 hitPoint,
296 Vector3 hitDirection,
297 ref float attackPower,
298 bool isMeleeAttack) => false;
299
304 public virtual void ProcessAttackment(Attackment attackment) { }
305
309 public virtual void OnSetModel(ComponentModel componentModel, Model model, out bool isSet) {
310 isSet = false;
311 }
312
313 [Obsolete("Use OnAnimateModel() instead")]
314 public virtual void OnModelAnimate(ComponentCreatureModel componentCreatureModel, out bool skip) {
315 skip = false;
316 }
317
322 public virtual void OnAnimateModel(ComponentModel componentModel, out bool skip) {
323 skip = false;
324 }
325
333 public virtual void OnModelDrawExtra(ComponentModel componentModel, Camera camera, out bool skip) {
334 skip = false;
335 }
336
343 public virtual void OnModelCalculateBones(ComponentModel componentModel, Camera camera, out bool skip) {
344 skip = false;
345 }
346
353 public virtual void OnModelCalculateIsVisible(ComponentModel componentModel, Camera camera, out bool skip) {
354 skip = false;
355 }
356
362 public virtual void RecalculateModelEyePosition(ComponentModel componentModel, ref Vector3 eyePosition) { }
363
369 public virtual void RecalculateModelEyeRotation(ComponentModel componentModel, ref Quaternion eyeRotation) { }
370
379 [Obsolete("护甲系统调整,该接口不再适用。对于调整护甲的结算顺序,请调用DecideArmorProtectionSequence接口;对于调整单件护甲的防御效果,请给被调整的护甲创建新的ClothingData。")]
380 public virtual float ApplyArmorProtection(ComponentClothing componentClothing, float attackPower, bool appliedByOtherMods, out bool applied) {
381 applied = false;
382 return attackPower;
383 }
384
389 [Obsolete("You can update your factors in your mod components")]
390 public virtual void OnLevelUpdate(ComponentLevel level) { }
391
397 [Obsolete("You can update your factors in your mod components")]
398 public virtual void OnFactorsUpdate(ComponentFactors componentFactors, float dt) { }
399
404 public virtual void GuiUpdate(ComponentGui componentGui) { }
405
412 public virtual void GuiDraw(ComponentGui componentGui, Camera camera, int drawOrder) { }
413
419 public virtual void UpdateInput(ComponentInput componentInput, WidgetInput widgetInput) { }
420
424 public virtual void DrawToScreen(ViewWidget viewWidget, Widget.DrawContext dc) { }
425
431 public virtual void ClothingWidgetOpen(ComponentGui componentGui, ClothingWidget clothingWidget) { }
432
436 public virtual void OnBlockExploded(SubsystemTerrain subsystemTerrain, int x, int y, int z, int value) { }
437
441 public virtual void OnEntityAdd(Entity entity) { }
442
446 public virtual void OnEntityRemove(Entity entity) { }
447
453 public virtual void InitializeCreatureTypes(SubsystemCreatureSpawn spawn, List<SubsystemCreatureSpawn.CreatureType> creatureTypes) { }
454
462 public virtual void SpawnEntity(SubsystemSpawn spawn, Entity entity, SpawnEntityData spawnEntityData, out bool spawned) {
463 spawned = false;
464 }
465
471 public virtual void OnDespawned(Entity entity, ComponentSpawn componentSpawn) { }
472
473 public virtual void CalculateExplosionPower(SubsystemExplosions subsystemExplosions, ref float explosionPower) { }
474
483 public virtual void OnComponentBodyExploded(ComponentBody componentBody,
484 ref Injury explosionInjury,
485 ref Vector3 impulse,
486 ref bool setOnFire,
487 ref float fluctuation) { }
488
492 public virtual void DeadBeforeDrops(ComponentHealth componentHealth, ref KillParticleSystem killParticleSystem, ref bool dropAllItems) { }
493
497 public virtual void TerrainChangeCell(SubsystemTerrain subsystemTerrain, int x, int y, int z, int value, out bool skip) {
498 skip = false;
499 }
500
504 [Obsolete("该方法已被弃用,请使用CalculateCreatureInjuryAmount, OnCreatureDying, OnCreatureDied代替", true)]
505 public virtual void OnCreatureInjure(ComponentHealth componentHealth,
506 float amount,
507 ComponentCreature attacker,
508 bool ignoreInvulnerability,
509 string cause,
510 out bool skip) {
511 skip = false;
512 }
513
517 public virtual void CalculateCreatureInjuryAmount(Injury injury) { }
518
526 public virtual void OnCreatureDying(ComponentHealth componentHealth, Injury injury) { }
527
535 public virtual void OnCreatureDied(ComponentHealth componentHealth, Injury injury, ref int experienceOrbDrop, ref bool calculateInKill) { }
536
546 public virtual void ChangeVisualEffectOnInjury(ComponentHealth componentHealth,
547 float lastHealth,
548 ref float redScreenFactor,
549 ref bool playPainSound,
550 ref int healthBarFlashCount,
551 ref float creatureModelRedFactor) { }
552
553 public virtual void OnCreatureSpiked(ComponentHealth componentHealth,
554 SubsystemBlockBehavior spikeBlockBehavior,
555 CellFace cellFace,
556 float velocity,
557 ref Injury blockInjury) { }
558
562 public virtual Color ChangeSkyColor(Color oldColor, Vector3 direction, float timeOfDay, int temperature) => oldColor;
563
569 public virtual void SetShaderParameter(Shader shader, Camera camera) { }
570
574 public virtual void ModelShaderParameter(Shader shader,
575 Camera camera,
576 List<SubsystemModelsRenderer.ModelData> modelsData,
577 float? alphaThreshold) { }
578
582 public virtual void SkyDrawExtra(SubsystemSky subsystemSky, Camera camera) { }
583
588 public virtual int GetMaxInstancesCount() => 7;
589
597 public virtual void OnModelRendererDrawExtra(SubsystemModelsRenderer modelsRenderer,
599 Camera camera,
600 float? alphaThreshold) { }
601
607 public virtual void SetHitValueParticleSystem(HitValueParticleSystem hitValueParticleSystem, Attackment attackment) { }
608
614 public virtual void OnSaveSpawnData(ComponentSpawn spawn, SpawnEntityData spawnEntityData) { }
615
619 public virtual void OnReadSpawnData(Entity entity, SpawnEntityData spawnEntityData) { }
620
626 public virtual void OnTerrainContentsGenerated(TerrainChunk chunk) { }
627
632 public virtual void ToFreeChunks(TerrainUpdater terrainUpdater, TerrainChunk chunk, out bool keepWorking) {
633 keepWorking = false;
634 }
635
639 // <param name="chunk"></param>
640 public virtual bool ToAllocateChunks(TerrainUpdater terrainUpdater, TerrainUpdater.UpdateLocation[] locations) => false;
641
645 [Obsolete("Use SubsystemUpdate(SubsystemUpdate subsystemUpdate, float dt)")]
646 public virtual void SubsystemUpdate(float dt) { }
647 public virtual void SubsystemUpdate(SubsystemUpdate subsystemUpdate, float dt) { }
648
653 public virtual void OnProjectLoaded(Project project) { }
654
658 public virtual void OnProjectDisposed() { }
659
663 public virtual void BlocksInitalized() { }
664
671 public virtual object BeforeGameLoading(PlayScreen playScreen, object item) => item;
672
677 public virtual void OnLoadingStart(List<Action> actions) { }
678
684 public virtual void OnLoadingFinished(List<Action> actions) { }
685
690 public virtual void SaveSettings(XElement xElement) { }
691
698 public virtual void LoadSettings(XElement xElement) { }
699
704 public virtual void OnXdbLoad(XElement xElement) { }
705
710 [Obsolete("Use ProjectXmlLoad(XElement xElement, WorldInfo worldInfo, ContainerWidget gameWidget)")]
711 public virtual void ProjectXmlLoad(XElement xElement) { }
712 public virtual void ProjectXmlLoad(XElement xElement, WorldInfo worldInfo, ContainerWidget gameWidget) { }
713
718 public virtual void ProjectXmlSave(XElement xElement) { }
719
724 public virtual void OnProjectXmlSaved(XElement xElement) { }
725
732 public virtual void OnCraftingRecipeDecode(List<CraftingRecipe> m_recipes, XElement element, out bool decoded) {
733 decoded = false;
734 }
735
742 public virtual bool MatchRecipe(string[] requiredIngredients, string[] actualIngredient, out bool matched) {
743 matched = false;
744 return false;
745 }
746
753 public virtual int DecodeResult(string result, out bool decoded) {
754 decoded = false;
755 return 0;
756 }
757
765 public virtual void DecodeIngredient(string ingredient, out string craftingId, out int? data, out bool decoded) {
766 decoded = false;
767 craftingId = string.Empty;
768 data = null;
769 }
770
776 public virtual void OnCameraChange(ComponentPlayer m_componentPlayer, ComponentGui componentGui) { }
777
782 public virtual void ManageCameras(GameWidget gameWidget) { }
783
787 public virtual void OnCapture() { }
788
792 public virtual void MenuPlayMusic(out string contentMusicPath) {
793 contentMusicPath = string.Empty;
794 }
795
805 public virtual void IsTerrainSafeToGo(ComponentPilot componentPilot,
806 Vector3 position,
807 Vector3 direction,
808 out bool isTerrainSafeToGo,
809 out bool skipVanilla) {
810 isTerrainSafeToGo = false;
811 skipVanilla = false;
812 }
813
822 public virtual void IsPredator(ComponentFlyAwayBehavior flyAwayBehavior, Entity target, out bool isPredator, out bool skipVanilla) {
823 isPredator = false;
824 skipVanilla = false;
825 }
826
837 public virtual void CallNearbyCreaturesHelp(ComponentHerdBehavior herdBehavior,
838 ComponentCreature target,
839 float maxRange,
840 float maxChaseTime,
841 bool isPersistent,
842 out bool skipVanilla) {
843 skipVanilla = false;
844 }
845
854 public virtual void FindHerdCenter(ComponentCreature componentCreature, out Vector3? herdCenter, out bool skipVanilla) {
855 herdCenter = null;
856 skipVanilla = false;
857 }
858
868 public virtual void ScoreMount(ComponentRider componentRider, ComponentMount componentMount, out float? score) {
869 score = null;
870 }
871
885 public virtual void OnTreasureGenerate(SubsystemTerrain subsystemTerrain,
886 int x,
887 int y,
888 int z,
889 int neighborX,
890 int neighborY,
891 int neighborZ,
892 ref int blockValue,
893 ref int count,
894 out bool isGenerate) {
895 isGenerate = false;
896 }
897
902 public virtual void OnWidgetConstruct(ref Widget widget) { }
903
908 public virtual void OnWidgetContentsLoaded(Widget widget) { }
909
918 public virtual void BeforeWidgetDrawItemRender(Widget.DrawItem drawItem,
919 out bool skipVanillaDraw,
920 out Action afterWidgetDraw,
921 ref Rectangle scissorRectangle,
922 Widget.DrawContext drawContext) {
923 skipVanillaDraw = false;
924 afterWidgetDraw = null;
925 }
926
931 public virtual void OnDrawItemAssigned(Widget.DrawContext drawContext) { }
932
939 public virtual void OnModalPanelWidgetSet(ComponentGui componentGui, Widget oldWidget, Widget newWidget) { }
940
946 public virtual void GenerateChunkVertices(TerrainChunk chunk, bool even) { }
947
953 public virtual void GenerateChunkLightSources(DynamicArray<TerrainUpdater.LightSource> lightSources, TerrainChunk chunk) { }
954
961 public virtual void CalculateSmoothLight(SubsystemTerrain subsystemTerrain, Vector3 p, ref float num) { }
962
966 public virtual void WindowModeChanged(WindowMode mode) { }
967
977 public virtual int DamageItem(Block block, int oldValue, int damageCount, Entity owner, out bool skipVanilla) {
978 skipVanilla = false;
979 return 0;
980 }
981
993 public virtual void OnProjectileHitTerrain(Projectile projectile,
994 TerrainRaycastResult terrainRaycastResult,
995 ref bool triggerBlocksBehavior,
996 ref bool destroyCell,
997 ref float impactSoundLoudness,
998 ref bool projectileGetStuck,
999 ref Vector3 velocityAfterHit,
1000 ref Vector3 angularVelocityAfterHit) { }
1001
1011 public virtual void OnProjectileHitBody(Projectile projectile,
1012 BodyRaycastResult bodyRaycastResult,
1013 ref Attackment attackment,
1014 ref Vector3 velocityAfterAttack,
1015 ref Vector3 angularVelocityAfterAttack,
1016 ref bool ignoreBody) { }
1017
1028 public virtual void OnProjectileDraw(Projectile projectile,
1029 SubsystemProjectiles subsystemProjectiles,
1030 Camera camera,
1031 int drawOrder,
1032 ref bool shouldDrawBlock,
1033 ref float drawBlockSize,
1034 ref Color drawBlockColor) { }
1035
1040 public virtual void OnProjectileFlyOutOfLoadedChunks(Projectile projectile) { }
1041
1052 public virtual void OnPickableDraw(Pickable pickable,
1053 SubsystemPickables subsystemPickables,
1054 Camera camera,
1055 int drawOrder,
1056 ref bool shouldDrawBlock,
1057 ref float drawBlockSize,
1058 ref Color drawBlockColor) { }
1059
1068 public virtual void UpdateComponentBody(ComponentBody componentBody, float dt, bool skippedByOtherMods, out bool skipVanilla) {
1069 skipVanilla = false;
1070 }
1071
1078 public virtual float? BodyCountInRaycast(ComponentBody componentBody, Ray3 ray, out bool skip) {
1079 skip = false;
1080 return null;
1081 }
1082
1090 public virtual void OnMovingBlockSetAdded(ref SubsystemMovingBlocks.MovingBlockSet movingBlockSet,
1091 SubsystemMovingBlocks subsystemMovingBlocks,
1092 ref bool testCollision,
1093 out bool doNotAdd) {
1094 doNotAdd = false;
1095 }
1096
1102 public virtual void OnMovingBlockSetRemoved(IMovingBlockSet movingBlockSet, SubsystemMovingBlocks subsystemMovingBlocks) { }
1103
1111 public virtual void OnMovingBlockSetUpdate(IMovingBlockSet movingBlockSet,
1112 SubsystemMovingBlocks subsystemMovingBlocks,
1113 bool skippedByOtherMods,
1114 out bool skipVanilla) {
1115 skipVanilla = false;
1116 }
1117
1124 public virtual void OnProjectileAdded(SubsystemProjectiles subsystemProjectiles,
1125 ref Projectile projectile,
1126 ValuesDictionary loadValuesDictionary) { }
1127
1134 public virtual void OnPickableAdded(SubsystemPickables subsystemPickables, ref Pickable pickable, ValuesDictionary loadValuesDictionary) { }
1135
1142 public virtual void SaveProjectile(SubsystemProjectiles subsystemProjectiles,
1143 Projectile projectile,
1144 ref ValuesDictionary valuesDictionary) { }
1145
1152 public virtual void SavePickable(SubsystemPickables subsystemPickables, Pickable pickable, ref ValuesDictionary valuesDictionary) { }
1153
1163 public virtual void OnBlockDug(ComponentMiner componentMiner,
1164 BlockPlacementData digValue,
1165 int cellValue,
1166 ref int durabilityReduction,
1167 ref bool mute,
1168 ref int playerDataDugAdd) {
1169 mute = false;
1170 }
1171
1177 public virtual void ChangeGameTimeDelta(SubsystemTime subsystemTime, ref float dt) { }
1178
1188 public virtual void OnIUpdateableAddOrRemove(SubsystemUpdate subsystemUpdate,
1189 IUpdateable updateable,
1190 bool toAdd1OrRemove0,
1191 bool skippedByOtherMods,
1192 out bool skip) {
1193 skip = false;
1194 }
1195
1203 public virtual void OnIDrawableAdded(SubsystemDrawing subsystemDrawing, IDrawable drawable, bool skippedByOtherMods, out bool skip) {
1204 skip = false;
1205 }
1206
1215 public virtual void OnFurnitureDesigned(FurnitureDesign furnitureDesign,
1216 bool designedFromExistingFurniture,
1217 ref int pickableCount,
1218 ref bool destroyDesignBlocks,
1219 ref int toolDamageCount) { }
1220
1226 public virtual void OnInventorySlotWidgetDefined(InventorySlotWidget inventorySlotWidget, out List<Widget> childrenWidgetsToAdd) {
1227 childrenWidgetsToAdd = null;
1228 }
1229
1235 public virtual void InventorySlotWidgetMeasureOverride(InventorySlotWidget inventorySlotWidget, Vector2 parentAvailableSize) { }
1236
1247 public virtual void HandleMoveInventoryItem(InventorySlotWidget inventorySlotWidget,
1248 IInventory sourceInventory,
1249 int sourceSlotIndex,
1250 IInventory targetInventory,
1251 int targetSlotIndex,
1252 ref int count,
1253 out bool moved) {
1254 moved = false;
1255 }
1256
1266 InventorySlotWidget inventorySlotWidget,
1267 int totalItemCount,
1268 DragMode dragMode,
1269 ref int splitCount) { }
1270
1281 public virtual void HandleInventoryDragProcess(InventorySlotWidget inventorySlotWidget,
1282 IInventory sourceInventory,
1283 int sourceSlotIndex,
1284 IInventory targetInventory,
1285 int targetSlotIndex,
1286 ref int processCapacity) { }
1287
1298 public virtual void HandleInventoryDragMove(InventorySlotWidget inventorySlotWidget,
1299 IInventory sourceInventory,
1300 int sourceSlotIndex,
1301 IInventory targetInventory,
1302 int targetSlotIndex,
1303 bool skippedByOtherMods,
1304 out bool skip) {
1305 skip = false;
1306 }
1307
1314 public virtual void OnPlayerControlSteed(ComponentPlayer componentPlayer, bool skippedByOtherMods, out bool skipVanilla) {
1315 skipVanilla = false;
1316 }
1317
1324 public virtual void OnPlayerControlBoat(ComponentPlayer componentPlayer, bool skippedByOtherMods, out bool skipVanilla) {
1325 skipVanilla = false;
1326 }
1327
1334 public virtual void OnPlayerControlOtherMount(ComponentPlayer componentPlayer, bool skippedByOtherMods, out bool skipVanilla) {
1335 skipVanilla = false;
1336 }
1337
1344 public virtual void OnPlayerControlWalk(ComponentPlayer componentPlayer, bool skippedByOtherMods, out bool skipVanilla) {
1345 skipVanilla = false;
1346 }
1347
1357 public virtual void OnPlayerInputInteract(ComponentPlayer componentPlayer,
1358 ref bool playerOperated,
1359 ref double timeIntervalLastActionTime,
1360 ref int priorityUse,
1361 ref int priorityInteract,
1362 ref int priorityPlace) { }
1363
1373 public virtual void UpdatePlayerInputAim(ComponentPlayer componentPlayer,
1374 bool aiming,
1375 ref bool playerOperated,
1376 ref float timeIntervalAim,
1377 bool skippedByOtherMods,
1378 out bool skipVanilla) {
1379 skipVanilla = false;
1380 }
1381
1391 public virtual void OnPlayerInputHit(ComponentPlayer componentPlayer,
1392 ref bool playerOperated,
1393 ref double timeIntervalHit,
1394 ref float meleeAttackRange,
1395 bool skippedByOtherMods,
1396 out bool skipVanilla) {
1397 skipVanilla = false;
1398 }
1399
1409 public virtual void UpdatePlayerInputDig(ComponentPlayer componentPlayer,
1410 bool digging,
1411 ref bool playerOperated,
1412 ref double timeIntervalDig,
1413 bool skippedByOtherMods,
1414 out bool skipVanilla) {
1415 skipVanilla = false;
1416 }
1417
1424 public virtual void OnPlayerInputDrop(ComponentPlayer componentPlayer, bool skippedByOtherMods, out bool skipVanilla) {
1425 skipVanilla = false;
1426 }
1427
1436 public virtual void OnLightningStrike(SubsystemSky subsystemSky,
1437 ref Vector3 targetPosition,
1438 ref bool strike,
1439 ref float explosionPressure,
1440 ref bool setBodyOnFire) { }
1441
1445 public virtual void OnTerrainBrushesCreated() { }
1446
1452 public virtual void FindCoarseSpawnPosition(ITerrainContentsGenerator terrainContentsGenerator, ref Vector3 spawnPosition) { }
1453
1462 public virtual void OnChaseBehaviorAttacked(ComponentChaseBehavior componentChaseBehavior,
1463 float chaseTimeBefore,
1464 ref float chaseTime,
1465 ref bool hitBody,
1466 ref bool playAttackSound) { }
1467
1473 public virtual void OnChaseBehaviorAttackFailed(ComponentChaseBehavior componentChaseBehavior, ref float chaseTime) { }
1474
1480 public virtual void CalculateFallDamage(ComponentHealth componentHealth, ref float damage) { }
1481
1487 public virtual void OnLocomotionStopped(ComponentLocomotion componentLocomotion, ref bool fallsOnDeathOrStun) { }
1488
1497 public virtual void OnComponentLocomotionLoaded(ComponentLocomotion componentLocomotion,
1498 ref float mobWalkSpeedFactor,
1499 ref float mobFlySpeedFactor,
1500 ref float mobSwimSpeedFactor,
1501 ref bool disableCreativeFlyInSurvivalMode) { }
1502
1509 public virtual void OnDispenserDispensePickable(ComponentDispenser componentDispenser, ref Pickable pickable, ref int removeSlotCount) { }
1510
1518 public virtual void OnDispenserShoot(ComponentDispenser componentDispenser,
1519 ref Projectile projectile,
1520 ref bool canDispensePickable,
1521 ref int removeSlotCount) { }
1522
1530 public virtual void DispenserChooseItemToDispense(ComponentDispenser componentDispenser, ref int slot, ref int value, out bool chosen) {
1531 chosen = false;
1532 }
1533
1540 public virtual void LoadWorldInfoWidget(WorldInfo worldInfo, XElement savedWorldItemNode, ref ContainerWidget worldInfoWidget) { }
1541
1546 [Obsolete("Override EditBlockDescriptionScreen(Dictionary<string,string> blockProperties, int blockValue) instead.")]
1547 public virtual void EditBlockDescriptionScreen(Dictionary<string, string> blockProperties) { }
1548
1554 public virtual void EditBlockDescriptionScreen(Dictionary<string, string> blockProperties, int blockValue) { }
1555
1560 public virtual void EditRecipeScreenWidget(RecipaediaRecipesScreen screen) { }
1561
1569 BestiaryCreatureInfo bestiaryCreatureInfo,
1570 ValuesDictionary entityValuesDictionary) { }
1571
1579 public virtual void LoadCreatureInfoInBestiaryScreen(BestiaryScreen bestiaryScreen,
1580 ContainerWidget creatureInfoWidget,
1581 BestiaryCreatureInfo bestiaryCreatureInfo,
1582 ValuesDictionary entityValuesDictionary) { }
1583
1592 public virtual void ResetOptionsForNonCreativeMode(WorldSettings worldSettings,
1593 EnvironmentBehaviorMode environmentBehaviorModeBefore,
1594 TimeOfDayMode timeOfDayModeBefore,
1595 bool areWeatherEffectsEnabledBefore,
1596 bool areSurvivalMechanicsEnabledBefore) { }
1597
1603 public virtual void CraftingRecipesManagerInitialize(List<CraftingRecipe> recipes, ref bool sort) { }
1604
1608 public virtual void CraftingRecipesManagerInitialized() { }
1609
1613 public virtual void PlayInGameMusic() { }
1614
1615 [Obsolete("Use TerrainContentsGenerator24Initialize")]
1616 public virtual void TerrainContentsGenerator23Initialize(ITerrainContentsGenerator terrainContentsGenerator,
1617 SubsystemTerrain subsystemTerrain) { }
1618
1619 public virtual void TerrainContentsGenerator24Initialize(ITerrainContentsGenerator terrainContentsGenerator,
1620 SubsystemTerrain subsystemTerrain) { }
1621
1622 public virtual void PrepareModels(SubsystemModelsRenderer subsystemModelsRenderer, Camera camera, bool skippedByOtherMods, out bool skip) {
1623 skip = false;
1624 }
1625
1626 public virtual void RenderModels(SubsystemModelsRenderer subsystemModelsRenderer,
1627 Camera camera,
1628 int drawOrder,
1629 bool skippedByOtherMods,
1630 out bool skip) {
1631 skip = false;
1632 }
1633
1640 public virtual void UpdateDeathCameraWidget(PlayerData playerData, ref bool disableVanillaTapToRespawnAction, ref bool respawn) { }
1641
1650 public virtual void OnComponentBodyExplodedStart(ComponentBody componentBody,
1651 Vector3 explosionCenter,
1652 float explosionPressure,
1653 ref float shakeStrength) { }
1654
1664 public virtual void GrowPlant(SubsystemPlantBlockBehavior subsystemPlantBlockBehavior,
1665 int x,
1666 int y,
1667 int z,
1668 int pollPass,
1669 out bool skipVanilla) {
1670 skipVanilla = false;
1671 }
1672
1678 public virtual void OnProjectileTurnIntoPickable(Projectile projectile, ref Pickable pickable) { }
1679
1685 public virtual void EntityComponentsInitialized(Entity entity, List<KeyValuePair<int, Component>> componentList) { }
1686
1691 public virtual void ProjectBeforeSubsystemsAndEntitiesLoad(Project project) { }
1692
1698 public virtual void OnScreenEntered(Screen screen, object[] screenParameters) { }
1699
1704 public virtual void OnScreenLeaved(Screen screen) { }
1705
1711 public virtual void BeforeWidgetUpdate(Widget widget) { }
1712
1717 public virtual void AfterWidgetUpdate(Widget widget) { }
1718
1719 public virtual void OnChaseBehaviorStartChasing(ComponentChaseBehavior chaseBehavior) { }
1720 public virtual void OnChaseBehaviorStopChasing(ComponentChaseBehavior chaseBehavior) { }
1721
1729 public virtual void ChaseBehaviorScoreTarget(ComponentChaseBehavior chaseBehavior, ComponentCreature creatureToBeTarget, ref float score) { }
1730
1732 public virtual void UpdateChaseBehaviorChasing(ComponentChaseBehavior chaseBehavior) { }
1733
1740 public virtual void DecideLoot(ComponentLoot componentLoot, List<BlockDropValue> dropValues) { }
1741
1749 public virtual void OnMainMenuScreenCreated(MainMenuScreen mainMenuScreen,
1750 StackPanelWidget leftBottomBar,
1751 StackPanelWidget rightBottomBar) { }
1752
1759 [Obsolete("Use OnMainMenuScreenCreated instead.")]
1760 public virtual void OnMainMenuScreenUpdate(MainMenuScreen mainMenuScreen, StackPanelWidget leftBottomBar, StackPanelWidget rightBottomBar) { }
1761
1774 [Obsolete("You can update your factors in your mod components.")]
1775 public virtual void OnFactorsGenerate(ComponentFactors componentFactors) { }
1776
1784 public virtual void DecideArmorProtectionSequence(ComponentClothing componentClothing,
1785 Attackment attackment,
1786 float randomNumber,
1787 List<int> clothesList) { }
1788
1796 public virtual void ApplyProtectionBeforeClothes(ComponentClothing componentClothing,
1797 Attackment attackment,
1798 ref float attackPowerAfterProtection) { }
1799
1807 public virtual void ApplyProtectionAfterClothes(ComponentClothing componentClothing,
1808 Attackment attackment,
1809 List<int> listAfterProtection,
1810 ref float attackPowerAfterProtection) { }
1811
1815 public virtual void InitializeClothingSlots() { }
1816
1821 public virtual void OnPlayerModelWidgetMeasureOverride(PlayerModelWidget playerModelWidget) { }
1822
1828 public virtual void IsCrosshairVisible(ComponentAimingSights componentAimingSights, ref bool isVisible) { }
1829
1834 public virtual IEnumerable<KeyValuePair<string, object>> GetKeyboardMappings() {
1835 yield break;
1836 }
1837
1841 public virtual IEnumerable<KeyValuePair<string, object>> GetGamepadMappings() {
1845 //ValuesDictionary valuesDictionary = [];
1846 //valuesDictionary.SetValue("ModifierKey", Engine.Input.GamePadButton.LeftShoulder);
1847 //valuesDictionary.SetValue("ActionKey", Engine.Input.GamePadButton.X);
1848 //yield return new("TimeOfDay", valuesDictionary);
1849 yield break;
1850 }
1851
1856 public virtual IEnumerable<KeyValuePair<string, int>> GetCameraList() {
1857 yield break;
1858 }
1859
1863 public virtual void InitKeyCompatibleGroups() { }
1864
1871 public virtual void OnSettingsScreenCreated(SettingsScreen settingsScreen, out Dictionary<ButtonWidget, Action> buttonsToAdd) {
1872 buttonsToAdd = [];
1873 }
1874
1880 public virtual void ModifyLogColor(string text, ref Color color) { }
1881
1886 public virtual void PlayerDataFirstUpdate(PlayerData playerData) { }
1887
1893 public virtual void RecalculateCameraProjection(Camera camera, ref Matrix projectionMatrix) { }
1894
1903 public virtual void OnProjectileRaycastBody(ComponentBody componentBody, Projectile projectile, float distance, out bool ignore) {
1904 ignore = false;
1905 }
1906
1918 public virtual void ClothingProcessSlotItems(ComponentClothing componentClothing,
1919 int slotIndex,
1920 ref int inputValue,
1921 ref int inputCount,
1922 ref int processedValue,
1923 ref int processedCount,
1924 bool skippedByOtherMods,
1925 out bool skipVanilla) {
1926 skipVanilla = false;
1927 }
1928
1929 [Obsolete(
1930 "该接口有误,建议使用另一个同名接口ClothingProcessSlotItems(ComponentClothing componentClothing,int slotIndex,ref int inputValue,ref int inputCount,ref int processedValue,ref int processedCount,bool skippedByOtherMods,out bool skipVanilla)"
1931 )]
1932 public virtual void ClothingProcessSlotItems(ComponentPlayer componentPlayer,
1933 int slotIndex,
1934 ref int inputValue,
1935 ref int inputCount,
1936 ref int processedValue,
1937 ref int processedCount,
1938 bool skippedByOtherMods,
1939 out bool skipVanilla) {
1940 skipVanilla = false;
1941 }
1942
1952 ModelShader modelShader,
1953 Camera camera,
1954 SubsystemModelsRenderer subsystemModelsRenderer,
1955 out bool skip) {
1956 skip = false;
1957 }
1958
1967 public virtual void OnFirstPersonModelDrawing(ComponentFirstPersonModel componentFirstPersonModel,
1968 Camera camera,
1969 int itemValue,
1970 ref Matrix matrix,
1971 out bool skip) {
1972 skip = false;
1973 }
1974
1983 public virtual void OnEntityBehaviorBlockInteracted(object raycastResult,
1984 bool isInitialNull,
1985 ref ComponentBlockEntity componentBlockEntity) { }
1986
1999 public virtual void OnAppendModelMeshPart(BlockMesh blockMesh,
2000 ModelMeshPart meshPart,
2001 Matrix matrix,
2002 bool makeEmissive,
2003 bool flipWindingOrder,
2004 bool doubleSided,
2005 bool flipNormals,
2006 Color color,
2007 out bool skip) {
2008 skip = false;
2009 }
2010
2017 public virtual void OnAppendModelMesh(BlockMesh blockMesh, BlockMesh blockMesh1, out bool skip) {
2018 skip = false;
2019 }
2020
2028 public virtual void OnVitalStatsEat(
2029 ComponentVitalStats vitalStats,
2030 ref int value,
2031 ref bool skipVanilla,
2032 out bool eatSuccess) {
2033 // 默认返回进食失败,模组可重写修改
2034 eatSuccess = false;
2035 }
2036
2044 public virtual void OnVitalStatsUpdateFood(
2045 ComponentVitalStats vitalStats,
2046 ref float food,
2047 ref float gameTimeDelta,
2048 ref bool skipVanilla) { }
2049
2057 public virtual void OnVitalStatsUpdateStamina(
2058 ComponentVitalStats vitalStats,
2059 ref float stamina,
2060 ref float gameTimeDelta,
2061 ref bool skipVanilla) { }
2062
2070 public virtual void OnVitalStatsUpdateSleep(
2071 ComponentVitalStats vitalStats,
2072 ref float sleep,
2073 ref float gameTimeDelta,
2074 ref bool skipVanilla) { }
2075
2084 ComponentVitalStats vitalStats,
2085 ref float temperature,
2086 ref float gameTimeDelta,
2087 ref bool skipVanilla) { }
2088
2096 public virtual void OnVitalStatsUpdateWetness(
2097 ComponentVitalStats vitalStats,
2098 ref float wetness,
2099 ref float gameTimeDelta,
2100 ref bool skipVanilla) { }
2101 }
2102}
The spell "Attackment" is wrong, But it is not recommended to change it because many mods rely on thi...
virtual void ModDispose()
Mod被卸载时执行
virtual void ViewFogColor(float viewUnderWaterDepth, float viewUnderMagmaDepth, ref Color viewFogColor)
视图雾颜色调整
virtual void OnSettingsScreenCreated(SettingsScreen settingsScreen, out Dictionary< ButtonWidget, Action > buttonsToAdd)
在设置界面创建时执行。可用于模组添加新的设置按钮。 此接口可避免切换语言重新创建Screen导致按钮丢失的情况
virtual void SaveProjectile(SubsystemProjectiles subsystemProjectiles, Projectile projectile, ref ValuesDictionary valuesDictionary)
保存世界时,存储射弹信息
virtual void GetModFile(string filename, Action< Stream > stream, out bool skip, out bool fileFound)
在系统读取本模组的文件时触发 注意:modinfo文件、mod图标只能由原版逻辑加载。如果需要修改调整,请自己在模组中重新写一遍加载逻辑
virtual void ChaseBehaviorScoreTarget(ComponentChaseBehavior chaseBehavior, ComponentCreature creatureToBeTarget, ref float score)
生物在选择追击对象时,对被追击对象的评分。评分越高,则会被选中。 仅建议在该生物为本模组生物,或目标生物为本模组生物时,修改追击权重。
virtual void OnBlockDug(ComponentMiner componentMiner, BlockPlacementData digValue, int cellValue, ref int durabilityReduction, ref bool mute, ref int playerDataDugAdd)
在方块被挖掘完毕时执行
virtual void CallNearbyCreaturesHelp(ComponentHerdBehavior herdBehavior, ComponentCreature target, float maxRange, float maxChaseTime, bool isPersistent, out bool skipVanilla)
摇人行为。 仅建议对自己模组的生物使用,不要干涉其他模组生物的行为。
virtual void OnProjectLoaded(Project project)
当Project被加载时执行
virtual void OnPlayerInputInteract(ComponentPlayer componentPlayer, ref bool playerOperated, ref double timeIntervalLastActionTime, ref int priorityUse, ref int priorityInteract, ref int priorityPlace)
当玩家输入交互逻辑时执行的操作
virtual IEnumerable< KeyValuePair< string, object > > GetGamepadMappings()
用于添加新的手柄按键映射,在重置按键设置时也会使用这里的设置作为默认值。 使用yield return可返回多个键值对。键:映射名;值:按键(Key)或鼠标按钮(MouseButton)
virtual void PlayerDataFirstUpdate(PlayerData playerData)
PlayerData首次更新时执行
virtual void DeadBeforeDrops(ComponentHealth componentHealth, ref KillParticleSystem killParticleSystem, ref bool dropAllItems)
死亡前瞬间执行
virtual void OnFactorsUpdate(ComponentFactors componentFactors, float dt)
因素控制力量、抗性、速度、饥饿速率组件更新时执行
virtual void OnPlayerControlSteed(ComponentPlayer componentPlayer, bool skippedByOtherMods, out bool skipVanilla)
在玩家骑上坐骑时每帧执行,用于调整玩家骑行动物时的控制逻辑
virtual void OnXdbLoad(XElement xElement)
Xdb文件加载时执行
virtual void OnScreenLeaved(Screen screen)
离开Screen时执行
virtual void OnWidgetConstruct(ref Widget widget)
当界面被创建时
virtual IEnumerable< KeyValuePair< string, int > > GetCameraList()
用于添加新的摄像机顺序,在重置摄像机列表时也会使用这里的设置作为默认值。 使用yield return可返回多个键值对。键:摄像机类名;值:顺序
virtual void OnMinerHit2(ComponentMiner componentMiner, ComponentBody componentBody, Vector3 hitPoint, Vector3 hitDirection, ref int durabilityReduction, ref Attackment attackment)
在生物攻击时执行
virtual void OnAppendModelMeshPart(BlockMesh blockMesh, ModelMeshPart meshPart, Matrix matrix, bool makeEmissive, bool flipWindingOrder, bool doubleSided, bool flipNormals, Color color, out bool skip)
在BlockMesh.AppendModelMeshPart之前执行
virtual void CraftingRecipesManagerInitialized()
在配方表加载完成后执行,在排序完成后执行
virtual void __ModInitialize()
当ModLoader类被实例化时执行
virtual void InventorySlotWidgetMeasureOverride(InventorySlotWidget inventorySlotWidget, Vector2 parentAvailableSize)
绘制物品格子的耐久条、食物条等元素
virtual void DecodeIngredient(string ingredient, out string craftingId, out int? data, out bool decoded)
解码配方
virtual void ProjectXmlSave(XElement xElement)
Project.xml保存时执行
virtual void GuiDraw(ComponentGui componentGui, Camera camera, int drawOrder)
Gui组件绘制时执行
virtual void CalculateFallDamage(ComponentHealth componentHealth, ref float damage)
计算动物的坠落伤害
virtual void ResetOptionsForNonCreativeMode(WorldSettings worldSettings, EnvironmentBehaviorMode environmentBehaviorModeBefore, TimeOfDayMode timeOfDayModeBefore, bool areWeatherEffectsEnabledBefore, bool areSurvivalMechanicsEnabledBefore)
在进行世界设置时,如果不是创造模式,则会修改设定
virtual void OnReadSpawnData(Entity entity, SpawnEntityData spawnEntityData)
当读取生物数据时
virtual void GuiUpdate(ComponentGui componentGui)
Gui组件帧更新时执行
virtual void OnProjectileHitTerrain(Projectile projectile, TerrainRaycastResult terrainRaycastResult, ref bool triggerBlocksBehavior, ref bool destroyCell, ref float impactSoundLoudness, ref bool projectileGetStuck, ref Vector3 velocityAfterHit, ref Vector3 angularVelocityAfterHit)
当射弹击中方块时执行
virtual void OnChaseBehaviorAttackFailed(ComponentChaseBehavior componentChaseBehavior, ref float chaseTime)
在动物执行近战攻击没有命中目标时执行
virtual void OnInventorySlotWidgetDefined(InventorySlotWidget inventorySlotWidget, out List< Widget > childrenWidgetsToAdd)
在创建InventorySlotWidget时执行,可以增加元素
virtual void OnFirstPersonModelDrawing(ComponentFirstPersonModel componentFirstPersonModel, Camera camera, int itemValue, ref Matrix matrix, out bool skip)
当第一人称手部模型或手持方块图标被渲染时执行
virtual void OnAppendModelMesh(BlockMesh blockMesh, BlockMesh blockMesh1, out bool skip)
在BlockMesh.AppendModelMesh之前执行
virtual void OnPlayerInputHit(ComponentPlayer componentPlayer, ref bool playerOperated, ref double timeIntervalHit, ref float meleeAttackRange, bool skippedByOtherMods, out bool skipVanilla)
在玩家执行“攻击”动作时执行,比如恒泰左键放箭,工业左键点击船
virtual void OnProjectileRaycastBody(ComponentBody componentBody, Projectile projectile, float distance, out bool ignore)
射弹更新寻找下一个可以命中的Body时执行
virtual void OnTerrainContentsGenerated(TerrainChunk chunk)
区块地形生成时 注意此方法运行在子线程中
virtual void EditBlockDescriptionScreen(Dictionary< string, string > blockProperties, int blockValue)
在方块介绍页面中,增加或减少方块的属性字段
virtual void OnPlayerModelWidgetMeasureOverride(PlayerModelWidget playerModelWidget)
在绘制人物界面中的人物模型的时候执行,可以通过在playerModelWidget.m_modelWidget中增删元素来在人物界面绘制新模型
virtual void OnComponentBodyExploded(ComponentBody componentBody, ref Injury explosionInjury, ref Vector3 impulse, ref bool setOnFire, ref float fluctuation)
生物等实体在遭受爆炸时执行
virtual void ClothingSlotProcessCapacity(ComponentClothing componentClothing, int slotIndex, int blockValue, ref bool notToProcessVanilla, out int capacity)
控制物品拖动到人物上方时,是否能执行操作。 返回1表示可以处理物品。 多个模组执行时,取最大值
virtual void UpdatePlayerInputAim(ComponentPlayer componentPlayer, bool aiming, ref bool playerOperated, ref float timeIntervalAim, bool skippedByOtherMods, out bool skipVanilla)
在玩家正在瞄准时执行
virtual void OnEntityRemove(Entity entity)
当实体被移除时执行
virtual void SaveSettings(XElement xElement)
模组设置保存时执行
virtual void OnDrawItemAssigned(Widget.DrawContext drawContext)
在 DrawItem 排序后。
virtual void CraftingRecipesManagerInitialize(List< CraftingRecipe > recipes, ref bool sort)
在配方表加载的时候执行,用于删除原版配方
virtual void ProjectBeforeSubsystemsAndEntitiesLoad(Project project)
游戏Project创建时执行,可用于移除Subsystem、Entity、Entity.Component
virtual void OnLoadingStart(List< Action > actions)
加载任务开始时执行 在BlocksManager初始化之前
virtual void WindowModeChanged(WindowMode mode)
当窗口模式改变时执行。
virtual void OnEntityBehaviorBlockInteracted(object raycastResult, bool isInitialNull, ref ComponentBlockEntity componentBlockEntity)
当玩家开始交互一个带有SubsystemEntityBlockBehavior的方块时执行 可以用于当玩家打开一个通过地形生成,导致没有ComponentBlockEntity的箱子时,添加宝箱实体并为...
virtual void ManageCameras(GameWidget gameWidget)
当GameWidget被创建时执行,适合添加新的摄像机类型。具体方法可参考SurvivalCraftModLoader.ManageCameras
virtual void BeforeWidgetDrawItemRender(Widget.DrawItem drawItem, out bool skipVanillaDraw, out Action afterWidgetDraw, ref Rectangle scissorRectangle, Widget.DrawContext drawContext)
在 DrawItem 被绘制前。
virtual void RecalculateCameraProjection(Camera camera, ref Matrix projectionMatrix)
重新计算摄像机投影矩阵
virtual void OnVitalStatsUpdateSleep(ComponentVitalStats vitalStats, ref float sleep, ref float gameTimeDelta, ref bool skipVanilla)
状态(更新睡眠值)钩子
virtual void SetFurnitureDesignColor(FurnitureDesign design, Block block, int value, ref int faceTextureSlot, ref Color color)
设置家具的颜色
virtual void OnDispenserShoot(ComponentDispenser componentDispenser, ref Projectile projectile, ref bool canDispensePickable, ref int removeSlotCount)
在发射器弹射物品时执行
virtual void SkyDrawExtra(SubsystemSky subsystemSky, Camera camera)
天空额外绘制
virtual void OnDespawned(Entity entity, ComponentSpawn componentSpawn)
当生物消失时执行
virtual void OnVitalStatsUpdateTemperature(ComponentVitalStats vitalStats, ref float temperature, ref float gameTimeDelta, ref bool skipVanilla)
状态(更新体温)钩子
virtual void LoadSettings(XElement xElement)
模组设置加载时执行 模组作者有必要在读取模组设置后将设置数据放入自己的类或结构中 API在运行时不会保存着模组设置
virtual void OnProjectXmlSaved(XElement xElement)
Project.xml在所有的Entity和Subsystem保存完毕后再执行
virtual void RecalculateModelEyePosition(ComponentModel componentModel, ref Vector3 eyePosition)
重新计算模型眼睛位置
virtual void LoadWorldInfoWidget(WorldInfo worldInfo, XElement savedWorldItemNode, ref ContainerWidget worldInfoWidget)
在世界选择列表时,调整存档的外观
virtual void MenuPlayMusic(out string contentMusicPath)
更改主页背景音乐
virtual void UpdateChaseBehaviorChasing(ComponentChaseBehavior chaseBehavior)
virtual void OnMovingBlockSetUpdate(IMovingBlockSet movingBlockSet, SubsystemMovingBlocks subsystemMovingBlocks, bool skippedByOtherMods, out bool skipVanilla)
在移动方块更新时触发
virtual void OnMinerPlace(ComponentMiner miner, TerrainRaycastResult raycastResult, int x, int y, int z, int value, BlockPlacementData placementData, out bool placed)
当人物放置时执行,若Placed为true则不执行原放置操作
virtual void OnPlayerDead(PlayerData playerData)
当人物死亡时执行。在玩家进入世界且玩家处于死亡状态时也会执行 可以通过playerData.m_stateMachine.PreviousState == "Playing",来判断是刚死的,还是加载世...
virtual void OnChaseBehaviorStartChasing(ComponentChaseBehavior chaseBehavior)
virtual void ProjectXmlLoad(XElement xElement, WorldInfo worldInfo, ContainerWidget gameWidget)
virtual bool MatchRecipe(string[] requiredIngredients, string[] actualIngredient, out bool matched)
配方匹配时执行
virtual void ModifyLogColor(string text, ref Color color)
对单条日志消息进行判定以修改其显示颜色
virtual void SetShaderParameter(Shader shader, Camera camera)
设置着色器参数
virtual void CalculateLighting(ref float brightness)
方块亮度 (黑暗区域亮度)
virtual void OnModelCalculateIsVisible(ComponentModel componentModel, Camera camera, out bool skip)
当模型计算是否可见时执行,Skip为是否跳过原本的计算
virtual void ToFreeChunks(TerrainUpdater terrainUpdater, TerrainChunk chunk, out bool keepWorking)
当区块即将被释放时 KeepWorking为True时该区块会继续保持运作,不被释放
virtual void TerrainContentsGenerator24Initialize(ITerrainContentsGenerator terrainContentsGenerator, SubsystemTerrain subsystemTerrain)
virtual void ApplyProtectionAfterClothes(ComponentClothing componentClothing, Attackment attackment, List< int > listAfterProtection, ref float attackPowerAfterProtection)
在计算护甲防御后,自定义新的结算
virtual void AttackPowerParameter(ComponentBody target, ComponentCreature attacker, Vector3 hitPoint, Vector3 hitDirection, ref float impulseFactor, ref float stunTimeFactor, ref bool recalculate)
更改击退和晕眩效果
virtual void IsPredator(ComponentFlyAwayBehavior flyAwayBehavior, Entity target, out bool isPredator, out bool skipVanilla)
ComponentFlyAwayBehavior组件接口 用于判断是否将目标规划为捕食者,从而飞走
virtual void OnEntityAdd(Entity entity)
当实体被添加时执行
virtual void DispenserChooseItemToDispense(ComponentDispenser componentDispenser, ref int slot, ref int value, out bool chosen)
发射器选择消耗哪一个物品进行发射
virtual void OnMovingBlockSetAdded(ref SubsystemMovingBlocks.MovingBlockSet movingBlockSet, SubsystemMovingBlocks subsystemMovingBlocks, ref bool testCollision, out bool doNotAdd)
在添加移动方块时触发
virtual void OnPlayerInputDrop(ComponentPlayer componentPlayer, bool skippedByOtherMods, out bool skipVanilla)
在玩家电脑上“按Q释放剑弃”时执行
virtual void OnProjectileTurnIntoPickable(Projectile projectile, ref Pickable pickable)
射弹转化为掉落物时执行
virtual void ClothingProcessSlotItems(ComponentPlayer componentPlayer, int slotIndex, ref int inputValue, ref int inputCount, ref int processedValue, ref int processedCount, bool skippedByOtherMods, out bool skipVanilla)
virtual void OnModelRendererDrawExtra(SubsystemModelsRenderer modelsRenderer, SubsystemModelsRenderer.ModelData modelData, Camera camera, float? alphaThreshold)
绘制额外模型数据的方法,如人物头顶的名字
virtual float ApplyArmorProtection(ComponentClothing componentClothing, float attackPower, bool appliedByOtherMods, out bool applied)
计算护甲免伤时执行
virtual void ChangeVisualEffectOnInjury(ComponentHealth componentHealth, float lastHealth, ref float redScreenFactor, ref bool playPainSound, ref int healthBarFlashCount, ref float creatureModelRedFactor)
每帧更新的时候,调整血量带来的视觉效果
virtual void SetHitValueParticleSystem(HitValueParticleSystem hitValueParticleSystem, Attackment attackment)
设定伤害粒子参数
virtual void RecalculateModelEyeRotation(ComponentModel componentModel, ref Quaternion eyeRotation)
重新计算模型眼睛旋转
virtual void OnModelDrawExtra(ComponentModel componentModel, Camera camera, out bool skip)
当模型对象绘制额外时执行,skip为是否跳过原本的绘制。 与OnModelRendererDrawExtra不同,本方法主要是人物第三人称模型手上物品的绘制
virtual void OnFurnitureDesigned(FurnitureDesign furnitureDesign, bool designedFromExistingFurniture, ref int pickableCount, ref bool destroyDesignBlocks, ref int toolDamageCount)
在创建家具时执行
virtual void SetClothes(ComponentClothing componentClothing, ClothingSlot slot, IEnumerable< int > clothes)
virtual bool ClothingProcessSlotItems(ComponentPlayer componentPlayer, Block block, int slotIndex, int value, int count)
当人物吃东西时执行
virtual void OnLightningStrike(SubsystemSky subsystemSky, ref Vector3 targetPosition, ref bool strike, ref float explosionPressure, ref bool setBodyOnFire)
在闪电劈下时执行
virtual void OnCreatureInjure(ComponentHealth componentHealth, float amount, ComponentCreature attacker, bool ignoreInvulnerability, string cause, out bool skip)
重定义生物受伤方法,Skip为true则不执行原Injure代码
virtual void OnProjectileFlyOutOfLoadedChunks(Projectile projectile)
射弹离开加载区块的时候执行
virtual int GetMaxInstancesCount()
设置生物最大组件数,多个Mod时取最大
virtual void OnBlockExploded(SubsystemTerrain subsystemTerrain, int x, int y, int z, int value)
当方块被炸掉时执行
virtual void ProjectXmlLoad(XElement xElement)
Project.xml加载时执行
virtual void PrepareModels(SubsystemModelsRenderer subsystemModelsRenderer, Camera camera, bool skippedByOtherMods, out bool skip)
virtual void InitializeClothingSlots()
初始化ClothingSlot的时候执行。在此接口添加脖子、手臂等新的可穿戴部位。
virtual void OnCapture()
屏幕截图时执行
virtual void IsCrosshairVisible(ComponentAimingSights componentAimingSights, ref bool isVisible)
设定是否显示默认的十字准星。可用于关闭PC端十字准星的强制显示
virtual void OnFactorsGenerate(ComponentFactors componentFactors)
在计算一个生物的Factors执行。仅限非玩家生物,玩家需要使用OnLevelUpdate。 ComponentFactors里面有四个List,这四个List储存了所有对该属性有影响的因子。模组可以修...
virtual void LoadCreatureInfoInBestiaryScreen(BestiaryScreen bestiaryScreen, ContainerWidget creatureInfoWidget, BestiaryCreatureInfo bestiaryCreatureInfo, ValuesDictionary entityValuesDictionary)
在生物图鉴目录列表更新该条目时,编辑该条目
virtual void OnModalPanelWidgetSet(ComponentGui componentGui, Widget oldWidget, Widget newWidget)
当ModalPanelWidget被设置时执行
virtual bool SetRainAndSnowColor(ref Color rainColor, ref Color snowColor)
设置雨和雪的颜色
virtual void RenderModels(SubsystemModelsRenderer subsystemModelsRenderer, Camera camera, int drawOrder, bool skippedByOtherMods, out bool skip)
virtual void OnPickableDraw(Pickable pickable, SubsystemPickables subsystemPickables, Camera camera, int drawOrder, ref bool shouldDrawBlock, ref float drawBlockSize, ref Color drawBlockColor)
绘制掉落物的时候执行
virtual void ChangeGameTimeDelta(SubsystemTime subsystemTime, ref float dt)
改变SubsystemTime的时间推移速度,偏向底层,一般开发者不必了解
virtual void OnCraftingRecipeDecode(List< CraftingRecipe > m_recipes, XElement element, out bool decoded)
配方解码时执行
virtual void DecideArmorProtectionSequence(ComponentClothing componentClothing, Attackment attackment, float randomNumber, List< int > clothesList)
计算护甲防御时,修改参与护甲防御的衣物列表
virtual void OnModelAnimate(ComponentCreatureModel componentCreatureModel, out bool skip)
virtual object BeforeGameLoading(PlayScreen playScreen, object item)
存档开始加载前执行
virtual void HandleInventoryDragMove(InventorySlotWidget inventorySlotWidget, IInventory sourceInventory, int sourceSlotIndex, IInventory targetInventory, int targetSlotIndex, bool skippedByOtherMods, out bool skip)
在InventorySlotWidget.HandleDragDrop时执行,如果物品没有修改操作,则执行移动物品操作
virtual void OnTreasureGenerate(SubsystemTerrain subsystemTerrain, int x, int y, int z, int neighborX, int neighborY, int neighborZ, ref int blockValue, ref int count, out bool isGenerate)
挖掘触发宝物生成时,注意这里能获取到上个Mod生成宝物的情况
virtual void OnScreenEntered(Screen screen, object[] screenParameters)
进入Screen时执行
virtual void OnWidgetContentsLoaded(Widget widget)
当界面内容完成加载时
virtual void GenerateChunkLightSources(DynamicArray< TerrainUpdater.LightSource > lightSources, TerrainChunk chunk)
生成光源数据
virtual void OnProjectileHitBody(Projectile projectile, BodyRaycastResult bodyRaycastResult, ref Attackment attackment, ref Vector3 velocityAfterAttack, ref Vector3 angularVelocityAfterAttack, ref bool ignoreBody)
当射弹击中生物、船只等实体时执行
virtual void OnSaveSpawnData(ComponentSpawn spawn, SpawnEntityData spawnEntityData)
当储存生物数据时
virtual void SetHitInterval(ComponentMiner miner, ref double hitInterval)
设置伤害间隔
virtual void OnPlayerControlBoat(ComponentPlayer componentPlayer, bool skippedByOtherMods, out bool skipVanilla)
在玩家乘坐船时每帧执行,用于调整玩家乘船时的控制逻辑
virtual void OnComponentLocomotionLoaded(ComponentLocomotion componentLocomotion, ref float mobWalkSpeedFactor, ref float mobFlySpeedFactor, ref float mobSwimSpeedFactor, ref bool disableCreativeFlyInSurvivalMode)
在ComponentLocomotion加载时执行
virtual void IsTerrainSafeToGo(ComponentPilot componentPilot, Vector3 position, Vector3 direction, out bool isTerrainSafeToGo, out bool skipVanilla)
ComponentPilot组件接口 用于判断是否地形是否安全
virtual void OnModelCalculateBones(ComponentModel componentModel, Camera camera, out bool skip)
当模型计算骨骼绝对变换时执行,Skip为是否跳过原本的计算
virtual void EntityComponentsInitialized(Entity entity, List< KeyValuePair< int, Component > > componentList)
在实体创建时执行,可用于移除实体的特定组件
virtual void UpdateComponentBody(ComponentBody componentBody, float dt, bool skippedByOtherMods, out bool skipVanilla)
执行动物的Update操作。 建议只在对自己模组的动物才进行带skip的覆盖原版的操作;对原版和其他模组的动物,请不要过多干涉覆盖原有的操作
virtual void BlocksInitalized()
方块初始化完成时执行
virtual void OnIDrawableAdded(SubsystemDrawing subsystemDrawing, IDrawable drawable, bool skippedByOtherMods, out bool skip)
在IDrawable添加或删除时执行,用于模组接管IDrawable的绘制行为
virtual void OnCreatureDied(ComponentHealth componentHealth, Injury injury, ref int experienceOrbDrop, ref bool calculateInKill)
在动物收到Injure()且生命值低于0时,执行操作。
virtual void TerrainChangeCell(SubsystemTerrain subsystemTerrain, int x, int y, int z, int value, out bool skip)
重定义方块更改方法,Skip为true则不执行原ChangeCell代码
virtual void FindHerdCenter(ComponentCreature componentCreature, out Vector3? herdCenter, out bool skipVanilla)
ComponentHerdBehavior组件接口, 用于生物寻找大部队中心点。 仅建议对自己模组的生物使用,不要干涉其他模组生物的行为。
virtual void OnIUpdateableAddOrRemove(SubsystemUpdate subsystemUpdate, IUpdateable updateable, bool toAdd1OrRemove0, bool skippedByOtherMods, out bool skip)
在IUpdateable添加或删除时执行,用于模组接管IUpdateable的更新行为 (如恒泰模组将动物放在多线程中进行更新,降低怪物数量多导致的卡顿)
virtual void ProcessAttackment(Attackment attackment)
在攻击时执行
virtual void DecideLoot(ComponentLoot componentLoot, List< BlockDropValue > dropValues)
修改生物的战利品。 建议不要清空dropValues推倒重来,不利于模组兼容性。
virtual void CalculateExplosionPower(SubsystemExplosions subsystemExplosions, ref float explosionPower)
virtual void OnComponentBodyExplodedStart(ComponentBody componentBody, Vector3 explosionCenter, float explosionPressure, ref float shakeStrength)
在爆炸开始,计算动物摇晃程度时执行。 为了尽可能确保兼容性,建议只对属于自己模组的生物进行接管编辑
virtual void DrawToScreen(ViewWidget viewWidget, Widget.DrawContext dc)
ViewWidget绘制屏幕时执行
virtual void OnMovingBlockSetRemoved(IMovingBlockSet movingBlockSet, SubsystemMovingBlocks subsystemMovingBlocks)
移除移动方块时触发
virtual void OnModelDataDrawing(SubsystemModelsRenderer.ModelData modelData, ModelShader modelShader, Camera camera, SubsystemModelsRenderer subsystemModelsRenderer, out bool skip)
当单个模型数据被渲染时执行
virtual ? float BodyCountInRaycast(ComponentBody componentBody, Ray3 ray, out bool skip)
计算动物在Raycast下的表现。输出null表示这个body不计入Raycast结果;输出一个具体的数值表示Raycast计算出来的距离。
virtual void UpdateChaseBehaviorLookingForTarget(ComponentChaseBehavior chaseBehavior)
virtual void EditRecipeScreenWidget(RecipaediaRecipesScreen screen)
在合成表页面时每帧更新时,编辑该页面
virtual void GrowPlant(SubsystemPlantBlockBehavior subsystemPlantBlockBehavior, int x, int y, int z, int pollPass, out bool skipVanilla)
在游戏执行植物生长判定时执行,为保证良好兼容性,建议只在处理属于自己模组的方块时改变控制
virtual void SubsystemUpdate(float dt)
子系统帧更新时执行
virtual void OnProjectileDraw(Projectile projectile, SubsystemProjectiles subsystemProjectiles, Camera camera, int drawOrder, ref bool shouldDrawBlock, ref float drawBlockSize, ref Color drawBlockColor)
绘制射弹的时候执行
virtual void UpdateDeathCameraWidget(PlayerData playerData, ref bool disableVanillaTapToRespawnAction, ref bool respawn)
在更新玩家死亡界面时执行
virtual void InitKeyCompatibleGroups()
初始化按键兼容组
virtual void OnVitalStatsEat(ComponentVitalStats vitalStats, ref int value, ref bool skipVanilla, out bool eatSuccess)
玩家生命状态(进食)钩子
virtual void OnEatPickable(ComponentEatPickableBehavior eatPickableBehavior, Pickable eatPickable, out bool dealed)
动物吃掉落物时执行
virtual void OnCameraChange(ComponentPlayer m_componentPlayer, ComponentGui componentGui)
改变相机模式时执行
virtual void OnMinerDig(ComponentMiner miner, TerrainRaycastResult raycastResult, ref float digProgress, out bool digged)
当人物挖掘时执行
virtual void OnMainMenuScreenCreated(MainMenuScreen mainMenuScreen, StackPanelWidget leftBottomBar, StackPanelWidget rightBottomBar)
在主界面初始化后执行,你可以通过这个给主界面加些你想要的按钮或者文字等 开发者也可以使用BeforeWidgetUpdate和AfterWidgetUpdate这两个接口实现更多种屏幕的局部调整
virtual int DecodeResult(string result, out bool decoded)
获得解码结果时执行
virtual void InitializeCreatureTypes(SubsystemCreatureSpawn spawn, List< SubsystemCreatureSpawn.CreatureType > creatureTypes)
自然生成生物列表初始化时执行
virtual void OnVitalStatsUpdateStamina(ComponentVitalStats vitalStats, ref float stamina, ref float gameTimeDelta, ref bool skipVanilla)
状态(更新耐力值)钩子
virtual void OnCreatureSpiked(ComponentHealth componentHealth, SubsystemBlockBehavior spikeBlockBehavior, CellFace cellFace, float velocity, ref Injury blockInjury)
virtual void TerrainContentsGenerator23Initialize(ITerrainContentsGenerator terrainContentsGenerator, SubsystemTerrain subsystemTerrain)
virtual void HandleMoveInventoryItem(InventorySlotWidget inventorySlotWidget, IInventory sourceInventory, int sourceSlotIndex, IInventory targetInventory, int targetSlotIndex, ref int count, out bool moved)
当移动物品时执行。从sourceInventory的第sourceSlotIndex个格子,移动count个物品,到targetInventory的第targetSlotIndex个格子
virtual void UpdateInput(ComponentInput componentInput, WidgetInput widgetInput)
更新输入时执行
virtual void OnCreatureDying(ComponentHealth componentHealth, Injury injury)
如果动物受到Injure且生命值小于0时,执行操作。 如果在函数执行完毕后Health > 0,则取消死亡判定。 通常用于各种模组的“不死图腾”机制
virtual void OnPickableAdded(SubsystemPickables subsystemPickables, ref Pickable pickable, ValuesDictionary loadValuesDictionary)
游戏中添加掉落物时触发
virtual void AfterWidgetUpdate(Widget widget)
在Widget完成Update()后立即执行,能用于修改游戏中已有按钮的功能
virtual void PlayInGameMusic()
在游戏游玩过程中时放音乐
virtual void SpawnEntity(SubsystemSpawn spawn, Entity entity, SpawnEntityData spawnEntityData, out bool spawned)
生物出生时执行
virtual void SubsystemUpdate(SubsystemUpdate subsystemUpdate, float dt)
virtual void OnDispenserDispensePickable(ComponentDispenser componentDispenser, ref Pickable pickable, ref int removeSlotCount)
在发射器投掷物品时执行
virtual Color ChangeSkyColor(Color oldColor, Vector3 direction, float timeOfDay, int temperature)
更改天空颜色
virtual void OnPlayerControlWalk(ComponentPlayer componentPlayer, bool skippedByOtherMods, out bool skipVanilla)
当玩家既不在坐骑上,也不在船上时执行,用于控制玩家行走的控制逻辑
virtual void ScoreMount(ComponentRider componentRider, ComponentMount componentMount, out float? score)
ComponentRider组件接口 用于获取可符合骑行条件生物 通过此接口,模组可以实现自定义骑行,也可以用于生物骑行生物相关逻辑 为保证模组兼容性,建议预先判断是否是自己模组的载具,且仅处理自己模组...
virtual bool CompareModVersion(string currentVersion, string lastVersion)
在加载存档前,比较当前模组的版本和存档上次使用模组的版本 仅比较本模组
virtual void OnTerrainBrushesCreated()
用于调整原版已有矿物、水域、植物等地形地貌的生成,例如减少原版矿物生成量
virtual void SavePickable(SubsystemPickables subsystemPickables, Pickable pickable, ref ValuesDictionary valuesDictionary)
保存世界时,存储掉落物信息
virtual void BeforeMinerPlace(ComponentMiner componentMiner, TerrainRaycastResult terrainRaycastResult, int x, int y, int z, BlockPlacementData placementData, out bool placementNotAllowed)
在人物放置时执行,在OnMinerPlace之前
virtual void CalculateCreatureInjuryAmount(Injury injury)
计算生物收到伤害的量
virtual void OnChaseBehaviorAttacked(ComponentChaseBehavior componentChaseBehavior, float chaseTimeBefore, ref float chaseTime, ref bool hitBody, ref bool playAttackSound)
在动物执行近战攻击命中目标时执行
virtual void ModelShaderParameter(Shader shader, Camera camera, List< SubsystemModelsRenderer.ModelData > modelsData, float? alphaThreshold)
更改模型着色器参数的值
virtual int DamageItem(Block block, int oldValue, int damageCount, Entity owner, out bool skipVanilla)
在执行DamageItem得到方块掉耐久后,得到的新方块值时执行
virtual bool OnPlayerSpawned(PlayerData.SpawnMode spawnMode, ComponentPlayer componentPlayer, Vector3 position)
人物出生时执行
virtual void OnMainMenuScreenUpdate(MainMenuScreen mainMenuScreen, StackPanelWidget leftBottomBar, StackPanelWidget rightBottomBar)
在主界面更新
virtual void OnProjectDisposed()
当Project被释放时执行
virtual void UpdatePlayerInputDig(ComponentPlayer componentPlayer, bool digging, ref bool playerOperated, ref double timeIntervalDig, bool skippedByOtherMods, out bool skipVanilla)
在玩家执行“挖掘”动作时执行
virtual void ApplyProtectionBeforeClothes(ComponentClothing componentClothing, Attackment attackment, ref float attackPowerAfterProtection)
在计算护甲防御前,自定义新的结算 例如:玩家携带力场护盾时,优先使用力场护盾进行防御
virtual void OnAnimateModel(ComponentModel componentModel, out bool skip)
当模型对象作出动画时执行 skip为是否跳过原动画代码
virtual void OnLocomotionStopped(ComponentLocomotion componentLocomotion, ref bool fallsOnDeathOrStun)
在动物晕眩或死亡时执行移动
virtual void HandleInventoryDragProcess(InventorySlotWidget inventorySlotWidget, IInventory sourceInventory, int sourceSlotIndex, IInventory targetInventory, int targetSlotIndex, ref int processCapacity)
在InventorySlotWidget.HandleDragDrop时执行,先执行物品的修改操作 (比如原版火药拖到枪身上时执行上膛操作)
virtual void OnLoadingFinished(List< Action > actions)
加载任务结束时执行 在BlocksManager初始化之后
virtual bool ToAllocateChunks(TerrainUpdater terrainUpdater, TerrainUpdater.UpdateLocation[] locations)
加载指定区块,如有区块数变动返回 true,否则返回 false
virtual void FindCoarseSpawnPosition(ITerrainContentsGenerator terrainContentsGenerator, ref Vector3 spawnPosition)
在创建世界时寻找玩家的初步生成大致位置
virtual void UpdateCreaturePropertiesInBestiaryDescriptionScreen(BestiaryDescriptionScreen bestiaryDescriptionScreen, BestiaryCreatureInfo bestiaryCreatureInfo, ValuesDictionary entityValuesDictionary)
在生物图鉴页面每帧更新时,编辑该页面
virtual void OnPlayerControlOtherMount(ComponentPlayer componentPlayer, bool skippedByOtherMods, out bool skipVanilla)
在玩家乘坐船、动物以外的物体时每帧执行,用于控制玩家骑模组坐骑的控制魔力
virtual bool AttackBody(ComponentBody target, ComponentCreature attacker, Vector3 hitPoint, Vector3 hitDirection, ref float attackPower, bool isMeleeAttack)
当Miner执行AttackBody方法时执行
virtual void OnVitalStatsUpdateFood(ComponentVitalStats vitalStats, ref float food, ref float gameTimeDelta, ref bool skipVanilla)
状态(更新饥饿值)钩子
virtual void ClothingWidgetOpen(ComponentGui componentGui, ClothingWidget clothingWidget)
衣物背包界面被打开时执行
virtual void OnMinerHit(ComponentMiner miner, ComponentBody componentBody, Vector3 hitPoint, Vector3 hitDirection, ref float attackPower, ref float playerProbability, ref float creatureProbability, out bool hitted)
virtual void IsLevelSufficientForTool(ComponentMiner miner, int toolValue, ref bool canUse, out bool skip)
当前等级是否可以使用手中物品进行:挖掘,使用,伤害,瞄准 Mod开发者可以自定义物品是否符合使用条件
virtual IEnumerable< KeyValuePair< string, object > > GetKeyboardMappings()
用于添加新的键盘鼠标按键映射,在重置按键设置时也会使用这里的设置作为默认值。 使用yield return可返回多个键值对。键:映射名;值:按键(Key)或鼠标按钮(MouseButton)
virtual void OnProjectileAdded(SubsystemProjectiles subsystemProjectiles, ref Projectile projectile, ValuesDictionary loadValuesDictionary)
游戏中添加射弹时触发
virtual void OnInventorySlotWidgetCalculateSplitCount(InventorySlotWidget inventorySlotWidget, int totalItemCount, DragMode dragMode, ref int splitCount)
在InventorySlotWidget计算分割物品数量时执行(包括拖拽显示数量和实际移动数量),允许修改最终的分割数量 (比如原版的1个/一半分割逻辑,可通过此方法自定义为固定数量、按物品类型分割等)
virtual void GetModFiles(string extension, Action< string, Stream > action, out bool skip)
在加载本模组的资源时触发。 注意:模组的dll只能由原版逻辑加载
virtual void GenerateChunkVertices(TerrainChunk chunk, bool even)
生成地形顶点时使用
virtual void OnChaseBehaviorStopChasing(ComponentChaseBehavior chaseBehavior)
virtual void CalculateSmoothLight(SubsystemTerrain subsystemTerrain, Vector3 p, ref float num)
计算动物模型光照
virtual void OnLevelUpdate(ComponentLevel level)
等级组件更新时执行,仅限玩家。参考OnFactorsUpdate接口使用说明。
virtual void OnSetModel(ComponentModel componentModel, Model model, out bool isSet)
当模型对象进行模型设值时执行
virtual void BeforeWidgetUpdate(Widget widget)
在Widget即将执行Update()时执行,能用于修改游戏中已有按钮的功能 并且可以通过一定的操作,拦截原版按钮的功能
virtual void EditBlockDescriptionScreen(Dictionary< string, string > blockProperties)
在方块介绍页面中,增加或减少方块的属性字段
virtual void OnVitalStatsUpdateWetness(ComponentVitalStats vitalStats, ref float wetness, ref float gameTimeDelta, ref bool skipVanilla)
状态(更新湿度)钩子
virtual void ClothingProcessSlotItems(ComponentClothing componentClothing, int slotIndex, ref int inputValue, ref int inputCount, ref int processedValue, ref int processedCount, bool skippedByOtherMods, out bool skipVanilla)
将物品拖动到衣物界面玩家身上时执行
virtual void OnMinerPlace(ComponentMiner miner, TerrainRaycastResult raycastResult, int x, int y, int z, int value, out bool placed)
当人物放置时执行,若Placed为true则不执行原放置操作
绘制任务,有多种类型,绘制任务会按照 Layer 进行排序。