Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
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 IsLevelSufficientForTool (ComponentMiner miner, int toolValue, ref bool canUse, out bool skip)
 当前等级是否可以使用手中物品进行:挖掘,使用,伤害,瞄准 Mod开发者可以自定义物品是否符合使用条件
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 void OnMinerPlace (ComponentMiner miner, TerrainRaycastResult raycastResult, int x, int y, int z, int value, BlockPlacementData placementData, 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 ClothingSlotProcessCapacity (ComponentClothing componentClothing, int slotIndex, int blockValue, ref bool notToProcessVanilla, out int capacity)
 控制物品拖动到人物上方时,是否能执行操作。 返回1表示可以处理物品。 多个模组执行时,取最大值
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)
virtual void OnAnimateModel (ComponentModel componentModel, out bool skip)
 当模型对象作出动画时执行 skip为是否跳过原动画代码
virtual void OnModelDrawExtra (ComponentModel componentModel, Camera camera, out bool skip)
 当模型对象绘制额外时执行,skip为是否跳过原本的绘制。 与OnModelRendererDrawExtra不同,本方法主要是人物第三人称模型手上物品的绘制
virtual void OnModelCalculateBones (ComponentModel componentModel, Camera camera, out bool skip)
 当模型计算骨骼绝对变换时执行,Skip为是否跳过原本的计算
virtual void OnModelCalculateIsVisible (ComponentModel componentModel, Camera camera, out bool skip)
 当模型计算是否可见时执行,Skip为是否跳过原本的计算
virtual void RecalculateModelEyePosition (ComponentModel componentModel, ref Vector3 eyePosition)
 重新计算模型眼睛位置
virtual void RecalculateModelEyeRotation (ComponentModel componentModel, ref Quaternion eyeRotation)
 重新计算模型眼睛旋转
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 SubsystemUpdate (SubsystemUpdate 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< Action > actions)
 加载任务开始时执行 在BlocksManager初始化之前
virtual void OnLoadingFinished (List< 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 ProjectXmlLoad (XElement xElement, WorldInfo worldInfo, ContainerWidget gameWidget)
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 ManageCameras (GameWidget gameWidget)
 当GameWidget被创建时执行,适合添加新的摄像机类型。具体方法可参考SurvivalCraftModLoader.ManageCameras
virtual void OnCapture ()
 屏幕截图时执行
virtual void MenuPlayMusic (out string contentMusicPath)
 更改主页背景音乐
virtual void IsTerrainSafeToGo (ComponentPilot componentPilot, Vector3 position, Vector3 direction, out bool isTerrainSafeToGo, out bool skipVanilla)
 ComponentPilot组件接口 用于判断是否地形是否安全
virtual void IsPredator (ComponentFlyAwayBehavior flyAwayBehavior, Entity target, out bool isPredator, out bool skipVanilla)
 ComponentFlyAwayBehavior组件接口 用于判断是否将目标规划为捕食者,从而飞走
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 OnWidgetContentsLoaded (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 componentGui, Widget oldWidget, Widget newWidget)
 当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 OnInventorySlotWidgetCalculateSplitCount (InventorySlotWidget inventorySlotWidget, int totalItemCount, DragMode dragMode, ref int splitCount)
 在InventorySlotWidget计算分割物品数量时执行(包括拖拽显示数量和实际移动数量),允许修改最终的分割数量 (比如原版的1个/一半分割逻辑,可通过此方法自定义为固定数量、按物品类型分割等)
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 EditBlockDescriptionScreen (Dictionary< string, string > blockProperties, int blockValue)
 在方块介绍页面中,增加或减少方块的属性字段
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储存了所有对该属性有影响的因子。模组可以修改其中的因子来实现自定义的操作。
virtual void DecideArmorProtectionSequence (ComponentClothing componentClothing, Attackment attackment, float randomNumber, List< int > clothesList)
 计算护甲防御时,修改参与护甲防御的衣物列表
virtual void ApplyProtectionBeforeClothes (ComponentClothing componentClothing, Attackment attackment, ref float attackPowerAfterProtection)
 在计算护甲防御前,自定义新的结算 例如:玩家携带力场护盾时,优先使用力场护盾进行防御
virtual void ApplyProtectionAfterClothes (ComponentClothing componentClothing, Attackment attackment, List< int > listAfterProtection, ref float attackPowerAfterProtection)
 在计算护甲防御后,自定义新的结算
virtual void InitializeClothingSlots ()
 初始化ClothingSlot的时候执行。在此接口添加脖子、手臂等新的可穿戴部位。
virtual void OnPlayerModelWidgetMeasureOverride (PlayerModelWidget playerModelWidget)
 在绘制人物界面中的人物模型的时候执行,可以通过在playerModelWidget.m_modelWidget中增删元素来在人物界面绘制新模型
virtual void IsCrosshairVisible (ComponentAimingSights componentAimingSights, ref bool isVisible)
 设定是否显示默认的十字准星。可用于关闭PC端十字准星的强制显示
virtual IEnumerable< KeyValuePair< string, object > > GetKeyboardMappings ()
 用于添加新的键盘鼠标按键映射,在重置按键设置时也会使用这里的设置作为默认值。 使用yield return可返回多个键值对。键:映射名;值:按键(Key)或鼠标按钮(MouseButton)
virtual IEnumerable< KeyValuePair< string, object > > GetGamepadMappings ()
 用于添加新的手柄按键映射,在重置按键设置时也会使用这里的设置作为默认值。 使用yield return可返回多个键值对。键:映射名;值:按键(Key)或鼠标按钮(MouseButton)
virtual IEnumerable< KeyValuePair< string, int > > GetCameraList ()
 用于添加新的摄像机顺序,在重置摄像机列表时也会使用这里的设置作为默认值。 使用yield return可返回多个键值对。键:摄像机类名;值:顺序
virtual void InitKeyCompatibleGroups ()
 初始化按键兼容组
virtual void OnSettingsScreenCreated (SettingsScreen settingsScreen, out Dictionary< ButtonWidget, Action > buttonsToAdd)
 在设置界面创建时执行。可用于模组添加新的设置按钮。 此接口可避免切换语言重新创建Screen导致按钮丢失的情况
virtual void ModifyLogColor (string text, ref Color color)
 对单条日志消息进行判定以修改其显示颜色
virtual void PlayerDataFirstUpdate (PlayerData playerData)
 PlayerData首次更新时执行
virtual void RecalculateCameraProjection (Camera camera, ref Matrix projectionMatrix)
 重新计算摄像机投影矩阵
virtual void OnProjectileRaycastBody (ComponentBody componentBody, Projectile projectile, float distance, out bool ignore)
 射弹更新寻找下一个可以命中的Body时执行
virtual void ClothingProcessSlotItems (ComponentClothing componentClothing, int slotIndex, ref int inputValue, ref int inputCount, ref int processedValue, ref int processedCount, bool skippedByOtherMods, out bool skipVanilla)
 将物品拖动到衣物界面玩家身上时执行
virtual void ClothingProcessSlotItems (ComponentPlayer componentPlayer, int slotIndex, ref int inputValue, ref int inputCount, ref int processedValue, ref int processedCount, bool skippedByOtherMods, out bool skipVanilla)
virtual void OnModelDataDrawing (SubsystemModelsRenderer.ModelData modelData, ModelShader modelShader, Camera camera, SubsystemModelsRenderer subsystemModelsRenderer, out bool skip)
 当单个模型数据被渲染时执行
virtual void OnFirstPersonModelDrawing (ComponentFirstPersonModel componentFirstPersonModel, Camera camera, int itemValue, ref Matrix matrix, out bool skip)
 当第一人称手部模型或手持方块图标被渲染时执行
virtual void OnEntityBehaviorBlockInteracted (object raycastResult, bool isInitialNull, ref ComponentBlockEntity componentBlockEntity)
 当玩家开始交互一个带有SubsystemEntityBlockBehavior的方块时执行 可以用于当玩家打开一个通过地形生成,导致没有ComponentBlockEntity的箱子时,添加宝箱实体并为箱子添加战利品 该接口可能会引发模组冲突,谨慎使用
virtual void OnAppendModelMeshPart (BlockMesh blockMesh, ModelMeshPart meshPart, Matrix matrix, bool makeEmissive, bool flipWindingOrder, bool doubleSided, bool flipNormals, Color color, out bool skip)
 在BlockMesh.AppendModelMeshPart之前执行
virtual void OnAppendModelMesh (BlockMesh blockMesh, BlockMesh blockMesh1, out bool skip)
 在BlockMesh.AppendModelMesh之前执行
virtual void OnVitalStatsEat (ComponentVitalStats vitalStats, ref int value, ref bool skipVanilla, out bool eatSuccess)
 玩家生命状态(进食)钩子
virtual void OnVitalStatsUpdateFood (ComponentVitalStats vitalStats, ref float food, ref float gameTimeDelta, ref bool skipVanilla)
 状态(更新饥饿值)钩子
virtual void OnVitalStatsUpdateStamina (ComponentVitalStats vitalStats, ref float stamina, ref float gameTimeDelta, ref bool skipVanilla)
 状态(更新耐力值)钩子
virtual void OnVitalStatsUpdateSleep (ComponentVitalStats vitalStats, ref float sleep, ref float gameTimeDelta, ref bool skipVanilla)
 状态(更新睡眠值)钩子
virtual void OnVitalStatsUpdateTemperature (ComponentVitalStats vitalStats, ref float temperature, ref float gameTimeDelta, ref bool skipVanilla)
 状态(更新体温)钩子
virtual void OnVitalStatsUpdateWetness (ComponentVitalStats vitalStats, ref float wetness, ref float gameTimeDelta, ref bool skipVanilla)
 状态(更新湿度)钩子

Public 属性

ModEntity Entity

详细描述

在文件 ModLoader.cs8 行定义.

成员函数说明

◆ __ModInitialize()

virtual void Game.ModLoader.__ModInitialize ( )
virtual

当ModLoader类被实例化时执行

Game.SurvivalCraftModLoader 重载.

在文件 ModLoader.cs14 行定义.

◆ AfterWidgetUpdate()

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

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

参数
widget

在文件 ModLoader.cs1717 行定义.

◆ ApplyArmorProtection()

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

计算护甲免伤时执行

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

在文件 ModLoader.cs380 行定义.

◆ ApplyProtectionAfterClothes()

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

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

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

在文件 ModLoader.cs1807 行定义.

◆ ApplyProtectionBeforeClothes()

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

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

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

在文件 ModLoader.cs1796 行定义.

◆ 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不移交

在文件 ModLoader.cs293 行定义.

◆ 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伤害位置
hitDirection
impulseFactor击退效果
stunTimeFactor眩晕时间
recalculate是否重写眩晕?

在文件 ModLoader.cs222 行定义.

◆ BeforeGameLoading()

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

存档开始加载前执行

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

在文件 ModLoader.cs671 行定义.

◆ 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则玩家不能放置方块

在文件 ModLoader.cs143 行定义.

◆ 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绘制上下文。

在文件 ModLoader.cs918 行定义.

◆ BeforeWidgetUpdate()

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

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

参数
widget

在文件 ModLoader.cs1711 行定义.

◆ BlocksInitalized()

virtual void Game.ModLoader.BlocksInitalized ( )
virtual

方块初始化完成时执行

在文件 ModLoader.cs663 行定义.

◆ BodyCountInRaycast()

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

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

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

在文件 ModLoader.cs1078 行定义.

◆ CalculateCreatureInjuryAmount()

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

计算生物收到伤害的量

Game.JsModLoader 重载.

在文件 ModLoader.cs517 行定义.

◆ CalculateExplosionPower()

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

在文件 ModLoader.cs473 行定义.

◆ CalculateFallDamage()

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

计算动物的坠落伤害

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

在文件 ModLoader.cs1480 行定义.

◆ CalculateLighting()

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

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

参数
brightness亮度值

在文件 ModLoader.cs67 行定义.

◆ CalculateSmoothLight()

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

计算动物模型光照

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

在文件 ModLoader.cs961 行定义.

◆ CallNearbyCreaturesHelp()

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

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

参数
herdBehavior
target
maxRange
maxChaseTime
isPersistent
skipVanilla是否跳过原版逻辑

在文件 ModLoader.cs837 行定义.

◆ ChangeGameTimeDelta()

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

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

参数
subsystemTime
dt

在文件 ModLoader.cs1177 行定义.

◆ ChangeSkyColor()

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

更改天空颜色

在文件 ModLoader.cs562 行定义.

◆ 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时完全红色

在文件 ModLoader.cs546 行定义.

◆ ChaseBehaviorScoreTarget()

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

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

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

在文件 ModLoader.cs1729 行定义.

◆ ClothingProcessSlotItems() [1/3]

virtual void Game.ModLoader.ClothingProcessSlotItems ( ComponentClothing componentClothing,
int slotIndex,
ref int inputValue,
ref int inputCount,
ref int processedValue,
ref int processedCount,
bool skippedByOtherMods,
out bool skipVanilla )
virtual

将物品拖动到衣物界面玩家身上时执行

参数
componentClothing
slotIndex拖动到的栏位(头部、躯干、护腿、脚)
inputValue拖动过来的方块的方块完整值。修改会改动移交给下一个模组的完整值
inputCount拖动过来的方块的数量。修改会改动移交给下一个模组的数量
processedValue执行完毕后,留下的物品的Value。例如奶桶在食用完毕后会留下空桶。
processedCount执行完毕后,留下的物品的数量。
skippedByOtherMods是否已经被其他模组接管执行
skipVanilla是否由本模组接管执行。为保证模组间兼容性,建议只在处理本模组物品时,才将skipVanilla设置为true或改动inputValue和inputCount。

在文件 ModLoader.cs1918 行定义.

◆ ClothingProcessSlotItems() [2/3]

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

当人物吃东西时执行

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

在文件 ModLoader.cs240 行定义.

◆ ClothingProcessSlotItems() [3/3]

virtual void Game.ModLoader.ClothingProcessSlotItems ( ComponentPlayer componentPlayer,
int slotIndex,
ref int inputValue,
ref int inputCount,
ref int processedValue,
ref int processedCount,
bool skippedByOtherMods,
out bool skipVanilla )
virtual

在文件 ModLoader.cs1932 行定义.

◆ ClothingSlotProcessCapacity()

virtual void Game.ModLoader.ClothingSlotProcessCapacity ( ComponentClothing componentClothing,
int slotIndex,
int blockValue,
ref bool notToProcessVanilla,
out int capacity )
virtual

控制物品拖动到人物上方时,是否能执行操作。 返回1表示可以处理物品。 多个模组执行时,取最大值

参数
componentClothing
slotIndex
blockValue
notToProcessVanilla
capacity
返回

在文件 ModLoader.cs253 行定义.

◆ ClothingWidgetOpen()

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

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

参数
componentGui
clothingWidget

在文件 ModLoader.cs431 行定义.

◆ CompareModVersion()

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

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

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

在文件 ModLoader.cs47 行定义.

◆ CraftingRecipesManagerInitialize()

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

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

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

在文件 ModLoader.cs1603 行定义.

◆ CraftingRecipesManagerInitialized()

virtual void Game.ModLoader.CraftingRecipesManagerInitialized ( )
virtual

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

在文件 ModLoader.cs1608 行定义.

◆ DamageItem()

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

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

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

在文件 ModLoader.cs977 行定义.

◆ DeadBeforeDrops()

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

死亡前瞬间执行

在文件 ModLoader.cs492 行定义.

◆ DecideArmorProtectionSequence()

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

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

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

在文件 ModLoader.cs1784 行定义.

◆ DecideLoot()

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

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

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

在文件 ModLoader.cs1740 行定义.

◆ DecodeIngredient()

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

解码配方

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

在文件 ModLoader.cs765 行定义.

◆ DecodeResult()

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

获得解码结果时执行

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

在文件 ModLoader.cs753 行定义.

◆ DispenserChooseItemToDispense()

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

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

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

在文件 ModLoader.cs1530 行定义.

◆ DrawToScreen()

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

ViewWidget绘制屏幕时执行

在文件 ModLoader.cs424 行定义.

◆ EditBlockDescriptionScreen() [1/2]

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

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

参数
blockProperties

在文件 ModLoader.cs1547 行定义.

◆ EditBlockDescriptionScreen() [2/2]

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

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

参数
blockProperties已有的方块属性表
blockValue被介绍的方块完整值

在文件 ModLoader.cs1554 行定义.

◆ EditRecipeScreenWidget()

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

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

参数
screen

在文件 ModLoader.cs1560 行定义.

◆ EntityComponentsInitialized()

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

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

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

在文件 ModLoader.cs1685 行定义.

◆ FindCoarseSpawnPosition()

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

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

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

在文件 ModLoader.cs1452 行定义.

◆ FindHerdCenter()

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

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

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

在文件 ModLoader.cs854 行定义.

◆ GenerateChunkLightSources()

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

生成光源数据

参数
lightSources光源
chunk区块

在文件 ModLoader.cs953 行定义.

◆ GenerateChunkVertices()

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

生成地形顶点时使用

参数
chunk
even

在文件 ModLoader.cs946 行定义.

◆ GetCameraList()

virtual IEnumerable< KeyValuePair< string, int > > Game.ModLoader.GetCameraList ( )
virtual

用于添加新的摄像机顺序,在重置摄像机列表时也会使用这里的设置作为默认值。 使用yield return可返回多个键值对。键:摄像机类名;值:顺序

Game.SurvivalCraftModLoader 重载.

在文件 ModLoader.cs1856 行定义.

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

◆ GetGamepadMappings()

virtual IEnumerable< KeyValuePair< string, object > > Game.ModLoader.GetGamepadMappings ( )
virtual

用于添加新的手柄按键映射,在重置按键设置时也会使用这里的设置作为默认值。 使用yield return可返回多个键值对。键:映射名;值:按键(Key)或鼠标按钮(MouseButton)

在文件 ModLoader.cs1841 行定义.

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

◆ GetKeyboardMappings()

virtual IEnumerable< KeyValuePair< string, object > > Game.ModLoader.GetKeyboardMappings ( )
virtual

用于添加新的键盘鼠标按键映射,在重置按键设置时也会使用这里的设置作为默认值。 使用yield return可返回多个键值对。键:映射名;值:按键(Key)或鼠标按钮(MouseButton)

在文件 ModLoader.cs1834 行定义.

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

◆ GetMaxInstancesCount()

virtual int Game.ModLoader.GetMaxInstancesCount ( )
virtual

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

返回

Game.SurvivalCraftModLoader 重载.

在文件 ModLoader.cs588 行定义.

◆ 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过后,返回是否得到文件

在文件 ModLoader.cs35 行定义.

◆ GetModFiles()

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

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

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

在文件 ModLoader.cs23 行定义.

◆ 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是否跳过原版的执行进程,注意本接口不能跳过其他模组的执行进程

在文件 ModLoader.cs1664 行定义.

◆ GuiDraw()

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

Gui组件绘制时执行

参数
componentGui
camera
drawOrder

在文件 ModLoader.cs412 行定义.

◆ GuiUpdate()

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

Gui组件帧更新时执行

参数
componentGui

在文件 ModLoader.cs404 行定义.

◆ 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跳过原版的执行逻辑

在文件 ModLoader.cs1298 行定义.

◆ 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的数相当于跳过原版逻辑

在文件 ModLoader.cs1281 行定义.

◆ 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
sourceInventory
sourceSlotIndex
targetInventory
targetSlotIndex
count留给后面模组和原版处理物品的数量
moved是否完成移动操作,注意这个不影响跳过原版处理

在文件 ModLoader.cs1247 行定义.

◆ InitializeClothingSlots()

virtual void Game.ModLoader.InitializeClothingSlots ( )
virtual

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

在文件 ModLoader.cs1815 行定义.

◆ InitializeCreatureTypes()

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

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

参数
spawn
creatureTypes

在文件 ModLoader.cs453 行定义.

◆ InitKeyCompatibleGroups()

virtual void Game.ModLoader.InitKeyCompatibleGroups ( )
virtual

初始化按键兼容组

Game.SurvivalCraftModLoader 重载.

在文件 ModLoader.cs1863 行定义.

◆ InventorySlotWidgetMeasureOverride()

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

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

参数
inventorySlotWidget
parentAvailableSize其父widget的大小

在文件 ModLoader.cs1235 行定义.

◆ IsCrosshairVisible()

virtual void Game.ModLoader.IsCrosshairVisible ( ComponentAimingSights componentAimingSights,
ref bool isVisible )
virtual

设定是否显示默认的十字准星。可用于关闭PC端十字准星的强制显示

参数
componentAimingSights
isVisible

在文件 ModLoader.cs1828 行定义.

◆ IsLevelSufficientForTool()

virtual void Game.ModLoader.IsLevelSufficientForTool ( ComponentMiner miner,
int toolValue,
ref bool canUse,
out bool skip )
virtual

当前等级是否可以使用手中物品进行:挖掘,使用,伤害,瞄准 Mod开发者可以自定义物品是否符合使用条件

参数
miner
toolValue方块值
canUse能使用
skip跳过原版后,返回canUse值

在文件 ModLoader.cs101 行定义.

◆ IsPredator()

virtual void Game.ModLoader.IsPredator ( ComponentFlyAwayBehavior flyAwayBehavior,
Entity target,
out bool isPredator,
out bool skipVanilla )
virtual

ComponentFlyAwayBehavior组件接口 用于判断是否将目标规划为捕食者,从而飞走

参数
flyAwayBehavior
target
isPredator目标是否为捕食者
skipVanilla是否跳过原版逻辑

在文件 ModLoader.cs822 行定义.

◆ IsTerrainSafeToGo()

virtual void Game.ModLoader.IsTerrainSafeToGo ( ComponentPilot componentPilot,
Vector3 position,
Vector3 direction,
out bool isTerrainSafeToGo,
out bool skipVanilla )
virtual

ComponentPilot组件接口 用于判断是否地形是否安全

参数
direction
isTerrainSafeToGo前往地形是安全的
skipVanilla是否跳过原版逻辑
componentPilot
position

在文件 ModLoader.cs805 行定义.

◆ LoadCreatureInfoInBestiaryScreen()

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

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

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

在文件 ModLoader.cs1579 行定义.

◆ LoadSettings()

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

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

参数
xElement

在文件 ModLoader.cs698 行定义.

◆ LoadWorldInfoWidget()

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

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

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

在文件 ModLoader.cs1540 行定义.

◆ ManageCameras()

virtual void Game.ModLoader.ManageCameras ( GameWidget gameWidget)
virtual

当GameWidget被创建时执行,适合添加新的摄像机类型。具体方法可参考SurvivalCraftModLoader.ManageCameras

参数
gameWidget

Game.SurvivalCraftModLoader 重载.

在文件 ModLoader.cs782 行定义.

◆ MatchRecipe()

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

配方匹配时执行

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

在文件 ModLoader.cs742 行定义.

◆ MenuPlayMusic()

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

更改主页背景音乐

在文件 ModLoader.cs792 行定义.

◆ ModDispose()

virtual void Game.ModLoader.ModDispose ( )
virtual

Mod被卸载时执行

在文件 ModLoader.cs52 行定义.

◆ ModelShaderParameter()

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

更改模型着色器参数的值

在文件 ModLoader.cs574 行定义.

◆ ModifyLogColor()

virtual void Game.ModLoader.ModifyLogColor ( string text,
ref Color color )
virtual

对单条日志消息进行判定以修改其显示颜色

参数
text
color

在文件 ModLoader.cs1880 行定义.

◆ OnAnimateModel()

virtual void Game.ModLoader.OnAnimateModel ( ComponentModel componentModel,
out bool skip )
virtual

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

在文件 ModLoader.cs322 行定义.

◆ OnAppendModelMesh()

virtual void Game.ModLoader.OnAppendModelMesh ( BlockMesh blockMesh,
BlockMesh blockMesh1,
out bool skip )
virtual

在BlockMesh.AppendModelMesh之前执行

参数
blockMesh
blockMesh1
skip如果要跳过原版方法,设置此值为true

在文件 ModLoader.cs2017 行定义.

◆ OnAppendModelMeshPart()

virtual void Game.ModLoader.OnAppendModelMeshPart ( BlockMesh blockMesh,
ModelMeshPart meshPart,
Matrix matrix,
bool makeEmissive,
bool flipWindingOrder,
bool doubleSided,
bool flipNormals,
Color color,
out bool skip )
virtual

在BlockMesh.AppendModelMeshPart之前执行

参数
blockMesh
meshPart
matrix
makeEmissive
flipWindingOrder
doubleSided
flipNormals
color
skip如果要跳过原版方法,设置此值为true

在文件 ModLoader.cs1999 行定义.

◆ OnBlockDug()

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

在方块被挖掘完毕时执行

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

在文件 ModLoader.cs1163 行定义.

◆ OnBlockExploded()

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

当方块被炸掉时执行

在文件 ModLoader.cs436 行定义.

◆ OnCameraChange()

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

改变相机模式时执行

参数
m_componentPlayer
componentGui

Game.SurvivalCraftModLoader 重载.

在文件 ModLoader.cs776 行定义.

◆ OnCapture()

virtual void Game.ModLoader.OnCapture ( )
virtual

屏幕截图时执行

在文件 ModLoader.cs787 行定义.

◆ 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是否发出攻击音效

在文件 ModLoader.cs1462 行定义.

◆ OnChaseBehaviorAttackFailed()

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

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

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

在文件 ModLoader.cs1473 行定义.

◆ OnChaseBehaviorStartChasing()

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

在文件 ModLoader.cs1719 行定义.

◆ OnChaseBehaviorStopChasing()

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

在文件 ModLoader.cs1720 行定义.

◆ OnComponentBodyExploded()

virtual void Game.ModLoader.OnComponentBodyExploded ( ComponentBody componentBody,
ref Injury explosionInjury,
ref Vector3 impulse,
ref bool setOnFire,
ref float fluctuation )
virtual

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

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

在文件 ModLoader.cs483 行定义.

◆ OnComponentBodyExplodedStart()

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

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

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

在文件 ModLoader.cs1650 行定义.

◆ 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是否在生存模式中停止创造飞行(通常发生在创造模式切换到生存模式中)

在文件 ModLoader.cs1497 行定义.

◆ OnCraftingRecipeDecode()

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

配方解码时执行

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

在文件 ModLoader.cs732 行定义.

◆ OnCreatureDied()

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

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

参数
componentHealth
injury
experienceOrbDrop
calculateInKill

在文件 ModLoader.cs535 行定义.

◆ OnCreatureDying()

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

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

参数
componentHealth
injury

在文件 ModLoader.cs526 行定义.

◆ OnCreatureInjure()

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

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

在文件 ModLoader.cs505 行定义.

◆ OnCreatureSpiked()

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

在文件 ModLoader.cs553 行定义.

◆ OnDespawned()

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

当生物消失时执行

参数
entity
componentSpawn

在文件 ModLoader.cs471 行定义.

◆ OnDispenserDispensePickable()

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

在发射器投掷物品时执行

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

在文件 ModLoader.cs1509 行定义.

◆ OnDispenserShoot()

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

在发射器弹射物品时执行

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

在文件 ModLoader.cs1518 行定义.

◆ OnDrawItemAssigned()

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

在 DrawItem 排序后。

参数
drawContext绘制上下文。

Game.SurvivalCraftModLoader 重载.

在文件 ModLoader.cs931 行定义.

◆ OnEatPickable()

virtual void Game.ModLoader.OnEatPickable ( ComponentEatPickableBehavior eatPickableBehavior,
Pickable eatPickable,
out bool dealed )
virtual

动物吃掉落物时执行

在文件 ModLoader.cs266 行定义.

◆ OnEntityAdd()

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

当实体被添加时执行

在文件 ModLoader.cs441 行定义.

◆ OnEntityBehaviorBlockInteracted()

virtual void Game.ModLoader.OnEntityBehaviorBlockInteracted ( object raycastResult,
bool isInitialNull,
ref ComponentBlockEntity componentBlockEntity )
virtual

当玩家开始交互一个带有SubsystemEntityBlockBehavior的方块时执行 可以用于当玩家打开一个通过地形生成,导致没有ComponentBlockEntity的箱子时,添加宝箱实体并为箱子添加战利品 该接口可能会引发模组冲突,谨慎使用

参数
raycastResult可能的类型为TerrainRaycastResult或MovingBlockRaycastResult
isInitialNull表示在开始交互方块时,方块并没有对应的交互实体。通常在首次交互野生箱子时发生
componentBlockEntity在交互时指向的ComponentBlockEntity,可能为null

在文件 ModLoader.cs1983 行定义.

◆ OnEntityRemove()

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

当实体被移除时执行

在文件 ModLoader.cs446 行定义.

◆ OnFactorsGenerate()

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

在计算一个生物的Factors执行。仅限非玩家生物,玩家需要使用OnLevelUpdate。 ComponentFactors里面有四个List,这四个List储存了所有对该属性有影响的因子。模组可以修改其中的因子来实现自定义的操作。

public List&lt;Factor&gt; m_strengthFactors = [];
public List&lt;Factor&gt; m_speedFactors = [];
public List&lt;Factor&gt; m_hungerFactors = [];
public List&lt;Factor&gt; m_resilienceFactors = [];

在执行这个接口后,游戏会根据这四个List计算出StrengthFactor、SpeedFactor、HungerFactor、ResilienceFactor的最终值

参数
componentFactors

在文件 ModLoader.cs1775 行定义.

◆ OnFactorsUpdate()

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

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

参数
componentFactors
dt

在文件 ModLoader.cs398 行定义.

◆ OnFirstPersonModelDrawing()

virtual void Game.ModLoader.OnFirstPersonModelDrawing ( ComponentFirstPersonModel componentFirstPersonModel,
Camera camera,
int itemValue,
ref Matrix matrix,
out bool skip )
virtual

当第一人称手部模型或手持方块图标被渲染时执行

参数
componentFirstPersonModel
camera
itemValue手持方块完整值,为0表示空手
matrix
skip

在文件 ModLoader.cs1967 行定义.

◆ 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家具锤消耗的耐久量,如果家具锤剩余耐久不足以支持消耗量,则玩家无法创建家具并弹出提示

在文件 ModLoader.cs1215 行定义.

◆ 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_drawables

在文件 ModLoader.cs1203 行定义.

◆ OnInventorySlotWidgetCalculateSplitCount()

virtual void Game.ModLoader.OnInventorySlotWidgetCalculateSplitCount ( InventorySlotWidget inventorySlotWidget,
int totalItemCount,
DragMode dragMode,
ref int splitCount )
virtual

在InventorySlotWidget计算分割物品数量时执行(包括拖拽显示数量和实际移动数量),允许修改最终的分割数量 (比如原版的1个/一半分割逻辑,可通过此方法自定义为固定数量、按物品类型分割等)

参数
inventorySlotWidget触发分割数量计算的InventorySlotWidget实例(当前物品槽)
totalItemCount分割前的物品总数量(当前槽位的物品总数)
dragMode当前的拖拽模式(AllItems:全部/SingleItem:单个/HalfItems:一半)
splitCount原版逻辑计算后的分割数量(ref关键字允许修改,修改后会作为最终的分割数量使用)

在文件 ModLoader.cs1265 行定义.

◆ OnInventorySlotWidgetDefined()

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

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

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

在文件 ModLoader.cs1226 行定义.

◆ 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()

在文件 ModLoader.cs1188 行定义.

函数调用图:

◆ OnLevelUpdate()

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

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

参数
level

在文件 ModLoader.cs390 行定义.

◆ 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是否点燃目标

在文件 ModLoader.cs1436 行定义.

◆ OnLoadingFinished()

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

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

参数
actions

在文件 ModLoader.cs684 行定义.

◆ OnLoadingStart()

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

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

在文件 ModLoader.cs677 行定义.

◆ OnLocomotionStopped()

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

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

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

在文件 ModLoader.cs1487 行定义.

◆ OnMainMenuScreenCreated()

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

在主界面初始化后执行,你可以通过这个给主界面加些你想要的按钮或者文字等 开发者也可以使用BeforeWidgetUpdate和AfterWidgetUpdate这两个接口实现更多种屏幕的局部调整

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

在文件 ModLoader.cs1749 行定义.

◆ OnMainMenuScreenUpdate()

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

在主界面更新

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

在文件 ModLoader.cs1760 行定义.

◆ OnMinerDig()

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

当人物挖掘时执行

参数
miner
raycastResult
digProgress
digged
返回

Game.JsModLoader 重载.

在文件 ModLoader.cs129 行定义.

◆ 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
参数
miner
componentBody
hitPoint
hitDirection
attackPower伤害值
playerProbability玩家命中率
creatureProbability生物命中率
hitted

在文件 ModLoader.cs77 行定义.

◆ 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发起的攻击

在文件 ModLoader.cs114 行定义.

◆ OnMinerPlace() [1/2]

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

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

参数
miner
raycastResult
x
y
z
value
placementData
placed
返回

在文件 ModLoader.cs187 行定义.

◆ OnMinerPlace() [2/2]

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
x
y
z
value
placed
返回

Game.JsModLoader 重载.

在文件 ModLoader.cs165 行定义.

◆ OnModalPanelWidgetSet()

virtual void Game.ModLoader.OnModalPanelWidgetSet ( ComponentGui componentGui,
Widget oldWidget,
Widget newWidget )
virtual

当ModalPanelWidget被设置时执行

参数
componentGui
oldWidget
newWidget

在文件 ModLoader.cs939 行定义.

◆ OnModelAnimate()

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

在文件 ModLoader.cs314 行定义.

◆ OnModelCalculateBones()

virtual void Game.ModLoader.OnModelCalculateBones ( ComponentModel componentModel,
Camera camera,
out bool skip )
virtual

当模型计算骨骼绝对变换时执行,Skip为是否跳过原本的计算

参数
componentModel
camera
skip

在文件 ModLoader.cs343 行定义.

◆ OnModelCalculateIsVisible()

virtual void Game.ModLoader.OnModelCalculateIsVisible ( ComponentModel componentModel,
Camera camera,
out bool skip )
virtual

当模型计算是否可见时执行,Skip为是否跳过原本的计算

参数
componentModel
camera
skip

在文件 ModLoader.cs353 行定义.

◆ OnModelDataDrawing()

virtual void Game.ModLoader.OnModelDataDrawing ( SubsystemModelsRenderer.ModelData modelData,
ModelShader modelShader,
Camera camera,
SubsystemModelsRenderer subsystemModelsRenderer,
out bool skip )
virtual

当单个模型数据被渲染时执行

参数
modelData
modelShader
camera
subsystemModelsRenderer
skip

在文件 ModLoader.cs1951 行定义.

◆ OnModelDrawExtra()

virtual void Game.ModLoader.OnModelDrawExtra ( ComponentModel componentModel,
Camera camera,
out bool skip )
virtual

当模型对象绘制额外时执行,skip为是否跳过原本的绘制。 与OnModelRendererDrawExtra不同,本方法主要是人物第三人称模型手上物品的绘制

参数
componentModel
camera
skip

在文件 ModLoader.cs333 行定义.

◆ OnModelRendererDrawExtra()

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

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

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

Game.SurvivalCraftModLoader 重载.

在文件 ModLoader.cs597 行定义.

◆ OnMovingBlockSetAdded()

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

在添加移动方块时触发

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

在文件 ModLoader.cs1090 行定义.

◆ OnMovingBlockSetRemoved()

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

移除移动方块时触发

参数
movingBlockSet
subsystemMovingBlocks

在文件 ModLoader.cs1102 行定义.

◆ OnMovingBlockSetUpdate()

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

在移动方块更新时触发

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

在文件 ModLoader.cs1111 行定义.

◆ OnPickableAdded()

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

游戏中添加掉落物时触发

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

在文件 ModLoader.cs1134 行定义.

◆ 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

在文件 ModLoader.cs1052 行定义.

◆ OnPlayerControlBoat()

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

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

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

在文件 ModLoader.cs1324 行定义.

◆ OnPlayerControlOtherMount()

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

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

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

在文件 ModLoader.cs1334 行定义.

◆ OnPlayerControlSteed()

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

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

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

在文件 ModLoader.cs1314 行定义.

◆ OnPlayerControlWalk()

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

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

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

在文件 ModLoader.cs1344 行定义.

◆ OnPlayerDead()

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

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

参数
playerData

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

在文件 ModLoader.cs280 行定义.

◆ OnPlayerInputDrop()

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

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

参数
componentPlayer
skippedByOtherMods
skipVanilla

在文件 ModLoader.cs1424 行定义.

◆ 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跳过原版执行操作(为了模组间兼容性,建议只在手持自己模组方块时这样做)

在文件 ModLoader.cs1391 行定义.

◆ 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则禁止玩家放置方块

在文件 ModLoader.cs1357 行定义.

◆ OnPlayerModelWidgetMeasureOverride()

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

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

参数
playerModelWidget

在文件 ModLoader.cs1821 行定义.

◆ OnPlayerSpawned()

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

人物出生时执行

Game.JsModLoader 重载.

在文件 ModLoader.cs273 行定义.

◆ OnProjectDisposed()

virtual void Game.ModLoader.OnProjectDisposed ( )
virtual

当Project被释放时执行

Game.JsModLoader 重载.

在文件 ModLoader.cs658 行定义.

◆ OnProjectileAdded()

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

游戏中添加射弹时触发

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

在文件 ModLoader.cs1124 行定义.

◆ 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绘制方块颜色

在文件 ModLoader.cs1028 行定义.

◆ OnProjectileFlyOutOfLoadedChunks()

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

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

参数
projectile

在文件 ModLoader.cs1040 行定义.

◆ 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射弹行进直接穿过该生物。射弹后续的更新会忽略该生物,速度和角速度保持原状。攻击照常执行。

在文件 ModLoader.cs1011 行定义.

◆ 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在击中方块后,射弹的角速度

在文件 ModLoader.cs993 行定义.

◆ OnProjectileRaycastBody()

virtual void Game.ModLoader.OnProjectileRaycastBody ( ComponentBody componentBody,
Projectile projectile,
float distance,
out bool ignore )
virtual

射弹更新寻找下一个可以命中的Body时执行

参数
componentBody射弹可能命中的Body
projectile触发判定的射弹
ignore设置为true会让射弹无视此Body
distance射弹和目标的在本帧更新中的距离

也可以通过将componentBody列入projectile.BodiesToIgnore中,以忽略目标

在文件 ModLoader.cs1903 行定义.

◆ OnProjectileTurnIntoPickable()

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

射弹转化为掉落物时执行

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

在文件 ModLoader.cs1678 行定义.

◆ OnProjectLoaded()

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

当Project被加载时执行

参数
project

Game.JsModLoader 重载.

在文件 ModLoader.cs653 行定义.

◆ OnProjectXmlSaved()

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

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

参数
xElement

在文件 ModLoader.cs724 行定义.

◆ OnReadSpawnData()

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

当读取生物数据时

在文件 ModLoader.cs619 行定义.

◆ OnSaveSpawnData()

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

当储存生物数据时

参数
spawn
spawnEntityData

在文件 ModLoader.cs614 行定义.

◆ OnScreenEntered()

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

进入Screen时执行

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

在文件 ModLoader.cs1698 行定义.

◆ OnScreenLeaved()

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

离开Screen时执行

参数
screen离开的Screen

在文件 ModLoader.cs1704 行定义.

◆ OnSetModel()

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

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

在文件 ModLoader.cs309 行定义.

◆ OnSettingsScreenCreated()

virtual void Game.ModLoader.OnSettingsScreenCreated ( SettingsScreen settingsScreen,
out Dictionary< ButtonWidget, Action > buttonsToAdd )
virtual

在设置界面创建时执行。可用于模组添加新的设置按钮。 此接口可避免切换语言重新创建Screen导致按钮丢失的情况

参数
settingsScreen
buttonsToAdd键为按钮,值为按下后进行的操作

在文件 ModLoader.cs1871 行定义.

◆ OnTerrainBrushesCreated()

virtual void Game.ModLoader.OnTerrainBrushesCreated ( )
virtual

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

在文件 ModLoader.cs1445 行定义.

◆ OnTerrainContentsGenerated()

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

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

参数
chunk

在文件 ModLoader.cs626 行定义.

◆ 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生成宝物的情况

参数
subsystemTerrain
x
y
z
neighborX
neighborY
neighborZ
blockValue宝物的方块值
count宝物数量
isGenerate是否继续让其它Mod处理

在文件 ModLoader.cs885 行定义.

◆ OnVitalStatsEat()

virtual void Game.ModLoader.OnVitalStatsEat ( ComponentVitalStats vitalStats,
ref int value,
ref bool skipVanilla,
out bool eatSuccess )
virtual

玩家生命状态(进食)钩子

参数
vitalStats生命状态组件
value物品完整值
skipVanilla是否跳过原版逻辑
eatSuccess输出:进食是否成功

在文件 ModLoader.cs2028 行定义.

◆ OnVitalStatsUpdateFood()

virtual void Game.ModLoader.OnVitalStatsUpdateFood ( ComponentVitalStats vitalStats,
ref float food,
ref float gameTimeDelta,
ref bool skipVanilla )
virtual

状态(更新饥饿值)钩子

参数
vitalStats生命状态组件
food饥饿值
gameTimeDelta时间增量
skipVanilla是否跳过原版逻辑

在文件 ModLoader.cs2044 行定义.

◆ OnVitalStatsUpdateSleep()

virtual void Game.ModLoader.OnVitalStatsUpdateSleep ( ComponentVitalStats vitalStats,
ref float sleep,
ref float gameTimeDelta,
ref bool skipVanilla )
virtual

状态(更新睡眠值)钩子

参数
vitalStats生命状态组件
sleep睡眠值
gameTimeDelta时间增量
skipVanilla是否跳过原版逻辑

在文件 ModLoader.cs2070 行定义.

◆ OnVitalStatsUpdateStamina()

virtual void Game.ModLoader.OnVitalStatsUpdateStamina ( ComponentVitalStats vitalStats,
ref float stamina,
ref float gameTimeDelta,
ref bool skipVanilla )
virtual

状态(更新耐力值)钩子

参数
vitalStats生命状态组件
stamina耐力值
gameTimeDelta时间增量
skipVanilla是否跳过原版逻辑

在文件 ModLoader.cs2057 行定义.

◆ OnVitalStatsUpdateTemperature()

virtual void Game.ModLoader.OnVitalStatsUpdateTemperature ( ComponentVitalStats vitalStats,
ref float temperature,
ref float gameTimeDelta,
ref bool skipVanilla )
virtual

状态(更新体温)钩子

参数
vitalStats生命状态组件
temperature体温值
gameTimeDelta时间增量
skipVanilla是否跳过原版逻辑

在文件 ModLoader.cs2083 行定义.

◆ OnVitalStatsUpdateWetness()

virtual void Game.ModLoader.OnVitalStatsUpdateWetness ( ComponentVitalStats vitalStats,
ref float wetness,
ref float gameTimeDelta,
ref bool skipVanilla )
virtual

状态(更新湿度)钩子

参数
vitalStats生命状态组件
wetness湿度值
gameTimeDelta时间增量
skipVanilla是否跳过原版逻辑

在文件 ModLoader.cs2096 行定义.

◆ OnWidgetConstruct()

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

当界面被创建时

参数
widget

在文件 ModLoader.cs902 行定义.

◆ OnWidgetContentsLoaded()

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

当界面内容完成加载时

参数
widget

在文件 ModLoader.cs908 行定义.

◆ OnXdbLoad()

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

Xdb文件加载时执行

参数
xElement

在文件 ModLoader.cs704 行定义.

◆ PlayerDataFirstUpdate()

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

PlayerData首次更新时执行

参数
playerData

在文件 ModLoader.cs1886 行定义.

◆ PlayInGameMusic()

virtual void Game.ModLoader.PlayInGameMusic ( )
virtual

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

在文件 ModLoader.cs1613 行定义.

◆ PrepareModels()

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

在文件 ModLoader.cs1622 行定义.

◆ ProcessAttackment()

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

在攻击时执行

参数
attackment

Game.JsModLoader 重载.

在文件 ModLoader.cs304 行定义.

◆ ProjectBeforeSubsystemsAndEntitiesLoad()

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

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

参数
project

在文件 ModLoader.cs1691 行定义.

◆ ProjectXmlLoad() [1/2]

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

Project.xml加载时执行

参数
xElement

在文件 ModLoader.cs711 行定义.

◆ ProjectXmlLoad() [2/2]

virtual void Game.ModLoader.ProjectXmlLoad ( XElement xElement,
WorldInfo worldInfo,
ContainerWidget gameWidget )
virtual

在文件 ModLoader.cs712 行定义.

◆ ProjectXmlSave()

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

Project.xml保存时执行

参数
xElement

在文件 ModLoader.cs718 行定义.

◆ RecalculateCameraProjection()

virtual void Game.ModLoader.RecalculateCameraProjection ( Camera camera,
ref Matrix projectionMatrix )
virtual

重新计算摄像机投影矩阵

参数
camera
projectionMatrix

在文件 ModLoader.cs1893 行定义.

◆ RecalculateModelEyePosition()

virtual void Game.ModLoader.RecalculateModelEyePosition ( ComponentModel componentModel,
ref Vector3 eyePosition )
virtual

重新计算模型眼睛位置

参数
componentModel
eyePosition

在文件 ModLoader.cs362 行定义.

◆ RecalculateModelEyeRotation()

virtual void Game.ModLoader.RecalculateModelEyeRotation ( ComponentModel componentModel,
ref Quaternion eyeRotation )
virtual

重新计算模型眼睛旋转

参数
componentModel
eyeRotation

在文件 ModLoader.cs369 行定义.

◆ RenderModels()

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

在文件 ModLoader.cs1626 行定义.

◆ ResetOptionsForNonCreativeMode()

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

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

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

在文件 ModLoader.cs1592 行定义.

◆ SavePickable()

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

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

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

在文件 ModLoader.cs1152 行定义.

◆ SaveProjectile()

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

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

参数
subsystemProjectiles
projectile
valuesDictionary存储射弹信息的ValuesDictionary

在文件 ModLoader.cs1142 行定义.

◆ SaveSettings()

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

模组设置保存时执行

参数
xElement一个空容器,模组作者需将自己的设置信息存入这个空容器内

在文件 ModLoader.cs690 行定义.

◆ ScoreMount()

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

ComponentRider组件接口 用于获取可符合骑行条件生物 通过此接口,模组可以实现自定义骑行,也可以用于生物骑行生物相关逻辑 为保证模组兼容性,建议预先判断是否是自己模组的载具,且仅处理自己模组的载具

参数
componentRider
componentMount
score返回的分数。返回null则表示不处理,移交给原版或下一个模组。返回正数表示允许骑乘,返回负数表示禁止骑乘(即使其他模组允许)。

在文件 ModLoader.cs868 行定义.

◆ SetClothes()

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

在文件 ModLoader.cs261 行定义.

◆ SetFurnitureDesignColor()

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

设置家具的颜色

在文件 ModLoader.cs209 行定义.

◆ SetHitInterval()

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

设置伤害间隔

在文件 ModLoader.cs91 行定义.

◆ SetHitValueParticleSystem()

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

设定伤害粒子参数

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

在文件 ModLoader.cs607 行定义.

◆ SetRainAndSnowColor()

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

设置雨和雪的颜色

参数
rainColor
snowColor
返回

在文件 ModLoader.cs204 行定义.

◆ SetShaderParameter()

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

设置着色器参数

参数
shader
camera

在文件 ModLoader.cs569 行定义.

◆ SkyDrawExtra()

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

天空额外绘制

在文件 ModLoader.cs582 行定义.

◆ SpawnEntity()

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

生物出生时执行

参数
spawn
entity
spawnEntityData
spawned

在文件 ModLoader.cs462 行定义.

◆ SubsystemUpdate() [1/2]

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

子系统帧更新时执行

在文件 ModLoader.cs646 行定义.

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

◆ SubsystemUpdate() [2/2]

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

在文件 ModLoader.cs647 行定义.

函数调用图:

◆ TerrainChangeCell()

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

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

在文件 ModLoader.cs497 行定义.

◆ TerrainContentsGenerator23Initialize()

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

在文件 ModLoader.cs1616 行定义.

◆ TerrainContentsGenerator24Initialize()

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

在文件 ModLoader.cs1619 行定义.

◆ ToAllocateChunks()

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

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

在文件 ModLoader.cs640 行定义.

◆ ToFreeChunks()

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

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

在文件 ModLoader.cs632 行定义.

◆ UpdateChaseBehaviorChasing()

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

在文件 ModLoader.cs1732 行定义.

◆ UpdateChaseBehaviorLookingForTarget()

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

在文件 ModLoader.cs1731 行定义.

◆ 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

在文件 ModLoader.cs1068 行定义.

◆ UpdateCreaturePropertiesInBestiaryDescriptionScreen()

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

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

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

在文件 ModLoader.cs1568 行定义.

◆ UpdateDeathCameraWidget()

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

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

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

在文件 ModLoader.cs1640 行定义.

◆ UpdateInput()

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

更新输入时执行

参数
componentInput
widgetInput

在文件 ModLoader.cs419 行定义.

◆ 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跳过原版执行操作(为了模组间兼容性,建议只在手持自己模组方块时这样做)

在文件 ModLoader.cs1373 行定义.

◆ 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跳过原版执行操作(为了模组间兼容性,建议只在手持自己模组方块时这样做)

在文件 ModLoader.cs1409 行定义.

◆ ViewFogColor()

virtual void Game.ModLoader.ViewFogColor ( float viewUnderWaterDepth,
float viewUnderMagmaDepth,
ref Color viewFogColor )
virtual

视图雾颜色调整

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

在文件 ModLoader.cs60 行定义.

◆ WindowModeChanged()

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

当窗口模式改变时执行。

Game.SurvivalCraftModLoader 重载.

在文件 ModLoader.cs966 行定义.

类成员变量说明

◆ Entity

ModEntity Game.ModLoader.Entity

在文件 ModLoader.cs9 行定义.


该类的文档由以下文件生成:
  • E:/sc/doxygen/SurvivalcraftApi 1.8.2.3/Survivalcraft.Windows/ModsManager/ModLoader.cs