From 0b28d580d2837984b78b2ebf2c486fd48823bf03 Mon Sep 17 00:00:00 2001 From: silencer-pl <103842328+silencer-pl@users.noreply.github.com> Date: Fri, 6 Sep 2024 04:55:45 -0400 Subject: [PATCH] talking npcs proof of concept --- code/__DEFINES/job.dm | 2 + code/__DEFINES/shuttles.dm | 2 + .../objects/effects/landmarks/landmarks.dm | 43 +++++++++++++++++++ code/modules/gear_presets/xenosurge.dm | 33 ++++++++++++++ .../mob/living/carbon/human/human_defines.dm | 31 +++++++++++++ code/modules/shuttle/shuttles/dropship.dm | 2 +- maps/shuttles/dropship_wraith.dmm | 2 + 7 files changed, 114 insertions(+), 1 deletion(-) diff --git a/code/__DEFINES/job.dm b/code/__DEFINES/job.dm index 245d6a97f5..447abd1544 100644 --- a/code/__DEFINES/job.dm +++ b/code/__DEFINES/job.dm @@ -44,6 +44,8 @@ #define JOB_UER_MARINE_POINT "UER Marine Point" #define JOB_UER_MARINE_LEAD "UER Marine Team Lead" +#define JOB_UER_PO "UER Dropship Pilot" + var/global/list/job_squad_roles = JOB_SQUAD_ROLES_LIST #define JOB_COLONIST "Colonist" diff --git a/code/__DEFINES/shuttles.dm b/code/__DEFINES/shuttles.dm index b25da4ac98..39550c3f0e 100644 --- a/code/__DEFINES/shuttles.dm +++ b/code/__DEFINES/shuttles.dm @@ -124,6 +124,8 @@ #define GOLDEN_ARROW_LZ "golden arrow lz" +#define ARROWHEAD_LZ "arrowhead lz" + #define DROPSHIP_FLYBY_ID "special_flight" #define DROPSHIP_LZ1 "dropship-lz1" #define DROPSHIP_LZ2 "dropship-lz2" diff --git a/code/game/objects/effects/landmarks/landmarks.dm b/code/game/objects/effects/landmarks/landmarks.dm index 789459b71e..89dda34836 100644 --- a/code/game/objects/effects/landmarks/landmarks.dm +++ b/code/game/objects/effects/landmarks/landmarks.dm @@ -516,3 +516,46 @@ /// In landmarks.dm and not unit_test.dm so it is always active in the mapping tools. /obj/effect/landmark/unit_test_top_right name = "unit test zone top right" + + +/obj/effect/landmark/npc_spawner + name = "NPC spawner" + icon_state = "x2" + var/equipment_path = /datum/equipment_preset/pve/pilot_npc + var/npc_name = "John Doe" + var/npc_chat_color = "#ffffff" + var/gender_to_set = MALE + +/obj/effect/landmark/npc_spawner/Initialize() + . = ..() + INVOKE_ASYNC(src, PROC_REF(spawn_npc)) + return INITIALIZE_HINT_QDEL + +/obj/effect/landmark/npc_spawner/Destroy() + equipment_path = null + return ..() + +/obj/effect/landmark/npc_spawner/proc/spawn_npc() + var/mob/living/carbon/human/H = new(loc) + H.setDir(dir) + if(!H.hud_used) + H.create_hud() + arm_equipment(H, equipment_path, FALSE, FALSE) + H.name = npc_name + H.langchat_color = npc_chat_color + H.gender = gender_to_set + for(var/obj/structure/bed/chair/dropship/pilot/chair in get_area(H)) + if(chair != null) + if(get_turf(chair) == get_turf(H)) + chair.do_buckle(H,H) + break + +/obj/effect/landmark/npc_spawner/pilot_left + npc_name = "Isabel 'Shrike' Vasquez" + npc_chat_color = "#e40f3d" + gender_to_set = FEMALE + +/obj/effect/landmark/npc_spawner/pilot_right + + npc_name = "James 'Jim' Biggs" + npc_chat_color = "#59eec9" diff --git a/code/modules/gear_presets/xenosurge.dm b/code/modules/gear_presets/xenosurge.dm index fb664709e1..e888bb5783 100644 --- a/code/modules/gear_presets/xenosurge.dm +++ b/code/modules/gear_presets/xenosurge.dm @@ -151,3 +151,36 @@ /obj/effect/landmark/start/marine/pve/lead/squad2 icon_state = "leader_spawn_delta" squad = SQUAD_MARINE_4 + +/datum/job/marine/pve/pilot_npc + title = JOB_UER_PO + total_positions = 0 + spawn_positions = 0 + supervisors = "Mission Control" + gear_preset = /datum/equipment_preset/pve/pilot_npc + entry_message_body = "haha" + +/datum/equipment_preset/pve/pilot_npc + name = "UER Marine Lead" + flags = EQUIPMENT_PRESET_EXTRA|EQUIPMENT_PRESET_MARINE + + access = list(ACCESS_MARINE_PREP) + assignment = JOB_UER_PO + rank = JOB_UER_PO + faction = FACTION_MARINE + paygrade = "NO3" + role_comm_title = "PO" + skills = /datum/skills/pve/standard + +/datum/equipment_preset/pve/pilot_npc/load_gear(mob/living/carbon/human/new_human) + + new_human.equip_to_slot_or_del(new /obj/item/device/radio/headset/almayer/po(new_human), WEAR_L_EAR) + new_human.equip_to_slot_or_del(new /obj/item/storage/backpack/marine(new_human), WEAR_BACK) + new_human.equip_to_slot_or_del(new /obj/item/clothing/under/marine/officer/pilot(new_human), WEAR_BODY) + new_human.equip_to_slot_or_del(new /obj/item/clothing/shoes/marine/knife(new_human), WEAR_FEET) + new_human.equip_to_slot_or_del(new /obj/item/clothing/gloves/yellow(new_human), WEAR_HANDS) + new_human.equip_to_slot_or_del(new /obj/item/storage/belt/gun/m4a3/mod88(new_human), WEAR_WAIST) + new_human.equip_to_slot_or_del(new /obj/item/clothing/suit/storage/bomber(new_human), WEAR_JACKET) + new_human.equip_to_slot_or_del(new /obj/item/storage/pouch/general/large(new_human), WEAR_R_STORE) + new_human.equip_to_slot_or_del(new /obj/item/clothing/head/helmet/marine/pilot(new_human), WEAR_HEAD) + new_human.equip_to_slot_or_del(new /obj/item/clothing/glasses/sunglasses(new_human), WEAR_EYES) diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index 659dc0c57c..1343be4d19 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -276,3 +276,34 @@ to_chat(usr, "Removed [rem_organ] from [src].") qdel(rem_organ) +/mob/living/carbon/human/proc/talkas(str, delay, radio) //Talk as. Delay in BYOND ticks (about 1/10 of a second per tick) If not provided, delay calculated automatically depending in message length. + if (!str) return + var/list/heard = get_mobs_in_view(world_view_size, src) + src.langchat_speech(str, heard, GLOB.all_languages, skip_language_check = TRUE) + src.visible_message("[src] says, \"[str]\"") + var/talkdelay = delay + if (!talkdelay) + if ((length("[str]")) <= 64) + talkdelay = 40 + if ((length("[str]")) > 64) + talkdelay = 60 + if(radio) + to_chat(world, "[src][icon2html('icons/obj/items/radio.dmi', usr, "beacon")] \u005BUAS Arrowhead\u0028[src.job]\u0029\u005D , says \"[str]\"", type = MESSAGE_TYPE_RADIO) + sleep(talkdelay) + return + +/mob/living/carbon/human/proc/emoteas(str, delay, radio) //Emote as. Delay in BYOND ticks (about 1/10 of a second per tick) If not provided, delay calculated automatically depending in message length. + if (!str) return + var/list/heard = get_mobs_in_view(world_view_size, src) + src.langchat_speech(str, heard, GLOB.all_languages, skip_language_check = TRUE, animation_style = LANGCHAT_FAST_POP, additional_styles = list("langchat_small", "emote")) + src.visible_message("[src] [str]") + var/talkdelay = delay + if (!talkdelay) + if ((length("[str]")) <= 64) + talkdelay = 40 + if ((length("[str]")) > 64) + talkdelay = 60 + if(radio) + to_chat(world, "[src][icon2html('icons/obj/items/radio.dmi', usr, "beacon")] \u005BUAS Arrowhead\u0028[usr.job]\u0029\u005D [str]", type = MESSAGE_TYPE_RADIO) + sleep(talkdelay) + return diff --git a/code/modules/shuttle/shuttles/dropship.dm b/code/modules/shuttle/shuttles/dropship.dm index 0fc03dd501..2870307cdb 100644 --- a/code/modules/shuttle/shuttles/dropship.dm +++ b/code/modules/shuttle/shuttles/dropship.dm @@ -335,7 +335,7 @@ /obj/docking_port/stationary/marine_dropship/arrowhead_hangar name = "Wraith Launch Bay" - id = GOLDEN_ARROW_LZ + id = ARROWHEAD_LZ auto_open = TRUE roundstart_template = /datum/map_template/shuttle/wraith diff --git a/maps/shuttles/dropship_wraith.dmm b/maps/shuttles/dropship_wraith.dmm index 9368f496f7..41d8e018b1 100644 --- a/maps/shuttles/dropship_wraith.dmm +++ b/maps/shuttles/dropship_wraith.dmm @@ -91,6 +91,7 @@ /obj/structure/bed/chair/dropship/pilot{ dir = 1 }, +/obj/effect/landmark/npc_spawner/pilot_left, /turf/open/shuttle/dropship{ icon_state = "rasputin15" }, @@ -136,6 +137,7 @@ /obj/structure/bed/chair/dropship/pilot{ dir = 1 }, +/obj/effect/landmark/npc_spawner/pilot_right, /turf/open/shuttle/dropship{ icon_state = "rasputin15" },