void Awake() { if(startingDirection == null){ throw new Exception("No starting direction"); } characterController = GetComponent<CharacterController>(); mind = GetComponent<Mind>(); }
public CloningStartedMessage(Mind capturedMind) { CapturedMind = capturedMind; }
/// <summary> /// Use this when a player is currently a ghost and wants to reenter their body. /// </summary> /// <param name="forConnection">connection to transfer control to</param> /// TODO: Remove need for this parameter /// <param name="forConnection">object forConnection is currently in control of</param> /// <param name="forMind">mind to transfer control back into their body</param> public static void ServerGhostReenterBody(NetworkConnection forConnection, GameObject fromObject, Mind forMind) { var body = forMind.GetCurrentMob(); var oldGhost = forMind.ghost; var ps = body.GetComponent <PlayerScript>(); var mind = ps.mind; var occupation = mind.occupation; var settings = ps.characterSettings; ServerTransferPlayer(forConnection, body, fromObject, EVENT.PlayerRejoined, settings, oldGhost != null); body.GetComponent <PlayerScript>().playerNetworkActions.ReenterBodyUpdates(); if (oldGhost) { Despawn.ServerSingle(oldGhost.gameObject); } }
public ClonerDNAEntry(Mind m, HumanoidCharacterProfile hcp) { Mind = m; Profile = hcp; }
#pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { BeginContext(54, 8, true); WriteLiteral("\r\n\r\n<h2>"); EndContext(); BeginContext(63, 19, false); #line 4 "E:\ПВИ Курсач\MinderXAuth v3\MinderXAuth\Views\Home\Lenta.cshtml" Write(ViewData["Message"]); #line default #line hidden EndContext(); BeginContext(82, 9, true); WriteLiteral("</h2>\r\n\r\n"); EndContext(); BeginContext(92, 42, false); #line 6 "E:\ПВИ Курсач\MinderXAuth v3\MinderXAuth\Views\Home\Lenta.cshtml" Write(Html.Partial("_GetUser", ViewData["user"])); #line default #line hidden EndContext(); BeginContext(134, 148, true); WriteLiteral("\r\n\r\n<h2>While you were away...</h2>\r\n\r\n<div style=\"position:center; left:50px; right:50px\">\r\n <table border=\"1\" width=\"100%\" cellpadding=\"5\">\r\n\r\n"); EndContext(); #line 13 "E:\ПВИ Курсач\MinderXAuth v3\MinderXAuth\Views\Home\Lenta.cshtml" foreach (var mind in Model) { string commentBlock = "comment" + mind.MindId.ToString(); Mind k = new Mind { NumOfLikes = mind.NumOfLikes, MindId = mind.MindId }; #line default #line hidden BeginContext(496, 40, true); WriteLiteral(" <tr>\r\n <td><a"); EndContext(); BeginWriteAttribute("href", " href=\"", 536, "\"", 577, 2); WriteAttributeValue("", 543, "/UserPage/UserPage?id=", 543, 22, true); #line 22 "E:\ПВИ Курсач\MinderXAuth v3\MinderXAuth\Views\Home\Lenta.cshtml" WriteAttributeValue("", 565, mind.UserId, 565, 12, false); #line default #line hidden EndWriteAttribute(); BeginContext(578, 6, true); WriteLiteral("> <img"); EndContext(); BeginWriteAttribute("src", " src=\"", 584, "\"", 603, 1); #line 22 "E:\ПВИ Курсач\MinderXAuth v3\MinderXAuth\Views\Home\Lenta.cshtml" WriteAttributeValue("", 590, mind.UserPic, 590, 13, false); #line default #line hidden EndWriteAttribute(); BeginContext(604, 76, true); WriteLiteral(" class=\"img-circle\" height=\"100\" width=\"100\"></a></td>\r\n <td>"); EndContext(); BeginContext(681, 11, false); #line 23 "E:\ПВИ Курсач\MinderXAuth v3\MinderXAuth\Views\Home\Lenta.cshtml" Write(mind.MindId); #line default #line hidden EndContext(); BeginContext(692, 30, true); WriteLiteral("</td>\r\n <td><p>"); EndContext(); BeginContext(723, 13, false); #line 24 "E:\ПВИ Курсач\MinderXAuth v3\MinderXAuth\Views\Home\Lenta.cshtml" Write(mind.MindMess); #line default #line hidden EndContext(); BeginContext(736, 31, true); WriteLiteral("</p></td>\r\n <td>"); EndContext(); BeginContext(768, 11, false); #line 25 "E:\ПВИ Курсач\MinderXAuth v3\MinderXAuth\Views\Home\Lenta.cshtml" Write(mind.UserId); #line default #line hidden EndContext(); BeginContext(779, 27, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(807, 15, false); #line 26 "E:\ПВИ Курсач\MinderXAuth v3\MinderXAuth\Views\Home\Lenta.cshtml" Write(mind.DateOfMind); #line default #line hidden EndContext(); BeginContext(822, 29, true); WriteLiteral("</td>\r\n <td>\r\n"); EndContext(); #line 28 "E:\ПВИ Курсач\MinderXAuth v3\MinderXAuth\Views\Home\Lenta.cshtml" string nameBlock = "numOfLike" + mind.MindId.ToString(); string formblock = "formblock" + mind.MindId.ToString(); #line default #line hidden BeginContext(1062, 51, true); WriteLiteral(" <div>\r\n "); EndContext(); BeginContext(1113, 344, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "399d955719f14d76a46c128bc91f7c72", async() => { BeginContext(1260, 2, true); WriteLiteral("\r\n"); EndContext(); BeginContext(1426, 24, true); WriteLiteral(" "); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper); BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "id", 1, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line 33 "E:\ПВИ Курсач\MinderXAuth v3\MinderXAuth\Views\Home\Lenta.cshtml" AddHtmlAttributeValue("", 1123, formblock, 1123, 10, false); #line default #line hidden EndAddHtmlAttributeValues(__tagHelperExecutionContext); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2); BeginWriteTagHelperAttribute(); WriteLiteral("#"); #line 33 "E:\ПВИ Курсач\MinderXAuth v3\MinderXAuth\Views\Home\Lenta.cshtml" Write(nameBlock); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __tagHelperExecutionContext.AddHtmlAttribute("data-ajax-update", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1457, 32, true); WriteLiteral("\r\n\r\n <div"); EndContext(); BeginWriteAttribute("id", " id=\"", 1489, "\"", 1504, 1); #line 38 "E:\ПВИ Курсач\MinderXAuth v3\MinderXAuth\Views\Home\Lenta.cshtml" WriteAttributeValue("", 1494, nameBlock, 1494, 10, false); #line default #line hidden EndWriteAttribute(); BeginContext(1505, 31, true); WriteLiteral(">\r\n "); EndContext(); BeginContext(1537, 49, false); #line 39 "E:\ПВИ Курсач\MinderXAuth v3\MinderXAuth\Views\Home\Lenta.cshtml" Write(Html.Partial("~/Views/Home/addLike.cshtml", mind)); #line default #line hidden EndContext(); BeginContext(1586, 201, true); WriteLiteral("\r\n </div>\r\n\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n\r\n <div>\r\n\r\n "); EndContext(); BeginContext(1787, 393, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "3dc1874707cc4d9690f136a71b536802", async() => { BeginContext(1924, 203, true); WriteLiteral("\r\n <input type=\"submit\" value=\"add comment\">\r\n <input type=\"text\" name=\"commentText\">\r\n <input type=\"hidden\" name=\"MindId\""); EndContext(); BeginWriteAttribute("value", " value=", 2127, "", 2146, 1); #line 53 "E:\ПВИ Курсач\MinderXAuth v3\MinderXAuth\Views\Home\Lenta.cshtml" WriteAttributeValue("", 2134, mind.MindId, 2134, 12, false); #line default #line hidden EndWriteAttribute(); BeginContext(2146, 27, true); WriteLiteral(">\r\n "); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_4); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2); BeginWriteTagHelperAttribute(); WriteLiteral("#"); #line 50 "E:\ПВИ Курсач\MinderXAuth v3\MinderXAuth\Views\Home\Lenta.cshtml" Write(commentBlock); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __tagHelperExecutionContext.AddHtmlAttribute("data-ajax-update", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(2180, 32, true); WriteLiteral("\r\n\r\n <div"); EndContext(); BeginWriteAttribute("id", " id=\"", 2212, "\"", 2230, 1); #line 56 "E:\ПВИ Курсач\MinderXAuth v3\MinderXAuth\Views\Home\Lenta.cshtml" WriteAttributeValue("", 2217, commentBlock, 2217, 13, false); #line default #line hidden EndWriteAttribute(); BeginContext(2231, 31, true); WriteLiteral(">\r\n "); EndContext(); BeginContext(2263, 51, false); #line 57 "E:\ПВИ Курсач\MinderXAuth v3\MinderXAuth\Views\Home\Lenta.cshtml" Write(Html.Partial("~/Views/Home/_Comments.cshtml", mind)); #line default #line hidden EndContext(); BeginContext(2314, 104, true); WriteLiteral("\r\n </div>\r\n </div>\r\n </td>\r\n </tr>\r\n"); EndContext(); #line 62 "E:\ПВИ Курсач\MinderXAuth v3\MinderXAuth\Views\Home\Lenta.cshtml" } #line default #line hidden BeginContext(2429, 20, true); WriteLiteral(" </table>\r\n</div>"); EndContext(); }
/// <summary> /// Sets the owner of the objective and performs setup if required /// </summary> public void DoSetup(Mind owner) { Owner = owner; Setup(); }
// Function from file: ninja_event.dm public override bool start( ) { ByTable spawn_locs = null; Obj_Effect_Landmark L = null; ByTable candidates = null; dynamic C = null; Mind Mind = null; ByTable possible_targets = null; Mind M = null; ByTable objectives = null; Objective_Download O = null; Objective_Steal_Special O2 = null; int? selected = null; Mind M2 = null; dynamic is_bad_guy = null; Objective_Assassinate O3 = null; Objective_Protect O4 = null; int? selected2 = null; dynamic M3 = null; dynamic is_bad_guy2 = null; Objective_Debrain O5 = null; Objective_Capture O6 = null; Objective_Survive O7 = null; dynamic N = null; if (!Lang13.Bool(this.spawn_loc)) { spawn_locs = new ByTable(); foreach (dynamic _b in Lang13.Enumerate(GlobalVars.landmarks_list, typeof(Obj_Effect_Landmark))) { L = _b; if (L.loc is Tile) { switch ((string)(L.name)) { case "ninjaspawn": case "carpspawn": spawn_locs.Add(L.loc); break; } } } if (!(spawn_locs.len != 0)) { this.kill(); return(false); } this.spawn_loc = Rand13.PickFromTable(spawn_locs); } if (!Lang13.Bool(this.spawn_loc)) { this.kill(); return(false); } if (!Lang13.Bool(this.key)) { candidates = GlobalFuncs.get_candidates("space ninja"); if (!(candidates.len != 0)) { this.kill(); return(false); } C = Rand13.PickFromTable(candidates); this.key = C.key; } if (!Lang13.Bool(this.key)) { this.kill(); return(false); } Mind = GlobalFuncs.create_ninja_mind(this.key); Mind.active = true; possible_targets = new ByTable(); foreach (dynamic _c in Lang13.Enumerate(GlobalVars.ticker.minds, typeof(Mind))) { M = _c; if (Lang13.Bool(M.current) && Convert.ToInt32(M.current.stat) != 2) { if (M.current is Mob_Living_Carbon_Human) { if (Lang13.Bool(M.special_role)) { possible_targets[M] = 0; } else if (GlobalVars.command_positions.Contains(M.assigned_role)) { possible_targets[M] = 1; } } } } objectives = new ByTable(new object [] { 1, 2, 3, 4 }); while (Mind.objectives.len < 6) { dynamic _d = GlobalFuncs.pick_n_take(objectives); // Was a switch-case, sorry for the mess. if (_d == 1) { O = new Objective_Download(); O.owner = Mind; O.gen_amount_goal(); Mind.objectives.Add(O); } else if (_d == 2) { O2 = new Objective_Steal_Special(); O2.owner = Mind; Mind.objectives.Add(O2); } else if (_d == 3) { if (!(possible_targets.len != 0)) { continue; } selected = Rand13.Int(1, possible_targets.len); M2 = possible_targets[selected]; is_bad_guy = possible_targets[M2]; possible_targets.Cut(selected, (selected ?? 0) + 1); if (Lang13.Bool(is_bad_guy ^ this.helping_station)) { O3 = new Objective_Assassinate(); O3.owner = Mind; O3.target = M2; O3.explanation_text = new Txt("Slay ").the(M2.current.real_name).item().str(", the ").item(M2.assigned_role).str(".").ToString(); Mind.objectives.Add(O3); } else { O4 = new Objective_Protect(); O4.owner = Mind; O4.target = M2; O4.explanation_text = new Txt("Protect ").the(M2.current.real_name).item().str(", the ").item(M2.assigned_role).str(", from harm.").ToString(); Mind.objectives.Add(O4); } } else if (_d == 4) { if (!(possible_targets.len != 0)) { continue; } selected2 = Rand13.Int(1, possible_targets.len); M3 = possible_targets[selected2]; is_bad_guy2 = possible_targets[M3]; possible_targets.Cut(selected2, (selected2 ?? 0) + 1); if (Lang13.Bool(is_bad_guy2 ^ this.helping_station)) { O5 = new Objective_Debrain(); O5.owner = Mind; O5.target = M3; O5.explanation_text = "Steal the brain of " + M3.current.real_name + "."; Mind.objectives.Add(O5); } else { O6 = new Objective_Capture(); O6.owner = Mind; O6.gen_amount_goal(); Mind.objectives.Add(O6); } } else { break; } } O7 = new Objective_Survive(); O7.owner = Mind; Mind.objectives.Add(O7); Mind.store_memory("I am an elite mercenary assassin of the mighty Spider Clan. A <font color='red'><B>SPACE NINJA</B></font>!"); Mind.store_memory("Suprise is my weapon. Shadows are my armor. Without them, I am nothing. (//initialize your suit by right clicking on it, to use abilities like stealth)!"); Mind.store_memory("Officially, " + (this.helping_station != 0 ? "Nanotrasen" : "The Syndicate") + " are my employer."); this.Ninja = GlobalFuncs.create_space_ninja(this.spawn_loc); Mind.transfer_to(this.Ninja); if (this.Ninja.wear_suit is Obj_Item_Clothing_Suit_Space_SpaceNinja) { N = this.Ninja.wear_suit; ((Obj_Item_Clothing_Suit_Space_SpaceNinja)N).randomize_param(); } this.Ninja.v_internal = this.Ninja.s_store; this.Ninja.update_internals_hud_icon(true); if (this.Ninja.mind != Mind) { throw new Exception("Ninja created with incorrect mind"); return(false); } this.Ninja.WriteMsg(new Sound("sound/effects/ninja_greeting.ogg")); this.success_spawn = true; return(false); }
protected Role(Mind mind) { Mind = mind; }
// Function from file: objective.dm public override int check_completion( ) { ByTable check_names = null; Mind M = null; dynamic mloc = null; int success = 0; Mind changeling = null; dynamic H = null; dynamic cloc = null; dynamic name = null; if (!(this.department_real_names.len != 0) || !(this.department_minds.len != 0)) { return(1); } check_names = this.department_real_names.Copy(); foreach (dynamic _a in Lang13.Enumerate(this.department_minds, typeof(Mind))) { M = _a; if (GlobalVars.ticker.mode.changelings.Contains(M)) { continue; } if (Lang13.Bool(M.current)) { mloc = GlobalFuncs.get_turf(M.current); if (((Ent_Static)mloc).onCentcom() && Convert.ToInt32(M.current.stat) != 2) { return(0); } } } success = 0; foreach (dynamic _c in Lang13.Enumerate(GlobalVars.ticker.mode.changelings, typeof(Mind))) { changeling = _c; if (success >= this.department_minds.len) { return(1); } if (changeling.current is Mob_Living_Carbon_Human) { H = changeling.current; cloc = GlobalFuncs.get_turf(changeling.current); if (Lang13.Bool(cloc) && ((Ent_Static)cloc).onCentcom() && Convert.ToInt32(changeling.current.stat) != 2) { string _loop_ctrl_1 = null; foreach (dynamic _b in Lang13.Enumerate(check_names)) { name = _b; if (H.dna.real_name == name) { check_names.Remove(name); success++; _loop_ctrl_1 = "continue"; break; } } if (_loop_ctrl_1 == "break") { break; } else if (_loop_ctrl_1 == "continue") { continue; } } } } if (success >= this.department_minds.len) { return(1); } return(0); }
// Function from file: objective.dm public void get_department_staff( ) { ByTable departments = null; dynamic department_head = null; dynamic ling_count = null; Mind M = null; this.department_minds = new ByTable(); this.department_real_names = new ByTable(); departments = new ByTable(new object [] { "Head of Security", "Research Director", "Chief Engineer", "Chief Medical Officer" }); department_head = Rand13.PickFromTable(departments); dynamic _a = department_head; // Was a switch-case, sorry for the mess. if (_a == "Head of Security") { this.department_string = "security"; } else if (_a == "Research Director") { this.department_string = "science"; } else if (_a == "Chief Engineer") { this.department_string = "engineering"; } else if (_a == "Chief Medical Officer") { this.department_string = "medical"; } ling_count = GlobalVars.ticker.mode.changelings; foreach (dynamic _b in Lang13.Enumerate(GlobalVars.ticker.minds, typeof(Mind))) { M = _b; if (GlobalVars.ticker.mode.changelings.Contains(M)) { continue; } if (GlobalFuncs.get_department_heads(M.assigned_role).Contains(department_head)) { if (Lang13.Bool(ling_count)) { ling_count--; this.department_minds.Add(M); this.department_real_names.Add(M.current.real_name); } else { break; } } } if (!(this.department_minds.len != 0)) { GlobalFuncs.log_game("" + this.type + " has failed to find department staff, and has removed itself. the round will continue normally"); this.owner.objectives.Remove(this); GlobalFuncs.qdel(this); return; } return; }
public bool OnGhostAttempt(Mind mind, bool canReturnGlobal) { return(false); }
internal RestaurantAgent() { Mind .AddPattern("a", "$something") .HowToEvaluate(c => c["something"]) .AddPattern("an", "$something") .HowToEvaluate(c => c["something"]) .AddPattern("if", "$something", "then", "$something2") .HowToDo(c => { var isConditionTrue = c.IsTrue("something"); if (isConditionTrue) { return(c["something2"]); } return(DbConstraint.Entity("nothing")); }) .AddPattern("$someone", "said", "$something") .HowToEvaluate(c => c["someone"].ExtendByAnswer("What @ said?", c["something"])) .AddPattern("user", "specified", "$something") .IsTrue("criterions on $something exists") .AddPattern("$something", "exists") .IsTrue(c => Body.IfDbContains(c["something"])) .AddPattern("criterions", "on", "$something") .HowToEvaluate(c => findUserCriterions(c["something"])) .AddPattern("you", "know", "$something") .IsTrue(c => Body.IfDbContains(c["something"])) .AddPattern("which", "$something") .HowToEvaluate(c => new DbConstraint().ExtendByAnswer("What is @?", c["something"]) ) .AddPattern("$something", "user", "wants") .HowToEvaluate(c => c["something"].ExtendBySubject(DbConstraint.Entity("user"), "What @ wants?") ) .AddPattern("remember", "$something") .HowToDo(c => { var fact = c["something"]; if (fact.PhraseConstraint != "nothing") { var answerEntry = fact.SubjectConstraints.First(); Mind.Database.AddFact(fact.PhraseConstraint, answerEntry.Question, answerEntry.Answer.PhraseConstraint); } return(DbConstraint.Entity("nothing")); }) .AddPattern("I", "want", "$something") .HowToEvaluate(c => DbConstraint.Entity("user").ExtendByAnswer("What @ wants?", c["something"])) .AddPattern("fact", "from", "$someone") .HowToEvaluate(c => { var input = Mind.Database.GetAnswers("user", "What @ said?").First(); var evaluation = Mind.Evaluator.Evaluate(input, Evaluator.HowToEvaluateQ, c); var factConstraint = evaluation.Constraint; if (factConstraint.PhraseConstraint != null && (factConstraint.SubjectConstraints.Any() || factConstraint.AnswerConstraints.Any())) { return(evaluation.Constraint); } else { return(DbConstraint.Entity("nothing")); } }) ; /*AddPolicyFact("remember fact from user"); * AddPolicyFact("if user said hello then say hi"); * AddPolicyFact("if you know which restaurant user wants then offer it");*/ }
public TraitorRole(Mind mind) : base(mind) { }
// Function from file: revenant.dm public bool reform( ) { string key_of_revenant = null; Mob_Living_SimpleAnimal_Revenant R = null; dynamic M = null; ByTable candidates = null; dynamic C = null; Mind player_mind = null; if (Lang13.Bool(this.gc_destroyed) || !(this != null) || this.inert) { return(false); } GlobalFuncs.message_admins("Revenant ectoplasm was left undestroyed for 1 minute and is reforming into a new revenant."); this.loc = GlobalFuncs.get_turf(this); R = new Mob_Living_SimpleAnimal_Revenant(GlobalFuncs.get_turf(this)); if (this.client_to_revive != null) { foreach (dynamic _a in Lang13.Enumerate(GlobalVars.dead_mob_list)) { M = _a; if (M.client == this.client_to_revive) { R.client = this.client_to_revive; key_of_revenant = this.client_to_revive.key; } } } if (!Lang13.Bool(key_of_revenant)) { GlobalFuncs.message_admins("The new revenant's old client either could not be found or is in a new, living mob - grabbing a random candidate instead..."); candidates = GlobalFuncs.get_candidates("revenant"); if (!(candidates.len != 0)) { GlobalFuncs.qdel(R); GlobalFuncs.message_admins("No candidates were found for the new revenant. Oh well!"); this.inert = true; this.visible_message("<span class='revenwarning'>" + this + " settles down and seems lifeless.</span>"); return(false); } C = Rand13.PickFromTable(candidates); key_of_revenant = C.key; if (!Lang13.Bool(key_of_revenant)) { GlobalFuncs.qdel(R); GlobalFuncs.message_admins("No ckey was found for the new revenant. Oh well!"); this.inert = true; this.visible_message("<span class='revenwarning'>" + this + " settles down and seems lifeless.</span>"); return(false); } } player_mind = new Mind(key_of_revenant); player_mind.active = true; player_mind.transfer_to(R); player_mind.assigned_role = "revenant"; player_mind.special_role = "Revenant"; GlobalVars.ticker.mode.traitors.Or(player_mind); GlobalFuncs.message_admins("" + key_of_revenant + " has been " + (this.client_to_revive != null ? "re" : "") + "made into a revenant by reforming ectoplasm."); GlobalFuncs.log_game("" + key_of_revenant + " was " + (this.client_to_revive != null ? "re" : "") + "made as a revenant by reforming ectoplasm."); this.visible_message("<span class='revenboldnotice'>" + this + " suddenly rises into the air before fading away.</span>"); GlobalFuncs.qdel(this); if (this != null) { this.inert = true; } return(true); }
public virtual void Update(float elapsed) { ani.Update(elapsed); if (IsDead) { animation = 12 + ani.Frame; if (ani.End) { Location = null; dead = true; } return; } Path.Speed = 35; Vector2 old = new Vector2(position); // process dangers (only if hired) if (Player != null) { if (Location.Danger != null) { float rate = 1; if (Protection != null) { Interaction.DangerProtection p = Protection.Type.GetProtection(Location.Danger.Type); if (p != null) { rate -= p.Rate; } } if (rate > 0) { health -= Location.Danger.HealthDecrease * elapsed * rate; if (IsDead) { Die(); return; } } } } Mind.Process(elapsed); Location loc = Location; if (loc == null) { loc = Player.Location; } position = Path.Process(loc.Map.Mask, Position, elapsed); Vector2 dir = position - old; if (dir.x != 0 || dir.y != 0) { if (dir.y < 0 /*&& System.Math.Abs(dir.y) > System.Math.Abs(dir.x)*/) // up { Animation = 8 + ani.Frame; } else if (dir.y > 0 /*&& System.Math.Abs(dir.y) > System.Math.Abs(dir.x)*/) // down { Animation = 6 + ani.Frame; } else { if (dir.x < 0) // left { Animation = 4 + ani.Frame; } else if (dir.x > 0) // right { Animation = 2 + ani.Frame; } } } else { Animation = 0; } if (!aniDelay.IsIn && Animation != nextAnimation) { aniDelay.FadeIn(); aniDelay.Update(elapsed); if (aniDelay.IsIn) { animation = nextAnimation; } } }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static Mind create_ninja_mind( dynamic key = null ) { Mind Mind = null; Mind = new Mind( key ); Mind.assigned_role = "Space Ninja"; Mind.special_role = "Space Ninja"; GlobalVars.ticker.mode.traitors |= Mind; return Mind; }
public void CancelAction() { Path.MoveTo = Position; Mind.MoveToObject(null); }
// Function from file: abduction.dm public override bool post_setup(bool?report = null) { ByTable agent_landmarks = null; ByTable scientist_landmarks = null; Obj_Effect_Landmark_Abductor A = null; Mind agent = null; Ent_Static L = null; Mind scientist = null; dynamic team_name = null; dynamic H = null; Species_Abductor S = null; int?team_number = null; agent_landmarks = new ByTable(); scientist_landmarks = new ByTable(); agent_landmarks.len = this.max_teams; scientist_landmarks.len = this.max_teams; foreach (dynamic _a in Lang13.Enumerate(GlobalVars.landmarks_list, typeof(Obj_Effect_Landmark_Abductor))) { A = _a; if (A is Obj_Effect_Landmark_Abductor_Agent) { agent_landmarks[String13.ParseNumber(A.team)] = A; } else if (A is Obj_Effect_Landmark_Abductor_Scientist) { scientist_landmarks[String13.ParseNumber(A.team)] = A; } } agent = null; L = null; scientist = null; team_name = null; H = null; S = null; team_number = null; team_number = 1; while ((team_number ?? 0) <= (this.abductor_teams ?? 0)) { team_name = this.team_names[team_number]; agent = this.agents[team_number]; H = agent.current; L = agent_landmarks[team_number]; H.loc = L.loc; ((Mob)H).set_species(typeof(Species_Abductor)); S = H.dna.species; S.agent = true; S.team = team_number; H.real_name = team_name + " Agent"; this.equip_common(H, team_number); this.equip_agent(H, team_number); this.greet_agent(agent, team_number); scientist = this.scientists[team_number]; H = scientist.current; L = scientist_landmarks[team_number]; H.loc = L.loc; ((Mob)H).set_species(typeof(Species_Abductor)); S = H.dna.species; S.scientist = true; S.team = team_number; H.real_name = team_name + " Scientist"; this.equip_common(H, team_number); this.equip_scientist(H, team_number); this.greet_scientist(scientist, team_number); team_number++; } return(base.post_setup(report)); }
/// <summary> /// Spawns a new player character and transfers the connection's control into the new body. /// If existingMind is null, creates the new mind and assigns it to the new body. /// /// Fires server and client side player spawn hooks. /// </summary> /// <param name="connection">connection to give control to the new player character</param> /// <param name="occupation">occupation of the new player character</param> /// <param name="characterSettings">settings of the new player character</param> /// <param name="existingMind">existing mind to transfer to the new player, if null new mind will be created /// and assigned to the new player character</param> /// <param name="spawnPos">world position to spawn at</param> /// <param name="spawnItems">If spawning a player, should the player spawn without the defined initial equipment for their occupation?</param> /// <param name="willDestroyOldBody">if true, indicates the old body is going to be destroyed rather than pooled, /// thus we shouldn't send any network message which reference's the old body's ID since it won't exist.</param> /// /// <returns>the spawned object</returns> private static GameObject ServerSpawnInternal(NetworkConnection connection, Occupation occupation, CharacterSettings characterSettings, Mind existingMind, Vector3Int?spawnPos = null, bool spawnItems = true, bool willDestroyOldBody = false, bool showBanner = true) { //determine where to spawn them if (spawnPos == null) { Transform spawnTransform; //Spawn normal location for special jobs or if less than 2 minutes passed if (GameManager.Instance.stationTime < ARRIVALS_SPAWN_TIME || occupation.LateSpawnIsArrivals == false) { spawnTransform = SpawnPoint.GetRandomPointForJob(occupation.JobType); } else { spawnTransform = SpawnPoint.GetRandomPointForLateSpawn(); //Fallback to assistant spawn location if none found for late join if (spawnTransform == null && occupation.JobType != JobType.NULL) { spawnTransform = SpawnPoint.GetRandomPointForJob(JobType.ASSISTANT); } } if (spawnTransform == null) { Logger.LogErrorFormat( "Unable to determine spawn position for connection {0} occupation {1}. Cannot spawn player.", Category.EntitySpawn, connection.address, occupation.DisplayName); return(null); } spawnPos = spawnTransform.transform.position.CutToInt(); } //create the player object var newPlayer = ServerCreatePlayer(spawnPos.GetValueOrDefault(), occupation.SpecialPlayerPrefab); var newPlayerScript = newPlayer.GetComponent <PlayerScript>(); //get the old body if they have one. var oldBody = existingMind?.GetCurrentMob(); //transfer control to the player object ServerTransferPlayer(connection, newPlayer, oldBody, Event.PlayerSpawned, characterSettings, willDestroyOldBody); if (existingMind == null) { //create the mind of the player Mind.Create(newPlayer, occupation); } else { //transfer the mind to the new body existingMind.SetNewBody(newPlayerScript); } var ps = newPlayer.GetComponent <PlayerScript>(); var connectedPlayer = PlayerList.Instance.Get(connection); connectedPlayer.Name = ps.playerName; connectedPlayer.Job = ps.mind.occupation.JobType; UpdateConnectedPlayersMessage.Send(); //fire all hooks var info = SpawnInfo.Player(occupation, characterSettings, CustomNetworkManager.Instance.humanPlayerPrefab, SpawnDestination.At(spawnPos), spawnItems: spawnItems); Spawn._ServerFireClientServerSpawnHooks(SpawnResult.Single(info, newPlayer)); if (occupation != null && showBanner) { SpawnBannerMessage.Send( newPlayer, occupation.DisplayName, occupation.SpawnSound.AssetAddress, occupation.TextColor, occupation.BackgroundColor, occupation.PlaySound); } if (info.SpawnItems) { newPlayer.GetComponent <DynamicItemStorage>()?.SetUpOccupation(occupation); } return(newPlayer); }
// Function from file: slaughterevent.dm public bool get_slaughter(bool?end_if_fail = null) { end_if_fail = end_if_fail ?? false; ByTable candidates = null; dynamic C = null; Mind player_mind = null; ByTable spawn_locs = null; Obj_Effect_Landmark L = null; dynamic holder = null; Mob_Living_SimpleAnimal_Slaughter S = null; this.key_of_slaughter = null; if (!Lang13.Bool(this.key_of_slaughter)) { candidates = GlobalFuncs.get_candidates("xenomorph"); if (!(candidates.len != 0)) { if (end_if_fail == true) { return(false); } this.find_slaughter(); return(false); } C = Rand13.PickFromTable(candidates); this.key_of_slaughter = C.key; } if (!Lang13.Bool(this.key_of_slaughter)) { if (end_if_fail == true) { return(false); } this.find_slaughter(); return(false); } player_mind = new Mind(this.key_of_slaughter); player_mind.active = true; spawn_locs = new ByTable(); foreach (dynamic _b in Lang13.Enumerate(GlobalVars.landmarks_list, typeof(Obj_Effect_Landmark))) { L = _b; if (L.loc is Tile) { switch ((string)(L.name)) { case "carpspawn": spawn_locs.Add(L.loc); break; } } } if (!(spawn_locs != null)) { this.find_slaughter(); return(false); } holder = GlobalFuncs.PoolOrNew(typeof(Obj_Effect_Dummy_Slaughter), Rand13.PickFromTable(spawn_locs)); S = new Mob_Living_SimpleAnimal_Slaughter(holder); S.holder = holder; player_mind.transfer_to(S); player_mind.assigned_role = "Slaughter Demon"; player_mind.special_role = "Slaughter Demon"; GlobalVars.ticker.mode.traitors.Or(player_mind); S.WriteMsg(S.playstyle_string); S.WriteMsg("<B>You are currently not currently in the same plane of existence as the station. Blood Crawl near a blood pool to manifest.</B>"); S.WriteMsg("sound/magic/demon_dies.ogg"); GlobalFuncs.message_admins("" + this.key_of_slaughter + " has been made into a slaughter demon by an event."); GlobalFuncs.log_game("" + this.key_of_slaughter + " was spawned as a slaughter demon by an event."); return(true); }
public override string WriteProof() { var length = Mind.ColorableBoards[0].ToXYZ().Length; var allBoards = Mind.ColorableBoards.Union(Mind.NonColorableBoards).ToList(); var comparer = new SequenceGeneralizer <int> .VectorComparer(); var sg = new SequenceGeneralizer <int>(length, new List <int> { 0, 1, 2 }); var zot2 = allBoards.Select(b => b.To012()).ToList(); var examples2 = allBoards.Select(b => b.To012()).ToList(); var nonExamples2 = Enumerable.Repeat(Enumerable.Range(0, 3), length).CartesianProduct().Select(ll => ll.ToList()).Except(zot2.Distinct(comparer), comparer).ToList(); var generalized2 = sg.Generalize(examples2, nonExamples2, false); var allBoardsXYZ = generalized2.Select(gg => "$" + string.Join("", gg.Select(_ => _.ToTex())) + "$").Listify("or"); var sb = new StringBuilder(); var figureID = "fig:" + Guid.NewGuid().ToString(); sb.AppendLine("\\begin{figure}"); sb.AppendLine("\\centering"); sb.AppendLine(_figureTikz); sb.AppendLine("\\caption{Solid vertices have lists of size 3 and the labeled vertices have lists of size 2.}\\label{" + figureID + "}"); sb.AppendLine("\\end{figure}"); sb.AppendLine("\\begin{lem}"); sb.AppendLine("The graph in Figure \\ref{" + figureID + "} is reducible."); sb.AppendLine("\\end{lem}"); var letters = new List <string>() { "X", "Y", "Z" }; var stringLength = Mind.ColorableBoards[0].Stacks.Value.Count(ss => ss.PopulationCount() == 2); var rng = new Random(DateTime.Now.Millisecond); var randomString = ""; for (int i = 0; i < stringLength; i++) { randomString += letters[rng.Next(3)]; } var randomString2 = ""; for (int i = 0; i < stringLength; i++) { randomString2 += letters[rng.Next(3)]; } var randomString3 = ""; for (int i = 0; i < stringLength; i++) { randomString3 += letters[rng.Next(3)]; } sb.Append("\\begin{proof}"); sb.AppendLine("Let $X = \\{0,1\\}$, $Y = \\{0,2\\}$ and $Z = \\{1,2\\}$. Then with the vertex ordering in Figure \\ref{" + figureID + "}, a string such as " + randomString + ", "); sb.AppendLine("represents a possible list assignment on $V(H)$ arising from a $3$-edge-coloring of $G-E(H)$."); sb.AppendLine("By an $X$-Kempe change, we mean flipping colors $0$ and $1$ on a two-colored path in $G-E(H)$. We call such a path an $X$-path. "); sb.AppendLine("Any endpoint of an $X$-path in $H$ must end at a $Y$ or $Z$ vertex. The meanings of $Y$-Kempe change, $Z$-Kempe change, $Y$-path and $Z$-path are analogous."); sb.AppendLine("Note that if there are an odd number of $Y$'s and $Z$'s, then at least one $X$-path has only one endpoint in $H$."); sb.AppendLine("We use shorthand notation like $\\K_{X, 2}(" + randomString + ",5,6) \\Rightarrow " + randomString2 + "," + randomString3 + "$ (Case 1)."); sb.AppendLine("This means the $X$-Kempe change on " + randomString + " starting at the second vertex and ending at the fifth and sixth result in boards " + randomString2 + " and " + randomString3 + " respectively and these are handled by Case 1."); sb.AppendLine("The $\\infty$ symbol means starting (or ending) outside $H$."); sb.AppendLine(); if (Mind.OnlyConsiderNearlyColorableBoards) { sb.AppendLine("We need to handle all boards that are nearly colorable for edge $e$ up to permutations of $\\{X,Y,Z\\}$, so it will suffice to handle all boards of the form " + allBoardsXYZ + "."); } else { sb.AppendLine("We need to handle all boards up to permutations of $\\{X,Y,Z\\}$, so it will suffice to handle all boards of the form " + allBoardsXYZ + "."); } sb.AppendLine(); var wonBoards = new List <SuperSlimBoard>(); for (int caseNumber = 1; caseNumber <= Cases.Count; caseNumber++) { var c = Cases[caseNumber - 1]; var boards = c.Boards; List <SuperSlimBoard> thisClaimBoards; if (caseNumber > 1) { thisClaimBoards = boards.SelectMany(b => new[] { b }.Union(_permutationLinked[b].Select(tup => tup.Item2))).ToList(); } else { thisClaimBoards = boards; } wonBoards.AddRange(thisClaimBoards); var zot = thisClaimBoards.Select(b => b.To012()).ToList(); var examples = thisClaimBoards.Select(b => b.To012()).ToList(); var nonExamples = Enumerable.Repeat(Enumerable.Range(0, 3), length).CartesianProduct().Select(ll => ll.ToList()).Except(zot.Distinct(comparer), comparer).ToList(); var generalized = sg.Generalize(examples, nonExamples); var boardsXYZ = generalized.Select(gg => "$" + string.Join("", gg.Select(_ => _.ToTex())) + "$").Listify("or"); sb.AppendLine(); sb.AppendLine("\\bigskip"); sb.AppendLine(string.Format("\\case{{{0}}}{{$B$ is one of " + boardsXYZ + ".}}", caseNumber)); sb.AppendLine(); sb.AppendLine("\\bigskip"); if (caseNumber == 1) { sb.AppendLine(); sb.AppendLine("In all these cases, $H$ is immediately colorable from the lists."); } else { sb.AppendLine(); var fixGroups = boards.GroupBy(b => { var treeInfo = Mind.GetWinTreeInfo(b); var fixLetter = ((long)((1 << treeInfo.First().Alpha) | (1 << treeInfo.First().Beta))).ToXYZ(); return(fixLetter); }); foreach (var fixGroup in fixGroups) { var others = letters.ToList(); others.Remove(fixGroup.Key); var swapCountGroups = fixGroup.GroupBy(b => Mind.GetWinTreeInfo(b).Max(ti => ti.SwapVertices.Count)).ToList(); foreach (var swapCountGroup in swapCountGroups) { if (swapCountGroup.Key == 1) { foreach (var b in swapCountGroup) { var treeInfo = Mind.GetWinTreeInfo(b); var groups = treeInfo.GroupBy(ss => ss.SwapVertices[0]); sb.Append("$\\K_{" + fixGroup.Key + ",\\infty}(" + b.ToXYZ() + "," + groups.OrderBy(gg => gg.Key).Select(gg => gg.Key.GetXYZIndex(b) + 1).Listify(null) + ")"); sb.AppendLine("\\Rightarrow $" + groups.OrderBy(gg => gg.Key).Select(gg => "$" + GetChildBoardName(b, gg.First()) + "$").Listify(null) + "( Case " + treeInfo.Select(bc => GetHandledCaseNumber(b, bc)).Distinct().OrderBy(xx => xx).Listify() + ")."); sb.AppendLine(); if (_permutationLinked[b].Count > 0) { sb.AppendLine(); sb.AppendLine(); sb.AppendLine(_permutationLinked[b].Select(ppp => "$" + ppp.Item1 + "\\Rightarrow " + ppp.Item2.ToXYZ() + "$").Listify()); sb.AppendLine(); sb.AppendLine(); } } } else if (swapCountGroup.Key == 2) { foreach (var b in swapCountGroup) { var treeInfo = Mind.GetWinTreeInfo(b); var leftover = treeInfo.ToList(); while (leftover.Count > 0) { var commonestSwapper = Enumerable.Range(0, b._stackCount).MaxIndex(v => leftover.Count(bc => bc.SwapVertices.Contains(v))); var handledAll = leftover.Where(bc => bc.SwapVertices.Contains(commonestSwapper)).ToList(); var handled = handledAll.Distinct(bc => bc.SwapVertices.Count == 1 ? -1 : bc.SwapVertices.Except(commonestSwapper).First()).ToList(); sb.Append("$\\K_{" + fixGroup.Key + "," + (commonestSwapper.GetXYZIndex(b) + 1) + "}(" + b.ToXYZ()); var single = handled.FirstOrDefault(bc => bc.SwapVertices.Count == 1); if (single != null) { sb.Append(",\\infty"); } if (handled.Where(bc => bc.SwapVertices.Count > 1).Count() > 0) { sb.Append("," + handled.Where(bc => bc.SwapVertices.Count > 1).OrderBy(bc => bc.SwapVertices.Except(commonestSwapper).First()).Select(bc => bc.SwapVertices.Except(commonestSwapper).First().GetXYZIndex(b) + 1).Listify(null)); } sb.Append(")"); sb.AppendLine("\\Rightarrow $" + handled.OrderBy(bc => bc.SwapVertices.Count == 1 ? -1 : bc.SwapVertices.Except(commonestSwapper).First()).Select(bc => "$" + GetChildBoardName(b, bc) + "$").Listify(null) + "(Case " + handled.Select(bc => GetHandledCaseNumber(b, bc)).Distinct().OrderBy(xx => xx).Listify() + ")."); sb.AppendLine(); foreach (var bc in handledAll) { leftover.Remove(bc); } } if (_permutationLinked[b].Count > 0) { sb.AppendLine(); sb.AppendLine(); sb.AppendLine(_permutationLinked[b].Select(ppp => "$" + ppp.Item1 + "\\Rightarrow " + ppp.Item2.ToXYZ() + "$").Listify()); sb.AppendLine(); sb.AppendLine(); } } } } } } sb.AppendLine(); } sb.AppendLine("\\end{proof}"); return(sb.ToString()); }
public SerializedPersoData(List <Perso> persos) { Persos = new Dictionary <string, EPerso>(); foreach (Perso perso in persos) { EPerso ePerso = new EPerso() { Position = perso.Gao.transform.localPosition, Rotation = perso.Gao.transform.localRotation.eulerAngles, Scale = perso.Gao.transform.localScale, Family = perso.p3dData?.family?.name, AIModel = perso.brain?.mind?.AI_model.name }; if (perso.brain?.mind != null && perso.brain.mind.dsgMem != null && perso.brain.mind.dsgMem.dsgVar != null) { Mind mind = perso.brain.mind; DsgMem dsgMem = mind.dsgMem; DsgVarInfoEntry[] dsgVars = dsgMem.dsgVar.dsgVarInfos; Dictionary <string, EDsgVar> variables = new Dictionary <string, EDsgVar>(); for (int i = 0; i < dsgMem.dsgVar.dsgVarInfos.Length; i++) { variables.Add("dsgVar_" + i, GetExportableDsgVar(dsgMem, dsgMem.dsgVar, i)); } ePerso.Variables = variables; } if (perso.Gao != null && perso.Gao.transform.parent != null) { GameObject parent = perso.Gao.transform.parent.gameObject; PersoBehaviour pb = parent.GetComponent <PersoBehaviour>(); if (pb != null && pb.perso != null) { ePerso.ParentPerso = pb.perso.namePerso; } } ePerso.StandardGame = new EStandardGame() { CustomBits = perso.stdGame.customBits, IsAlwaysActive = perso.stdGame.IsAlwaysActive, IsMainActor = perso.stdGame.IsMainActor, IsAPlatform = perso.stdGame.platformType != 0 ? true:false, UpdateCheckByte = perso.stdGame.miscFlags, TransparencyZoneMin = perso.stdGame.transparencyZoneMin, TransparencyZoneMax = perso.stdGame.transparencyZoneMax, TooFarLimit = perso.stdGame.tooFarLimit }; if (!Persos.ContainsKey(perso.namePerso)) { Persos.Add(perso.namePerso, ePerso); } else { Debug.LogWarning("Warning: duplicate perso name " + perso.namePerso + ", ignoring duplicates..."); } } }
public Traitor(Mind mind) : base(mind) { }
public void WipeMind() { Mind?.ChangeOwningPlayer(null); Mind = null; }
public Job(Mind mind, JobPrototype jobPrototype) : base(mind) { Prototype = jobPrototype; Name = jobPrototype.Name; }
public IEnumerable <ObjectivePrototype> GetAllPossibleObjectives(Mind mind) { return(_prototypeManager.EnumeratePrototypes <ObjectivePrototype>().Where(objectivePrototype => objectivePrototype.CanBeAssigned(mind))); }
/// <summary> /// Don't call this unless you know what the hell you're doing. /// Use <see cref="Mind.TransferTo(IEntity)"/> instead. /// If that doesn't cover it, make something to cover it. /// </summary> public void InternalAssignMind(Mind value) { Mind = value; Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, new MindAddedMessage()); }
public SuspicionInnocentRole(Mind mind, AntagPrototype antagPrototype) : base(mind) { Prototype = antagPrototype; Name = antagPrototype.Name; Antagonist = antagPrototype.Antagonist; }
/// <summary> /// Spawns a ghost for the indicated mind's body and transfers the connection's control to it. /// </summary> /// <param name="conn"></param> /// <param name="oldBody"></param> /// <param name="characterSettings"></param> /// <param name="occupation"></param> /// <returns></returns> public static void ServerSpawnGhost(Mind forMind) { if (forMind == null) { Logger.LogError("Mind was null for ServerSpawnGhost", Category.Server); return; } //determine where to spawn the ghost var body = forMind.GetCurrentMob(); if (body == null) { Logger.LogError("Body was null for ServerSpawnGhost", Category.Server); return; } var settings = body.GetComponent <PlayerScript>().characterSettings; var connection = body.GetComponent <NetworkIdentity>().connectionToClient; var registerTile = body.GetComponent <RegisterTile>(); if (registerTile == null) { Logger.LogErrorFormat("Cannot spawn ghost for body {0} because it has no registerTile", Category.ItemSpawn, body.name); return; } Vector3Int spawnPosition = body.GetComponent <ObjectBehaviour>().AssumedWorldPositionServer().RoundToInt(); if (spawnPosition == TransformState.HiddenPos) { //spawn ghost at occupation location if we can't determine where their body is Transform spawnTransform = GetSpawnForJob(forMind.occupation.JobType); if (spawnTransform == null) { Logger.LogErrorFormat("Unable to determine spawn position for occupation {1}. Cannot spawn ghost.", Category.ItemSpawn, forMind.occupation.DisplayName); return; } spawnPosition = spawnTransform.transform.position.CutToInt(); } var matrixInfo = MatrixManager.AtPoint(spawnPosition, true); var parentNetId = matrixInfo.NetID; var parentTransform = matrixInfo.Objects; //using parentTransform.rotation rather than Quaternion.identity because objects should always //be upright w.r.t. localRotation, NOT world rotation var ghost = Object.Instantiate(CustomNetworkManager.Instance.ghostPrefab, spawnPosition, parentTransform.rotation, parentTransform); ghost.GetComponent <PlayerScript>().registerTile.ServerSetNetworkedMatrixNetID(parentNetId); forMind.Ghosting(ghost); ServerTransferPlayer(connection, ghost, body, EVENT.GhostSpawned, settings); //fire all hooks var info = SpawnInfo.Ghost(forMind.occupation, settings, CustomNetworkManager.Instance.ghostPrefab, SpawnDestination.At(spawnPosition, parentTransform)); Spawn._ServerFireClientServerSpawnHooks(SpawnResult.Single(info, ghost)); }
/// <summary> /// Don't call this unless you know what the hell you're doing. /// Use <see cref="Mind.TransferTo(IEntity)"/> instead. /// If that doesn't cover it, make something to cover it. /// </summary> public void InternalEjectMind() { Mind = null; }
/// <summary> /// Don't call this unless you know what the hell you're doing. /// Use <see cref="Mind.TransferTo(IEntity)"/> instead. /// If that doesn't cover it, make something to cover it. /// </summary> public void InternalAssignMind(Mind value) { Mind = value; }
public IObjectiveCondition GetAssigned(Mind mind) { return(new DieCondition { _mind = mind }); }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static void generate_objectives( Mind M = null, double? objectives_made = null, bool? has_escape = null ) { ByTable objective_types = null; ByTable escape_objective_types = null; dynamic O = null; dynamic obj = null; dynamic E = null; dynamic obj2 = null; double? i = null; dynamic holder_obj = null; dynamic holder_obj2 = null; dynamic O2 = null; if ( objectives_made == null ) { objectives_made = 2; } if ( has_escape == null ) { has_escape = GlobalVars.TRUE; } objective_types = Lang13.get_all_types( typeof(Objective_Default) ) - typeof(Objective_Default); escape_objective_types = Lang13.get_all_types( typeof(Objective_EscapeObj) ) - typeof(Objective_EscapeObj); O = null; foreach (dynamic _a in objective_types ) { O = _a; obj = Lang13.call( O ); if ( M.special_role != obj.required_role && obj.required_role != null ) { objective_types -= O; } if ( !Lang13.Bool( obj.randomgen ) ) { objective_types -= O; } }; E = null; foreach (dynamic _b in escape_objective_types ) { E = _b; obj2 = Lang13.call( E ); if ( M.special_role != obj2.required_role && obj2.required_role != null ) { objective_types -= E; } if ( !Lang13.Bool( obj2.randomgen ) ) { objective_types -= E; } }; i = null; i = 1; while (( i ??0) <= ( objectives_made ??0)) { if ( i == objectives_made && has_escape == true ) { holder_obj = Rand13.pick( escape_objective_types ); GlobalFuncs.add_objective( M, holder_obj ); return; } else { holder_obj2 = Rand13.pick( objective_types ); objective_types -= holder_obj2; O2 = Lang13.call( holder_obj2 ); if ( !Lang13.Bool( O2.martyr_compatible ) ) { escape_objective_types -= new ByTable(new object [] { typeof(Objective_EscapeObj_Martyr) }); } GlobalFuncs.add_objective( M, holder_obj2 ); } i++; } return; }
public State(Character body, Mind mind) { this.body = body; this.mind = mind; }