Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
SubsystemBulletBlockBehavior.cs
浏览该文件的文档.
1using Engine;
3
4namespace Game {
7
9
11
12 public Random m_random = new();
13
14 public override int[] HandledBlocks => [];
15
16 public override bool OnHitAsProjectile(CellFace? cellFace, ComponentBody componentBody, WorldItem worldItem) {
18 bool result = true;
19 if (cellFace.HasValue) {
20 int cellValue = m_subsystemTerrain.Terrain.GetCellValue(cellFace.Value.X, cellFace.Value.Y, cellFace.Value.Z);
21 int num = Terrain.ExtractContents(cellValue);
22 Block obj = BlocksManager.Blocks[num];
23 if (worldItem.Velocity.Length() > 30f) {
24 m_subsystemExplosions.TryExplodeBlock(cellFace.Value.X, cellFace.Value.Y, cellFace.Value.Z, cellValue);
25 }
26 if (obj.GetDensity(cellValue) >= 1.5f
27 && worldItem.Velocity.Length() > 30f) {
28 float num2 = 1f;
29 float minDistance = 8f;
30 if (bulletType == BulletBlock.BulletType.BuckshotBall) {
31 num2 = 0.25f;
32 minDistance = 4f;
33 }
34 if (m_random.Float(0f, 1f) < num2) {
35 m_subsystemAudio.PlayRandomSound(
36 "Audio/Ricochets",
37 1f,
38 m_random.Float(-0.2f, 0.2f),
39 new Vector3(cellFace.Value.X, cellFace.Value.Y, cellFace.Value.Z),
40 minDistance,
41 true
42 );
43 result = false;
44 }
45 }
46 }
47 return result;
48 }
49
50 public override void Load(ValuesDictionary valuesDictionary) {
51 base.Load(valuesDictionary);
52 m_subsystemTerrain = Project.FindSubsystem<SubsystemTerrain>(true);
53 m_subsystemAudio = Project.FindSubsystem<SubsystemAudio>(true);
55 }
56 }
57}
virtual float GetDensity(int value)
static BulletType GetBulletType(int data)
override bool OnHitAsProjectile(CellFace? cellFace, ComponentBody componentBody, WorldItem worldItem)
override void Load(ValuesDictionary valuesDictionary)
static int ExtractContents(int value)
static int ExtractData(int value)
ValuesDictionary ValuesDictionary