// Function from file: interactive.dm public int?takeDelegate(Mob_Living_Carbon_Human_Interactive from = null, int?doReset = null) { doReset = doReset ?? GlobalVars.TRUE; this.eye_color = "red"; if (from == this) { return(GlobalVars.FALSE); } this.TARGET = from.TARGET; this.LAST_TARGET = from.LAST_TARGET; this.retal = from.retal; this.retal_target = from.retal_target; this.doing = from.doing; this.timeout = 0; this.inactivity_period = 0; this.interest = 100; if (Lang13.Bool(doReset)) { from.TARGET = null; from.LAST_TARGET = null; from.retal = false; from.retal_target = null; from.doing = 0; } return(GlobalVars.TRUE); }
// Function from file: npcpool.dm public void insertBot(Mob_Living_Carbon_Human_Interactive toInsert = null) { if (toInsert is Mob_Living_Carbon_Human_Interactive) { this.botPool_l.Or(toInsert); } return; }
// Function from file: npcpool.dm public override void fire( ) { int?npcCount = null; Mob_Living_Carbon_Human_Interactive check = null; ByTable checkInRange = null; Mob_Living_Carbon_Human_Interactive check2 = null; dynamic candidate = null; int facCount = 0; int helpProb = 0; dynamic C = null; dynamic D = null; Mob_Living_Carbon_Human_Interactive check3 = null; dynamic candidate2 = null; int facCount2 = 0; int helpProb2 = 0; dynamic C2 = null; dynamic D2 = null; npcCount = 1; foreach (dynamic _a in Lang13.Enumerate(this.botPool_l, typeof(Mob_Living_Carbon_Human_Interactive))) { check = _a; if (!(check != null)) { this.botPool_l.Cut(npcCount, (npcCount ?? 0) + 1); continue; } checkInRange = Map13.FetchInView(check, 32); if (!Lang13.Bool(Lang13.FindIn(check.TARGET, checkInRange))) { this.needsDelegate.Or(check); } else if (check.isnotfunc(GlobalVars.FALSE)) { this.needsDelegate.Or(check); } else if ((check.doing & 8) != 0) { this.needsAssistant.Or(check); } else { this.canBeUsed.Or(check); } npcCount++; } if (this.needsDelegate.len != 0) { npcCount = 1; foreach (dynamic _d in Lang13.Enumerate(this.needsDelegate, typeof(Mob_Living_Carbon_Human_Interactive))) { check2 = _d; if (!(check2 != null)) { this.needsDelegate.Cut(npcCount, (npcCount ?? 0) + 1); continue; } if (this.canBeUsed.len != 0) { candidate = Rand13.PickFromTable(this.canBeUsed); facCount = 0; helpProb = 0; foreach (dynamic _c in Lang13.Enumerate(check2.faction)) { C = _c; foreach (dynamic _b in Lang13.Enumerate(candidate.faction)) { D = _b; if (D == C) { helpProb = Num13.MinInt(100, helpProb + 25); } facCount++; } } if (facCount == 1 && helpProb > 0) { helpProb = 100; } if (Rand13.PercentChance(helpProb)) { if (Lang13.Bool(((Mob_Living_Carbon_Human_Interactive)candidate).takeDelegate(check2))) { this.needsDelegate.Remove(check2); this.canBeUsed.Remove(candidate); candidate.eye_color = "red"; } } } npcCount++; } } if (this.needsAssistant.len != 0) { npcCount = 1; foreach (dynamic _g in Lang13.Enumerate(this.needsAssistant, typeof(Mob_Living_Carbon_Human_Interactive))) { check3 = _g; if (!(check3 != null)) { this.needsAssistant.Cut(npcCount, (npcCount ?? 0) + 1); continue; } if (this.canBeUsed.len != 0) { candidate2 = Rand13.PickFromTable(this.canBeUsed); facCount2 = 0; helpProb2 = 0; foreach (dynamic _f in Lang13.Enumerate(check3.faction)) { C2 = _f; foreach (dynamic _e in Lang13.Enumerate(candidate2.faction)) { D2 = _e; if (D2 == C2) { helpProb2 = Num13.MinInt(100, helpProb2 + 25); } facCount2++; } } if (facCount2 == 1 && helpProb2 > 0) { helpProb2 = 100; } if (Rand13.PercentChance(helpProb2)) { if (Lang13.Bool(((Mob_Living_Carbon_Human_Interactive)candidate2).takeDelegate(check3, GlobalVars.FALSE))) { this.needsAssistant.Remove(check3); this.canBeUsed.Remove(candidate2); candidate2.eye_color = "yellow"; } } } npcCount++; } } return; }