Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (self.impaleChunk == null)
- {
- return;
- }
- self.stuckTime += 0.00357142859f;
- float num = Custom.LerpMap(self.stuckTime, 0.4f, 1f, 1f, 0.5f);
- self.attackReady = 1f;
- self.flyingThisFrame = (self.stuckTime > 0.5f && self.Consious);
- for (int i = 0; i < self.impaleDistances.GetLength(0); i++)
- {
- float d = Custom.LerpMap((float)i, 1f, (float)(self.bodyChunks.Length - 1), 1f, 0.1f) * num;
- Vector2 a = Custom.DirVec(self.bodyChunks[i].pos, self.impaleChunk.pos) * (Vector2.Distance(self.bodyChunks[i].pos, self.impaleChunk.pos) - self.impaleDistances[i, 0]);
- float num2 = self.impaleChunk.mass / (self.bodyChunks[i].mass + self.impaleChunk.mass);
- self.bodyChunks[i].vel += a * num2 * d;
- self.bodyChunks[i].pos += a * num2 * d;
- self.impaleChunk.vel -= a * (1f - num2) * d;
- self.impaleChunk.pos -= a * (1f - num2) * d;
- if (rot && self.impaleChunk.rotationChunk != null)
- {
- a = Custom.DirVec(self.bodyChunks[i].pos, self.impaleChunk.rotationChunk.pos) * (Vector2.Distance(self.bodyChunks[i].pos, self.impaleChunk.rotationChunk.pos) - self.impaleDistances[i, 1]);
- num2 = self.impaleChunk.rotationChunk.mass / (self.bodyChunks[i].mass + self.impaleChunk.rotationChunk.mass);
- self.bodyChunks[i].vel += a * num2 * d;
- self.bodyChunks[i].pos += a * num2 * d;
- self.impaleChunk.rotationChunk.vel -= a * (1f - num2) * d;
- self.impaleChunk.rotationChunk.pos -= a * (1f - num2) * d;
- }
- }
- if (self.Consious)
- {
- for (int j = 1; j < self.TotalSegments; j++)
- {
- self.AddSegmentVel(j, self.stuckTime * Custom.RNV() * UnityEngine.Random.value * UnityEngine.Random.value * UnityEngine.Random.value * 18f);
- }
- self.crawlSin += 0.2f + 0.4f * num;
- self.SinMovementInBody(2.5f * ((!self.small) ? 1f : 0.6f) * self.stuckTime, 2.5f * ((!self.small) ? 1f : 0.6f) * self.stuckTime, 0.6f, 0.6f);
- }
- if (self.stuckTime > 1f || (self.stuckTime > 0.2f && (self.grabbedBy.Count > 0 || !(self.impaleChunk.owner is Creature) || !self.room.VisualContact(self.mainBodyChunk.pos, self.impaleChunk.pos))))
- {
- self.stuckTime = 0f;
- self.mainBodyChunk.vel += Custom.DirVec(self.impaleChunk.pos, self.mainBodyChunk.pos) * 9f;
- self.bodyChunks[1].vel += Custom.DirVec(self.impaleChunk.pos, self.mainBodyChunk.pos) * 7f;
- self.impaleChunk = null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement