Skip to content
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

Components bug related to props #499

Open
WSSDude opened this issue Feb 17, 2021 · 3 comments
Open

Components bug related to props #499

WSSDude opened this issue Feb 17, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@WSSDude
Copy link
Collaborator

WSSDude commented Feb 17, 2021

Reported by @striderxfossility inside #497


Also there is a BUG in these components related to props.

For example:

local tpp = player:FindComponentByName(CName.new("TPPRepresentation"))
print(tpp.detachedObjectInfo[1].itemTDBID) -- prints "Items.PlayerFppHead" CName
tpp.detachedObjectInfo[1].itemTDBID = TweakDBID.new("Items.PlayerWaTppHead")

print(tpp.detachedObjectInfo[1].itemTDBID) -- Still prints "Items.PlayerFppHead" CName

WORKAROUND FOR NOW:

local tpp     = player:FindComponentByName(CName.new("TPPRepresentation"))
local obj     = NewObject('gameFppRepDetachedObjectInfo')
obj.slotID    = TweakDBID.new("TppHead")
obj.itemTDBID = TweakDBID.new("Items.PlayerWaTppHead")

tpp.detachedObjectInfo = {obj}

print(tpp.detachedObjectInfo[1].itemTDBID) -- now prints "Items.PlayerWaTppHead" CName
@WSSDude WSSDude added the bug Something isn't working label Feb 17, 2021
@maximegmd
Copy link
Owner

This has to do with the fact that we copy by value arrays in ToLua, it's a broader project where we need to wrap internal arrays instead of converting to Lua arrays

@0xSombra
Copy link
Contributor

If you ever decide to "wrap internal arrays instead of converting to Lua arrays":
TweakDB::GetFlat can return an array, It shouldn't be wrapped. A Flat shouldn't be modified outside of TweakDB::SetFlat
https://github.com/yamashi/CyberEngineTweaks/blob/47f04d660b521467f5d1279986c48717079430cb/src/reverse/TweakDB.cpp#L176-L193

@maximegmd
Copy link
Owner

Got it, thanks for the info :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants