// Function from file: shuttle.dm public virtual int dock(dynamic S1 = null) { int _default = 0; dynamic S0 = null; Type turf_type = null; Type area_type = null; ByTable L0 = null; ByTable L1 = null; double? rotation = null; dynamic A0 = null; dynamic T0 = null; int? i = null; Base_Data T02 = null; Ent_Static T1 = null; Ent_Static Ts1 = null; Ent_Dynamic AM = null; _default = this.canDock(S1); if (_default != 0) { //throw new Exception( "dock(): shuttle cannot dock" ); return(_default); } if (this.canMove()) { return(-1); } this.closePortDoors(); S0 = this.get_docked(); turf_type = typeof(Tile_Space); area_type = typeof(Zone_Space); if (Lang13.Bool(S0)) { if (Lang13.Bool(S0.turf_type)) { turf_type = S0.turf_type; } if (Lang13.Bool(S0.area_type)) { area_type = S0.area_type; } } L0 = this.return_ordered_turfs(this.x, this.y, this.z, this.dir, this.areaInstance); L1 = this.return_ordered_turfs(Lang13.IntNullable(S1.x), Lang13.IntNullable(S1.y), Lang13.IntNullable(S1.z), Lang13.IntNullable(S1.dir)); rotation = (GlobalFuncs.dir2angle(S1.dir) ?? 0) - (GlobalFuncs.dir2angle(this.dir) ?? 0); if ((rotation ?? 0) % 90 != 0) { rotation += (rotation ?? 0) % 90; } rotation = GlobalFuncs.SimplifyDegrees(rotation); if (this.areaInstance.contents.len != 0) { A0 = Lang13.FindObj("" + area_type); if (!Lang13.Bool(A0)) { A0 = Lang13.Call(area_type, null); } foreach (dynamic _a in Lang13.Enumerate(L0)) { T0 = _a; A0.contents.Add(T0); } } this.roadkill(L1, Convert.ToInt32(S1.dir)); i = null; i = 1; while ((i ?? 0) <= L0.len) { T02 = L0[i]; if (!(T02 != null)) { } else { T1 = L1[i]; if (!(T1 != null)) { } else { if (T02.type != ((dynamic)T02).baseturf) { ((dynamic)T02).copyTurf(T1); this.areaInstance.contents.Add(T1); if (T1 is Tile_Simulated) { Ts1 = T1; ((dynamic)Ts1).copy_air_with_tile(T02); } foreach (dynamic _b in Lang13.Enumerate(T02, typeof(Ent_Dynamic))) { AM = _b; AM.onShuttleMove(T1, rotation); } } if (Lang13.Bool(rotation)) { T1.shuttleRotate(rotation); } ((dynamic)T1).redraw_lighting(); GlobalVars.SSair.remove_from_active(T1); ((dynamic)T1).CalculateAdjacentTurfs(); GlobalVars.SSair.add_to_active(T1, true); ((dynamic)T02).ChangeTurf(turf_type); ((dynamic)T02).redraw_lighting(); GlobalVars.SSair.remove_from_active(T02); ((dynamic)T02).CalculateAdjacentTurfs(); GlobalVars.SSair.add_to_active(T02, true); } } i++; } this.loc = S1.loc; this.dir = Convert.ToInt32(S1.dir); return(_default); }