-
-
Notifications
You must be signed in to change notification settings - Fork 464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Extending upgrade
api for scripting, correct some upgrading logics
#1463
[Feature] Extending upgrade
api for scripting, correct some upgrading logics
#1463
Conversation
upgrade
api for scripting, correct some upgrading logicsupgrade
api for scripting, correct some upgrading logics
@yohjimane, this might be interesting to you! (could you also look at it/maybe review?) |
Thanks for the heads up! Changes look good to me (e.g. shouldnt conflict with OXR gunslinger) other than some minor code style issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thank you Neloreck :)
…correct net_spawn logics with upgrading.
6582e52
to
c239d9e
Compare
Rebased / updated upgrades iteration |
Thanks! Waiting for CI to finish, and merging! |
Changes
net_Spawn_install_upgrades
logics to work with same signature as originalnet_Spawn
event and expect abstract entitynet_Spawn_install_upgrades
logics call before base method related to net spawning and binder lifecycle calls [A]can_install
when loading data -> does not make sense to check data when loading from file, it should be validated on moment of addition [B]A
Previous implementation of
net_Spawn_install_upgrades
called cleanup of client side objectm_upgrades
and tried to sync it with server entity. Also it was calledafter
binder lifecycle methods from script so it made all the logics used in scripts on spawn event irrelevant (LUA added extension -> it is added to client object -> it is added to server object -> inventory item lifecycle deletes all the data from client object and fetches it from temporary spawn entity where it is empty).Also I believe some code parts mocked this method and called original one before base lifecycle specifically for same reasons.
B
On load event we should not re-validate everything what was done before by game engine. Also keeping old logics blocks us from installing all upgrades with scripts. Once you are loading save where 2 upgrades from same group are installed, game crashes without these changes. So basically the change solves two problems.
C
Added new methods and separated concept of
install
andadd
for compatibility and code quality. Problem is thatinstall
runs script checks and script effects which are part of interaction with mechanic. If you want to purely add upgrades based only on script logics you have to use something else.add
just adds and saves upgrade ignoring script effects/preconditions and it does not unload/detach addons from weapons and armor.Usage
As result, I was able to create logics in my mod where all the weapon/armor get random upgrades on spawn with random chance.
It makes looting more fun + there are situations with unique items where both upgrades from same group are activated.