My Project v1
Project
载入中...
搜索中...
未找到
Game.JsModLoader
类 Game.JsModLoader 继承关系图:
Game.JsModLoader 的协作图:

Public 成员函数

override void OnMinerDig (ComponentMiner miner, TerrainRaycastResult raycastResult, ref float DigProgress, out bool Digged)
 当人物挖掘时执行
 
override void OnMinerPlace (ComponentMiner miner, TerrainRaycastResult raycastResult, int x, int y, int z, int value, out bool Placed)
 当人物放置时执行,若Placed为true则不执行原放置操作
 
override bool OnPlayerSpawned (PlayerData.SpawnMode spawnMode, ComponentPlayer componentPlayer, Vector3 position)
 人物出生时执行
 
override void OnPlayerDead (PlayerData playerData)
 当人物死亡时执行。在玩家进入世界且玩家处于死亡状态时也会执行 可以通过playerData.m_stateMachine.PreviousState == "Playing",来判断是刚死的,还是加载世界的时候就已经死了。并规避由于退出重进世界造成的“反复死亡判断”bug
 
override void ProcessAttackment (Attackment attackment)
 在攻击时执行
 
override void CalculateCreatureInjuryAmount (Injury injury)
 计算生物收到伤害的量
 
override void OnProjectLoaded (Project project)
 当Project被加载时执行
 
override void OnProjectDisposed ()
 当Project被释放时执行
 
- Public 成员函数 继承自 Game.ModLoader
virtual void __ModInitialize ()
 当ModLoader类被实例化时执行
 
virtual void GetModFiles (string extension, Action< string, Stream > action, out bool skip)
 在加载本模组的资源时触发。 注意:模组的dll只能由原版逻辑加载
 
virtual void GetModFile (string filename, Action< Stream > stream, out bool skip, out bool fileFound)
 在系统读取本模组的文件时触发 注意:modinfo文件、mod图标只能由原版逻辑加载。如果需要修改调整,请自己在模组中重新写一遍加载逻辑
 
virtual bool CompareModVersion (string currentVersion, string lastVersion)
 在加载存档前,比较当前模组的版本和存档上次使用模组的版本 仅比较本模组
 
virtual void ModDispose ()
 Mod被卸载时执行
 
virtual void ViewFogColor (float ViewUnderWaterDepth, float ViewUnderMagmaDepth, ref Color viewFogColor)
 视图雾颜色调整
 
virtual void CalculateLighting (ref float brightness)
 方块亮度 (黑暗区域亮度)
 
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 SetHitInterval (ComponentMiner miner, ref double hitInterval)
 设置伤害间隔
 
virtual void OnMinerHit2 (ComponentMiner componentMiner, ComponentBody componentBody, Vector3 hitPoint, Vector3 hitDirection, ref int durabilityReduction, ref Attackment attackment)
 在生物攻击时执行
 
virtual void BeforeMinerPlace (ComponentMiner componentMiner, TerrainRaycastResult terrainRaycastResult, int x, int y, int z, BlockPlacementData placementData, out bool PlacementNotAllowed)
 在人物放置时执行,在OnMinerPlace之前
 
virtual bool SetRainAndSnowColor (ref Color rainColor, ref Color snowColor)
 设置雨和雪的颜色
 
virtual void SetFurnitureDesignColor (FurnitureDesign design, Block block, int value, ref int FaceTextureSlot, ref Color Color)
 设置家具的颜色
 
virtual void AttackPowerParameter (ComponentBody target, ComponentCreature attacker, Vector3 hitPoint, Vector3 hitDirection, ref float impulseFactor, ref float stunTimeFactor, ref bool recalculate)
 更改击退和晕眩效果
 
virtual bool ClothingProcessSlotItems (ComponentPlayer componentPlayer, Block block, int slotIndex, int value, int count)
 当人物吃东西时执行
 
virtual void SetClothes (ComponentClothing componentClothing, ClothingSlot slot, IEnumerable< int > clothes)
 
virtual void OnEatPickable (ComponentEatPickableBehavior eatPickableBehavior, Pickable EatPickable, out bool Dealed)
 动物吃掉落物时执行
 
virtual bool AttackBody (ComponentBody target, ComponentCreature attacker, Vector3 hitPoint, Vector3 hitDirection, ref float attackPower, bool isMeleeAttack)
 当Miner执行AttackBody方法时执行
 
virtual void OnSetModel (ComponentModel componentModel, Model model, out bool IsSet)
 当模型对象进行模型设值时执行
 
virtual void OnModelAnimate (ComponentCreatureModel componentCreatureModel, out bool Skip)
 当动物模型对象作出动画时执行 Skip为是否跳过原动画代码
 
virtual float ApplyArmorProtection (ComponentClothing componentClothing, float attackPower, bool appliedByOtherMods, out bool Applied)
 计算护甲免伤时执行
 
virtual void OnLevelUpdate (ComponentLevel level)
 等级组件更新时执行,仅限玩家。参考OnFactorsUpdate接口使用说明。
 
virtual void OnFactorsUpdate (ComponentFactors componentFactors, float dt)
 因素控制力量、抗性、速度、饥饿速率组件更新时执行
 
virtual void GuiUpdate (ComponentGui componentGui)
 Gui组件帧更新时执行
 
virtual void GuiDraw (ComponentGui componentGui, Camera camera, int drawOrder)
 Gui组件绘制时执行
 
virtual void UpdateInput (ComponentInput componentInput, WidgetInput widgetInput)
 更新输入时执行
 
virtual void DrawToScreen (ViewWidget viewWidget, Widget.DrawContext dc)
 ViewWidget绘制屏幕时执行
 
virtual void ClothingWidgetOpen (ComponentGui componentGui, ClothingWidget clothingWidget)
 衣物背包界面被打开时执行
 
virtual void OnBlockExploded (SubsystemTerrain subsystemTerrain, int x, int y, int z, int value)
 当方块被炸掉时执行
 
virtual void OnEntityAdd (Entity entity)
 当实体被添加时执行
 
virtual void OnEntityRemove (Entity entity)
 当实体被移除时执行
 
virtual void InitializeCreatureTypes (SubsystemCreatureSpawn spawn, List< SubsystemCreatureSpawn.CreatureType > creatureTypes)
 自然生成生物列表初始化时执行
 
virtual void SpawnEntity (SubsystemSpawn spawn, Entity entity, SpawnEntityData spawnEntityData, out bool Spawned)
 生物出生时执行
 
virtual void OnDespawned (Entity entity, ComponentSpawn componentSpawn)
 当生物消失时执行
 
virtual void CalculateExplosionPower (SubsystemExplosions subsystemExplosions, ref float explosionPower)
 
virtual void OnComponentBodyExploded (ComponentBody componentBody, ref Injury explosionInjury, ref Vector3 Impulse, ref bool SetOnFire, ref float Fluctuation)
 生物等实体在遭受爆炸时执行
 
virtual void DeadBeforeDrops (ComponentHealth componentHealth, ref KillParticleSystem killParticleSystem, ref bool dropAllItems)
 死亡前瞬间执行
 
virtual void TerrainChangeCell (SubsystemTerrain subsystemTerrain, int x, int y, int z, int value, out bool Skip)
 重定义方块更改方法,Skip为true则不执行原ChangeCell代码
 
virtual void OnCreatureInjure (ComponentHealth componentHealth, float amount, ComponentCreature attacker, bool ignoreInvulnerability, string cause, out bool Skip)
 重定义生物受伤方法,Skip为true则不执行原Injure代码
 
virtual void OnCreatureDying (ComponentHealth componentHealth, Injury injury)
 如果动物受到Injure且生命值小于0时,执行操作。 如果在函数执行完毕后Health > 0,则取消死亡判定。 通常用于各种模组的“不死图腾”机制
 
virtual void OnCreatureDied (ComponentHealth componentHealth, Injury injury, ref int experienceOrbDrop, ref bool CalculateInKill)
 在动物收到Injure()且生命值低于0时,执行操作。
 
virtual void ChangeVisualEffectOnInjury (ComponentHealth componentHealth, float lastHealth, ref float redScreenFactor, ref bool playPainSound, ref int healthBarFlashCount, ref float creatureModelRedFactor)
 每帧更新的时候,调整血量带来的视觉效果
 
virtual void OnCreatureSpiked (ComponentHealth componentHealth, SubsystemBlockBehavior spikeBlockBehavior, CellFace cellFace, float velocity, ref Injury blockInjury)
 
virtual Color ChangeSkyColor (Color oldColor, Vector3 direction, float timeOfDay, int temperature)
 更改天空颜色
 
virtual void SetShaderParameter (Shader shader, Camera camera)
 设置着色器参数
 
virtual void ModelShaderParameter (Shader shader, Camera camera, List< SubsystemModelsRenderer.ModelData > modelsData, float? alphaThreshold)
 更改模型着色器参数的值
 
virtual void SkyDrawExtra (SubsystemSky subsystemSky, Camera camera)
 天空额外绘制
 
virtual int GetMaxInstancesCount ()
 设置生物最大组件数,多个Mod时取最大
 
virtual void OnModelRendererDrawExtra (SubsystemModelsRenderer modelsRenderer, SubsystemModelsRenderer.ModelData modelData, Camera camera, float? alphaThreshold)
 绘制额外模型数据的方法,如人物头顶的名字
 
virtual void SetHitValueParticleSystem (HitValueParticleSystem hitValueParticleSystem, Attackment attackment)
 设定伤害粒子参数
 
virtual void OnSaveSpawnData (ComponentSpawn spawn, SpawnEntityData spawnEntityData)
 当储存生物数据时
 
virtual void OnReadSpawnData (Entity entity, SpawnEntityData spawnEntityData)
 当读取生物数据时
 
virtual void OnTerrainContentsGenerated (TerrainChunk chunk)
 区块地形生成时 注意此方法运行在子线程中
 
virtual void ToFreeChunks (TerrainUpdater terrainUpdater, TerrainChunk chunk, out bool KeepWorking)
 当区块即将被释放时 KeepWorking为True时该区块会继续保持运作,不被释放
 
virtual bool ToAllocateChunks (TerrainUpdater terrainUpdater, TerrainUpdater.UpdateLocation[] locations)
 加载指定区块,如有区块数变动返回 true,否则返回 false
 
virtual void SubsystemUpdate (float dt)
 子系统帧更新时执行
 
virtual void BlocksInitalized ()
 方块初始化完成时执行
 
virtual object BeforeGameLoading (PlayScreen playScreen, object item)
 存档开始加载前执行
 
virtual void OnLoadingStart (List< System.Action > actions)
 加载任务开始时执行 在BlocksManager初始化之前
 
virtual void OnLoadingFinished (List< System.Action > actions)
 加载任务结束时执行 在BlocksManager初始化之后
 
virtual void SaveSettings (XElement xElement)
 模组设置保存时执行
 
virtual void LoadSettings (XElement xElement)
 模组设置加载时执行 模组作者有必要在读取模组设置后将设置数据放入自己的类或结构中 API在运行时不会保存着模组设置
 
virtual void OnXdbLoad (XElement xElement)
 Xdb文件加载时执行
 
virtual void ProjectXmlLoad (XElement xElement)
 Project.xml加载时执行
 
virtual void ProjectXmlSave (XElement xElement)
 Project.xml保存时执行
 
virtual void OnProjectXmlSaved (XElement xElement)
 Project.xml在所有的Entity和Subsystem保存完毕后再执行
 
virtual void OnCraftingRecipeDecode (List< CraftingRecipe > m_recipes, XElement element, out bool Decoded)
 配方解码时执行
 
virtual bool MatchRecipe (string[] requiredIngredients, string[] actualIngredient, out bool Matched)
 配方匹配时执行
 
virtual int DecodeResult (string result, out bool Decoded)
 获得解码结果时执行
 
virtual void DecodeIngredient (string ingredient, out string craftingId, out int? data, out bool Decoded)
 解码配方
 
virtual void OnCameraChange (ComponentPlayer m_componentPlayer, ComponentGui componentGui)
 改变相机模式时执行
 
virtual void OnCapture ()
 屏幕截图时执行
 
virtual void MenuPlayMusic (out string ContentMusicPath)
 更改主页背景音乐
 
virtual void CallNearbyCreaturesHelp (ComponentHerdBehavior herdBehavior, ComponentCreature target, float maxRange, float maxChaseTime, bool isPersistent, out bool skipVanilla)
 摇人行为。 仅建议对自己模组的生物使用,不要干涉其他模组生物的行为。
 
virtual void FindHerdCenter (ComponentCreature componentCreature, out Vector3? herdCenter, out bool skipVanilla)
 ComponentHerdBehavior组件接口, 用于生物寻找大部队中心点。 仅建议对自己模组的生物使用,不要干涉其他模组生物的行为。
 
virtual void ScoreMount (ComponentRider componentRider, ComponentMount componentMount, out float? score)
 ComponentRider组件接口 用于获取可符合骑行条件生物 通过此接口,模组可以实现自定义骑行,也可以用于生物骑行生物相关逻辑
 
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 OnWidgetConstruct (ref Widget widget)
 当界面被创建时
 
virtual void BeforeWidgetDrawItemRender (Widget.DrawItem drawItem, out bool skipVanillaDraw, out Action afterWidgetDraw, ref Rectangle scissorRectangle, Widget.DrawContext drawContext)
 在 DrawItem 被绘制前。
 
virtual void OnDrawItemAssigned (Widget.DrawContext drawContext)
 在 DrawItem 排序后。
 
virtual void OnModalPanelWidgetSet (ComponentGui gui, Widget Old, Widget New)
 当ModalPanelWidget被设置时执行
 
virtual void GenerateChunkVertices (TerrainChunk chunk, bool even)
 生成地形顶点时使用
 
virtual void GenerateChunkLightSources (DynamicArray< TerrainUpdater.LightSource > lightSources, TerrainChunk chunk)
 生成光源数据
 
virtual void CalculateSmoothLight (SubsystemTerrain subsystemTerrain, Vector3 p, ref float num)
 计算动物模型光照
 
virtual void WindowModeChanged (WindowMode mode)
 当窗口模式改变时执行。
 
virtual int DamageItem (Block block, int oldValue, int damageCount, Entity owner, out bool skipVanilla)
 在执行DamageItem得到方块掉耐久后,得到的新方块值时执行
 
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 OnProjectileHitBody (Projectile projectile, BodyRaycastResult bodyRaycastResult, ref Attackment attackment, ref Vector3 velocityAfterAttack, ref Vector3 angularVelocityAfterAttack, ref bool ignoreBody)
 当射弹击中生物、船只等实体时执行
 
virtual void OnProjectileDraw (Projectile projectile, SubsystemProjectiles subsystemProjectiles, Camera camera, int drawOrder, ref bool shouldDrawBlock, ref float drawBlockSize, ref Color drawBlockColor)
 绘制射弹的时候执行
 
virtual void OnProjectileFlyOutOfLoadedChunks (Projectile projectile)
 射弹离开加载区块的时候执行
 
virtual void OnPickableDraw (Pickable pickable, SubsystemPickables subsystemPickables, Camera camera, int drawOrder, ref bool shouldDrawBlock, ref float drawBlockSize, ref Color drawBlockColor)
 绘制掉落物的时候执行
 
virtual void UpdateComponentBody (ComponentBody componentBody, float dt, bool skippedByOtherMods, out bool skipVanilla)
 执行动物的Update操作。 建议只在对自己模组的动物才进行带skip的覆盖原版的操作;对原版和其他模组的动物,请不要过多干涉覆盖原有的操作
 
virtual ? float BodyCountInRaycast (ComponentBody componentBody, Ray3 ray, out bool skip)
 计算动物在Raycast下的表现。输出null表示这个body不计入Raycast结果;输出一个具体的数值表示Raycast计算出来的距离。
 
virtual void OnMovingBlockSetAdded (ref SubsystemMovingBlocks.MovingBlockSet movingBlockSet, SubsystemMovingBlocks subsystemMovingBlocks, ref bool testCollision, out bool doNotAdd)
 在添加移动方块时触发
 
virtual void OnMovingBlockSetRemoved (IMovingBlockSet movingBlockSet, SubsystemMovingBlocks subsystemMovingBlocks)
 移除移动方块时触发
 
virtual void OnMovingBlockSetUpdate (IMovingBlockSet movingBlockSet, SubsystemMovingBlocks subsystemMovingBlocks, bool skippedByOtherMods, out bool skipVanilla)
 在移动方块更新时触发
 
virtual void OnProjectileAdded (SubsystemProjectiles subsystemProjectiles, ref Projectile projectile, ValuesDictionary loadValuesDictionary)
 游戏中添加射弹时触发
 
virtual void OnPickableAdded (SubsystemPickables subsystemPickables, ref Pickable pickable, ValuesDictionary loadValuesDictionary)
 游戏中添加掉落物时触发
 
virtual void SaveProjectile (SubsystemProjectiles subsystemProjectiles, Projectile projectile, ref ValuesDictionary valuesDictionary)
 保存世界时,存储射弹信息
 
