Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using ServerMod2.API;
- using Smod2.API;
- using Smod2.EventHandlers;
- using Smod2.Events;
- using UnityEngine;
- using UnityEngine.Networking;
- // Token: 0x0200015D RID: 349
- public partial class CharacterClassManager : NetworkBehaviour
- {
- // Token: 0x06000898 RID: 2200 RVA: 0x000367CC File Offset: 0x000349CC
- [Command(channel = 2)]
- private void CmdRegisterEscape()
- {
- if (Vector3.Distance(base.transform.position, base.GetComponent<Escape>().worldPosition) > (float)(base.GetComponent<Escape>().radius * 2))
- {
- return;
- }
- int classid = -1;
- List<Handcuffs> list = new List<Handcuffs>();
- foreach (Handcuffs handcuffs in UnityEngine.Object.FindObjectsOfType<Handcuffs>())
- {
- if (!(handcuffs == null) && !(handcuffs.cuffTarget == null) && !(handcuffs.cuffTarget != base.gameObject))
- {
- list.Add(handcuffs);
- }
- }
- PlayerCheckEscapeEvent playerCheckEscapeEvent = new PlayerCheckEscapeEvent(new SmodPlayer(base.gameObject))
- {
- AllowEscape = false,
- ChangeRole = Role.UNASSIGNED
- };
- EventManager.Manager.HandleEvent<IEventHandlerCheckEscape>(playerCheckEscapeEvent);
- if (playerCheckEscapeEvent.AllowEscape && playerCheckEscapeEvent.ChangeRole != Role.UNASSIGNED)
- {
- foreach (Handcuffs handcuffs2 in list)
- {
- handcuffs2.NetworkcuffTarget = null;
- }
- base.transform.Translate(0f, 200f, 0f);
- this.SetPlayersClass((int)playerCheckEscapeEvent.ChangeRole, base.gameObject, true);
- return;
- }
- CharacterClassManager component = base.GetComponent<CharacterClassManager>();
- global::Team team = this.klasy[component.curClass].team;
- if (team != global::Team.RSC)
- {
- if (team != global::Team.CDP)
- {
- return;
- }
- RoundSummary.escaped_ds++;
- if (ConfigFile.GetBool("escapee_restrained_check", false, false) && list.Count > 0)
- {
- classid = 13;
- }
- else
- {
- classid = 8;
- }
- }
- else
- {
- RoundSummary.escaped_scientists++;
- if (ConfigFile.GetBool("escapee_restrained_check", false, false) && list.Count > 0)
- {
- classid = 8;
- }
- else
- {
- classid = 4;
- }
- }
- foreach (Handcuffs handcuffs3 in list)
- {
- handcuffs3.NetworkcuffTarget = null;
- }
- base.transform.Translate(0f, 200f, 0f);
- this.SetPlayersClass(classid, base.gameObject, true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement