-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathModifiers.cs
63 lines (58 loc) · 1.95 KB
/
Modifiers.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using MetroOverhaul.NEXT;
using System;
using System.Linq;
using UnityEngine;
namespace MetroOverhaul
{
public static class Modifiers
{
public static void RemoveElectricityPoles(NetInfo prefab)
{
if (prefab?.m_lanes == null)
{
return;
}
foreach (var lane in prefab.m_lanes)
{
var mLaneProps = lane.m_laneProps;
var props = mLaneProps?.m_props;
if (props == null)
{
continue;
}
lane.m_laneProps = ScriptableObject.CreateInstance<NetLaneProps>();
lane.m_laneProps.m_props = (from prop in props
where prop != null
let mProp = prop.m_prop
where mProp != null
where mProp.name != "RailwayPowerline"
select prop).ToArray();
}
}
public static void CreatePavement(NetInfo prefab)
{
if (prefab == null)
{
return;
}
prefab.m_createGravel = false;
prefab.m_createRuining = false;
prefab.m_createPavement = true;
}
public static void MakePedestrianLanesNarrow(NetInfo prefab, NetInfoVersion version)
{
if (version == NetInfoVersion.Tunnel)
{
if (prefab?.m_lanes == null)
{
return;
}
foreach (var lane in prefab.m_lanes.Where(lane => lane != null && lane.m_laneType == NetInfo.LaneType.Pedestrian))
{
lane.m_width = 2;
lane.m_position = Math.Sign(lane.m_position) * (4 + .5f * lane.m_width);
}
}
}
}
}