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

Public 成员函数

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 OnMinerDig (ComponentMiner miner, TerrainRaycastResult raycastResult, ref float DigProgress, out bool Digged)
 当人物挖掘时执行
 
virtual void BeforeMinerPlace (ComponentMiner componentMiner, TerrainRaycastResult terrainRaycastResult, int x, int y, int z, BlockPlacementData placementData, out bool PlacementNotAllowed)
 在人物放置时执行,在OnMinerPlace之前
 
virtual void OnMinerPlace (ComponentMiner miner, TerrainRaycastResult raycastResult, int x, int y, int z, int value, out bool Placed)
 当人物放置时执行,若Placed为true则不执行原放置操作
 
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 OnPlayerSpawned (PlayerData.SpawnMode spawnMode, ComponentPlayer componentPlayer, Vector3 position)
 人物出生时执行
 
virtual void OnPlayerDead (PlayerData playerData)
 当人物死亡时执行。在玩家进入世界且玩家处于死亡状态时也会执行 可以通过playerData.m_stateMachine.PreviousState == "Playing",来判断是刚死的,还是加载世界的时候就已经死了。并规避由于退出重进世界造成的“反复死亡判断”bug
 
virtual bool AttackBody (ComponentBody target, ComponentCreature attacker, Vector3 hitPoint, Vector3 hitDirection, ref float attackPower, bool isMeleeAttack)
 当Miner执行AttackBody方法时执行
 
virtual void ProcessAttackment (Attackment attackment)
 在攻击时执行
 
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 CalculateCreatureInjuryAmount (Injury injury)
 计算生物收到伤害的量
 
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 OnProjectLoaded (Project project)
 当Project被加载时执行
 
virtual void OnProjectDisposed ()
 当Project被释放时执行
 
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 属性

ModEntity Entity
 

成员函数说明

◆ __ModInitialize()

virtual void Game.ModLoader.__ModInitialize ( )
virtual

当ModLoader类被实例化时执行

Game.SurvivalCraftModLoader 重载.

这是这个函数的调用关系图:

◆ AfterWidgetUpdate()

virtual void Game.ModLoader.AfterWidgetUpdate ( Widget widget)
virtual

在Widget完成Update()后立即执行,能用于修改游戏中已有按钮的功能

参数
widget

◆ ApplyArmorProtection()

virtual float Game.ModLoader.ApplyArmorProtection ( ComponentClothing componentClothing,
float attackPower,
bool appliedByOtherMods,
out bool Applied )
virtual

计算护甲免伤时执行

参数
componentClothing
attackPower未计算免伤前的伤害
返回
免伤后的伤害,当多个mod都有免伤计算时,取最小值

◆ ApplyProtectionAfterClothes()

virtual void Game.ModLoader.ApplyProtectionAfterClothes ( ComponentClothing componentClothing,
Attackment attackment,
List< int > listAfterProtection,
ref float attackPowerAfteProtection )
virtual

在计算护甲防御后,自定义新的结算

参数
componentClothing挨打者的护甲组件
attackment导致该护甲结算的攻击
attackPowerAfteProtection结算护甲后的攻击力

◆ ApplyProtectionBeforeClothes()

virtual void Game.ModLoader.ApplyProtectionBeforeClothes ( ComponentClothing componentClothing,
Attackment attackment,
ref float attackPowerAfteProtection )
virtual

在计算护甲防御前,自定义新的结算 例如:玩家携带力场护盾时,优先使用力场护盾进行防御

参数
componentClothing挨打者的护甲组件
attackment导致该护甲结算的攻击
attackPowerAfteProtection结算护甲后的攻击力

◆ AttackBody()

virtual bool Game.ModLoader.AttackBody ( ComponentBody target,
ComponentCreature attacker,
Vector3 hitPoint,
Vector3 hitDirection,
ref float attackPower,
bool isMeleeAttack )
virtual

当Miner执行AttackBody方法时执行

参数
target
attacker
hitPoint
hitDirection
attackPower
isMeleeAttack
返回
false移交到下一个Mod处理,true不移交

◆ AttackPowerParameter()

virtual void Game.ModLoader.AttackPowerParameter ( ComponentBody target,
ComponentCreature attacker,
Vector3 hitPoint,
Vector3 hitDirection,
ref float impulseFactor,
ref float stunTimeFactor,
ref bool recalculate )
virtual

更改击退和晕眩效果

参数
target目标
attacker攻击者
hitPoint伤害位置
impulseFactor击退效果
stunTimeFactor眩晕时间
recalculate是否重写眩晕?

◆ BeforeGameLoading()

virtual object Game.ModLoader.BeforeGameLoading ( PlayScreen playScreen,
object item )
virtual

存档开始加载前执行

参数
playScreen世界选择界面
item类型为WorldInfo,存储即将进入的存档信息
返回
返回类型应当保证为WorldInfo,返回null可以阻止玩家进入存档

◆ BeforeMinerPlace()

virtual void Game.ModLoader.BeforeMinerPlace ( ComponentMiner componentMiner,
TerrainRaycastResult terrainRaycastResult,
int x,
int y,
int z,
BlockPlacementData placementData,
out bool PlacementNotAllowed )
virtual

在人物放置时执行,在OnMinerPlace之前

参数
componentMiner
terrainRaycastResult
x放置方块的坐标x
y放置方块的坐标y
z放置方块的坐标z
placementData包含放置方块的方块表面等信息
PlacementNotAllowed返回true则玩家不能放置方块

◆ BeforeWidgetDrawItemRender()

virtual void Game.ModLoader.BeforeWidgetDrawItemRender ( Widget.DrawItem drawItem,
out bool skipVanillaDraw,
out Action afterWidgetDraw,
ref Rectangle scissorRectangle,
Widget.DrawContext drawContext )
virtual

在 DrawItem 被绘制前。

参数
drawItem被绘制的 DrawItem。
skipVanillaDraw是否跳过原版绘制代码。
afterWidgetDraw原版绘制完成后的回调。
scissorRectangle绘制时的 ScissorRectangle。
drawContext绘制上下文。

◆ BeforeWidgetUpdate()

virtual void Game.ModLoader.BeforeWidgetUpdate ( Widget widget)
virtual

在Widget即将执行Update()时执行,能用于修改游戏中已有按钮的功能 并且可以通过一定的操作,拦截原版按钮的功能

参数
widget

◆ BlocksInitalized()

virtual void Game.ModLoader.BlocksInitalized ( )
virtual

方块初始化完成时执行

这是这个函数的调用关系图:

◆ BodyCountInRaycast()

virtual ? float Game.ModLoader.BodyCountInRaycast ( ComponentBody componentBody,
Ray3 ray,
out bool skip )
virtual

计算动物在Raycast下的表现。输出null表示这个body不计入Raycast结果;输出一个具体的数值表示Raycast计算出来的距离。

参数
componentBody
ray动物位置
skip原版计算出来的强度

◆ CalculateCreatureInjuryAmount()

virtual void Game.ModLoader.CalculateCreatureInjuryAmount ( Injury injury)
virtual

计算生物收到伤害的量

Game.JsModLoader 重载.

◆ CalculateExplosionPower()

virtual void Game.ModLoader.CalculateExplosionPower ( SubsystemExplosions subsystemExplosions,
ref float explosionPower )
virtual

◆ CalculateFallDamage()

virtual void Game.ModLoader.CalculateFallDamage ( ComponentHealth componentHealth,
ref float damage )
virtual

计算动物的坠落伤害

参数
componentHealth生物的ComponentHealth,至于坠落速度等信息则从ComponentHealth出发寻找
damage坠落伤害

◆ CalculateLighting()

virtual void Game.ModLoader.CalculateLighting ( ref float brightness)
virtual

方块亮度 (黑暗区域亮度)

参数
brightness亮度值

◆ CalculateSmoothLight()

virtual void Game.ModLoader.CalculateSmoothLight ( SubsystemTerrain subsystemTerrain,
Vector3 p,
ref float num )
virtual

