问题描述:wx-78在使用格挡插件后,在客机上可能会出现无法右键点击自身进入格挡状态的问题。
根本原因:这个问题应该是entityscript.lua中的entity对象的inst.actionreplica.inherentactions使用了net_bytearray这个网络变量引起的, net_bytearray只支持8-bit unsigned integers,也就是只支持[0,255],而目前ACTIONS里的动作数量已经达到299个了,加了mod会更多,当pairs拿到的ACTIONS.TOGGLEWXSHIELDING的id>255时,客机就无法正常同步对应的动作ID了。
解决方法:把inst.actionreplica.inherentactions改为net_ushortarray
激活格挡插件的时候,会使用AddInherentAction方法给wx78_classified绑定ACTIONS.TOGGLEWXSHIELDING动作
然后在AddInherentAction中会调用SerializeInherentActions函数来对主客机的绑定动作进行同步
此时会使用pairs迭代器遍历ACTIONS表,然后将对应的id存入inst.actionreplica.inherentactions来同步到客户端,而inst.actionreplica.inherentactions是一个net_bytearray,只能存入[0,255]的数字,当动作id大于255时就会出现问题,客机无法正常同步对应的动作ID,从而导致对应的动作无法正常被激活。
目前光饥荒联机版本身的动作数量就已经超过255个了,如果开了模组的话会更多,出现这个问题的概率也会更大

There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now