virtual void SavePickable (SubsystemPickables subsystemPickables, Pickable pickable, ref ValuesDictionary valuesDictionary)
 保存世界时,存储掉落物信息
 
virtual void OnBlockDug (ComponentMiner componentMiner, BlockPlacementData digValue, int cellValue, ref int DurabilityReduction, ref bool mute, ref int PlayerDataDugAdd)
 在方块被挖掘完毕时执行
 
virtual void ChangeGameTimeDelta (SubsystemTime subsystemTime, ref float dt)
 改变SubsystemTime的时间推移速度,偏向底层,一般开发者不必了解
 
virtual void OnIUpdateableAddOrRemove (SubsystemUpdate subsystemUpdate, IUpdateable updateable, bool ToAdd1OrRemove0, bool skippedByOtherMods, out bool skip)
 在IUpdateable添加或删除时执行,用于模组接管IUpdateable的更新行为 (如恒泰模组将动物放在多线程中进行更新,降低怪物数量多导致的卡顿)
 
virtual void OnIDrawableAdded (SubsystemDrawing subsystemDrawing, IDrawable drawable, bool skippedByOtherMods, out bool skip)
 在IDrawable添加或删除时执行,用于模组接管IDrawable的绘制行为
 
virtual void OnFurnitureDesigned (FurnitureDesign furnitureDesign, bool designedFromExistingFurniture, ref int pickableCount, ref bool destroyDesignBlocks, ref int toolDamageCount)
 在创建家具时执行
 
virtual void OnInventorySlotWidgetDefined (InventorySlotWidget inventorySlotWidget, out List< Widget > childrenWidgetsToAdd)
 在创建InventorySlotWidget时执行,可以增加元素
 
virtual void InventorySlotWidgetMeasureOverride (InventorySlotWidget inventorySlotWidget, Vector2 parentAvailableSize)
 绘制物品格子的耐久条、食物条等元素
 
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 HandleInventoryDragProcess (InventorySlotWidget inventorySlotWidget, IInventory sourceInventory, int sourceSlotIndex, IInventory targetInventory, int targetSlotIndex, ref int ProcessCapacity)
 在InventorySlotWidget.HandleDragDrop时执行,先执行物品的修改操作 (比如原版火药拖到枪身上时执行上膛操作)
 
virtual void HandleInventoryDragMove (InventorySlotWidget inventorySlotWidget, IInventory sourceInventory, int sourceSlotIndex, IInventory targetInventory, int targetSlotIndex, bool skippedByOtherMods, out bool skip)
 在InventorySlotWidget.HandleDragDrop时执行,如果物品没有修改操作,则执行移动物品操作
 
virtual void OnPlayerControlSteed (ComponentPlayer componentPlayer, bool skippedByOtherMods, out bool skipVanilla)
 在玩家骑上坐骑时每帧执行,用于调整玩家骑行动物时的控制逻辑
 
virtual void OnPlayerControlBoat (ComponentPlayer componentPlayer, bool skippedByOtherMods, out bool skipVanilla)
 在玩家乘坐船时每帧执行,用于调整玩家乘船时的控制逻辑
 
virtual void OnPlayerControlOtherMount (ComponentPlayer componentPlayer, bool skippedByOtherMods, out bool skipVanilla)
 在玩家乘坐船、动物以外的物体时每帧执行,用于控制玩家骑模组坐骑的控制魔力
 
virtual void OnPlayerControlWalk (ComponentPlayer componentPlayer, bool skippedByOtherMods, out bool skipVanilla)
 当玩家既不在坐骑上,也不在船上时执行,用于控制玩家行走的控制逻辑
 
virtual void OnPlayerInputInteract (ComponentPlayer componentPlayer, ref bool playerOperated, ref double timeIntervalLastActionTime, ref int priorityUse, ref int priorityInteract, ref int priorityPlace)
 当玩家输入交互逻辑时执行的操作
 
virtual void UpdatePlayerInputAim (ComponentPlayer componentPlayer, bool aiming, ref bool playerOperated, ref float timeIntervalAim, bool skippedByOtherMods, out bool skipVanilla)
 在玩家正在瞄准时执行
 
