-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathKV3Surface.cs
108 lines (100 loc) · 2.89 KB
/
KV3Surface.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ValveKeyValue;
namespace KVSurfaceUpdater
{
internal class KV3Surface : KV3Object
{
public KVValue? Base;
public KVValue? density;
public KVValue? elasticity;
public KVValue? friction;
public KVValue? dampening;
public KVValue? stepleft;
public KVValue? stepright;
public KVValue? impacthard;
public KVValue? impactsoft;
public KVValue? bulletimpact;
public KVValue? Break;
public KVValue? scraperough;
public KVValue? scrapesmooth;
public KVValue? thickness;
public KVValue? gamematerial;
public KV3Decal? gamematerial_decal = null;
public KV3Surface(KVObject sourceObject) : base(sourceObject)
{
}
protected override void SetupWithKVObject(KVObject sourceObject)
{
Name = sourceObject.Name;
Base = sourceObject["base"];
density = sourceObject["density"];
elasticity = sourceObject["elasticity"];
friction = sourceObject["friction"];
dampening = sourceObject["dampening"];
stepleft = sourceObject["stepleft"];
stepright = sourceObject["stepright"];
impacthard = sourceObject["impacthard"];
impactsoft = sourceObject["impactsoft"];
bulletimpact = sourceObject["bulletimpact"];
Break = sourceObject["break"];
gamematerial = sourceObject["gamematerial"];
scraperough = sourceObject["scraperough"];
scrapesmooth = sourceObject["scrapesmooth"];
thickness = sourceObject["thickness"];
}
public override string ToString()
{
return @$"<!-- kv3 encoding:text:version{{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d}} format:generic:version{{7412167c-06e9-4698-aff2-e63eb59037e7}} -->
{{
data =
{{
BaseSurface = ""{(Base == null ? "data/surface/default.surface" : $"data/surface/{Prefix + (string)Base}.surface")}""
AudioMaterial = null
Description = ""{Name}""
Friction = {FloatOrDefault(friction)}
Elasticity = {FloatOrDefault(elasticity)}
Density = {FloatOrDefault(density)}
Thickness = {FloatOrDefault(thickness)}
Dampening = {FloatOrDefault(dampening)}
BounceThreshold = 50
ImpactEffects =
{{
Regular =
[
resource:"""",
]
Bullet =
[
resource:"""",
]
BulletDecal =
[
resource:""{(gamematerial_decal == null ? "" : $"data/decal/{gamematerial_decal.Name.ToLower()}.decal")}"",
]
}}
Sounds =
{{
FootLeft = ""{StringOrDefault(stepleft)}""
FootRight = ""{StringOrDefault(stepright)}""
FootLaunch = """"
FootLand = """"
Bullet = ""{StringOrDefault(bulletimpact)}""
SmoothScrape = ""{StringOrDefault(scrapesmooth)}""
RoughScrape = ""{StringOrDefault(scraperough)}""
ImpactHard = ""{StringOrDefault(impacthard)}""
ImpactSoft = ""{StringOrDefault(impactsoft)}""
}}
Breakables =
{{
BreakSound = """"
GenericGibs = null
}}
}}
}}";
}
}
}