Not logged inOpenClonk Forum
Up Topic General / Help and Questions / Visibility
- - By vagner [br] Date 2015-09-04 19:30
Can someone help me with VIS_OverlayOnly?
I need examples.
I did "this.Visibility = VIS_OverlayOnly;" and the object came to be invisible.
If all objects are in the same Layer, why the object are Invisible?
I did this->SetObjectLayer(this) and the object don't came to be visible.
VIS_OverlayOnly is not for object be visible for the same Layers objects?
Can someone give me examples for VIS_LayerToggle too?

I found a bug:
I created a Rock Object, and after that i did:
ObjectRock->SetObjectLayer(ObjectRock);
The rock could not interact more with the others objects, but if i press the Keyboard down, the clonk can get the Rock. If a throw the rock it can't hit another clonk, but i can grab it from the floor. Don't is it a Layer Bug?
Parent - - By Maikel Date 2015-09-04 20:23 Edited 2015-09-04 20:34
SetObjectLayer "moves" an object to the given layer, and objects of different layers do not interact with each other. The fact that the clonk could get the rock is a bug though.

I don't know what VIS_OverlayOnly is for though.

Maybe you can tell us what you want to do, because I don't think these features are relevant.
Parent - - By vagner [br] Date 2015-09-04 21:04
What i want to do:

The player 1 have three clonks: A, B and C.

If the clonk A have a invisible ring, the clonk B and C can't see the clonk A (But all clonks is from the same Owner). If I change de command to clonk A, he  can see the clonk A, B and C.
If i change the command for the clonk B he can see B and C, but can't see the clonk A.
In others words, i want do a object invisible to another object and not to the player.
Parent - By Zapper [de] Date 2015-09-04 22:07

>In others words, i want do a object invisible to another object and not to the player.


I think you have to do that yourself: you could check which Clonk the player is playing and do Visibility = VIS_None for the other Clonks, for example
Parent - - By Sven2 [us] Date 2015-09-04 23:54
The problem with object layers at the moment is that you need to add Find_Layer(this) explicitely to almost every search function. In Clonk Rage, the old FindObject()-function (with the gazillion parameters) would have this check by default.

I think it would make sense to adjust our search functions to also use this check by default and only turn if off if something like e.g. Find_AnyLayer() or an explicit layer search is specified.
Parent - - By Zapper [de] Date 2015-09-05 10:06 Edited 2015-09-05 10:11

>I think it would make sense to adjust our search functions to also use this check by default and only turn if off if something like e.g. Find_AnyLayer() or an explicit layer search is specified.


That has the about the same potential for bugs I guess. We have some places where a "helper function" (stuff like DoWealth/GetOwner/GetPower) might potentially trigger a FindObject search. We'd have to make extra sure to use Find_AnyLayer everywhere in places like that, because those bugs will probably be a lot harder to find.

Would you want to implement the implicit Find_Layer and adjust all the places? I'd have nothing against that.

PS: How does CreateObject behave? Does it create the objects in the layer of the caller?
PPS: What about attached objects - do they adjust their layer to their parent?
Parent - - By Sven2 [us] Date 2015-09-05 13:53

> That has the about the same potential for bugs I guess.


* DoWealth doesn't take an object
* GetOwner asks stuff on an object you already have. How does that interfere?
* GetPower? Whether objects in different layers should be effected by power / ownership radius is debatable. I'd say they shouldn't.

Back in Clonk Rage I did a search-all on FindObject, and almost all of them would have needed the layer check. The only exceptions would be stuff like global counters, e.g. counting all objects to get the current score or get all objects for a section change.

Layers are mostly to be used by missions / adventure scenarios where the scenario designer puts stuff away from interaction. E.g. they can turn a workshop into a decoration object. They can protected an important NPC  from being hit by spells and pushed off the cliff. Another use would be for hidden stuff in e.g. enterable buildings. In either case, it's specialized scenario settings where the author of the scenario will notice if any searches that need to catch these objects skip them (unlike e.g. free settlement, where the players might build things the author did not think of).

> PS: How does CreateObject behave? Does it create the objects in the layer of the caller?


Yes, it should do that. I built it like that in Clonk Rage. I don't know if that is still the case.

> PPS: What about attached objects - do they adjust their layer to their parent?


No. For example, dialogs are attached to NPCs. You often want the NPC to be protected by a layer, but the dialog object should be accessible for talking.
Parent - By Zapper [de] Date 2015-09-05 20:52
Well, then only one question remains!

>Would you want to implement the implicit Find_Layer and adjust all the places?

Parent - By Zapper [de] Date 2015-09-04 22:06

>..but if i press the Keyboard down, the clonk can get the Rock
>..Don't is it a Layer Bug?


yes, probably a bug :)
Parent - - By Zapper [de] Date 2015-09-05 10:22
I fixed it so that you can only collect stuff from your layer now
Parent - - By vagner [br] Date 2015-09-05 16:56 Edited 2015-09-05 16:58
Thanks!
But the bug fix will be posted in the next release?
Parent - By Zapper [de] Date 2015-09-05 17:04
Yes, but you can always download the newest version on the snapshots page:
http://www.openclonk.org/nightly-builds/

The last version is from 5 minutes ago :)

If you want to see the changes, you can find them in our repository here:
https://git.openclonk.org/openclonk.git
Up Topic General / Help and Questions / Visibility

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill