SleepingOverhaul
用酷炫且沉浸式的延时摄影睡眠(加速时间)取代原版“跳过至白天”的睡眠功能,并提供其他可配置的睡眠增强选项。
该延时摄影效果并非模拟——世界实际的刻率(tick-rate)会被加速。这是通过 Tickrate Changer 模组实现的,该模组由 Guichaguri 制作(请参阅下载页面以获取所需版本和下载链接)。
SleepingOverhaul 还有一个可选的 CMC(CoreModCompanion)模组,部分功能需要它才能运行。这些选项和功能在适当处均标有 “[CMC]”。
本模组——正如我的所有模组一样——需要 CosmicLib。如果不确定需要哪个版本的 CosmicLib,请查看下载页面上的更新日志。
完整功能列表:
- 当所有玩家都在床上时,会触发延时摄影效果而非直接跳到白天——世界速度最高提升至每秒 1000 刻;
- 可自定义“夜间开始时间”以促进睡眠(即强制玩家比平时更晚入睡);
- 允许在任何时间睡觉,并可在白天继续睡觉。这显然会覆盖任何自定义的“夜间开始时间”设置。另请注意,玩家必须手动醒来,否则他们将永远持续睡眠(未来若有需求可能会加入闹钟功能);
- [CMC] 解锁在任何维度(例如下界)睡觉的能力。不保证与模组添加的维度的兼容性。
- 自定义水平/垂直安全检测距离(即因附近存在怪物而显示“你现在无法睡觉”的范围);
- 睡觉/躺在床上时在屏幕上显示时钟(可配置);
- 睡眠投票系统:当达到最小比例的玩家在床上时,会定期向玩家发送礼貌提醒,并为未上床的玩家启动倒计时,最终执行几种可配置的操作之一:
当前的睡眠投票操作(投票和超时结束后执行的操作)包括:
- 无操作(仅每 x 秒显示一次提醒);
- 无论如何都启用延时摄影(保持清醒的玩家将不得不应对服务器刻率加速的情况);
- [CMC] 踢出所有清醒玩家,然后继续执行延时摄影(警告:如果没有 CMC,使用此操作会在踢出清醒玩家后错误地导致“跳过至白天”);
- 恢复原版行为(跳过至白天)
……超时时间和向玩家显示的消息均可在配置文件中完全自定义。
本模组现已被视为稳定且功能完整,但仍可能存在漏洞。它不会造成永久性损害,如果引发问题,可以安全地从现有世界中移除。请务必报告您发现的任何问题。
已知问题
- 下界中的时钟显示将仅显示 “??:??”。我未来可能会引入一个选项来改为显示主世界的时戳。
- 在专用服务器上运行时,延时摄影期间增加的刻率可能较慢。至少在我的开发机上运行服务器 + 3 个客户端时是这样。我不确定如何改进这一点,甚至是否有可能改进。我希望有一天能研究一下。
- 基于“随机方块刻”的作物生长和其他事物,其刻速不会如你所期望的那样按比例缩放。这很难简单地“修复”,因为这实际上不是一个漏洞,但我将在未来的版本中看看能做些什么(也许我可以自动更改 randomTickSpeed 游戏内规则)。
兼容性
- Morpheus。在此模组中睡眠投票没有意义,但我们现在有自己的系统来处理这个问题了。
- StellarAPI。需要手动禁用 StellarAPI 的所有自定义唤醒设置(位于 StellarAPI\MainConfig.cfg 下的 wake 部分),因为它会导致跳过至白天。
- Extended Days。与各种模组存在兼容性问题,而且据我经验,即使单独运行也存在故障。强烈建议改用 B3M 来改变昼夜长度。
技术细节
出于必要,本模组完全覆盖了原版的睡眠事件。它试图通过最后运行来尽可能兼容地实现这一目标,从而给其他模组在玩家睡觉时进行钩子处理的机会。与其他涉及睡眠特定操作的模组之间必然存在不兼容情况:
- SleepingOverhaul 通过钩住 PlayerSleepInBedEvent 来复制原版睡眠行为,始终返回一个值——这意味着原版的 trySleep 方法永远不会运行。修改此代码的核心模组将无法正常工作。如果有任何核心模组这样做,它们是在滥用核心模组技术——这会让 Lex 生气。
- 其他提供睡眠条件限制/覆盖的模组可能会发生冲突,特别是如果它们在 SleepingOverhaul 运行之前取消或改变了睡眠结果(SleepingOverhaul 以最低优先级运行)。例如,某个模组添加了它自己的“现在睡觉太危险了”或“你不能在这里睡觉”的判断。这是设计使然——其他阻止或改变睡眠条件的模组仍应被允许这样做。
- 其他监控 WorldServer 中 “allPlayersSleeping” 标志的模组将无法正常工作(未能设置此标志正是 SleepingOverhaul 避免首先触发“跳过至白天”的方法)。我不会修复这个问题——这些模组应该订阅 PlayerWakeUpEvent(在使用此模组时该事件仍会触发)。
- 其他订阅了 tick 事件并使用玩家 sleepTimer 的模组可能会出现不可预测的行为。不过,我不明白为什么会有模组想要这样做。
SleepingOverhaul
Replaces the vanilla "skip-to-day" function of sleep with a cool and immersive time-lapse sleep (speeds up time), among other configurable sleep enhancements.
The time-lapse is not a simulation - the actual tick-rate of the world is sped-up. This is achieved by using the Tickrate Changer mod by Guichaguri (see the download page for the required version and download link).
SleepingOverhaul also has an optional CMC (CoreModCompanion) mod which is required for some functionality. These options and features are marked with "[CMC]" where appropriate.
This mod - like all my mods do/will - requires CosmicLib. If in doubt about which version of CosmicLib is required, check the change log on the Download page.
Full feature list:
- When all players are in a bed, Time-lapse occurs instead of skipping to day - the world speeds up to a maximum of 1000 ticks/second;
- Set a custom "night-time start" for the sake of sleeping (I.e. force players to stay up later than usual);
- The ability to sleep at any time of the day and keep sleeping during the day. This obviously overrides any custom "night-time start" setting. Also note that player(s) must manually wake themselves up, otherwise they'll just keep sleeping forever (an alarm clock function may come in future if there's any demand for it);
- [CMC] Unlock the ability to sleep in any dimension (e.g. Nether). Compatibility is not guaranteed with mod-added dimensions.
- Customize the horizontal/vertical safety check distance (I.e. range for "You cannot sleep now" because of nearby mobs);
- Shows a clock on the screen while sleeping/laying in bed (configurable);
- A Sleep Vote system where, when a minimum ratio of players are in a bed, a polite reminder will be periodically sent to players and a countdown to one of several configurable actions will begin for the players who are not in a bed:
Current sleep vote actions (the thing to do when a vote and timeout have passed) are:
- No action (just show a reminder every x seconds);
- Enable Timelapse anyway (players who remain awake will have to deal with the server tickrate being sped-up);
- [CMC] Kick all awake players, then continue with Timelapse (WARNING: without the CMC, using this action will incorrectly cause a skip-to-day after kicking the awake players);
- Revert to vanilla behaviour (skip-to-day)
… timeouts and messages displayed to players are fully customizable in the configuration.
This mod is now considered STABLE and FEATURE COMPLETE but may still have bugs. It shouldn't cause any permanent damage and can be safely removed from existing worlds if it causes issues. Please be sure to report any issues you find.
Known Issues
- The clock display in the Nether will only show "??:??". I may introduce an option in future to instead show the Overworld timestamp.
- The increased tick-rate under Timelapse may be slow when running on a dedicated server. At least it is for me, when running a server + 3 clients on my dev machine. Not sure how to improve this, nor if it even can be improved. I hope to look into it some day.
- Crop growth and other things based on "random block ticks" do not scale their tick speed as you might expect. This cannot be easily "fixed" as it isn't really a bug, but I will see what I can do in a future release (maybe I can automate the randomTickSpeed gamerule change).
Compatibility
- Morpheus. Sleep-vote doesn't make sense in this mod, but we have our own system for that now anyway.
- StellarAPI. Need to manually disable all of StellarAPI's custom wake settings (at StellarAPI\MainConfig.cfg under wake) since it causes skip to day.
- Extended Days. Has compatibility issues with various mods, and is glitchy even on its own in my experience. I highly suggest B3M instead to change day length.
Technical details
By necessity, this mod completely overrides the vanilla sleep event. It tries to do so in as compatible a manner as possible by running last, giving other mods a chance to do their own hooks when players sleep. There will be incompatibilities with other mods that do specific things related to sleep:
- SleepingOverhaul replicates vanilla sleep behaviour by hooking the PlayerSleepInBedEvent, always returning a value - this means the vanilla trySleep method will never run. Coremods which modify this code will not function correctly. If there are any Coremods out there that do this, they're abusing core modding - that makes Lex angry.
- Other mods which provide conditional restrictions/overrides on sleeping may conflict, especially if they cancel or change the sleep result before SleepingOverhaul runs (SleepingOverhaul is running at lowest priority). An example of this might be a mod which adds it's own "It's too dangerous to sleep now" or "you can't sleep here" decisions. This is by design - other mods that block or change sleep conditions should still be allowed to do so.
- Other mods which monitor the "allPlayersSleeping" flag in WorldServer will not function correctly (failing to set this flag is how SleepingOverhaul avoids the 'skip-to-day' part in the first place). I will not fix this - these mods should be subscribed to the PlayerWakeUpEvent instead (which is still fired with this mod).
- Other mods with tick event subscriptions that utilize a player's sleepTimer may behave unpredictably. I can't imagine why a mod would want to do this, though.
评论 0
登录后参与评分
还没有评论,来抢沙发吧