virtual void OnPlayerInputHit (ComponentPlayer componentPlayer, ref bool playerOperated, ref double timeIntervalHit, ref float meleeAttackRange, bool skippedByOtherMods, out bool skipVanilla)
 在玩家执行“攻击”动作时执行,比如恒泰左键放箭,工业左键点击船
 
virtual void UpdatePlayerInputDig (ComponentPlayer componentPlayer, bool digging, ref bool playerOperated, ref double timeIntervalDig, bool skippedByOtherMods, out bool skipVanilla)
 在玩家执行“挖掘”动作时执行
 
virtual void OnPlayerInputDrop (ComponentPlayer componentPlayer, bool skippedByOtherMods, out bool skipVanilla)
 在玩家电脑上“按Q释放剑弃”时执行
 
virtual void OnLightningStrike (SubsystemSky subsystemSky, ref Vector3 targetPosition, ref bool strike, ref float explosionPressure, ref bool setBodyOnFire)
 在闪电劈下时执行
 
virtual void OnTerrainBrushesCreated ()
 用于调整原版已有矿物、水域、植物等地形地貌的生成,例如减少原版矿物生成量
 
virtual void FindCoarseSpawnPosition (ITerrainContentsGenerator terrainContentsGenerator, ref Vector3 spawnPosition)
 在创建世界时寻找玩家的初步生成大致位置
 
virtual void OnChaseBehaviorAttacked (ComponentChaseBehavior componentChaseBehavior, float chaseTimeBefore, ref float chaseTime, ref bool hitBody, ref bool playAttackSound)
 在动物执行近战攻击命中目标时执行
 
virtual void OnChaseBehaviorAttackFailed (ComponentChaseBehavior componentChaseBehavior, ref float chaseTime)
 在动物执行近战攻击没有命中目标时执行
 
virtual void CalculateFallDamage (ComponentHealth componentHealth, ref float damage)
 计算动物的坠落伤害
 
virtual void OnLocomotionStopped (ComponentLocomotion componentLocomotion, ref bool fallsOnDeathOrStun)
 在动物晕眩或死亡时执行移动
 
virtual void OnComponentLocomotionLoaded (ComponentLocomotion componentLocomotion, ref float mobWalkSpeedFactor, ref float mobFlySpeedFactor, ref float mobSwimSpeedFactor, ref bool disableCreativeFlyInSurvivalMode)
 在ComponentLocomotion加载时执行
 
virtual void OnDispenserDispensePickable (ComponentDispenser componentDispenser, ref Pickable pickable, ref int RemoveSlotCount)
 在发射器投掷物品时执行
 
virtual void OnDispenserShoot (ComponentDispenser componentDispenser, ref Projectile projectile, ref bool canDispensePickable, ref int RemoveSlotCount)
 在发射器弹射物品时执行
 
virtual void DispenserChooseItemToDispense (ComponentDispenser componentDispenser, ref int slot, ref int value, out bool chosen)
 发射器选择消耗哪一个物品进行发射
 
virtual void LoadWorldInfoWidget (WorldInfo worldInfo, XElement savedWorldItemNode, ref ContainerWidget worldInfoWidget)
 在世界选择列表时,调整存档的外观
 
virtual void EditBlockDescriptionScreen (Dictionary< string, string > blockProperties)
 在方块介绍页面中,增加或减少方块的属性字段
 
virtual void EditRecipeScreenWidget (RecipaediaRecipesScreen screen)
 在合成表页面时每帧更新时,编辑该页面
 
virtual void UpdateCreaturePropertiesInBestiaryDescriptionScreen (BestiaryDescriptionScreen bestiaryDescriptionScreen, BestiaryCreatureInfo bestiaryCreatureInfo, ValuesDictionary entityValuesDictionary)
 在生物图鉴页面每帧更新时,编辑该页面
 
virtual void LoadCreatureInfoInBestiaryScreen (BestiaryScreen bestiaryScreen, ContainerWidget creatureInfoWidget, BestiaryCreatureInfo bestiaryCreatureInfo, ValuesDictionary entityValuesDictionary)
 在生物图鉴目录列表更新该条目时,编辑该条目
 
virtual void ResetOptionsForNonCreativeMode (WorldSettings worldSettings, EnvironmentBehaviorMode environmentBehaviorModeBefore, TimeOfDayMode timeOfDayModeBefore, bool areWeatherEffectsEnabledBefore, bool areSurvivalMechanicsEnabledBefore)
 在进行世界设置时,如果不是创造模式,则会修改设定
 
