From 72093ffa7f15aa0e732c512b36647c6146111882 Mon Sep 17 00:00:00 2001 From: Maikel de Vries Date: Thu, 30 Nov 2017 18:54:02 +0100 Subject: [PATCH] fix switch target in horrid highway goal (#1960) --- .../LocomotiveHighway.ocd/Script.c | 19 +++++++++---------- planet/Worlds.ocf/HorridHighway.ocs/Script.c | 3 ++- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/planet/Worlds.ocf/HorridHighway.ocs/LocomotiveHighway.ocd/Script.c b/planet/Worlds.ocf/HorridHighway.ocs/LocomotiveHighway.ocd/Script.c index df8097600..ea1dca378 100644 --- a/planet/Worlds.ocf/HorridHighway.ocs/LocomotiveHighway.ocd/Script.c +++ b/planet/Worlds.ocf/HorridHighway.ocs/LocomotiveHighway.ocd/Script.c @@ -7,22 +7,21 @@ #include Library_Goal +#include Library_SwitchTarget /*-- Control --*/ -public func OpenDoor(object switch) +// Reaction to operation by a switch. +public func OnSetInputSignal(object operator, object switch, bool right) { - // Don't do anything here. - return; -} - -public func CloseDoor(object switch) -{ - if (!GetEffect("FxRunLocomotives", this) && !FindObject(Find_ID(Locomotive))) + if (!right) + { + if (!GetEffect("FxRunLocomotives", this) && !FindObject(Find_ID(Locomotive))) CreateEffect(FxRunLocomotives, 100, 36, this); - switch->ControlSwitchDir(nil, -1); - return; + switch->ControlSwitchDir(nil, -1); + } + _inherited(operator, switch, right, ...); } local FxRunLocomotives = new Effect diff --git a/planet/Worlds.ocf/HorridHighway.ocs/Script.c b/planet/Worlds.ocf/HorridHighway.ocs/Script.c index 9dda81adf..4fbbc5259 100644 --- a/planet/Worlds.ocf/HorridHighway.ocs/Script.c +++ b/planet/Worlds.ocf/HorridHighway.ocs/Script.c @@ -204,7 +204,8 @@ private func InitLeftIsland() { var switch = CreateObjectAbove(Switch, 20, LandscapeHeight() / 2); var goal = FindObject(Find_ID(Goal_LocomotiveHighway)); - switch->SetTarget(goal); + goal->SetPlrViewOnSignalChange(false); + switch->SetSwitchTarget(goal); switch->SetSwitchDir(-1); var guidepost = CreateObjectAbove(EnvPack_Guidepost2, 40, LandscapeHeight() / 2);