mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-18 19:39:42 +01:00
Overhauls Custom Synthetic Code (#6803)
Loads custom synths from json or SQL as opposed to a txt file. Adds support for multiple borg sprites, ai chassis and custom ai hologram sprites as opposed to one sprite per player. Adds the ability to use custom pai sprites
This commit is contained in:
@@ -592,6 +592,19 @@ var/list/holder_mob_icon_cache = list()
|
||||
/obj/item/weapon/holder/pai/rabbit
|
||||
icon_state = "rabbit_rest"
|
||||
item_state = "rabbit"
|
||||
/obj/item/weapon/holder/pai/custom
|
||||
var/customsprite = 1
|
||||
|
||||
/obj/item/weapon/holder/pai/custom/sync(mob/living/M)
|
||||
..()
|
||||
set_paiholder()
|
||||
|
||||
/obj/item/weapon/holder/pai/custom/proc/set_paiholder()
|
||||
|
||||
if(contained && customsprite == 1)
|
||||
icon = CUSTOM_ITEM_SYNTH
|
||||
icon_state = "[contained.icon_state]-holder"
|
||||
item_state = "[contained.icon_state]"
|
||||
|
||||
//corgi
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ var/list/ai_verbs_default = list(
|
||||
var/list/cameraRecords = list() //For storing what is shown to the cameras
|
||||
|
||||
var/datum/ai_icon/selected_sprite // The selected icon set
|
||||
var/custom_sprite = 0 // Whether the selected icon is custom
|
||||
var/custom_sprite = FALSE // Whether the selected icon is custom
|
||||
var/carded
|
||||
|
||||
var/multitool_mode = 0
|
||||
@@ -245,24 +245,13 @@ var/list/ai_verbs_default = list(
|
||||
return ..()
|
||||
|
||||
/mob/living/silicon/ai/proc/setup_icon()
|
||||
var/file = file2text("config/custom_sprites.txt")
|
||||
var/lines = text2list(file, "\n")
|
||||
|
||||
for(var/line in lines)
|
||||
// split & clean up
|
||||
var/list/Entry = text2list(line, ":")
|
||||
for(var/i = 1 to Entry.len)
|
||||
Entry[i] = trim(Entry[i])
|
||||
|
||||
if(Entry.len < 2)
|
||||
continue;
|
||||
|
||||
if(Entry[1] == src.ckey && Entry[2] == src.real_name)
|
||||
icon = CUSTOM_ITEM_SYNTH
|
||||
custom_sprite = 1
|
||||
selected_sprite = new/datum/ai_icon("Custom", "[src.ckey]-ai", "4", "[ckey]-ai-crash", "#FFFFFF", "#FFFFFF", "#FFFFFF")
|
||||
else
|
||||
selected_sprite = default_ai_icon
|
||||
var/datum/custom_synth/sprite = robot_custom_icons[name]
|
||||
if(istype(sprite) && sprite.synthckey == ckey)
|
||||
custom_sprite = TRUE
|
||||
icon = CUSTOM_ITEM_SYNTH
|
||||
selected_sprite = new/datum/ai_icon("Custom", "[sprite.aichassisicon]", "4", "[sprite.aichassisicon]-crash", "#FFFFFF", "#FFFFFF", "#FFFFFF")
|
||||
else
|
||||
selected_sprite = default_ai_icon
|
||||
updateicon()
|
||||
|
||||
/mob/living/silicon/ai/pointed(atom/A as mob|obj|turf in view())
|
||||
@@ -634,7 +623,8 @@ var/list/ai_verbs_default = list(
|
||||
var/icon_list[] = list(
|
||||
"default",
|
||||
"floating face",
|
||||
"carp"
|
||||
"carp",
|
||||
"custom"
|
||||
)
|
||||
input = input("Please select a hologram:") as null|anything in icon_list
|
||||
if(input)
|
||||
@@ -646,6 +636,14 @@ var/list/ai_verbs_default = list(
|
||||
holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holo2"))
|
||||
if("carp")
|
||||
holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holo4"))
|
||||
if("custom")
|
||||
if(custom_sprite)
|
||||
var/datum/custom_synth/sprite = robot_custom_icons[name]
|
||||
if(istype(sprite) && sprite.synthckey == ckey && sprite.aiholoicon)
|
||||
holo_icon = getHologramIcon(icon("icons/mob/custom_synths/customhologram.dmi","[sprite.aiholoicon]"))
|
||||
else
|
||||
to_chat(src, "You do not have a custom sprite!")
|
||||
return
|
||||
return
|
||||
|
||||
//Toggles the luminosity and applies it by re-entereing the camera.
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
var/obj/item/device/paicard/card // The card we inhabit
|
||||
var/obj/item/device/radio/radio // Our primary radio
|
||||
|
||||
|
||||
var/chassis = "repairbot" // A record of your chosen chassis.
|
||||
var/global/list/possible_chassis = list(
|
||||
"Drone" = "repairbot",
|
||||
@@ -25,6 +26,7 @@
|
||||
"Rat" = "rat",
|
||||
"Monkey" = "monkey",
|
||||
"Rabbit" = "rabbit"
|
||||
|
||||
)
|
||||
|
||||
var/global/list/pai_holder_types = list(
|
||||
@@ -131,6 +133,7 @@
|
||||
add_language(LANGUAGE_TRADEBAND, 1)
|
||||
add_language(LANGUAGE_GUTTER, 1)
|
||||
add_language(LANGUAGE_EAL, 1)
|
||||
set_custom_sprite()
|
||||
|
||||
verbs += /mob/living/silicon/pai/proc/choose_chassis
|
||||
verbs += /mob/living/silicon/pai/proc/choose_verbs
|
||||
@@ -146,6 +149,15 @@
|
||||
pda.name = "[pda.owner] ([pda.ownjob])"
|
||||
pda.toff = TRUE
|
||||
|
||||
|
||||
/mob/living/silicon/pai/proc/set_custom_sprite()
|
||||
var/datum/custom_synth/sprite = robot_custom_icons[name]
|
||||
if(istype(sprite) && sprite.synthckey == ckey)
|
||||
possible_chassis["Custom"] = "[sprite.paiicon]"
|
||||
pai_holder_types["Custom"] = /obj/item/weapon/holder/pai/custom
|
||||
icon = CUSTOM_ITEM_SYNTH
|
||||
else
|
||||
return
|
||||
/mob/living/silicon/pai/init_id()
|
||||
. = ..()
|
||||
idcard.registered_name = ""
|
||||
@@ -361,7 +373,7 @@
|
||||
var/choice
|
||||
var/finalized = "No"
|
||||
while(finalized == "No" && src.client)
|
||||
|
||||
set_custom_sprite()
|
||||
choice = input(usr,"What would you like to use for your mobile chassis icon? This decision can only be made once.") as null|anything in possible_chassis
|
||||
if(!choice) return
|
||||
|
||||
|
||||
@@ -3,33 +3,21 @@
|
||||
//Since the ckey is used as the icon_state, the current system will only permit a single custom robot sprite per ckey.
|
||||
//While it might be possible for a ckey to use that custom sprite for several real_names, it seems rather pointless to support it.
|
||||
var/list/robot_custom_icons
|
||||
|
||||
/hook/startup/proc/load_robot_custom_sprites()
|
||||
var/config_file = file2text("config/custom_sprites.txt")
|
||||
var/list/lines = text2list(config_file, "\n")
|
||||
|
||||
robot_custom_icons = list()
|
||||
for(var/line in lines)
|
||||
//split entry into ckey and real_name
|
||||
var/split_idx = findtext(line, "-") //this works if ckey cannot contain dashes, and findtext starts from the beginning
|
||||
if(!split_idx || split_idx == length(line))
|
||||
continue //bad entry
|
||||
|
||||
var/ckey = copytext(line, 1, split_idx)
|
||||
var/real_name = copytext(line, split_idx+1)
|
||||
|
||||
robot_custom_icons[ckey] = real_name
|
||||
if(config.load_customsynths_from == "sql")
|
||||
loadsynths_from_sql()
|
||||
else if(config.load_customsynths_from == "json")
|
||||
loadsynths_from_json()
|
||||
return 1
|
||||
|
||||
/mob/living/silicon/robot/proc/set_custom_sprite()
|
||||
var/rname = robot_custom_icons[ckey]
|
||||
if(rname && rname == real_name)
|
||||
var/datum/custom_synth/sprite = robot_custom_icons[name]
|
||||
if(istype(sprite) && sprite.synthckey == ckey)
|
||||
custom_sprite = 1
|
||||
icon = CUSTOM_ITEM_SYNTH
|
||||
var/list/valid_states = icon_states(icon)
|
||||
if(icon_state == "robot")
|
||||
if("[ckey]-Standard" in valid_states)
|
||||
icon_state = "[ckey]-Standard"
|
||||
if("[sprite.synthicon]-Standard" in valid_states)
|
||||
icon_state = "[sprite.synthicon]-Standard"
|
||||
else
|
||||
to_chat(src, "<span class='warning'>Could not locate [ckey]-Standard sprite.</span>")
|
||||
icon = 'icons/mob/robots.dmi'
|
||||
to_chat(src, "<span class='warning'>Could not locate [sprite.synthicon]-Standard sprite.</span>")
|
||||
icon = 'icons/mob/robots.dmi'
|
||||
@@ -267,15 +267,16 @@
|
||||
//Custom_sprite check and entry
|
||||
|
||||
if (custom_sprite == 1)
|
||||
var/datum/custom_synth/sprite = robot_custom_icons[name]
|
||||
var/list/valid_states = icon_states(CUSTOM_ITEM_SYNTH)
|
||||
if("[ckey]-[modtype]" in valid_states)
|
||||
module_sprites["Custom"] = "[src.ckey]-[modtype]"
|
||||
if("[sprite.synthicon]-[modtype]" in valid_states)
|
||||
module_sprites["Custom"] = "[sprite.synthicon]-[modtype]"
|
||||
icon = CUSTOM_ITEM_SYNTH
|
||||
icontype = "Custom"
|
||||
else
|
||||
icontype = module_sprites[1]
|
||||
icon = 'icons/mob/robots.dmi'
|
||||
to_chat(src, "<span class='warning'>Custom Sprite Sheet does not contain a valid icon_state for [ckey]-[modtype]</span>")
|
||||
to_chat(src, "<span class='warning'>Custom Sprite Sheet does not contain a valid icon_state for [sprite.synthicon]-[modtype]</span>")
|
||||
else
|
||||
icontype = module_sprites[1]
|
||||
icon_state = module_sprites[icontype]
|
||||
|
||||
Reference in New Issue
Block a user