virtual void CraftingRecipesManagerInitialize (List< CraftingRecipe > recipes, ref bool sort)
 在配方表加载的时候执行,用于删除原版配方
 
virtual void CraftingRecipesManagerInitialized ()
 在配方表加载完成后执行,在排序完成后执行
 
virtual void PlayInGameMusic ()
 在游戏游玩过程中时放音乐
 
virtual void TerrainContentsGenerator23Initialize (ITerrainContentsGenerator terrainContentsGenerator, SubsystemTerrain subsystemTerrain)
 
virtual void TerrainContentsGenerator24Initialize (ITerrainContentsGenerator terrainContentsGenerator, SubsystemTerrain subsystemTerrain)
 
virtual void PrepareModels (SubsystemModelsRenderer subsystemModelsRenderer, Camera camera, bool skippedByOtherMods, out bool skip)
 
virtual void RenderModels (SubsystemModelsRenderer subsystemModelsRenderer, Camera camera, int drawOrder, bool skippedByOtherMods, out bool skip)
 
virtual void UpdateDeathCameraWidget (PlayerData playerData, ref bool disableVanillaTapToRespawnAction, ref bool respawn)
 在更新玩家死亡界面时执行
 
virtual void OnComponentBodyExplodedStart (ComponentBody componentBody, Vector3 explosionCenter, float explosionPressure, ref float shakeStrength)
 在爆炸开始,计算动物摇晃程度时执行。 为了尽可能确保兼容性,建议只对属于自己模组的生物进行接管编辑
 
virtual void GrowPlant (SubsystemPlantBlockBehavior subsystemPlantBlockBehavior, int x, int y, int z, int pollPass, out bool skipVanilla)
 在游戏执行植物生长判定时执行,为保证良好兼容性,建议只在处理属于自己模组的方块时改变控制
 
virtual void OnProjectileTurnIntoPickable (Projectile projectile, ref Pickable pickable)
 射弹转化为掉落物时执行
 
virtual void EntityComponentsInitialized (Entity entity, List< KeyValuePair< int, Component > > componentList)
 在实体创建时执行,可用于移除实体的特定组件
 
virtual void ProjectBeforeSubsystemsAndEntitiesLoad (Project project)
 游戏Project创建时执行,可用于移除Subsystem、Entity、Entity.Component
 
virtual void OnScreenEntered (Screen screen, object[] screenParameters)
 进入Screen时执行
 
virtual void OnScreenLeaved (Screen screen)
 离开Screen时执行
 
virtual void BeforeWidgetUpdate (Widget widget)
 在Widget即将执行Update()时执行,能用于修改游戏中已有按钮的功能 并且可以通过一定的操作,拦截原版按钮的功能
 
virtual void AfterWidgetUpdate (Widget widget)
 在Widget完成Update()后立即执行,能用于修改游戏中已有按钮的功能
 
virtual void OnChaseBehaviorStartChasing (ComponentChaseBehavior chaseBehavior)
 
virtual void OnChaseBehaviorStopChasing (ComponentChaseBehavior chaseBehavior)
 
virtual void ChaseBehaviorScoreTarget (ComponentChaseBehavior chaseBehavior, ComponentCreature creatureToBeTarget, ref float score)
 生物在选择追击对象时,对被追击对象的评分。评分越高,则会被选中。 仅建议在该生物为本模组生物,或目标生物为本模组生物时,修改追击权重。
 
virtual void UpdateChaseBehaviorLookingForTarget (ComponentChaseBehavior chaseBehavior)
 
virtual void UpdateChaseBehaviorChasing (ComponentChaseBehavior chaseBehavior)
 
virtual void DecideLoot (ComponentLoot componentLoot, List< BlockDropValue > dropValues)
 修改生物的战利品。 建议不要清空dropValues推倒重来,不利于模组兼容性。
 
virtual void OnMainMenuScreenCreated (MainMenuScreen mainMenuScreen, StackPanelWidget leftBottomBar, StackPanelWidget rightBottomBar)
 在主界面初始化后执行,你可以通过这个给主界面加些你想要的按钮或者文字等 不过建议开发者使用BeforeWidgetUpdate和AfterWidgetUpdate这两个接口实现
 
