public override void OnCollidedWithBlock(WorldBase _world, int _clrIdx, Vector3i _blockPos, BlockValue _blockValue) { base.OnCollidedWithBlock(_world, _clrIdx, _blockPos, _blockValue); //if (!this.hasDriver || player == null || lastLandHitToolTipTime != -1 && Time.time - 2f < lastLandHitToolTipTime) if (!this.hasDriver || lastLandHitToolTipTime != -1 && Time.time - 2f < lastLandHitToolTipTime) { return; } // Slowing down the boat when it touches the ground Block block = Block.list[_blockValue.type]; if (!hasWaterAbove() && !(block.GetBlockName() == "air") && !block.GetType().IsSubclassOf(typeof(BlockLiquid)) && !(block.GetType() == typeof(BlockLiquidv2)) && !(block.GetBlockName() == "smallBoatDummyBlock") && !(block.GetBlockName() == "waterSupportBlock")) { //DebugMsg("Boat is touching Ground!"); isTouchingGround = true; if (LZ_float_field != null) { LZ_float_field.SetValue(this.vehicle, 1f); if (this.player != null && Time.time - 5f > lastLandHitToolTipTime) { GameManager.ShowTooltip(this.player, "This Vehicle can only move on Water."); lastLandHitToolTipTime = Time.time; } } } else { // Back to normal speed when in water isTouchingGround = false; if (LZ_float_field != null) { LZ_float_field.SetValue(this.vehicle, maxSpeedBackup); lastLandHitToolTipTime = -1; } } }
public override void Init(int _entityClass) { base.Init(_entityClass); Transform engine_splash = null; Transform[] transforms = this.GetComponentsInChildren <Transform>(true); foreach (Transform transform in transforms) { if (transform.name == "engine_splash") { engine_splash = transform; } } if (engine_splash != null) { DebugMsg("Found engine_splash Transform"); particleEmitter = engine_splash.GetComponent <EllipsoidParticleEmitter>(); if (particleEmitter != null) { DebugMsg("Found EllipsoidParticleEmitter"); particleEmitter.emit = false; } } if (LZ_float_field != null) { maxSpeedBackup = (float)LZ_float_field.GetValue(this.vehicle); } if (GS_VehicleSimulationInput_field != null) { vsi = (VehicleSimulationInput)GS_VehicleSimulationInput_field.GetValue(this); } }