diff --git a/code/game/gamemodes/clock_cult/clock_items/soul_vessel.dm b/code/game/gamemodes/clock_cult/clock_items/soul_vessel.dm index 5bc680f84e6..70a1d28038f 100644 --- a/code/game/gamemodes/clock_cult/clock_items/soul_vessel.dm +++ b/code/game/gamemodes/clock_cult/clock_items/soul_vessel.dm @@ -29,6 +29,7 @@ laws = new /datum/ai_laws/ratvar() braintype = picked_fluff_name all_clockwork_objects += src + brainmob.languages_spoken = RATVAR /obj/item/device/mmi/posibrain/soul_vessel/Destroy() all_clockwork_objects -= src diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index 08345aa6c22..d6e0d977e77 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -416,7 +416,7 @@ var/global/list/obj/item/device/pda/PDAs = list() var/alert_s = input(U,"Alert severity level","Ping Drones",null) as null|anything in list("Low","Medium","High","Critical") if(A && alert_s) var/msg = "NON-DRONE PING: [U.name]: [alert_s] priority alert in [A.name]!" - _alert_drones(msg, 1) + _alert_drones(msg, TRUE) U << msg diff --git a/code/modules/mob/living/brain/say.dm b/code/modules/mob/living/brain/say.dm index ccbbea31b0e..632716e7776 100644 --- a/code/modules/mob/living/brain/say.dm +++ b/code/modules/mob/living/brain/say.dm @@ -9,6 +9,9 @@ message = Gibberish(message, (emp_damage*6))//scrambles the message, gets worse when emp_damage is higher ..() +/mob/living/brain/get_spans() + return ..() | SPAN_ROBOT + /mob/living/brain/radio(message, message_mode, list/spans) if(message_mode && istype(container, /obj/item/device/mmi)) var/obj/item/device/mmi/R = container diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 2589ac7be0c..6142f2ccd71 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -15,7 +15,7 @@ real_name = name var/datum/atom_hud/data/human/medical/advanced/medhud = huds[DATA_HUD_MEDICAL_ADVANCED] medhud.add_to_hud(src) - faction |= "\ref[src]" + faction += "\ref[src]" /mob/living/prepare_huds() diff --git a/code/modules/mob/living/simple_animal/friendly/drone/extra_drone_types.dm b/code/modules/mob/living/simple_animal/friendly/drone/extra_drone_types.dm index 5911d5e7135..4b7699a75f0 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/extra_drone_types.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/extra_drone_types.dm @@ -145,7 +145,7 @@ /mob/living/simple_animal/drone/cogscarab/binarycheck() return FALSE -/mob/living/simple_animal/drone/cogscarab/alert_drones(msg, dead_can_hear = 0) +/mob/living/simple_animal/drone/cogscarab/alert_drones(msg, dead_can_hear = FALSE) if(msg == DRONE_NET_CONNECT) msg = "Hierophant Network: [name] activated." else if(msg == DRONE_NET_DISCONNECT) diff --git a/code/modules/mob/living/simple_animal/friendly/drone/say.dm b/code/modules/mob/living/simple_animal/friendly/drone/say.dm index 4210947ef35..5b65f01dabd 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/say.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/say.dm @@ -17,13 +17,12 @@ //Base proc for anything to call -/proc/_alert_drones(msg, dead_can_hear = 0, list/factions) +/proc/_alert_drones(msg, dead_can_hear = 0, mob/living/faction_checked_mob, exact_faction_match) for(var/W in mob_list) var/mob/living/simple_animal/drone/M = W if(istype(M) && M.stat != DEAD) - if(factions && factions.len) - var/list/friendly = factions&M.faction - if(friendly.len) + if(faction_checked_mob) + if(M.faction_check_mob(faction_checked_mob, exact_faction_match)) M << msg else M << msg @@ -33,15 +32,12 @@ //Wrapper for drones to handle factions -/mob/living/simple_animal/drone/proc/alert_drones(msg, dead_can_hear = 0) - _alert_drones(msg, dead_can_hear, faction) +/mob/living/simple_animal/drone/proc/alert_drones(msg, dead_can_hear = FALSE) + _alert_drones(msg, dead_can_hear, src, TRUE) /mob/living/simple_animal/drone/proc/drone_chat(msg) - var/rendered = "Drone Chat: \ - [name]: \ - [say_quote(msg, get_spans())]" - alert_drones(rendered, 1) + alert_drones("Drone Chat: [name] [say_quote(msg, get_spans())]", TRUE) /mob/living/simple_animal/drone/binarycheck() return TRUE diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index a65480120ea..86af56e1621 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -172,7 +172,7 @@ if(search_objects < 2) if(isliving(the_target)) var/mob/living/L = the_target - var/faction_check = faction_check(L) + var/faction_check = faction_check_mob(L) if(robust_searching) if(L.stat > stat_attack || L.stat != stat_attack && stat_exclusive == 1) return 0 @@ -312,11 +312,7 @@ do_alert_animation(src) playsound(loc, 'sound/machines/chime.ogg', 50, 1, -1) for(var/mob/living/simple_animal/hostile/M in oview(distance, targets_from)) - var/list/L = M.faction&faction - var/success = L.len - if(exact_faction_match) - success = (L.len == faction.len) //since the above op is &, an exact match would be of the same length - if(success) + if(faction_check_mob(M, TRUE)) if(M.AIStatus == AI_OFF) return else @@ -328,7 +324,7 @@ for(var/mob/living/L in T) if(L == src || L == A) continue - if(faction_check(L) && !attack_same) + if(faction_check_mob(L) && !attack_same) return visible_message("[src] [ranged_message] at [A]!") diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm index 1dd2a25160f..635b7e21b6d 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm @@ -200,7 +200,7 @@ Difficulty: Hard . = list() for(var/mob/living/L in targets) var/list/bloodpool = get_pools(get_turf(L), 0) - if(bloodpool.len && (!faction_check(L) || L.stat == DEAD)) + if(bloodpool.len && (!faction_check_mob(L) || L.stat == DEAD)) . += L /mob/living/simple_animal/hostile/megafauna/bubblegum/proc/try_bloodattack() @@ -250,7 +250,7 @@ Difficulty: Hard new /obj/effect/overlay/temp/bubblegum_hands/leftsmack(T) sleep(2.5) for(var/mob/living/L in T) - if(!faction_check(L)) + if(!faction_check_mob(L)) L << "[src] rends you!" playsound(T, attack_sound, 100, 1, -1) var/limb_to_hit = L.get_bodypart(pick("head", "chest", "r_arm", "l_arm", "r_leg", "l_leg")) @@ -266,7 +266,7 @@ Difficulty: Hard new /obj/effect/overlay/temp/bubblegum_hands/leftthumb(T) sleep(6) for(var/mob/living/L in T) - if(!faction_check(L)) + if(!faction_check_mob(L)) L << "[src] drags you through the blood!" playsound(T, 'sound/magic/enter_blood.ogg', 100, 1, -1) var/turf/targetturf = get_step(src, dir) diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm index 8c070a29a87..0f98920bf3f 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm @@ -588,7 +588,7 @@ Difficulty: Hard /obj/effect/overlay/temp/hierophant/blast/proc/do_damage(turf/T) for(var/mob/living/L in T.contents - hit_things) //find and damage mobs... hit_things += L - if((friendly_fire_check && caster && caster.faction_check(L)) || L.stat == DEAD) + if((friendly_fire_check && caster && caster.faction_check_mob(L)) || L.stat == DEAD) continue if(L.client) flash_color(L.client, "#660099", 1) @@ -603,7 +603,7 @@ Difficulty: Hard for(var/obj/mecha/M in T.contents - hit_things) //and mechs. hit_things += M if(M.occupant) - if(friendly_fire_check && caster && caster.faction_check(M.occupant)) + if(friendly_fire_check && caster && caster.faction_check_mob(M.occupant)) continue M.occupant << "Your [M.name] is struck by a [name]!" playsound(M,'sound/weapons/sear.ogg', 50, 1, -4) diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/retaliate.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/retaliate.dm index f11017553c5..248d0a60b08 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/retaliate.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/retaliate.dm @@ -28,7 +28,7 @@ continue if(isliving(A)) var/mob/living/M = A - if(faction_check(M) && attack_same || !faction_check(M)) + if(faction_check_mob(M) && attack_same || !faction_check_mob(M)) enemies |= M else if(istype(A, /obj/mecha)) var/obj/mecha/M = A @@ -37,7 +37,7 @@ enemies |= M.occupant for(var/mob/living/simple_animal/hostile/retaliate/H in around) - if(faction_check(H) && !attack_same && !H.attack_same) + if(faction_check_mob(H) && !attack_same && !H.attack_same) H.enemies |= enemies return 0 diff --git a/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm b/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm index f28233ba45d..6bfa9b46c50 100644 --- a/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm +++ b/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm @@ -69,7 +69,7 @@ var/grasp_pull_chance = 85 var/grasp_range = 4 del_on_death = 1 - + /mob/living/simple_animal/hostile/venus_human_trap/Destroy() for(var/L in grasping) var/datum/beam/B = grasping[L] @@ -99,7 +99,7 @@ if(grasping.len < max_grasps) grasping: for(var/mob/living/L in view(grasp_range, src)) - if(L == src || faction_check(L) || (L in grasping) || L == target) + if(L == src || faction_check_mob(L) || (L in grasping) || L == target) continue for(var/t in getline(src,L)) for(var/a in t) diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index e9a26713e2f..b7a4161c6b3 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -361,7 +361,7 @@ else if(!istype(M, childtype) && M.gender == MALE) //Better safe than sorry ;_; partner = M - else if(isliving(M) && !faction_check(M)) //shyness check. we're not shy in front of things that share a faction with us. + else if(isliving(M) && !faction_check_mob(M)) //shyness check. we're not shy in front of things that share a faction with us. return //we never mate when not alone, so just abort early if(alone && partner && children < 3) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index cb6ee7e4665..be7b382a87f 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -816,11 +816,28 @@ var/next_mob_id = 0 /mob/proc/canUseTopic() return -/mob/proc/faction_check(mob/target) - for(var/F in faction) - if(F in target.faction) - return 1 - return 0 +/mob/proc/faction_check_mob(mob/target, exact_match) + if(exact_match) //if we need an exact match, we need to do some bullfuckery. + var/list/faction_src = faction.Copy() + var/list/faction_target = target.faction.Copy() + if(!("\ref[src]" in faction_target)) //if they don't have our ref faction, remove it from our factions list. + faction_src -= "\ref[src]" //if we don't do this, we'll never have an exact match. + if(!("\ref[target]" in faction_src)) + faction_target -= "\ref[target]" //same thing here. + return faction_check(faction_src, faction_target, TRUE) + return faction_check(faction, target.faction, FALSE) + +/proc/faction_check(list/faction_A, list/faction_B, exact_match) + var/list/match_list + if(exact_match) + match_list = faction_A&faction_B //only items in both lists + var/length = LAZYLEN(match_list) + if(length) + return (length == LAZYLEN(faction_A)) //if they're not the same len(gth) or we don't have a len, then this isn't an exact match. + else + match_list = faction_A&faction_B + return LAZYLEN(match_list) + return FALSE //This will update a mob's name, real_name, mind.name, data_core records, pda, id and traitor text