virtual void OnMainMenuScreenUpdate (MainMenuScreen mainMenuScreen, StackPanelWidget leftBottomBar, StackPanelWidget rightBottomBar)
 在主界面更新
 
virtual void OnFactorsGenerate (ComponentFactors componentFactors)
 在计算一个生物的Factors执行。仅限非玩家生物,玩家需要使用OnLevelUpdate。 ComponentFactors里面有四个List,这四个List储存了所有对该属性有影响的因子。模组可以修改其中的因子来实现自定义的操作。 public List<Factor> m_strengthFactors = []; public List<Factor> m_speedFactors = []; public List<Factor> m_hungerFactors = []; public List<Factor> m_resilienceFactors = []; 在执行这个接口后,游戏会根据这四个List计算出StrengthFactor、SpeedFactor、HungerFactor、ResilienceFactor的最终值
 
virtual void DecideArmorProtectionSequence (ComponentClothing componentClothing, Attackment attackment, float randomNumber, List< int > clothesList)
 计算护甲防御时,修改参与护甲防御的衣物列表
 
virtual void ApplyProtectionBeforeClothes (ComponentClothing componentClothing, Attackment attackment, ref float attackPowerAfteProtection)
 在计算护甲防御前,自定义新的结算 例如:玩家携带力场护盾时,优先使用力场护盾进行防御
 
virtual void ApplyProtectionAfterClothes (ComponentClothing componentClothing, Attackment attackment, List< int > listAfterProtection, ref float attackPowerAfteProtection)
 在计算护甲防御后,自定义新的结算
 
virtual void InitializeClothingSlots ()
 初始化ClothingSlot的时候执行。在此接口添加脖子、手臂等新的可穿戴部位。
 
virtual void OnPlayerModelWidgetMeasureOverride (PlayerModelWidget playerModelWidget)
 在绘制人物界面中的人物模型的时候执行,可以通过在playerModelWidget.m_modelWidget中增删元素来在人物界面绘制新模型
 

额外继承的成员函数

- Public 属性 继承自 Game.ModLoader
ModEntity Entity
 

成员函数说明

◆ CalculateCreatureInjuryAmount()

override void Game.JsModLoader.CalculateCreatureInjuryAmount ( Injury injury)
virtual

计算生物收到伤害的量

重载 Game.ModLoader .

函数调用图:

◆ OnMinerDig()

override void Game.JsModLoader.OnMinerDig ( ComponentMiner miner,
TerrainRaycastResult raycastResult,
ref float DigProgress,
out bool Digged )
virtual

当人物挖掘时执行

参数
miner
raycastResult
返回

重载 Game.ModLoader .

函数调用图:

◆ OnMinerPlace()

override void Game.JsModLoader.OnMinerPlace ( ComponentMiner miner,
TerrainRaycastResult raycastResult,
int x,
int y,
int z,
int value,
out bool Placed )
virtual

当人物放置时执行,若Placed为true则不执行原放置操作

参数
miner
raycastResult
返回

重载 Game.ModLoader .

函数调用图:

◆ OnPlayerDead()

override void Game.JsModLoader.OnPlayerDead ( PlayerData playerData)
virtual

当人物死亡时执行。在玩家进入世界且玩家处于死亡状态时也会执行 可以通过playerData.m_stateMachine.PreviousState == "Playing",来判断是刚死的,还是加载世界的时候就已经死了。并规避由于退出重进世界造成的“反复死亡判断”bug

参数
playerData

重载 Game.ModLoader .

函数调用图:

◆ OnPlayerSpawned()

override bool Game.JsModLoader.OnPlayerSpawned ( PlayerData.SpawnMode spawnMode,
ComponentPlayer componentPlayer,
Vector3 position )
virtual

人物出生时执行

重载 Game.ModLoader .

函数调用图:

◆ OnProjectDisposed()

override void Game.JsModLoader.OnProjectDisposed ( )
virtual

当Project被释放时执行

重载 Game.ModLoader .

函数调用图:

◆ OnProjectLoaded()

override void Game.JsModLoader.OnProjectLoaded ( Project project)
virtual

当Project被加载时执行

参数
project

重载 Game.ModLoader .

函数调用图:

◆ ProcessAttackment()

override void Game.JsModLoader.ProcessAttackment ( Attackment attackment)
virtual

在攻击时执行

参数
attackment

重载 Game.ModLoader .

函数调用图:

该类的文档由以下文件生成: