Not logged inOpenClonk Forum
Up Topic Development / Scenario & Object Development / Basic functionality for switches
1 2 Previous Next
Parent - By Marky [de] Date 2017-11-27 17:47

>On question remains: on which side of the door is the default electronics station?!


Below? :o just kidding, it's a good question actually. Could be visible in the construction preview and allow flipping it.
Parent - By Zapper [de] Date 2017-11-25 10:41
Looks good so far! (from skimming over it)

>Could be replaced by one function with boolean argument if desired.


Some words to the notation:
If DoSwitchOn is a callback (I can't tell from the name), I'd suggest starting it with "On" (OnSwitchOn). If it's a setter function that changes internal state, I'd suggest starting it with "Set" (SetSwitchOn). And no matter which one it is, I'd suggest merging DoSwitchOn and DoSwitchOff into one function (e.g. SetSwitchState(bool)), like you mention. Usually you have conditions like
if (pressed) SetSwitchOn() else SetSwitchOff() which are more maintainable when written as SetSwitchState(pressed). Even in your base library, it would already remove code duplication (because most of the code in DoSwitchOn and DoSwitchOff is copy-pasted).
Parent - - By Maikel Date 2017-11-26 17:33
Tested what is in the main repos. Fixed my local stuff which was quite easy! So that is all good.

Regarding moving the player view, I think it should move back again after some time, as long as the light is on basically. Also when switching back and forth the view moves from door to clonk to door to clonk. It is better if it stays with the door all the time.
Parent - - By Marky [de] Date 2017-11-26 19:51
Switching back is possible, no problem. Don't know how I can prevent switching the view back to the Clonk if you interact repeatedly, though.

Your local stuff is tower of despair? Also, are there any other packs that have custom switches? I'd adjust those, too, but it's really not that much work, as you said.
Parent - - By Maikel Date 2017-11-26 22:54

> Don't know how I can prevent switching the view back to the Clonk if you interact repeatedly, though.


Me neither, anyone else has an idea?
Parent - By Sven2 [us] Date 2017-11-27 06:21
Shouldn't it be impossible to see if it happens in the same frame? The view is switched to the clonk before the control execution, and then back to the switch after.

Or is it resetting as part of the KeyUp? In this case, we could just remove that.
Parent - By Marky [de] Date 2018-02-06 21:22
Here is the current state of the objects, since I am stuck with low motivation and need input: https://github.com/gitMarky/openclonk/tree/switches

The experimental folder contains a test scenario with two stations (one with a switch), and a dynamite object that can be connected to it. Connections are done via pipe object at the moment (I wanted to avoid creating yet another object with the "same" functionality), and may behave buggy when connecting stations and objects that are not intended for connection.
The station is an or-gate currently, and this cannot be changed at the moment.

My thoughts:
* Instead of making the station and the switch separate structures, I'd rather like to be able to add switches to a station, like a basement.
* Instead of having the pipe connect to stations, I'd prefer a "wire box"/"wire kit" or whatever that can also add the switch to the station.
* The lorry dumping its contents as a reaction to switching it is a good idea, however I did not implement that, because it is difficult to decide in which direction to dump (left or right?) and I'd have to possibly animate the lorry body going sideways for dumping contents on the spot (in itself not a problem, but I'd not make the effort yet in case we decide to scrap the whole thing)
* Does it even add anything to the gameplay? At the moment it's rather limited. The advantages for Hazard, etc. are already there with the basic switch interface in OC 8.0
Up Topic Development / Scenario & Object Development / Basic functionality for switches
1 2 Previous Next

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill