-
-
Notifications
You must be signed in to change notification settings - Fork 0
Add network spawning for dynamic gltf-model objects. Make equippables work for network spawned objects. #4071
Conversation
…object flag is added on editor side. Update incomingNetworkReceptor to handle these dynamic objects.
…ked instantiated objects.
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, @hamzzam ! just a few questions/comments. the only changes i'd like to see before merging is to have those hasComponent
calls moved into removeComponent
. we might also want some of those console.log
calls removed, too.
!hasComponent(equippedEntity, EquippedComponent) | ||
) { | ||
addComponent(equipperEntity, EquipperComponent, { equippedEntity, data: {} }) | ||
if (!hasComponent(equipperEntity, EquipperComponent) && !hasComponent(equippedEntity, EquippedComponent)) { |
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.
for my own understanding, is this if
statement here to prevent the existing component data from being overwritten?
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.
Yes.
// } else { | ||
const world = useWorld() | ||
|
||
matches(action).when(NetworkWorldAction.setEquippedObject.matchesFromAny, (a) => { |
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.
what's the difference between .matches
and .matchesFromAny
? i always forget ><
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.
.matches
will match an action only when it comes from a trusted source (e.g., the host, or itself)
.matchesFromAny
will match an action no matter who sent it
In general .matchesFromAny
is unsafe, and .matches
should be preferred
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.
@NateTheGreatt happy to rename these for clarity if you can think of better names
packages/engine/src/networking/functions/incomingNetworkReceptor.ts
Outdated
Show resolved
Hide resolved
packages/engine/src/networking/functions/incomingNetworkReceptor.ts
Outdated
Show resolved
Hide resolved
packages/engine/src/networking/functions/incomingNetworkReceptor.ts
Outdated
Show resolved
Hide resolved
packages/engine/src/networking/functions/incomingNetworkReceptor.ts
Outdated
Show resolved
Hide resolved
if (hasComponent(entity, BoundingBoxComponent)) { | ||
// TODO: Does the Box3 object need to be destroyed before this? | ||
removeComponent(entity, BoundingBoxComponent) | ||
} | ||
if (hasComponent(entity, InteractiveFocusedComponent)) { | ||
removeComponent(entity, InteractiveFocusedComponent) | ||
} | ||
if (hasComponent(entity, SubFocusedComponent)) { | ||
removeComponent(entity, SubFocusedComponent) | ||
} |
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.
are these hasComponent
checks necessary if it's removing the component anyways? if it's needed, perhaps we should add the hadComponent
check to the removeComponent
function instead
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.
@NateTheGreatt Does bitecs allow removeComponent
if the entity does not have the component?
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.
Yeah I was of the assumption that bitECS does not allow removeComponent if the component does not exist. But I just ran a test it does not throw any errors. So I will update the code and remove the extra hasComponent checks.
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.
Done
Co-authored-by: Nate Martin <mrtn.nathaniel@gmail.com>
Co-authored-by: Nate Martin <mrtn.nathaniel@gmail.com>
Co-authored-by: Nate Martin <mrtn.nathaniel@gmail.com>
…or.ts Co-authored-by: Nate Martin <mrtn.nathaniel@gmail.com>
…or.ts Co-authored-by: Nate Martin <mrtn.nathaniel@gmail.com>
…or.ts Co-authored-by: Nate Martin <mrtn.nathaniel@gmail.com>
…or.ts Co-authored-by: Nate Martin <mrtn.nathaniel@gmail.com>
Removed the console.logs and hasComponent checks. Let me know if anything else needs to be updated. Thanks |
Are you able to provide a guide to show the functionality for this? I tried using the collision cube to create an equippable and there is an issue with the new interactable UI and i cant seem to equip anything. |
It was working fine before the latest dev merge. Let me try to debug |
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.
QA steps would be great. i forgot to add that to the PR template
@HexaField @NateTheGreatt I tested it out, the equippables functionality is working fine. There are some errors in the interactables logic due to which the text and highlighting are not working. I tried adding some sanity checks but that didn't help. Probably the dev who worked on it will need to fix those. To test the interactables you should do the following:
|
thanks for the repro steps @hamzzam! I tested it out and there seems to be an issue with the item following the hand bone after pickup. |
Hey @NateTheGreatt that's because the |
Yes I think we are now in a place where this should work. |
Ok. I will make a separate PR for that, we can get this PR approved if that is the only thing left. |
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.
Ok. I will make a separate PR for that, we can get this PR approved if that is the only thing left.
Or let me know if you think this change must be included in this PR.
sounds good to me 👍
Summary
A summary of changes being made in this PR
Checklist
npm run check
npm run lint
npm run test:packages
npm run build-client
References
References to pertaining issue(s)
Reviewers
@HexaField @speigg @NateTheGreatt