We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a1e8325 commit 62dafafCopy full SHA for 62dafaf
1 file changed
common/package.go
@@ -20,6 +20,8 @@ package common
20
21
import (
22
"fmt"
23
+ "path/filepath"
24
+ "strings"
25
"time"
26
)
27
@@ -70,7 +72,18 @@ func (pkg Package) Marshal() []byte {
70
72
if pkg.Type == "map" {
71
73
script["uid"] = fmt.Sprintf("map_%d", pkg.ID)
74
script["luamenu_installed"] = "OnMapDownloaded();"
- script["luamenu_action"] = fmt.Sprintf("OnMapSelected( '%s' );", pkg.Name)
75
+
76
+ // find true name if it's different
77
+ mapname := pkg.Name
78
+ for _, c := range pkg.Content {
79
+ if filepath.Ext(c.Path) != ".bsp" {
80
+ continue
81
+ }
82
83
+ mapname = strings.TrimSuffix(filepath.Base(c.Path), filepath.Ext(c.Path))
84
85
86
+ script["luamenu_action"] = fmt.Sprintf("OnMapSelected('%s');", mapname)
87
}
88
89
if len(pkg.Content) != 0 {
0 commit comments