// September 2015 // Levee Patroller / Dijk Patrouille // This source file is (c) by Deltares. This source file is open source but only available to select users. Do not redistribute without written permission of Stichting Deltares, Delft, The Netherlands. // This header has been automatically generated. class LeveeFailureBotulisme extends LeveeFailure placeable; #exec OBJ LOAD FILE=NVIDIA_TT_V1.utx var array deadobjects; Enum DroogteNodeType { Type_None, Type_BlauwAlg, Type_Duck, }; var DroogteNodeType activestate; function SetFailureOptions() { local int pos; /// Failure information: Mechanism = FM_WaterQuality; LinkedTile.Mechanism = Mechanism; NL_FailureName = "Botulisme"; EN_FailureName = "Botulisme"; activestate = Type_BlauwAlg; If (FRand() > 0.5) { activestate = Type_Duck; } /// Find droogte keyword string: pos = Instr(LinkedTile.extraconfig, "forcefish"); if (pos != -1) { activestate = Type_BlauwAlg; } super.SetFailureOptions(); LinkedTile.CurrentState = STA_Critical; } function CreateObjects() { local int i; local DynamicMover M; local DynamicMeshActor sMA; // local Emitter E; local Vector vpos; /// Used to find the matching water plane: //local FluidSurfaceInfo fsi; //local Name watermovertag; ////local FluidSurfaceInfo foundfsi; local float waterheight; local Rotator newrot; //watermovertag = LinkedTile.WaterMover.Name; local GeoBlauwAlg alg; local int itemcount; /// ID is the same as the linked object: id = LinkedTile.Name; /// Creating World Objects: /// For the record: The likely center is: -26816.00,9600.00,-384.00 /// For the record: The likely center rotation: 0,0,0 /// Set relative rotation, the original failure was based on a rotation of 0. So now we need to turn it back. SetFailureRelativeRotation(0); //BoezemWaterMover // ForEach AllActors(class 'FluidSurfaceInfo', fsi) // { Log("LinkedTile: " $ LinkedTile.BotulismeFluidSurface); if (LinkedTile.BotulismeFluidSurface != None) { // foundfsi = fsi; waterheight = LinkedTile.BotulismeFluidSurface.location.z + 10; // break; } Log("height: " $ waterheight); // } deadobjects.Insert(0, 7); M = CreateMover(RotateVector(-1418.66,-1800.00,-492.83), id$"measurebotulisme", StaticMesh'TrafficSignsSM.Pole.Pole' , 1.00, 2); M.SetKeyPos( RotateVectorNoLocation(0.00,0.00,512.00), 1); M.SetKeyRot( rot(0,0,0), 1); RotationOffset(M, LinkedTile.Rotation, 880,0,0); M = CreateMover(RotateVector(-1456.96,-1804.00,-134.78), id$"measurebotulisme", StaticMesh'TrafficSignsSM.Square.botulisme' , 1.00, 2); M.SetKeyPos( RotateVectorNoLocation(0.00,0.00,512.00), 1); M.SetKeyRot( rot(0,0,0), 1); M.AttachTag = GetName(id$"botulismebord"); M.SetBase(GetActor(M.AttachTag), vect(0,0,1)); RotationOffset(M, LinkedTile.Rotation, -15512,-2016,0); /// If we have ducks enabled: if (activestate == Type_Duck) { If (FRand() > 0.5) { M = CreateMover(RotateVector(-1712.00,-524.00,32.00), id$"measurebotulisme", StaticMesh'NatureSM.dead_animals.dead_duck' , 1.00, 2); M.SetDrawScale(0.50); M.SetKeyPos( RotateVectorNoLocation(0.00,0.00,-197.00), 1); M.SetKeyRot( rot(0,0,0), 1); RotationOffset(M, LinkedTile.Rotation, 0,-12584,0); M.SetLocation( GetRaytracedTerrain(M) ); itemcount++; } If (FRand() > 0.8) { M = CreateMover(RotateVector(-1552.00,-1648.00,32.00), id$"measurebotulisme", StaticMesh'NatureSM.dead_animals.dead_duck' , 1.00, 2); M.SetDrawScale(0.50); M.SetKeyPos( RotateVectorNoLocation(0.00,0.00,-197.00), 1); M.SetKeyRot( rot(0,0,0), 1); RotationOffset(M, LinkedTile.Rotation, 0,1104,0); M.SetLocation( GetRaytracedTerrain(M) ); itemcount++; } If (FRand() > 0.9 ) { M = CreateMover(RotateVector(-1268.00,-1008.00,100.00), id$"measurebotulisme", StaticMesh'NatureSM.dead_animals.dead_duck' , 1.00, 2); M.SetDrawScale(0.50); M.SetKeyPos( RotateVectorNoLocation(0.00,0.00,-197.00), 1); M.SetKeyRot( rot(0,0,0), 1); RotationOffset(M, LinkedTile.Rotation, -1840,-46320,3976); M.SetLocation( GetRaytracedTerrain(M) ); itemcount++; } If (FRand() > 0.95) { M = CreateMover(RotateVector(-1040.00,-172.00,216.00), id$"measurebotulisme", StaticMesh'NatureSM.dead_animals.dead_duck' , 1.00, 2); M.SetDrawScale(0.50); M.SetKeyPos( RotateVectorNoLocation(0.00,0.00,-197.00), 1); M.SetKeyRot( rot(0,0,0), 1); RotationOffset(M, LinkedTile.Rotation, 3488,7240,3704); M.SetLocation( GetRaytracedTerrain(M) ); itemcount++; } If (FRand() > 0.3) { M = CreateMover(RotateVector(-900.00,-1544.00,308.00), id$"measurebotulisme", StaticMesh'NatureSM.dead_animals.dead_duck' , 1.00, 2); M.SetDrawScale(0.50); M.SetKeyPos( RotateVectorNoLocation(0.00,0.00,-197.00), 1); M.SetKeyRot( rot(0,0,0), 1); RotationOffset(M, LinkedTile.Rotation, 2912,-12584,-5624); M.SetLocation( GetRaytracedTerrain(M) ); itemcount++; } If ( (FRand() > 0.75 && itemcount < 3) || itemcount < 2) { M = CreateMover(RotateVector(-564.00,-428.00,412.00), id$"measurebotulisme", StaticMesh'NatureSM.dead_animals.dead_duck' , 1.00, 2); M.SetDrawScale(0.50); M.SetKeyPos( RotateVectorNoLocation(0.00,0.00,-197.00), 1); M.SetKeyRot( rot(0,0,0), 1); RotationOffset(M, LinkedTile.Rotation, 0,-5192,0); M.SetLocation( GetRaytracedTerrain(M) ); itemcount++; } If ( (FRand() > 0.35 && itemcount < 3) || itemcount < 2) { M = CreateMover(RotateVector(-292.00,-1228.00,408.00), id$"measurebotulisme", StaticMesh'NatureSM.dead_animals.dead_duck' , 1.00, 2); M.SetDrawScale(0.50); M.SetKeyPos( RotateVectorNoLocation(0.00,0.00,-197.00), 1); M.SetKeyRot( rot(0,0,0), 1); RotationOffset(M, LinkedTile.Rotation, 0,-31768,0); M.SetLocation( GetRaytracedTerrain(M) ); itemcount++; } } if (activestate == Type_BlauwAlg) { If (FRand() > 0.5) { M = CreateMover(RotateVector(32.00,-1432.00,waterheight+12), id$"measurebotulisme", StaticMesh'NatureSM.dead_animals.blankvoorn' , 1.00, 2); M.SetDrawScale(0.10); M.SetKeyPos( RotateVectorNoLocation(0.00,0.00,-271.00), 1); M.SetKeyRot( rot(0,0,0), 1); RotationOffset(M, LinkedTile.Rotation, 18608,-28928,0); /// Odd fix... vpos = M.Location; vpos.z = waterheight; M.SetLocation(vpos); M.SetLocation( GetRaytracedWater(M) ); itemcount++; } If (FRand() > 0.9) { M = CreateMover(RotateVector(205.00,-1172.00,waterheight+12), id$"measurebotulisme", StaticMesh'NatureSM.dead_animals.blankvoorn' , 1.00, 2); M.SetDrawScale(0.10); M.SetKeyPos( RotateVectorNoLocation(0.00,0.00,-271.00), 1); M.SetKeyRot( rot(0,0,0), 1); RotationOffset(M, LinkedTile.Rotation, 31440,-28224,0); /// Odd fix... vpos = M.Location; vpos.z = waterheight; M.SetLocation(vpos); M.SetLocation( GetRaytracedWater(M) ); vpos = M.Location; vpos.x += -250 + Rand(400); vpos.y += -250 + Rand(400); //vpos.z = waterheight; newrot = rot(0,0,0); newrot.Yaw += Rand(32768); alg = (Spawn( class'GeoBlauwAlg',,,vpos, newrot)); alg.Tag = GetNAme(id$"measurebotulisme"); itemcount++; } If (FRand() > 0.9) { M = CreateMover(RotateVector(-128.00,-584.00,waterheight+12), id$"measurebotulisme", StaticMesh'NatureSM.dead_animals.blankvoorn' , 1.00, 2); M.SetDrawScale(0.10); M.SetKeyPos( RotateVectorNoLocation(0.00,0.00,-271.00), 1); M.SetKeyRot( rot(0,0,0), 1); RotationOffset(M, LinkedTile.Rotation, 18608,0,0); /// Odd fix... vpos = M.Location; vpos.z = waterheight; M.SetLocation(vpos); M.SetLocation( GetRaytracedWater(M) ); vpos = M.Location; vpos.x += -250 + Rand(400); vpos.y += -250 + Rand(400); //vpos.z = waterheight; newrot = rot(0,0,0); newrot.Yaw += Rand(32768); alg = (Spawn( class'GeoBlauwAlg',,,vpos, newrot)); alg.Tag = GetNAme(id$"measurebotulisme"); itemcount++; } If (FRand() > 0.4 || itemcount < 2) { M = CreateMover(RotateVector(8.00,-263.00,waterheight+12), id$"measurebotulisme", StaticMesh'NatureSM.dead_animals.blankvoorn' , 1.00, 2); M.SetDrawScale(0.10); M.SetKeyPos( RotateVectorNoLocation(0.00,0.00,-271.00), 1); M.SetKeyRot( rot(0,0,0), 1); RotationOffset(M, LinkedTile.Rotation, 31440,-33824,0); /// Odd fix... vpos = M.Location; vpos.z = waterheight; M.SetLocation(vpos); M.SetLocation( GetRaytracedWater(M) ); vpos = M.Location; vpos.x += -250 + Rand(400); vpos.y += -250 + Rand(400); // vpos.z = waterheight; newrot = rot(0,0,0); newrot.Yaw += Rand(32768); alg = (Spawn( class'GeoBlauwAlg',,,vpos, newrot)); alg.Tag = GetNAme(id$"measurebotulisme"); itemcount++; } If (FRand() > 0.75 || itemcount < 2) { M = CreateMover(RotateVector(248.00,-212.00,waterheight+12), id$"measurebotulisme", StaticMesh'NatureSM.dead_animals.blankvoorn' , 1.00, 2); M.SetDrawScale(0.10); M.SetKeyPos( RotateVectorNoLocation(0.00,0.00,-271.00), 1); M.SetKeyRot( rot(0,0,0), 1); RotationOffset(M, LinkedTile.Rotation, 18608,-28744,0); /// Odd fix... vpos = M.Location; vpos.z = waterheight; M.SetLocation(vpos); M.SetLocation( GetRaytracedWater(M) ); vpos = M.Location; vpos.x += -250 + Rand(400); vpos.y += -250 + Rand(400); //vpos.z = waterheight; newrot = rot(0,0,0); newrot.Yaw += Rand(32768); alg = (Spawn( class'GeoBlauwAlg',,,vpos, newrot)); alg.Tag = GetNAme(id$"measurebotulisme"); itemcount++; } } sMA = CreateMesh(Location, id$"StaticMeshActor", StaticMesh'SecDikeSM.SecDike.boezem_recht_no_road'); RotationOffset(sMA, LinkedTile.Rotation, 0,0,0); /// Add dry tex if needed: /// Find droogte keyword string: i = Instr(level.title, "Droogte"); Log("Droogte in title?"); Log(i); if (i != -1) { sMA.Skins.Insert(0,1); sMA.Skins[0] = TexScaler'ArnesEnvironmentDryT.PrimDikeShaders.GrassScaler2x'; } /// Call parent: BoundingBoxScale = vect(128,450,0); Super.CreateObjects(); } /// jln - 17-03-2010 This function gets the terrain underneath the object, and returns the position. function Vector GetRaytracedTerrain(Mover m) { local vector HitLocation, HitNormal; local vector start, end; local Actor temp; start = (vect(0,0,1)*128)+m.Location; end = vect(0,0,-1)*512+start; /// Find intersecting object foreach TraceActors ( class'Actor', temp, HitLocation,HitNormal,end, start) { if (temp.IsA('StaticMeshActor') || temp.IsA('TerrainInfo') || temp.IsA('Leveetile') ) { Log("[GetRaytracedTerrain: " $ temp); return HitLocation; } } /// Nothing found, return current location: return m.Location; } function Vector GetRaytracedWater(Mover m) { local vector HitLocation, HitNormal; local vector start, end; local Actor temp; start = (vect(0,0,1)*128)+m.Location; end = vect(0,0,-1)*512+start; /// Find intersecting object foreach TraceActors ( class'Actor', temp, HitLocation,HitNormal,end, start) { if (temp.IsA('FluidsurfaceInfo') ) { Log("[GetRaytracedWater: " $ temp); HitLocation.x = m.Location.x; HitLocation.y = m.Location.y; return HitLocation; } } /// Nothing found, return current location: return m.Location; } function CreateTriggers() { local DScriptedTrigger sT; local int pos; sT = Spawn(class'DScriptedTrigger'); /// Tag is the same as the linked object name: sT.Tag = GetFailureName(); FailureScript = sT; /// Store in public leveetile var. /// Position is the same as the linked object: sT.SetLocation(LinkedTile.Location); sT.Actions.insert(0, 3); /// Add end trigger if we are doing minigames: /// Find "forceend" keyword string: /// After 125 secs: pos = Instr(LinkedTile.extraconfig, "forceend"); if (pos != -1) { sT.Actions[0] = new class'ACTION_WaitForTimer'; ACTION_WaitForTimer(sT.Actions[0]).PauseTime = 60; sT.Actions[1] = new class'ACTION_EndGame'; } } function CreateSignals() { local SignalBioActivity signal0; local SignalReportBioActivity signal0report0; /// Signals information: Signals.Insert(0,1); // done: signal0 = New class'SignalBioActivity'; signal0.RiskCause=RISK_WaterQuality; signal0.FirstState = STA_Critical; signal0.CrossCutLocation=CUT_OuterSlope; signal0.SignalReports.insert(0,1); signal0report0 = New class'SignalReportBioActivity'; signal0report0.GeoState = STA_Critical; signal0.SignalReports[0] = signal0report0; Signals[0] = signal0; } function CreateMeasures() { local Measure Msr; /// Creating measures: Measures.Insert(0,1); Msr = New class'Measure'; Msr.SetPropertyText("EventMeasureTaken", id$"measurebotulisme"); Msr.bMeasureEffective = True; Msr.MeasureType = MEA_Removewaste; Measures[0] = Msr; } function CreateMeasureScripts() { // local DScriptedTrigger sT; } defaultproperties { FailureSize = TS_16M; }