Initial commit for mobile pAIs. Almost guaranteed to be broken as shit.

This commit is contained in:
Zuhayr
2014-07-17 23:09:47 +09:30
parent ea8cdb52c7
commit 1345ee5a5c
5 changed files with 157 additions and 15 deletions
+146 -8
View File
@@ -1,10 +1,12 @@
/mob/living/silicon/pai
name = "pAI"
icon = 'icons/mob/mob.dmi'//
icon_state = "shadow"
icon = 'icons/mob/pai.dmi'
icon_state = "repairbot"
robot_talk_understand = 0
emote_type = 2 // pAIs emotes are heard, not seen, so they can be seen through a container (eg. person)
small = 1
pass_flags = 1
var/network = "SS13"
var/obj/machinery/camera/current = null
@@ -15,10 +17,9 @@
var/obj/item/device/paicard/card // The card we inhabit
var/obj/item/device/radio/radio // Our primary radio
var/speakStatement = "states"
var/speakExclamation = "declares"
var/speakQuery = "queries"
var/list/possible_chassis // A list of chassis to choose from.
var/list/possible_say_verbs // A list of speech verbs to choose from.
var/chassis = "repairbot" // A record of your chosen chassis.
var/obj/item/weapon/pai_cable/cable // The cable we produce and use when door or camera jacking
@@ -54,6 +55,7 @@
/mob/living/silicon/pai/New(var/obj/item/device/paicard)
canmove = 0
src.loc = paicard
card = paicard
@@ -68,6 +70,10 @@
add_language("Tradeband", 1)
add_language("Gutter", 1)
verbs += /mob/living/silicon/pai/proc/fold_out
verbs += /mob/living/silicon/pai/proc/choose_chassis
verbs += /mob/living/silicon/pai/proc/choose_verbs
//PDA
pda = new(src)
spawn(5)
@@ -77,6 +83,20 @@
pda.toff = 1
..()
possible_chassis = list(
"Drone" = "repairbot",
"Cat" = "cat",
"Mouse" = "mouse"
)
possible_say_verbs = list(
"Robotic" = list("states","declares","queries"),
"Natural" = list("says","yells","asks"),
"Beep" = list("beeps","beeps loudly","boops"),
"Chirp" = list("chirps","chirrups","cheeps"),
"Feline" = list("purrs","yowls","meows")
)
/mob/living/silicon/pai/Login()
..()
usr << browse_rsc('html/paigrid.png') // Go ahead and cache the interface resources as early as possible
@@ -113,7 +133,9 @@
return 0
/mob/living/silicon/pai/restrained()
return 0
if(istype(src.loc,/obj/item/device/paicard))
return 0
..()
/mob/living/silicon/pai/emp_act(severity)
// Silence for 2 minutes
@@ -231,7 +253,6 @@
src.reset_view(C)
return 1
/mob/living/silicon/pai/cancel_camera()
set category = "pAI Commands"
set name = "Cancel Camera View"
@@ -239,6 +260,123 @@
src.unset_machine()
src:cameraFollow = null
//This is used to convert the stationary pai item into a mobile pai mob.
/mob/living/silicon/pai/proc/fold_out()
set category = "pAI Commands"
set name = "Unfold Chassis"
if(stat || sleeping || paralysis || weakened)
return
if(src.loc != card)
return
verbs -= /mob/living/silicon/pai/proc/fold_out
verbs += /mob/living/silicon/pai/proc/fold_up
var/turf/T = get_turf(src)
if(istype(T)) T.visible_message("<b>[src]</b> folds outwards, expanding into a mobile form.")
canmove = 1
//I'm not sure how much of this is necessary, but I would rather avoid issues.
if(istype(card.loc,/mob))
var/mob/M = card.loc
M.drop_item(card)
src.client.perspective = EYE_PERSPECTIVE
src.client.eye = src
src.loc = get_turf(card)
card.loc = src
src.forceMove(get_turf(card))
card.forceMove(src)
/mob/living/silicon/pai/proc/fold_up()
set category = "pAI Commands"
set name = "Condense Chassis"
if(stat || sleeping || paralysis || weakened)
return
if(src.loc == card)
return
close_up()
/mob/living/silicon/pai/proc/choose_chassis()
set category = "pAI Commands"
set name = "Choose Chassis"
var/choice
var/finalized = "No"
while(finalized == "No" && src.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 possible_chassis
if(!choice) return
icon_state = possible_chassis[choice]
finalized = alert("Look at your sprite. Is this what you wish to use?",,"No","Yes")
chassis = possible_chassis[choice]
verbs -= /mob/living/silicon/pai/proc/choose_chassis
/mob/living/silicon/pai/proc/choose_verbs()
set category = "pAI Commands"
set name = "Choose Speech Verbs"
var/choice = input(usr,"What theme would you like to use for your speech verbs? This decision can only be made once.") as null|anything in possible_say_verbs
if(!choice) return
var/list/sayverbs = possible_say_verbs[choice]
speak_statement = sayverbs[1]
speak_exclamation = sayverbs[(sayverbs.len>1 ? 2 : sayverbs.len)]
speak_query = sayverbs[(sayverbs.len>2 ? 3 : sayverbs.len)]
verbs -= /mob/living/silicon/pai/proc/choose_verbs
/mob/living/silicon/pai/lay_down()
set name = "Rest"
set category = "IC"
if(istype(src.loc,/obj/item/device/paicard))
resting = 0
else
resting = !resting
icon_state = resting ? "[chassis]_rest" : "[chassis]"
src << "\blue You are now [resting ? "resting" : "getting up"]"
canmove = !resting
//Overriding this will stop a number of headaches down the track.
/mob/living/silicon/pai/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(W.force)
visible_message("<span class='danger'>[user.name] attacks [src] with [W]!</span>")
src.adjustBruteLoss(W.force)
src.updatehealth()
else
visible_message("<span class='warning'>[user.name] bonks [src] harmlessly with [W].</span>")
if(stat != 2) close_up()
return
//I'm not sure how much of this is necessary, but I would rather avoid issues.
/mob/living/silicon/pai/proc/close_up()
verbs -= /mob/living/silicon/pai/proc/fold_up
verbs += /mob/living/silicon/pai/proc/fold_out
var/turf/T = get_turf(src)
if(istype(T)) T.visible_message("<b>[src]</b> neatly folds inwards, compacting down to a rectangular card.")
src.stop_pulling()
src.client.perspective = EYE_PERSPECTIVE
src.client.eye = card
src.loc = card
card.loc = get_turf(card)
src.forceMove(card)
card.forceMove(card.loc)
canmove = 0
//Addition by Mord_Sith to define AI's network change ability
/*
/mob/living/silicon/pai/proc/pai_network_change()
+3 -3
View File
@@ -2,11 +2,11 @@
var/ending = copytext(text, length(text))
if (ending == "?")
return "queries"
return speak_query
else if (ending == "!")
return "declares"
return speak_exclamation
return "states"
return speak_statement
#define IS_AI 1
#define IS_ROBOT 2
+6 -1
View File
@@ -8,6 +8,11 @@
var/list/hud_list[9]
var/list/speech_synthesizer_langs = list() //which languages can be vocalized by the speech synthesizer
//Used in say.dm.
var/speak_statement = "states"
var/speak_exclamation = "declares"
var/speak_query = "queries"
/mob/living/silicon/proc/show_laws()
return
@@ -141,7 +146,7 @@
/mob/living/silicon/remove_language(var/rem_language)
..(rem_language)
for (var/datum/language/L in speech_synthesizer_langs)
if (L.name == rem_language)
speech_synthesizer_langs -= L