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.
I noticed that the lightzone script didn't have any functionality to respond to light switch events. I added a
LightzoneSwitchComponent.gd
script to solve this. Parenting it to aLightzoneComponent
and connecting theswitched
signal from aCogito_Switch.gd
node to the_on_switched
function, this should should make the parent lightzone automatically follow the switch's state by enabling and disabling theArea3D::monitoring
property.Reason
Small change, follows composition, I think it makes sense for it to be included in the template since it's a big feature of a lot of immersive sims, allows for new gameplay and level design options :)
No side effects
Will only affect lightzones, and not connecting the signal or setting the switchable flag to false will make the lightzone behave as previously.
CogitoSwitch.gd::is_on
initial state is respected. I added aLightzoneSwitchComponent
to theLightzoneComponent
prefab and added aLightzoneComponent
child to theCeilingLamp
prefab as an example but feel free to make me restore them to their previous state.Downsides
Uses
get_parent()
, which violates pure composition. However the use-case is incredibly obvious based on the name and documentation, and it shouldn't pollute anything else, so I feel like using it in this limited scope makes sense.switchable-lightzone-example.mp4