计算动物模型光照

参数
subsystemTerrain
p动物位置
num原版计算出来的强度

◆ CallNearbyCreaturesHelp()

virtual void Game.ModLoader.CallNearbyCreaturesHelp ( ComponentHerdBehavior herdBehavior,
ComponentCreature target,
float maxRange,
float maxChaseTime,
bool isPersistent,
out bool skipVanilla )
virtual

摇人行为。 仅建议对自己模组的生物使用,不要干涉其他模组生物的行为。

参数
skipVanilla是否跳过原版逻辑

◆ ChangeGameTimeDelta()

virtual void Game.ModLoader.ChangeGameTimeDelta ( SubsystemTime subsystemTime,
ref float dt )
virtual

改变SubsystemTime的时间推移速度,偏向底层,一般开发者不必了解

参数
subsystemTime
dt

◆ ChangeSkyColor()

virtual Color Game.ModLoader.ChangeSkyColor ( Color oldColor,
Vector3 direction,
float timeOfDay,
int temperature )
virtual

更改天空颜色

◆ ChangeVisualEffectOnInjury()

virtual void Game.ModLoader.ChangeVisualEffectOnInjury ( ComponentHealth componentHealth,
float lastHealth,
ref float redScreenFactor,
ref bool playPainSound,
ref int healthBarFlashCount,
ref float creatureModelRedFactor )
virtual

每帧更新的时候,调整血量带来的视觉效果

参数
componentHealth
lastHealth在扣血之前的生命值
redScreenFactor玩家的红屏效果
playPainSound是否播放受伤音效
healthBarFlashCount玩家血条闪烁次数
creatureModelRedFactor生物模型变红,为0时不变红,为1时完全红色

◆ ChaseBehaviorScoreTarget()

virtual void Game.ModLoader.ChaseBehaviorScoreTarget ( ComponentChaseBehavior chaseBehavior,
ComponentCreature creatureToBeTarget,
ref float score )
virtual

生物在选择追击对象时,对被追击对象的评分。评分越高,则会被选中。 仅建议在该生物为本模组生物,或目标生物为本模组生物时,修改追击权重。

参数
chaseBehavior
creatureToBeTarget被评估的对象
score给出的评分

◆ ClothingProcessSlotItems()

virtual bool Game.ModLoader.ClothingProcessSlotItems ( ComponentPlayer componentPlayer,
Block block,
int slotIndex,
int value,
int count )
virtual

当人物吃东西时执行

参数
componentPlayer
block
value
count
返回
如果为 true:不移交到下一个 mod 处理

◆ ClothingWidgetOpen()

virtual void Game.ModLoader.ClothingWidgetOpen ( ComponentGui componentGui,
ClothingWidget clothingWidget )
virtual

衣物背包界面被打开时执行

参数
componentGui
clothingWidget

◆ CompareModVersion()

virtual bool Game.ModLoader.CompareModVersion ( string currentVersion,
string lastVersion )
virtual

在加载存档前,比较当前模组的版本和存档上次使用模组的版本 仅比较本模组

参数
currentVersion当前模组的版本
lastVersion存档上一次使用模组的版本
返回
返回true表示当前版本模组能加载目标版本模组的存档,返回false则不加载

◆ CraftingRecipesManagerInitialize()

virtual void Game.ModLoader.CraftingRecipesManagerInitialize ( List< CraftingRecipe > recipes,
ref bool sort )
virtual

在配方表加载的时候执行,用于删除原版配方

参数
recipes已经加载的配方
sort是否在删除后重新排序

◆ CraftingRecipesManagerInitialized()

virtual void Game.ModLoader.CraftingRecipesManagerInitialized ( )
virtual

在配方表加载完成后执行,在排序完成后执行

◆ DamageItem()

virtual int Game.ModLoader.DamageItem ( Block block,
int oldValue,
int damageCount,
Entity owner,
out bool skipVanilla )
virtual

在执行DamageItem得到方块掉耐久后,得到的新方块值时执行

参数
block
oldValue方块的旧值
damageCount损害的耐久量
owner方块的拥有者
skipVanilla跳过原版执行逻辑
返回

◆ DeadBeforeDrops()

virtual void Game.ModLoader.DeadBeforeDrops ( ComponentHealth componentHealth,
ref KillParticleSystem killParticleSystem,
ref bool dropAllItems )
virtual

死亡前瞬间执行

◆ DecideArmorProtectionSequence()

virtual void Game.ModLoader.DecideArmorProtectionSequence ( ComponentClothing componentClothing,
Attackment attackment,
float randomNumber,
List< int > clothesList )
virtual

计算护甲防御时,修改参与护甲防御的衣物列表

参数
componentClothing挨打者的护甲组件
attackment导致该护甲结算的攻击
randomNumber原版用来计算损伤部位的随机数
clothesList参与护甲防御的衣物列表

◆ DecideLoot()

virtual void Game.ModLoader.DecideLoot ( ComponentLoot componentLoot,
List< BlockDropValue > dropValues )
virtual

修改生物的战利品。 建议不要清空dropValues推倒重来,不利于模组兼容性。

参数
componentLoot
dropValues其中包含所有的战利品掉落物的方块值和数量

◆ DecodeIngredient()

virtual void Game.ModLoader.DecodeIngredient ( string ingredient,
out string craftingId,
out int? data,
out bool Decoded )
virtual

解码配方

参数
ingredient
craftingId
data
Decoded是否解码成功,不成功交由下一个Mod处理

◆ DecodeResult()

virtual int Game.ModLoader.DecodeResult ( string result,
out bool Decoded )
virtual

获得解码结果时执行

参数
result结果字符串
Decoded是否解码成功,不成功交由下一个Mod处理
返回

◆ DispenserChooseItemToDispense()

virtual void Game.ModLoader.DispenserChooseItemToDispense ( ComponentDispenser componentDispenser,
ref int slot,
ref int value,
out bool chosen )
virtual

发射器选择消耗哪一个物品进行发射

参数
componentDispenser
slot选择消耗哪一个格子的物品
value选择发射什么物品
chosen是否已经选择。若已经选择,则会跳过后面模组中执行。为了兼容性,仅推荐发射器在有自己模组方块的时候才执行

◆ DrawToScreen()

virtual void Game.ModLoader.DrawToScreen ( ViewWidget viewWidget,
Widget.DrawContext dc )
virtual

ViewWidget绘制屏幕时执行

◆ EditBlockDescriptionScreen()

virtual void Game.ModLoader.EditBlockDescriptionScreen ( Dictionary< string, string > blockProperties)
virtual

在方块介绍页面中,增加或减少方块的属性字段

参数
blockProperties

◆ EditRecipeScreenWidget()

virtual void Game.ModLoader.EditRecipeScreenWidget ( RecipaediaRecipesScreen screen)
virtual

在合成表页面时每帧更新时,编辑该页面

参数
screen

◆ EntityComponentsInitialized()

virtual void Game.ModLoader.EntityComponentsInitialized ( Entity entity,
List< KeyValuePair< int, Component > > componentList )
virtual

在实体创建时执行,可用于移除实体的特定组件

参数
entity被创建的实体
componentList这个实体将会拥有的Component,KeyValuePair的第一个表示Component的加载顺序编号,第二个表示实体的Component

◆ FindCoarseSpawnPosition()

virtual void Game.ModLoader.FindCoarseSpawnPosition ( ITerrainContentsGenerator terrainContentsGenerator,
ref Vector3 spawnPosition )
virtual

在创建世界时寻找玩家的初步生成大致位置

参数
spawnPosition玩家初步生成大致位置

◆ FindHerdCenter()

virtual void Game.ModLoader.FindHerdCenter ( ComponentCreature componentCreature,
out Vector3? herdCenter,
out bool skipVanilla )
virtual

ComponentHerdBehavior组件接口, 用于生物寻找大部队中心点。 仅建议对自己模组的生物使用,不要干涉其他模组生物的行为。

参数
skipVanilla是否跳过原版逻辑
herdCenter生物的大部队中心点,返回null则表示其行为不受大部队中心点约束

◆ GenerateChunkLightSources()

virtual void Game.ModLoader.GenerateChunkLightSources ( DynamicArray< TerrainUpdater.LightSource > lightSources,
TerrainChunk chunk )
virtual

生成光源数据

参数
lightSources光源
chunk区块

◆ GenerateChunkVertices()

virtual void Game.ModLoader.GenerateChunkVertices ( TerrainChunk chunk,
bool even )
virtual

生成地形顶点时使用

参数
chunk

◆ GetMaxInstancesCount()

virtual int Game.ModLoader.GetMaxInstancesCount ( )
virtual

设置生物最大组件数,多个Mod时取最大

返回

Game.SurvivalCraftModLoader 重载.

◆ GetModFile()

virtual void Game.ModLoader.GetModFile ( string filename,
Action< Stream > stream,
out bool skip,
out bool fileFound )
virtual

在系统读取本模组的文件时触发 注意:modinfo文件、mod图标只能由原版逻辑加载。如果需要修改调整,请自己在模组中重新写一遍加载逻辑

参数
filename获取模组文件的名称或前缀
stream文件流
skip跳过SC本体对模组获取文件的执行。由于该方法只会在调用你的模组的资源时触发,所以不必担心兼容性问题。
fileFound在skip过后,返回是否得到文件
这是这个函数的调用关系图:

◆ GetModFiles()

virtual void Game.ModLoader.GetModFiles ( string extension,
Action< string, Stream > action,
out bool skip )
virtual

在加载本模组的资源时触发。 注意:模组的dll只能由原版逻辑加载

参数
extension准备调用的文件的扩展名
action执行的操作
skip跳过SC本体对模组获取文件的执行。由于该方法只会在调用你的模组的资源时触发,所以不必担心兼容性问题。
这是这个函数的调用关系图:

◆ GrowPlant()

virtual void Game.ModLoader.GrowPlant ( SubsystemPlantBlockBehavior subsystemPlantBlockBehavior,
int x,
int y,
int z,
int pollPass,
out bool skipVanilla )
virtual

在游戏执行植物生长判定时执行,为保证良好兼容性,建议只在处理属于自己模组的方块时改变控制

参数
subsystemPlantBlockBehavior子系统,便于定位SubsystemTerrain等必要组件
x植物的坐标x
y植物的坐标y
z植物的坐标z
pollPass用途不确定
skipVanilla是否跳过原版的执行进程,注意本接口不能跳过其他模组的执行进程

◆ GuiDraw()

virtual void Game.ModLoader.GuiDraw ( ComponentGui componentGui,
Camera camera,
int drawOrder )
virtual

Gui组件绘制时执行

参数
componentGui
camera
drawOrder

◆ GuiUpdate()

virtual void Game.ModLoader.GuiUpdate ( ComponentGui componentGui)
virtual

Gui组件帧更新时执行

参数
componentGui

◆ HandleInventoryDragMove()

virtual void Game.ModLoader.HandleInventoryDragMove ( InventorySlotWidget inventorySlotWidget,
IInventory sourceInventory,
int sourceSlotIndex,
IInventory targetInventory,
int targetSlotIndex,
bool skippedByOtherMods,
out bool skip )
virtual

在InventorySlotWidget.HandleDragDrop时执行,如果物品没有修改操作,则执行移动物品操作

参数
inventorySlotWidget目标格子的InventorySlotWidget
sourceInventory
sourceSlotIndex
targetInventory
targetSlotIndex
skippedByOtherMods执行逻辑是否已经被其他模组跳过
skip跳过原版的执行逻辑

◆ HandleInventoryDragProcess()

virtual void Game.ModLoader.HandleInventoryDragProcess ( InventorySlotWidget inventorySlotWidget,
IInventory sourceInventory,
int sourceSlotIndex,
IInventory targetInventory,
int targetSlotIndex,
ref int ProcessCapacity )
virtual

在InventorySlotWidget.HandleDragDrop时执行,先执行物品的修改操作 (比如原版火药拖到枪身上时执行上膛操作)

参数
inventorySlotWidget目标格子的InventorySlotWidget
sourceInventory
sourceSlotIndex
targetInventory
targetSlotIndex
ProcessCapacity目标格子接受物品的数量。设置为不大于0的数相当于跳过原版逻辑

◆ HandleMoveInventoryItem()

virtual void Game.ModLoader.HandleMoveInventoryItem ( InventorySlotWidget inventorySlotWidget,
IInventory sourceInventory,
int sourceSlotIndex,
IInventory targetInventory,
int targetSlotIndex,
ref int count,
out bool moved )
virtual

当移动物品时执行。从sourceInventory的第sourceSlotIndex个格子,移动count个物品,到targetInventory的第targetSlotIndex个格子

参数
inventorySlotWidget
count留给后面模组和原版处理物品的数量
moved是否完成移动操作,注意这个不影响跳过原版处理

◆ InitializeClothingSlots()

virtual void Game.ModLoader.InitializeClothingSlots ( )
virtual

初始化ClothingSlot的时候执行。在此接口添加脖子、手臂等新的可穿戴部位。

◆ InitializeCreatureTypes()

virtual void Game.ModLoader.InitializeCreatureTypes ( SubsystemCreatureSpawn spawn,
List< SubsystemCreatureSpawn.CreatureType > creatureTypes )
virtual

自然生成生物列表初始化时执行

参数
spawn
creatureTypes

◆ InventorySlotWidgetMeasureOverride()

virtual void Game.ModLoader.InventorySlotWidgetMeasureOverride ( InventorySlotWidget inventorySlotWidget,
Vector2 parentAvailableSize )
virtual

绘制物品格子的耐久条、食物条等元素

参数
inventorySlotWidget
parentAvailableSize其父widget的大小

◆ LoadCreatureInfoInBestiaryScreen()

virtual void Game.ModLoader.LoadCreatureInfoInBestiaryScreen ( BestiaryScreen bestiaryScreen,
ContainerWidget creatureInfoWidget,
BestiaryCreatureInfo bestiaryCreatureInfo,
ValuesDictionary entityValuesDictionary )
virtual

在生物图鉴目录列表更新该条目时,编辑该条目

参数
bestiaryScreen
creatureInfoWidget可以更改的生物信息Widget
bestiaryCreatureInfo该生物的基础信息
entityValuesDictionary该生物在Database中的ValuesDictioanry

◆ LoadSettings()

virtual void Game.ModLoader.LoadSettings ( XElement xElement)
virtual

模组设置加载时执行 模组作者有必要在读取模组设置后将设置数据放入自己的类或结构中 API在运行时不会保存着模组设置

参数
xElement
这是这个函数的调用关系图:

◆ LoadWorldInfoWidget()

virtual void Game.ModLoader.LoadWorldInfoWidget ( WorldInfo worldInfo,
XElement savedWorldItemNode,
ref ContainerWidget worldInfoWidget )
virtual

在世界选择列表时,调整存档的外观

参数
worldInfo世界信息
savedWorldItemNode存储世界信息的XElement
worldInfoWidget要修改的Widget

◆ MatchRecipe()

virtual bool Game.ModLoader.MatchRecipe ( string[] requiredIngredients,
string[] actualIngredient,
out bool Matched )
virtual

配方匹配时执行

参数
requiredIngredients
actualIngredient
Matched是否匹配成功,不成功交由下一个Mod处理

◆ MenuPlayMusic()

virtual void Game.ModLoader.MenuPlayMusic ( out string ContentMusicPath)
virtual

更改主页背景音乐

这是这个函数的调用关系图:

◆ ModDispose()

virtual void Game.ModLoader.ModDispose ( )
virtual

Mod被卸载时执行

这是这个函数的调用关系图:

◆ ModelShaderParameter()

virtual void Game.ModLoader.ModelShaderParameter ( Shader shader,
Camera camera,
List< SubsystemModelsRenderer.ModelData > modelsData,
float? alphaThreshold )
virtual

更改模型着色器参数的值

◆ OnBlockDug()

virtual void Game.ModLoader.OnBlockDug ( ComponentMiner componentMiner,
BlockPlacementData digValue,
int cellValue,
ref int DurabilityReduction,
ref bool mute,
ref int PlayerDataDugAdd )
virtual

在方块被挖掘完毕时执行

参数
componentMiner
digValue
DurabilityReduction挖掘方块所消耗工具的耐久
mute挖掘方块是否取消播放音效
PlayerDataDugAdd是否增加玩家统计信息的挖掘方块计数

◆ OnBlockExploded()

virtual void Game.ModLoader.OnBlockExploded ( SubsystemTerrain subsystemTerrain,
int x,
int y,
int z,
int value )
virtual

当方块被炸掉时执行

◆ OnCameraChange()

virtual void Game.ModLoader.OnCameraChange ( ComponentPlayer m_componentPlayer,
ComponentGui componentGui )
virtual

改变相机模式时执行

参数
m_componentPlayer
componentGui

Game.SurvivalCraftModLoader 重载.

◆ OnCapture()

virtual void Game.ModLoader.OnCapture ( )
virtual

屏幕截图时执行

◆ OnChaseBehaviorAttacked()

virtual void Game.ModLoader.OnChaseBehaviorAttacked ( ComponentChaseBehavior componentChaseBehavior,
float chaseTimeBefore,
ref float chaseTime,
ref bool hitBody,
ref bool playAttackSound )
virtual

在动物执行近战攻击命中目标时执行

参数
componentChaseBehavior
chaseTimeBefore在攻击之前的剩余追逐时间
chaseTime在攻击之后的剩余追逐时间
hitBody是否能够攻击
playAttackSound是否发出攻击音效

◆ OnChaseBehaviorAttackFailed()

virtual void Game.ModLoader.OnChaseBehaviorAttackFailed ( ComponentChaseBehavior componentChaseBehavior,
ref float chaseTime )
virtual

在动物执行近战攻击没有命中目标时执行

参数
componentChaseBehavior
chaseTime在攻击之后的剩余追逐时间

◆ OnChaseBehaviorStartChasing()

virtual void Game.ModLoader.OnChaseBehaviorStartChasing ( ComponentChaseBehavior chaseBehavior)
virtual

◆ OnChaseBehaviorStopChasing()

virtual void Game.ModLoader.OnChaseBehaviorStopChasing ( ComponentChaseBehavior chaseBehavior)
virtual

◆ OnComponentBodyExploded()

virtual void Game.ModLoader.OnComponentBodyExploded ( ComponentBody componentBody,
ref Injury explosionInjury,
ref Vector3 Impulse,
ref bool SetOnFire,
ref float Fluctuation )
virtual

生物等实体在遭受爆炸时执行

参数
componentBody遭受爆炸的实体Body
explosionInjury该爆炸的Injuty
Impulse爆炸的击退力
SetOnFire爆炸是否会让实体着火
Fluctuation爆炸的击退、伤害浮动系数。目前只对非生物的船等实体有效

◆ OnComponentBodyExplodedStart()

virtual void Game.ModLoader.OnComponentBodyExplodedStart ( ComponentBody componentBody,
Vector3 explosionCenter,
float explosionPressure,
ref float shakeStrength )
virtual

在爆炸开始,计算动物摇晃程度时执行。 为了尽可能确保兼容性,建议只对属于自己模组的生物进行接管编辑

参数
componentBody将要摇晃的动物
explosionCenter爆炸中心地点
explosionPressure爆炸强度
shakeStrength动物摇晃的强度

◆ OnComponentLocomotionLoaded()

virtual void Game.ModLoader.OnComponentLocomotionLoaded ( ComponentLocomotion componentLocomotion,
ref float mobWalkSpeedFactor,
ref float mobFlySpeedFactor,
ref float mobSwimSpeedFactor,
ref bool disableCreativeFlyInSurvivalMode )
virtual

在ComponentLocomotion加载时执行

参数
componentLocomotion
mobWalkSpeedFactor非玩家生物的移速乘数
mobFlySpeedFactor非玩家生物的飞行速度乘数
mobSwimSpeedFactor非玩家生物的游泳速度乘数
disableCreativeFlyInSurvivalMode是否在生存模式中停止创造飞行(通常发生在创造模式切换到生存模式中)

◆ OnCraftingRecipeDecode()

virtual void Game.ModLoader.OnCraftingRecipeDecode ( List< CraftingRecipe > m_recipes,
XElement element,
out bool Decoded )
virtual

配方解码时执行

参数
element配方的Xelement
Decoded是否解码成功,不成功交由下一个Mod处理

◆ OnCreatureDied()

virtual void Game.ModLoader.OnCreatureDied ( ComponentHealth componentHealth,
Injury injury,
ref int experienceOrbDrop,
ref bool CalculateInKill )
virtual

在动物收到Injure()且生命值低于0时,执行操作。

参数
componentHealth

◆ OnCreatureDying()

virtual void Game.ModLoader.OnCreatureDying ( ComponentHealth componentHealth,
Injury injury )
virtual

如果动物受到Injure且生命值小于0时,执行操作。 如果在函数执行完毕后Health > 0,则取消死亡判定。 通常用于各种模组的“不死图腾”机制

参数
componentHealth

◆ OnCreatureInjure()

virtual void Game.ModLoader.OnCreatureInjure ( ComponentHealth componentHealth,
float amount,
ComponentCreature attacker,
bool ignoreInvulnerability,
string cause,
out bool Skip )
virtual

重定义生物受伤方法,Skip为true则不执行原Injure代码

◆ OnCreatureSpiked()

virtual void Game.ModLoader.OnCreatureSpiked ( ComponentHealth componentHealth,
SubsystemBlockBehavior spikeBlockBehavior,
CellFace cellFace,
float velocity,
ref Injury blockInjury )
virtual

◆ OnDespawned()

virtual void Game.ModLoader.OnDespawned ( Entity entity,
ComponentSpawn componentSpawn )
virtual

当生物消失时执行

参数
entity
componentSpawn

◆ OnDispenserDispensePickable()

virtual void Game.ModLoader.OnDispenserDispensePickable ( ComponentDispenser componentDispenser,
ref Pickable pickable,
ref int RemoveSlotCount )
virtual

在发射器投掷物品时执行

参数
componentDispenser该发射器的Component
pickable要发射的掉落物
RemoveSlotCount移除发射器物品栏中物品数量

◆ OnDispenserShoot()

virtual void Game.ModLoader.OnDispenserShoot ( ComponentDispenser componentDispenser,
ref Projectile projectile,
ref bool canDispensePickable,
ref int RemoveSlotCount )
virtual

在发射器弹射物品时执行

参数
componentDispenser该发射器的Component
projectile要发射的弹射物
canDispensePickable发射失败时,是否以掉落物的方式发射(即使不发射也会消耗)
RemoveSlotCount移除发射器物品栏中物品数量

◆ OnDrawItemAssigned()

virtual void Game.ModLoader.OnDrawItemAssigned ( Widget.DrawContext drawContext)
virtual

在 DrawItem 排序后。

参数
drawContext绘制上下文。

Game.SurvivalCraftModLoader 重载.

◆ OnEatPickable()

virtual void Game.ModLoader.OnEatPickable ( ComponentEatPickableBehavior eatPickableBehavior,
Pickable EatPickable,
out bool Dealed )
virtual

动物吃掉落物时执行

◆ OnEntityAdd()

virtual void Game.ModLoader.OnEntityAdd ( Entity entity)
virtual

当实体被添加时执行

◆ OnEntityRemove()

virtual void Game.ModLoader.OnEntityRemove ( Entity entity)
virtual

当实体被移除时执行

◆ OnFactorsGenerate()

virtual void Game.ModLoader.OnFactorsGenerate ( ComponentFactors componentFactors)
virtual

在计算一个生物的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的最终值

参数
componentFactors

◆ OnFactorsUpdate()

virtual void Game.ModLoader.OnFactorsUpdate ( ComponentFactors componentFactors,
float dt )
virtual

因素控制力量、抗性、速度、饥饿速率组件更新时执行

参数
componentFactors

◆ OnFurnitureDesigned()

virtual void Game.ModLoader.OnFurnitureDesigned ( FurnitureDesign furnitureDesign,
bool designedFromExistingFurniture,
ref int pickableCount,
ref bool destroyDesignBlocks,
ref int toolDamageCount )
virtual

在创建家具时执行

参数
furnitureDesign
designedFromExistingFurniture是否从已有家具方块创建,通常用于mod禁止家具复制
pickableCount产生的掉落物数量
destroyDesignBlocks是否移除搭建的建筑原型
toolDamageCount家具锤消耗的耐久量,如果家具锤剩余耐久不足以支持消耗量,则玩家无法创建家具并弹出提示

◆ OnIDrawableAdded()

virtual void Game.ModLoader.OnIDrawableAdded ( SubsystemDrawing subsystemDrawing,
IDrawable drawable,
bool skippedByOtherMods,
out bool skip )
virtual

在IDrawable添加或删除时执行,用于模组接管IDrawable的绘制行为

参数
subsystemDrawing
drawable
skippedByOtherMods是否已经被其他模组接管
skip宣布接管,该IDrawable不会放入SubsystemDrawing.m_drawbles

◆ OnInventorySlotWidgetDefined()

virtual void Game.ModLoader.OnInventorySlotWidgetDefined ( InventorySlotWidget inventorySlotWidget,
out List< Widget > childrenWidgetsToAdd )
virtual

在创建InventorySlotWidget时执行,可以增加元素

参数
inventorySlotWidget
childrenWidgetsToAdd创建InventorySlotWidget时,返回增加的子Widget

◆ OnIUpdateableAddOrRemove()

virtual void Game.ModLoader.OnIUpdateableAddOrRemove ( SubsystemUpdate subsystemUpdate,
IUpdateable updateable,
bool ToAdd1OrRemove0,
bool skippedByOtherMods,
out bool skip )
virtual

在IUpdateable添加或删除时执行,用于模组接管IUpdateable的更新行为 (如恒泰模组将动物放在多线程中进行更新,降低怪物数量多导致的卡顿)

参数
subsystemUpdate
updateable
ToAdd1OrRemove0这个IUpdateable是准备添加的,该变量为1;这个IUpdateable是准备移除的,该变量为0
skippedByOtherMods是否已经被其他模组接管
skip宣布接管,则不会被原版的SubsystemUpdate执行Update()

◆ OnLevelUpdate()

virtual void Game.ModLoader.OnLevelUpdate ( ComponentLevel level)
virtual

等级组件更新时执行,仅限玩家。参考OnFactorsUpdate接口使用说明。

参数
level

◆ OnLightningStrike()

virtual void Game.ModLoader.OnLightningStrike ( SubsystemSky subsystemSky,
ref Vector3 targetPosition,
ref bool strike,
ref float explosionPressure,
ref bool setBodyOnFire )
virtual

在闪电劈下时执行

参数
subsystemSky
targetPosition闪电劈下的位置
strike是否能成功执行
explosionPressure闪电的爆炸威力
setBodyOnFire是否点燃目标

◆ OnLoadingFinished()

virtual void Game.ModLoader.OnLoadingFinished ( List< System.Action > actions)
virtual

加载任务结束时执行 在BlocksManager初始化之后

参数
actions

◆ OnLoadingStart()

virtual void Game.ModLoader.OnLoadingStart ( List< System.Action > actions)
virtual

加载任务开始时执行 在BlocksManager初始化之前

◆ OnLocomotionStopped()

virtual void Game.ModLoader.OnLocomotionStopped ( ComponentLocomotion componentLocomotion,
ref bool fallsOnDeathOrStun )
virtual

在动物晕眩或死亡时执行移动

参数
componentLocomotion
fallsOnDeathOrStun在晕眩或死亡时是否坠落

◆ OnMainMenuScreenCreated()

virtual void Game.ModLoader.OnMainMenuScreenCreated ( MainMenuScreen mainMenuScreen,
StackPanelWidget leftBottomBar,
StackPanelWidget rightBottomBar )
virtual

在主界面初始化后执行,你可以通过这个给主界面加些你想要的按钮或者文字等 不过建议开发者使用BeforeWidgetUpdate和AfterWidgetUpdate这两个接口实现

参数
mainMenuScreen初始化完毕后的主界面
leftBottomBar主界面左下角的按钮栏,里面有着API的切换语言和资源管理按钮
rightBottomBar主界面右下角的按钮栏,Mod作者们可以在这里面放入想要的按钮(例如Mod设置按钮、Mod作者介绍按钮等)

◆ OnMainMenuScreenUpdate()

virtual void Game.ModLoader.OnMainMenuScreenUpdate ( MainMenuScreen mainMenuScreen,
StackPanelWidget leftBottomBar,
StackPanelWidget rightBottomBar )
virtual

在主界面更新

参数
leftBottomBar主界面左下角的按钮栏,里面有着API的切换语言和资源管理按钮
rightBottomBar主界面右下角的按钮栏,Mod作者们可以在这里面放入想要的按钮(例如Mod设置按钮、Mod作者介绍按钮等)

◆ OnMinerDig()

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

当人物挖掘时执行

参数
miner
raycastResult
返回

Game.JsModLoader 重载.

◆ OnMinerHit()

virtual void Game.ModLoader.OnMinerHit ( ComponentMiner miner,
ComponentBody componentBody,
Vector3 hitPoint,
Vector3 hitDirection,
ref float attackPower,
ref float playerProbability,
ref float creatureProbability,
out bool Hitted )
virtual
参数
attackPower伤害值
playerProbability玩家命中率
creatureProbability生物命中率

◆ OnMinerHit2()

virtual void Game.ModLoader.OnMinerHit2 ( ComponentMiner componentMiner,
ComponentBody componentBody,
Vector3 hitPoint,
Vector3 hitDirection,
ref int durabilityReduction,
ref Attackment attackment )
virtual

在生物攻击时执行

参数
componentMiner攻击者
componentBody被攻击方的ComponentBody
hitPoint命中点
hitDirection命中时的击退方向
durabilityReduction攻击后,手中武器掉的耐久量
attackment发起的攻击

◆ OnMinerPlace()

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

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

参数
miner
raycastResult
返回

Game.JsModLoader 重载.

◆ OnModalPanelWidgetSet()

virtual void Game.ModLoader.OnModalPanelWidgetSet ( ComponentGui gui,
Widget Old,
Widget New )
virtual

当ModalPanelWidget被设置时执行

参数
Old
New

◆ OnModelAnimate()

virtual void Game.ModLoader.OnModelAnimate ( ComponentCreatureModel componentCreatureModel,
out bool Skip )
virtual

当动物模型对象作出动画时执行 Skip为是否跳过原动画代码

◆ OnModelRendererDrawExtra()

virtual void Game.ModLoader.OnModelRendererDrawExtra ( SubsystemModelsRenderer modelsRenderer,
SubsystemModelsRenderer.ModelData modelData,
Camera camera,
float? alphaThreshold )
virtual

绘制额外模型数据的方法,如人物头顶的名字

参数
modelsRenderer
modelData正在绘制的模型
camera
alphaThreshold

Game.SurvivalCraftModLoader 重载.

◆ OnMovingBlockSetAdded()

virtual void Game.ModLoader.OnMovingBlockSetAdded ( ref SubsystemMovingBlocks.MovingBlockSet movingBlockSet,
SubsystemMovingBlocks subsystemMovingBlocks,
ref bool testCollision,
out bool doNotAdd )
virtual

在添加移动方块时触发

参数
movingBlockSet
subsystemMovingBlocks
testCollision对应原方法的TestCollision部分
doNotAdd取消添加移动方块

◆ OnMovingBlockSetRemoved()

virtual void Game.ModLoader.OnMovingBlockSetRemoved ( IMovingBlockSet movingBlockSet,
SubsystemMovingBlocks subsystemMovingBlocks )
virtual

移除移动方块时触发

参数
movingBlockSet
subsystemMovingBlocks

◆ OnMovingBlockSetUpdate()

virtual void Game.ModLoader.OnMovingBlockSetUpdate ( IMovingBlockSet movingBlockSet,
SubsystemMovingBlocks subsystemMovingBlocks,
bool skippedByOtherMods,
out bool skipVanilla )
virtual

在移动方块更新时触发

参数
movingBlockSet
subsystemMovingBlocks
skippedByOtherMods是否已被其他模组抢先执行更新
skipVanilla是否跳过原版执行更新(抢先更新)

◆ OnPickableAdded()

virtual void Game.ModLoader.OnPickableAdded ( SubsystemPickables subsystemPickables,
ref Pickable pickable,
ValuesDictionary loadValuesDictionary )
virtual

游戏中添加掉落物时触发

参数
subsystemPickables
pickable
loadValuesDictionary如果是加载世界过程中首次添加,那么会提供该射弹的相关ValuesDictionary;如果是游戏进行过程中添加,则为null

◆ OnPickableDraw()

virtual void Game.ModLoader.OnPickableDraw ( Pickable pickable,
SubsystemPickables subsystemPickables,
Camera camera,
int drawOrder,
ref bool shouldDrawBlock,
ref float drawBlockSize,
ref Color drawBlockColor )
virtual

绘制掉落物的时候执行

参数
pickable
subsystemPickables
camera
drawOrder
shouldDrawBlock是否执行原版绘制方块的方法
drawBlockSize
drawBlockColor

◆ OnPlayerControlBoat()

virtual void Game.ModLoader.OnPlayerControlBoat ( ComponentPlayer componentPlayer,
bool skippedByOtherMods,
out bool skipVanilla )
virtual

在玩家乘坐船时每帧执行,用于调整玩家乘船时的控制逻辑

参数
componentPlayer
skippedByOtherMods是否已经被其他模组跳过逻辑
skipVanilla跳过原版执行操作

◆ OnPlayerControlOtherMount()

virtual void Game.ModLoader.OnPlayerControlOtherMount ( ComponentPlayer componentPlayer,
bool skippedByOtherMods,
out bool skipVanilla )
virtual

在玩家乘坐船、动物以外的物体时每帧执行,用于控制玩家骑模组坐骑的控制魔力

参数
componentPlayer
skippedByOtherMods是否已经被其他模组跳过逻辑
skipVanilla跳过其他模组执行操作

◆ OnPlayerControlSteed()

virtual void Game.ModLoader.OnPlayerControlSteed ( ComponentPlayer componentPlayer,
bool skippedByOtherMods,
out bool skipVanilla )
virtual

在玩家骑上坐骑时每帧执行,用于调整玩家骑行动物时的控制逻辑

参数
componentPlayer
skippedByOtherMods是否已经被其他模组跳过逻辑
skipVanilla跳过原版执行操作

◆ OnPlayerControlWalk()

virtual void Game.ModLoader.OnPlayerControlWalk ( ComponentPlayer componentPlayer,
bool skippedByOtherMods,
out bool skipVanilla )
virtual

当玩家既不在坐骑上,也不在船上时执行,用于控制玩家行走的控制逻辑

参数
componentPlayer
skippedByOtherMods是否已经被其他模组跳过逻辑
skipVanilla跳过原版执行操作

◆ OnPlayerDead()

virtual void Game.ModLoader.OnPlayerDead ( PlayerData playerData)
virtual

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

参数
playerData

Game.JsModLoader , 以及 Game.SurvivalCraftModLoader 重载.

◆ OnPlayerInputDrop()

virtual void Game.ModLoader.OnPlayerInputDrop ( ComponentPlayer componentPlayer,
bool skippedByOtherMods,
out bool skipVanilla )
virtual

在玩家电脑上“按Q释放剑弃”时执行

参数
componentPlayer
skippedByOtherMods
skipVanilla

◆ OnPlayerInputHit()

virtual void Game.ModLoader.OnPlayerInputHit ( ComponentPlayer componentPlayer,
ref bool playerOperated,
ref double timeIntervalHit,
ref float meleeAttackRange,
bool skippedByOtherMods,
out bool skipVanilla )
virtual

在玩家执行“攻击”动作时执行,比如恒泰左键放箭,工业左键点击船

参数
componentPlayer
playerOperated为true则停止之后的挖掘操作
timeIntervalHit和上一次输入攻击操作,要求的最小时间间隔,小于该间隔时输入无效。(注意和ComponentMiner.HitInterval作区分)
meleeAttackRange近战攻击距离,小于等于0时表示不进行近战操作(比如手持弓时近战距离改为0,就不会拿着弓拍敌人)
skippedByOtherMods是否已经被其他模组跳过逻辑
skipVanilla跳过原版执行操作(为了模组间兼容性,建议只在手持自己模组方块时这样做)

◆ OnPlayerInputInteract()

virtual void Game.ModLoader.OnPlayerInputInteract ( ComponentPlayer componentPlayer,
ref bool playerOperated,
ref double timeIntervalLastActionTime,
ref int priorityUse,
ref int priorityInteract,
ref int priorityPlace )
virtual

当玩家输入交互逻辑时执行的操作

参数
componentPlayer
playerOperated为true则停止之后的挖掘、攻击等操作
timeIntervalLastActionTime距离上一次触发该操作距离的时长
priorityUse控制使用优先级,使用优先级小于等于0则禁止玩家使用手中物品
priorityInteract控制交互优先级,交互优先级小于等于0则禁止玩家交互方块
priorityPlace控制放置优先级,放置优先级小于等于0则禁止玩家放置方块

◆ OnPlayerModelWidgetMeasureOverride()

virtual void Game.ModLoader.OnPlayerModelWidgetMeasureOverride ( PlayerModelWidget playerModelWidget)
virtual

在绘制人物界面中的人物模型的时候执行,可以通过在playerModelWidget.m_modelWidget中增删元素来在人物界面绘制新模型

参数
playerModelWidget

◆ OnPlayerSpawned()

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

人物出生时执行

Game.JsModLoader 重载.

◆ OnProjectDisposed()

virtual void Game.ModLoader.OnProjectDisposed ( )
virtual

当Project被释放时执行

Game.JsModLoader 重载.

◆ OnProjectileAdded()

virtual void Game.ModLoader.OnProjectileAdded ( SubsystemProjectiles subsystemProjectiles,
ref Projectile projectile,
ValuesDictionary loadValuesDictionary )
virtual

游戏中添加射弹时触发

参数
subsystemProjectiles
projectile
loadValuesDictionary如果是加载世界过程中首次添加,那么会提供该射弹的相关ValuesDictionary;如果是游戏进行过程中添加,则为null

◆ OnProjectileDraw()

virtual void Game.ModLoader.OnProjectileDraw ( Projectile projectile,
SubsystemProjectiles subsystemProjectiles,
Camera camera,
int drawOrder,
ref bool shouldDrawBlock,
ref float drawBlockSize,
ref Color drawBlockColor )
virtual

绘制射弹的时候执行

参数
projectile射弹
subsystemProjectiles该子系统,可以从中获取项目和其他子系统
camera
drawOrder
shouldDrawBlock是否执行原版绘制方块的方法
drawBlockSize绘制方块大小
drawBlockColor绘制方块颜色

◆ OnProjectileFlyOutOfLoadedChunks()

virtual void Game.ModLoader.OnProjectileFlyOutOfLoadedChunks ( Projectile projectile)
virtual

射弹离开加载区块的时候执行

参数
projectile

◆ OnProjectileHitBody()

virtual void Game.ModLoader.OnProjectileHitBody ( Projectile projectile,
BodyRaycastResult bodyRaycastResult,
ref Attackment attackment,
ref Vector3 velocityAfterAttack,
ref Vector3 angularVelocityAfterAttack,
ref bool ignoreBody )
virtual

当射弹击中生物、船只等实体时执行

参数
projectile射弹
bodyRaycastResult实体映射结果
attackment该射弹命中实体时,执行的攻击。可以调整attackment的攻击力等数据
velocityAfterAttack在击中方块后,射弹的速度
angularVelocityAfterAttack在击中方块后,射弹的角速度
ignoreBody射弹行进直接穿过该生物。射弹后续的更新会忽略该生物,速度和角速度保持原状。攻击照常执行。

◆ OnProjectileHitTerrain()

virtual void Game.ModLoader.OnProjectileHitTerrain ( Projectile projectile,
TerrainRaycastResult terrainRaycastResult,
ref bool triggerBlocksBehavior,
ref bool destroyCell,
ref float impactSoundLoudness,
ref bool projectileGetStuck,
ref Vector3 velocityAfterHit,
ref Vector3 angularVelocityAfterHit )
virtual

当射弹击中方块时执行

参数
projectile射弹
terrainRaycastResult地形映射结果
triggerBlocksBehavior是否执行被命中的方块行为
destroyCell是否破坏被击中的方块
impactSoundLoudness发出的声音大小
projectileGetStuck射弹是否会被卡在方块里面
velocityAfterHit在击中方块后,射弹的速度
angularVelocityAfterHit在击中方块后,射弹的角速度

◆ OnProjectileTurnIntoPickable()

virtual void Game.ModLoader.OnProjectileTurnIntoPickable ( Projectile projectile,
ref Pickable pickable )
virtual

射弹转化为掉落物时执行

参数
projectile即将被转化并删除的射弹
pickable即将加入的掉落物

◆ OnProjectLoaded()

virtual void Game.ModLoader.OnProjectLoaded ( Project project)
virtual

当Project被加载时执行

参数
project

Game.JsModLoader 重载.

◆ OnProjectXmlSaved()

virtual void Game.ModLoader.OnProjectXmlSaved ( XElement xElement)
virtual

Project.xml在所有的Entity和Subsystem保存完毕后再执行

参数
xElement

◆ OnReadSpawnData()

virtual void Game.ModLoader.OnReadSpawnData ( Entity entity,
SpawnEntityData spawnEntityData )
virtual

当读取生物数据时

这是这个函数的调用关系图:

◆ OnSaveSpawnData()

virtual void Game.ModLoader.OnSaveSpawnData ( ComponentSpawn spawn,
SpawnEntityData spawnEntityData )
virtual

当储存生物数据时

参数
spawn
spawnEntityData
这是这个函数的调用关系图:

◆ OnScreenEntered()

virtual void Game.ModLoader.OnScreenEntered ( Screen screen,
object[] screenParameters )
virtual

进入Screen时执行

参数
screen进入的Screen
screenParameters进入Screen时传入的参数,参数的详细信息需要去查阅对应screen的代码

◆ OnScreenLeaved()

virtual void Game.ModLoader.OnScreenLeaved ( Screen screen)
virtual

离开Screen时执行

参数
screen离开的Screen

◆ OnSetModel()

virtual void Game.ModLoader.OnSetModel ( ComponentModel componentModel,
Model model,
out bool IsSet )
virtual

当模型对象进行模型设值时执行

◆ OnTerrainBrushesCreated()

virtual void Game.ModLoader.OnTerrainBrushesCreated ( )
virtual

用于调整原版已有矿物、水域、植物等地形地貌的生成,例如减少原版矿物生成量

◆ OnTerrainContentsGenerated()

virtual void Game.ModLoader.OnTerrainContentsGenerated ( TerrainChunk chunk)
virtual

区块地形生成时 注意此方法运行在子线程中

参数
chunk

◆ OnTreasureGenerate()

virtual void Game.ModLoader.OnTreasureGenerate ( SubsystemTerrain subsystemTerrain,
int x,
int y,
int z,
int neighborX,
int neighborY,
int neighborZ,
ref int BlockValue,
ref int Count,
out bool IsGenerate )
virtual

挖掘触发宝物生成时,注意这里能获取到上个Mod生成宝物的情况

参数
BlockValue宝物的方块值
Count宝物数量
IsGenerate是否继续让其它Mod处理

◆ OnWidgetConstruct()

virtual void Game.ModLoader.OnWidgetConstruct ( ref Widget widget)
virtual

当界面被创建时

参数
widget

◆ OnXdbLoad()

virtual void Game.ModLoader.OnXdbLoad ( XElement xElement)
virtual

Xdb文件加载时执行

参数
xElement
这是这个函数的调用关系图:

◆ PlayInGameMusic()

virtual void Game.ModLoader.PlayInGameMusic ( )
virtual

在游戏游玩过程中时放音乐

◆ PrepareModels()

virtual void Game.ModLoader.PrepareModels ( SubsystemModelsRenderer subsystemModelsRenderer,
Camera camera,
bool skippedByOtherMods,
out bool skip )
virtual

◆ ProcessAttackment()

virtual void Game.ModLoader.ProcessAttackment ( Attackment attackment)
virtual

在攻击时执行

参数
attackment

Game.JsModLoader 重载.

◆ ProjectBeforeSubsystemsAndEntitiesLoad()

virtual void Game.ModLoader.ProjectBeforeSubsystemsAndEntitiesLoad ( Project project)
virtual

游戏Project创建时执行,可用于移除Subsystem、Entity、Entity.Component

参数
project

◆ ProjectXmlLoad()

virtual void Game.ModLoader.ProjectXmlLoad ( XElement xElement)
virtual

Project.xml加载时执行

参数
xElement

◆ ProjectXmlSave()

virtual void Game.ModLoader.ProjectXmlSave ( XElement xElement)
virtual

Project.xml保存时执行

参数
xElement

◆ RenderModels()

virtual void Game.ModLoader.RenderModels ( SubsystemModelsRenderer subsystemModelsRenderer,
Camera camera,
int drawOrder,
bool skippedByOtherMods,
out bool skip )
virtual

◆ ResetOptionsForNonCreativeMode()

virtual void Game.ModLoader.ResetOptionsForNonCreativeMode ( WorldSettings worldSettings,
EnvironmentBehaviorMode environmentBehaviorModeBefore,
TimeOfDayMode timeOfDayModeBefore,
bool areWeatherEffectsEnabledBefore,
bool areSurvivalMechanicsEnabledBefore )
virtual

在进行世界设置时,如果不是创造模式,则会修改设定

参数
worldSettings要修改的世界设置
environmentBehaviorModeBefore
timeOfDayModeBefore
areWeatherEffectsEnabledBefore
areSurvivalMechanicsEnabledBefore

◆ SavePickable()

virtual void Game.ModLoader.SavePickable ( SubsystemPickables subsystemPickables,
Pickable pickable,
ref ValuesDictionary valuesDictionary )
virtual

保存世界时,存储掉落物信息

参数
subsystemPickables
pickable
valuesDictionary存储掉落物信息的ValuesDictionary
异常
NotImplementedException

◆ SaveProjectile()

virtual void Game.ModLoader.SaveProjectile ( SubsystemProjectiles subsystemProjectiles,
Projectile projectile,
ref ValuesDictionary valuesDictionary )
virtual

保存世界时,存储射弹信息

参数
subsystemProjectiles
projectile
valuesDictionary存储射弹信息的ValuesDictionaey
异常
NotImplementedException

◆ SaveSettings()

virtual void Game.ModLoader.SaveSettings ( XElement xElement)
virtual

模组设置保存时执行

参数
xElement一个空容器,模组作者需将自己的设置信息存入这个空容器内
这是这个函数的调用关系图:

◆ ScoreMount()

virtual void Game.ModLoader.ScoreMount ( ComponentRider componentRider,
ComponentMount componentMount,
out float? score )
virtual

ComponentRider组件接口 用于获取可符合骑行条件生物 通过此接口,模组可以实现自定义骑行,也可以用于生物骑行生物相关逻辑

参数
componentRider
score

◆ SetClothes()

virtual void Game.ModLoader.SetClothes ( ComponentClothing componentClothing,
ClothingSlot slot,
IEnumerable< int > clothes )
virtual

◆ SetFurnitureDesignColor()

virtual void Game.ModLoader.SetFurnitureDesignColor ( FurnitureDesign design,
Block block,
int value,
ref int FaceTextureSlot,
ref Color Color )
virtual

设置家具的颜色

这是这个函数的调用关系图:

◆ SetHitInterval()

virtual void Game.ModLoader.SetHitInterval ( ComponentMiner miner,
ref double hitInterval )
virtual

设置伤害间隔

◆ SetHitValueParticleSystem()

virtual void Game.ModLoader.SetHitValueParticleSystem ( HitValueParticleSystem hitValueParticleSystem,
Attackment attackment )
virtual

设定伤害粒子参数

参数
hitValueParticleSystem粒子
attackment产生该攻击粒子的攻击,为null表示攻击没有命中

◆ SetRainAndSnowColor()

virtual bool Game.ModLoader.SetRainAndSnowColor ( ref Color rainColor,
ref Color snowColor )
virtual

设置雨和雪的颜色

参数
rainColor
snowColor
返回

◆ SetShaderParameter()

virtual void Game.ModLoader.SetShaderParameter ( Shader shader,
Camera camera )
virtual

设置着色器参数

参数
shader
camera

◆ SkyDrawExtra()

virtual void Game.ModLoader.SkyDrawExtra ( SubsystemSky subsystemSky,
Camera camera )
virtual

天空额外绘制

◆ SpawnEntity()

virtual void Game.ModLoader.SpawnEntity ( SubsystemSpawn spawn,
Entity entity,
SpawnEntityData spawnEntityData,
out bool Spawned )
virtual

生物出生时执行

参数
spawn
entity
spawnEntityData

◆ SubsystemUpdate()

virtual void Game.ModLoader.SubsystemUpdate ( float dt)
virtual

子系统帧更新时执行

◆ TerrainChangeCell()

virtual void Game.ModLoader.TerrainChangeCell ( SubsystemTerrain subsystemTerrain,
int x,
int y,
int z,
int value,
out bool Skip )
virtual

重定义方块更改方法,Skip为true则不执行原ChangeCell代码

◆ TerrainContentsGenerator23Initialize()

virtual void Game.ModLoader.TerrainContentsGenerator23Initialize ( ITerrainContentsGenerator terrainContentsGenerator,
SubsystemTerrain subsystemTerrain )
virtual

◆ TerrainContentsGenerator24Initialize()

virtual void Game.ModLoader.TerrainContentsGenerator24Initialize ( ITerrainContentsGenerator terrainContentsGenerator,
SubsystemTerrain subsystemTerrain )
virtual

◆ ToAllocateChunks()

virtual bool Game.ModLoader.ToAllocateChunks ( TerrainUpdater terrainUpdater,
TerrainUpdater.UpdateLocation[] locations )
virtual

加载指定区块,如有区块数变动返回 true,否则返回 false

这是这个函数的调用关系图:

◆ ToFreeChunks()

virtual void Game.ModLoader.ToFreeChunks ( TerrainUpdater terrainUpdater,
TerrainChunk chunk,
out bool KeepWorking )
virtual

当区块即将被释放时 KeepWorking为True时该区块会继续保持运作,不被释放

这是这个函数的调用关系图:

◆ UpdateChaseBehaviorChasing()

virtual void Game.ModLoader.UpdateChaseBehaviorChasing ( ComponentChaseBehavior chaseBehavior)
virtual

◆ UpdateChaseBehaviorLookingForTarget()

virtual void Game.ModLoader.UpdateChaseBehaviorLookingForTarget ( ComponentChaseBehavior chaseBehavior)
virtual

◆ UpdateComponentBody()

virtual void Game.ModLoader.UpdateComponentBody ( ComponentBody componentBody,
float dt,
bool skippedByOtherMods,
out bool skipVanilla )
virtual

执行动物的Update操作。 建议只在对自己模组的动物才进行带skip的覆盖原版的操作;对原版和其他模组的动物,请不要过多干涉覆盖原有的操作

参数
componentBody
dt动物位置
skipVanilla跳过原版的更新操作
skippedByOtherMods前面的mod已经执行了带skip操作的Update

◆ UpdateCreaturePropertiesInBestiaryDescriptionScreen()

virtual void Game.ModLoader.UpdateCreaturePropertiesInBestiaryDescriptionScreen ( BestiaryDescriptionScreen bestiaryDescriptionScreen,
BestiaryCreatureInfo bestiaryCreatureInfo,
ValuesDictionary entityValuesDictionary )
virtual

在生物图鉴页面每帧更新时,编辑该页面

参数
bestiaryDescriptionScreen
bestiaryCreatureInfo该生物的基础信息
entityValuesDictionary该生物在Database中的ValuesDictionary

◆ UpdateDeathCameraWidget()

virtual void Game.ModLoader.UpdateDeathCameraWidget ( PlayerData playerData,
ref bool disableVanillaTapToRespawnAction,
ref bool respawn )
virtual

在更新玩家死亡界面时执行

参数
playerData具体死者
disableVanillaTapToRespawnAction是否阻止原版点击任意键就执行复活等下一步的操作
respawn是否复活

◆ UpdateInput()

virtual void Game.ModLoader.UpdateInput ( ComponentInput componentInput,
WidgetInput widgetInput )
virtual

更新输入时执行

参数
componentInput

◆ UpdatePlayerInputAim()

virtual void Game.ModLoader.UpdatePlayerInputAim ( ComponentPlayer componentPlayer,
bool aiming,
ref bool playerOperated,
ref float timeIntervalAim,
bool skippedByOtherMods,
out bool skipVanilla )
virtual

在玩家正在瞄准时执行

参数
componentPlayer
aiming是否正在瞄准
playerOperated为true则停止之后的挖掘、攻击等操作
timeIntervalAim和上一次执行瞄准操作,要求的最小时间间隔
skippedByOtherMods是否已经被其他模组跳过逻辑
skipVanilla跳过原版执行操作(为了模组间兼容性,建议只在手持自己模组方块时这样做)

◆ UpdatePlayerInputDig()

virtual void Game.ModLoader.UpdatePlayerInputDig ( ComponentPlayer componentPlayer,
bool digging,
ref bool playerOperated,
ref double timeIntervalDig,
bool skippedByOtherMods,
out bool skipVanilla )
virtual

在玩家执行“挖掘”动作时执行

参数
componentPlayer
digging玩家是否正在挖掘
playerOperated为true则停止之后的创造模式中键选择物品等操作
timeIntervalDig和上一次执行挖掘操作,要求的最小时间间隔。将该值降低可以像恒泰那样极速挖掘
skippedByOtherMods是否已经被其他模组跳过逻辑
skipVanilla跳过原版执行操作(为了模组间兼容性,建议只在手持自己模组方块时这样做)

◆ ViewFogColor()

virtual void Game.ModLoader.ViewFogColor ( float ViewUnderWaterDepth,
float ViewUnderMagmaDepth,
ref Color viewFogColor )
virtual

视图雾颜色调整

参数
ViewUnderWaterDepth大于0则表示在水下
ViewUnderMagmaDepth大于0则表示在岩浆中
viewFogColor视图雾颜色

◆ WindowModeChanged()

virtual void Game.ModLoader.WindowModeChanged ( WindowMode mode)
virtual

当窗口模式改变时执行。

Game.SurvivalCraftModLoader 重载.

类成员变量说明

◆ Entity

ModEntity Game.ModLoader.Entity

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