-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLaunchSiteScript.R
85 lines (80 loc) · 3.03 KB
/
LaunchSiteScript.R
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
data <- read.csv("Launch_Sites.csv")
data.include <- data[data$Include == 1,]
Sites <- vector(mode = "list")
SitesHead <- c("@KSCSWITCHER:AFTER[RealSolarSystem]",
"{",
" @LaunchSites",
" {")
for (i in 1:nrow(data.include)) {
Sites[[i]] <- c(
" Site",
" {",
iconv(tolower(paste(" name = ", data.include$Code[i], "_",
strsplit(as.character(data.include$Location[i]), split = " ", fixed = T)[[1]][1],
sep = "")), from = 'UTF-8', to = 'ASCII//TRANSLIT'),
paste(" displayName = ", toupper(data.include$Code)[i], " - ", data.include$Location[i], sep = ""),
" description =",
" PQSCity",
" {",
" KEYname = KSC",
" changeGrassColor = true",
paste(" latitude = ", data.include$Lat[i], sep = ""),
paste(" longitude = ", data.include$Long[i], sep = ""),
paste(" repositionRadiusOffset = ", data.include$altitude[i]+50, sep = ""),
" repositionToSphereSurface = false",
" lodvisibleRangeMult = 6",
paste(" reorientFinalAngle = ", -90-data.include$Long[i], sep = ""),
" }",
" PQSMod_MapDecalTangent",
" {",
" radius = 20000",
" heightMapDeformity = 80",
paste(" absoluteOffset = ", data.include$altitude[i], sep = ""),
" absolute = true",
paste(" latitude = ", data.include$Lat[i], sep = ""),
paste(" longitude = ", data.include$Long[i], sep = ""),
" }",
" }")
}
writeLines(c(SitesHead,unlist(Sites), " }","}"), con = "GameData/RSS-Sites/Sites.cfg")
Comm <- vector(mode = "list")
CommHead<-c("@Kopernicus:BEFORE[RealSolarSystem_Late]",
"{",
" @Body[Kerbin]",
" {",
" @PQS",
" {",
" @Mods",
" {")
for (i in 1:nrow(data.include)) {
Comm[[i]] <- c(
" City2",
" {",
" name = LaunchSiteTrackingStation",
paste(" objectName = ", toupper(data.include$Code)[i], " - ", data.include$Location[i], sep = ""),
" isKSC = True",
" commnetStation = True",
" snapToSurface = True",
paste(" lat = ", data.include$Lat[i], sep = ""),
paste(" lon = ", data.include$Long[i], sep = ""),
paste(" alt = ", round(data.include$altitude[i],digits = 0) + 150, sep = ""),
" snapHeightOffset = 0",
" up = 0.0, 1.0, 0.0",
" rotation = 0",
" order = 100",
" enabled = True",
" LOD",
" {",
" Value",
" {",
" visibleRange = 30000",
" keepActive = False",
" model = BUILTIN/Dish",
" scale = 0.1, 0.1, 0.1",
" delete = False",
" }",
" }",
" }"
)
}
writeLines(c(CommHead,unlist(Comm), " }", " }", " }", "}"), con = "GameData/RSS-Sites/CommNet_Sites.cfg")