Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
我尝试适配了超过1200射速的武器
我注意到有部分枪包中射速超过1200,在原版TACZ中这些武器的射速会被强行降低至1200每分钟
我通过将全自动的发射逻辑从Minecraft中独立出来的方式一定程度上解决的DPS低于理想值和弹药消耗低于理想值的问题。
改动与说明
网络部分
增加了三个数据包,分别为
ClientMessagePlayerShootBegin、ClientMessagePlayerShootEnd和ServerMessageGunStop,用途分别为客户端通知服务器开始全自动射击,客户端通知服务端停止全自动射击,服务端强行停止客户端继续射击(由于缺少弹药)。射击逻辑部分
我先简要说明一下修改后的全自动射击流程:摁下射击键后客户端想服务器发送
ClientMessagePlayerShootBegin同时自己启动一个子线程用于播放音效和提供后坐力,服务器收到后在LivingEntityShoot.startFullAuto方法中启动一个子线程用于向ShootBus类声明自己射出去的子弹数量,ShootBus.processAndClear方法注册了一个监听器,用于每刻将每个玩家打出去的子弹分别进行一次射击,避免了大量子弹实体造成的卡顿。当客户端松开射击键时,会发送ClientMessagePlayerShootEnd包并杀死自身创建的Gun-AutoShoot-Scheduler线程,服务器收到包后也会杀死自身创建的与该玩家绑定的Gun-AutoShoot-Scheduler线程。当服务器判定弹药打空之后会发送ServerMessageGunStop包直接调用客户端由Mixin注入的LivingEntity.stopFullAuto方法停止全自动射击。伤害计算部分
往
EntityKineticBullet.onBulletTick方法中加入了一个for循环用于多次计算一个子弹实体中包含的多个子弹造成的伤害。几乎没有对已有的半自动射击和爆发射击做出改变
杂项
新引入了
it.unimi.dsi:fastutil库用于ShootBus类中