From 57eadb3a0e76352d2ee43e9ceb1f0507cac2a105 Mon Sep 17 00:00:00 2001 From: FalseIncarnate Date: Sat, 18 Mar 2017 01:37:50 -0400 Subject: [PATCH] Removes real_name restriction for silicon sprites Also adds code support for custom maint drones. Whether or not we want to let people get custom drone sprites is up to the head admins, but the code is there for it. Maint drones have a new verb which attempts to equip their custom sprite, if one exists for that player, which can only be used once. --- code/modules/mob/living/silicon/ai/ai.dm | 55 ++++++++++++++++--- code/modules/mob/living/silicon/pai/pai.dm | 33 ++++++----- .../mob/living/silicon/robot/drone/drone.dm | 6 +- .../silicon/robot/drone/drone_abilities.dm | 53 +++++++++++++++++- .../modules/mob/living/silicon/robot/robot.dm | 18 +++--- config/example/custom_sprites.txt | 7 +-- 6 files changed, 132 insertions(+), 40 deletions(-) diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index b1505dc6d23..3947eceed1a 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -299,22 +299,59 @@ var/list/ai_verbs_default = list( for(var/i = 1 to Entry.len) Entry[i] = trim(Entry[i]) - if(Entry.len < 3 || Entry[1] != "ai") //ignore incorrectly formatted entries or entries that aren't marked for AI + if(Entry.len < 2 || Entry[1] != "ai") //ignore incorrectly formatted entries or entries that aren't marked for AI continue; - if(Entry[2] == ckey && Entry[3] == real_name) //They're in the list? Custom sprite time, var and icon change required + if(Entry[2] == ckey) //They're in the list? Custom sprite time, var and icon change required custom_sprite = 1 - icon = 'icons/mob/custom_synthetic/custom-synthetic.dmi' + var/display_choices = list( + "Monochrome", + "Blue", + "Clown", + "Inverted", + "Text", + "Smiley", + "Angry", + "Dorf", + "Matrix", + "Bliss", + "Firewall", + "Green", + "Red", + "Static", + "Triumvirate", + "Triumvirate Static", + "Red October", + "Sparkles", + "ANIMA", + "President", + "NT", + "NT2", + "Rainbow", + "Angel", + "Heartline", + "Hades", + "Helios", + "Syndicat Meow", + "Too Deep", + "Goon", + "Murica", + "Fuzzy", + "Glitchman", + "House", + "Database" + ) + if(custom_sprite) + display_choices += "Custom" //if(icon_state == initial(icon_state)) var/icontype = "" - if(custom_sprite == 1) - icontype = ("Custom")//automagically selects custom sprite if one is available - else - icontype = input("Select an icon!", "AI", null, null) in list("Monochrome", "Blue", "Clown", "Inverted", "Text", "Smiley", "Angry", "Dorf", "Matrix", "Bliss", "Firewall", "Green", "Red", "Static", "Triumvirate", "Triumvirate Static", "Red October", "Sparkles", "ANIMA", "President", "NT", "NT2", "Rainbow", "Angel", "Heartline", "Hades", "Helios", "Syndicat Meow", "Too Deep", "Goon", "Murica", "Fuzzy", "Glitchman", "House", "Database") + icontype = input("Select an icon!", "AI", null, null) in display_choices + icon = 'icons/mob/AI.dmi' //reset this in case we were on a custom sprite and want to change to a standard one switch(icontype) if("Custom") + icon = 'icons/mob/custom_synthetic/custom-synthetic.dmi' //set this here so we can use the custom_sprite icon_state = "[ckey]-ai" if("Clown") icon_state = "ai-clown" @@ -859,10 +896,10 @@ var/list/ai_verbs_default = list( for(var/i = 1 to Entry.len) Entry[i] = trim(Entry[i]) - if(Entry.len < 3 || Entry[1] != "hologram") + if(Entry.len < 2 || Entry[1] != "hologram") continue - if (Entry[2] == ckey && Entry[3] == real_name) //Custom holograms + if (Entry[2] == ckey) //Custom holograms custom_hologram = 1 // option is given in hologram menu var/input diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 9deba78f410..d3d102ebeb9 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -395,6 +395,7 @@ set category = "pAI Commands" set name = "Choose Chassis" + var/list/my_choices = list() var/choice var/finalized = "No" @@ -409,26 +410,32 @@ for(var/i = 1 to Entry.len) Entry[i] = trim(Entry[i]) - if(Entry.len < 3 || Entry[1] != "pai") //ignore incorrectly formatted entries or entries that aren't marked for pAI + if(Entry.len < 2 || Entry[1] != "pai") //ignore incorrectly formatted entries or entries that aren't marked for pAI continue; - if(Entry[2] == ckey && Entry[3] == real_name) //They're in the list? Custom sprite time, var and icon change required + if(Entry[2] == ckey) //They're in the list? Custom sprite time, var and icon change required custom_sprite = 1 - icon = 'icons/mob/custom_synthetic/custom-synthetic.dmi' + my_choices["Custom"] = "[ckey]-pai" + my_choices = possible_chassis.Copy() if(custom_sprite) - chassis = "[ckey]-pai" - icon_state = "[ckey]-pai" - else - while(finalized == "No" && client) + my_choices["Custom"] = "[ckey]-pai" - 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 + if(loc == card) //don't let them continue in card form, since they won't be able to actually see their new mobile form sprite. + to_chat(src, "You must be in your mobile form to reconfigure your chassis.") + return - icon_state = possible_chassis[choice] - finalized = alert("Look at your sprite. Is this what you wish to use?",,"No","Yes") + while(finalized == "No" && client) + 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 my_choices + if(!choice) return + if(choice == "Custom") + icon = 'icons/mob/custom_synthetic/custom-synthetic.dmi' + else + icon = 'icons/mob/pai.dmi' + icon_state = my_choices[choice] + finalized = alert("Look at your sprite. Is this what you wish to use?",,"No","Yes") - chassis = possible_chassis[choice] + chassis = my_choices[choice] verbs -= /mob/living/silicon/pai/proc/choose_chassis /mob/living/silicon/pai/proc/choose_verbs() @@ -586,7 +593,7 @@ // Handle being picked up. -/mob/living/silicon/pai/get_scooped(var/mob/living/carbon/grabber) +/mob/living/silicon/pai/get_scooped(mob/living/carbon/grabber) var/obj/item/weapon/holder/H = ..() if(!istype(H)) return diff --git a/code/modules/mob/living/silicon/robot/drone/drone.dm b/code/modules/mob/living/silicon/robot/drone/drone.dm index fdc1ace289c..7266d5b940d 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone.dm @@ -15,7 +15,7 @@ req_access = list(access_engine, access_robotics) ventcrawler = 2 magpulse = 1 - + default_language = "Drone" // We need to keep track of a few module items so we don't need to do list operations @@ -43,7 +43,7 @@ remove_language("Galactic Common") add_language("Drone Talk", 1) add_language("Drone", 1) - + // Disable the microphone wire on Drones if(radio) radio.wires.CutWireIndex(WIRE_TRANSMIT) @@ -281,7 +281,7 @@ if(!player) return - src.ckey = player.ckey + ckey = player.ckey if(player.mob && player.mob.mind) player.mob.mind.transfer_to(src) diff --git a/code/modules/mob/living/silicon/robot/drone/drone_abilities.dm b/code/modules/mob/living/silicon/robot/drone/drone_abilities.dm index d450d508bd3..2ee6eeb9f53 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone_abilities.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone_abilities.dm @@ -47,4 +47,55 @@ if(M.a_intent == I_HELP) get_scooped(M) - ..() \ No newline at end of file + ..() + +/mob/living/silicon/robot/drone/verb/customize() + set name = "Customize Chassis" + set desc = "Reconfigure your chassis into a customized version." + set category = "Drone" + + if(!custom_sprite) //Check to see if custom sprite time, checking the appopriate file to change a var + var/file = file2text("config/custom_sprites.txt") + var/lines = splittext(file, "\n") + + for(var/line in lines) + // split & clean up + var/list/Entry = splittext(line, ":") + for(var/i = 1 to Entry.len) + Entry[i] = trim(Entry[i]) + + if(Entry.len < 2 || Entry[1] != "drone") + continue + + if (Entry[2] == ckey) //Custom holograms + custom_sprite = 1 // option is given in hologram menu + + if(!custom_sprite) + to_chat(src, "Error 404: Custom chassis not found. Revoking customization option.") + else + icon = 'icons/mob/custom_synthetic/custom-synthetic.dmi' + icon_state = "[ckey]-drone" + to_chat(src, "You reconfigure your chassis and improve the station through your new aesthetics.") + verbs -= /mob/living/silicon/robot/drone/verb/customize + +/mob/living/silicon/robot/drone/get_scooped(mob/living/carbon/grabber) + var/obj/item/weapon/holder/H = ..() + if(!istype(H)) + return + if(resting) + resting = 0 + if(custom_sprite) + H.icon = 'icons/mob/custom_synthetic/custom-synthetic.dmi' + H.icon_override = 'icons/mob/custom_synthetic/custom_head.dmi' + H.lefthand_file = 'icons/mob/custom_synthetic/custom_lefthand.dmi' + H.righthand_file = 'icons/mob/custom_synthetic/custom_righthand.dmi' + H.icon_state = "[icon_state]" + H.item_state = "[icon_state]_hand" + else + H.icon_state = "drone" + H.item_state = "drone" + grabber.put_in_active_hand(H)//for some reason unless i call this it dosen't work + grabber.update_inv_l_hand() + grabber.update_inv_r_hand() + + return H \ No newline at end of file diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 0461919511a..28ec3c5114b 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -184,12 +184,11 @@ var/list/robot_verbs_default = list( for(var/i = 1 to Entry.len) Entry[i] = trim(Entry[i]) - if(Entry.len < 3 || Entry[1] != "cyborg") //ignore incorrectly formatted entries or entries that aren't marked for cyborg + if(Entry.len < 2 || Entry[1] != "cyborg") //ignore incorrectly formatted entries or entries that aren't marked for cyborg continue; - if(Entry[2] == ckey && Entry[3] == real_name) //They're in the list? Custom sprite time, var and icon change required + if(Entry[2] == ckey) //They're in the list? Custom sprite time, var and icon change required custom_sprite = 1 - icon = 'icons/mob/custom_synthetic/custom-synthetic.dmi' return 1 @@ -1252,15 +1251,14 @@ var/list/robot_verbs_default = list( triesleft-- var/icontype - - if(custom_sprite == 1) - icontype = "Custom" - triesleft = 0 - else - lockcharge = 1 //Locks borg until it select an icon to avoid secborgs running around with a standard sprite - icontype = input("Select an icon! [triesleft ? "You have [triesleft] more chances." : "This is your last try."]", "Robot", null, null) in module_sprites + lockcharge = 1 //Locks borg until it select an icon to avoid secborgs running around with a standard sprite + icontype = input("Select an icon! [triesleft ? "You have [triesleft] more chances." : "This is your last try."]", "Robot", null, null) in module_sprites if(icontype) + if(icontype == "Custom") + icon = 'icons/mob/custom_synthetic/custom-synthetic.dmi' + else + icon = 'icons/mob/robots.dmi' icon_state = module_sprites[icontype] if(icontype == "Bro") module.module_type = "Brobot" diff --git a/config/example/custom_sprites.txt b/config/example/custom_sprites.txt index 57969ba1a59..471764270d4 100644 --- a/config/example/custom_sprites.txt +++ b/config/example/custom_sprites.txt @@ -1,6 +1,5 @@ -Each entry should be composed of 3 parts, each divided by a colon (:) with no spaces, in order to work. Failure to do so will result in that entry being disregarded by the code. -- The first part should be either "cyborg", "ai", "hologram", or "pai". This tells the code what type of custom sprite this entry is for. The "ai" option is for AI core displays, while "hologram" is for AI hologram projections. +Each entry should be composed of 2 parts, divided by a colon (:) with no spaces, in order to work. Failure to do so will result in that entry being disregarded by the code. +- The first part should be either "cyborg", "ai", "hologram", "pai", or "drone". This tells the code what type of custom sprite this entry is for. The "ai" option is for AI core displays, while "hologram" is for AI hologram projections. - The second part should be the ckey of the player this entry is for. This tells the code who it works for and also is used to retrieve the proper sprite for them to use. -- The third part should be the "real name" of the character this entry is for. This is the name of the borg, AI, or pAI personality (not the player's real name!), because they can only use the sprite on that specific character name. -example:example:example \ No newline at end of file +example:example \ No newline at end of file