Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
SubsystemArrowBlockBehavior.cs
浏览该文件的文档.
1using Engine;
3
4namespace Game {
7
8 public Random m_random = new();
9
10 public override int[] HandledBlocks => [];
11
12 public override void OnFiredAsProjectile(Projectile projectile) {
13 if (ArrowBlock.GetArrowType(Terrain.ExtractData(projectile.Value)) == ArrowBlock.ArrowType.FireArrow) {
14 m_subsystemProjectiles.AddTrail(projectile, Vector3.Zero, new SmokeTrailParticleSystem(20, 0.5f, float.MaxValue, Color.White));
15 projectile.ProjectileStoppedAction = ProjectileStoppedAction.Disappear;
16 projectile.IsIncendiary = true;
17 }
18 }
19
20 public override bool OnHitAsProjectile(CellFace? cellFace, ComponentBody componentBody, WorldItem worldItem) {
22 if (worldItem.Velocity.Length() > 10f) {
23 float num = 0.1f;
24 if (arrowType == ArrowBlock.ArrowType.FireArrow) {
25 num = 0.5f;
26 }
27 if (arrowType == ArrowBlock.ArrowType.WoodenArrow) {
28 num = 0.2f;
29 }
30 if (arrowType == ArrowBlock.ArrowType.DiamondArrow) {
31 num = 0f;
32 }
33 if (arrowType == ArrowBlock.ArrowType.IronBolt) {
34 num = 0.05f;
35 }
36 if (arrowType == ArrowBlock.ArrowType.DiamondBolt) {
37 num = 0f;
38 }
39 if (m_random.Float(0f, 1f) < num) {
40 return true;
41 }
42 }
43 return false;
44 }
45
46 public override void Load(ValuesDictionary valuesDictionary) {
47 base.Load(valuesDictionary);
49 }
50 }
51}
static ArrowType GetArrowType(int data)
override bool OnHitAsProjectile(CellFace? cellFace, ComponentBody componentBody, WorldItem worldItem)
override void Load(ValuesDictionary valuesDictionary)
override void OnFiredAsProjectile(Projectile projectile)
static int ExtractData(int value)
ValuesDictionary ValuesDictionary
static Color White
static readonly Vector3 Zero