Another one

This commit is contained in:
VerySoft
2022-06-28 07:06:44 -04:00
parent b00f5ed9b7
commit e3fe41a70c
12 changed files with 337 additions and 94 deletions
+17 -4
View File
@@ -58,11 +58,21 @@ GLOBAL_LIST_BOILERPLATE(all_pai_cards, /obj/item/device/paicard)
/obj/item/device/paicard/attack_ghost(mob/user as mob)
if(pai != null) //Have a person in them already?
return ..()
var/time_till_respawn = user.time_till_respawn()
if(time_till_respawn == -1) // Special case, never allowed to respawn
to_chat(usr, "<span class='warning'>Respawning is not allowed!</span>")
else if(time_till_respawn) // Nonzero time to respawn
to_chat(usr, "<span class='warning'>You can't do that yet! You died too recently. You need to wait another [round(time_till_respawn/10/60, 0.1)] minutes.</span>")
return
if(jobban_isbanned(usr, "pAI"))
to_chat(usr,"<span class='warning'>You cannot join a pAI card when you are banned from playing as a pAI.</span>")
return
for(var/ourkey in paikeys)
if(ourkey == user.ckey)
to_chat(usr, "<span class='warning'>You can't just rejoin any old pAI card!!! Your card still exists.</span>")
return
var/choice = tgui_alert(user, "You sure you want to inhabit this PAI, or submit yourself to being recruited?", "Confirmation", list("Inhabit", "Recruit", "Cancel"))
if(choice == "Cancel")
return ..()
@@ -81,12 +91,14 @@ GLOBAL_LIST_BOILERPLATE(all_pai_cards, /obj/item/device/paicard)
var/obj/item/device/paicard/typeb/card = new(location)
var/mob/living/silicon/pai/new_pai = new(card)
new_pai.key = user.key
paikeys |= new_pai.ckey
card.setPersonality(new_pai)
new_pai.SetName(actual_pai_name)
else
var/obj/item/device/paicard/card = new(location)
var/mob/living/silicon/pai/new_pai = new(card)
new_pai.key = user.key
paikeys |= new_pai.ckey
card.setPersonality(new_pai)
new_pai.SetName(actual_pai_name)
@@ -95,6 +107,7 @@ GLOBAL_LIST_BOILERPLATE(all_pai_cards, /obj/item/device/paicard)
var/obj/item/device/paicard/typeb/card = new(location)
var/mob/living/silicon/pai/new_pai = new(card)
new_pai.key = user.key
paikeys |= new_pai.ckey
card.setPersonality(new_pai)
if(!new_pai.savefile_load(new_pai))
var/pai_name = tgui_input_text(new_pai, "Choose your character's name", "Character Name")
@@ -105,6 +118,7 @@ GLOBAL_LIST_BOILERPLATE(all_pai_cards, /obj/item/device/paicard)
var/obj/item/device/paicard/card = new(location)
var/mob/living/silicon/pai/new_pai = new(card)
new_pai.key = user.key
paikeys |= new_pai.ckey
card.setPersonality(new_pai)
if(!new_pai.savefile_load(new_pai))
var/pai_name = tgui_input_text(new_pai, "Choose your character's name", "Character Name")
@@ -513,6 +527,5 @@ GLOBAL_LIST_BOILERPLATE(all_pai_cards, /obj/item/device/paicard)
return pick(/obj/item/device/paicard ,/obj/item/device/paicard/typeb)
/obj/item/device/paicard/digest_act(var/atom/movable/item_storage = null)
if(!pai.digestable)
return
. = ..()
if(pai.digestable)
return ..()
+260 -77
View File
@@ -1,163 +1,346 @@
#define PP_FUNCTIONAL 0
#define PP_BROKEN 1
#define PP_MISSING 2
var/global/list/paikeys = list()
/obj/item/device/paicard
var/panel_open = FALSE
var/cell = TRUE //critical- power
var/processor = TRUE //critical- the thinky part
var/board = TRUE //critical- makes everything work
var/capacitor = TRUE //critical- power processing
var/projector = TRUE //non-critical- affects unfolding
var/emitter = TRUE //non-critical- affects unfolding
var/speech_synthesizer = TRUE //non-critical- affects speech
var/list/parts = list(
"cell",
"processor",
"board",
"capacitor",
"projector",
"emitter",
"speech synthesizer")
var/cell = PP_FUNCTIONAL //critical- power
var/processor = PP_FUNCTIONAL //critical- the thinky part
var/board = PP_FUNCTIONAL //critical- makes everything work
var/capacitor = PP_FUNCTIONAL //critical- power processing
var/projector = PP_FUNCTIONAL //non-critical- affects unfolding
var/emitter = PP_FUNCTIONAL //non-critical- affects unfolding
var/speech_synthesizer = PP_FUNCTIONAL //non-critical- affects speech
/obj/item/device/paicard/attackby(var/obj/item/I as obj, mob/user as mob)
if(istype(I,/obj/item/weapon/tool/screwdriver))
if(panel_open)
panel_open = FALSE
user.visible_message("<span class ='warning'>\The [user] secured \the [src]'s maintenance panel.</span>")
user.visible_message("<span class ='notice'>\The [user] secured \the [src]'s maintenance panel.</span>")
else
panel_open = TRUE
user.visible_message("<span class ='notice'>\The [user] opened \the [src]'s maintenance panel.</span>")
user.visible_message("<span class ='warning'>\The [user] opened \the [src]'s maintenance panel.</span>")
if(istype(I,/obj/item/device/robotanalyzer))
if(!panel_open)
to_chat(user, "<span class ='warning'>The panel isn't open. You will need to unscrew it to open it.</span>")
else
if(cell)
if(cell == PP_FUNCTIONAL)
to_chat(user,"Power cell: <span class ='notice'>functional</span>")
else
else if(cell == PP_BROKEN)
to_chat(user,"Power cell: <span class ='warning'>damaged - CRITICAL</span>")
if(processor)
else
to_chat(user,"Power cell: <span class ='warning'>missing - CRITICAL</span>")
if(processor == PP_FUNCTIONAL)
to_chat(user,"Processor: <span class ='notice'>functional</span>")
else
else if(processor == PP_BROKEN)
to_chat(user,"Processor: <span class ='warning'>damaged - CRITICAL</span>")
if(board)
else
to_chat(user,"Processor: <span class ='warning'>missing - CRITICAL</span>")
if(board == PP_FUNCTIONAL)
to_chat(user,"Board: <span class ='notice'>functional</span>")
else
else if(board == PP_BROKEN)
to_chat(user,"Board: <span class ='warning'>damaged - CRITICAL</span>")
if(capacitor)
else
to_chat(user,"Board: <span class ='warning'>missing - CRITICAL</span>")
if(capacitor == PP_FUNCTIONAL)
to_chat(user,"Capacitors: <span class ='notice'>functional</span>")
else
else if(capacitor == PP_BROKEN)
to_chat(user,"Capacitors: <span class ='warning'>damaged - CRITICAL</span>")
if(projector)
else
to_chat(user,"Capacitors: <span class ='warning'>missing - CRITICAL</span>")
if(projector == PP_FUNCTIONAL)
to_chat(user,"Projectors: <span class ='notice'>functional</span>")
else
else if(projector == PP_BROKEN)
to_chat(user,"Projectors: <span class ='warning'>damaged</span>")
if(emitter)
else
to_chat(user,"Projectors: <span class ='warning'>missing</span>")
if(emitter == PP_FUNCTIONAL)
to_chat(user,"Emitters: <span class ='notice'>functional</span>")
else
else if(emitter == PP_BROKEN)
to_chat(user,"Emitters: <span class ='warning'>damaged</span>")
if(speech_synthesizer)
to_chat(user,"Speech Synthesizer: <span class ='notice'>functional</span>")
else
to_chat(user,"Emitters: <span class ='warning'>missing</span>")
if(speech_synthesizer == PP_FUNCTIONAL)
to_chat(user,"Speech Synthesizer: <span class ='notice'>functional</span>")
else if(speech_synthesizer == PP_BROKEN)
to_chat(user,"Speech Synthesizer: <span class ='warning'>damaged</span>")
else
to_chat(user,"Speech Synthesizer: <span class ='warning'>missing</span>")
if(istype(I,/obj/item/device/multitool))
if(!panel_open)
to_chat(user, "<span class ='warning'>You can't do that in this state.</span>")
else
var/list/parts = list()
if(cell != PP_MISSING)
parts |= "cell"
if(processor != PP_MISSING)
parts |= "processor"
if(board != PP_MISSING)
parts |= "board"
if(capacitor != PP_MISSING)
parts |= "capacitor"
if(projector != PP_MISSING)
parts |= "projector"
if(emitter != PP_MISSING)
parts |= "emitter"
if(speech_synthesizer != PP_MISSING)
parts |= "speech synthesizer"
var/choice = tgui_input_list(user, "Which part would you like to check?", "Check part", parts)
switch(choice)
if("cell")
if(cell)
if(cell == PP_FUNCTIONAL)
to_chat(user,"Power cell: <span class ='notice'>functional</span>")
else
else if(speech_synthesizer == PP_BROKEN)
to_chat(user,"Power cell: <span class ='warning'>damaged</span>")
else
to_chat(user,"Power cell: <span class ='warning'>missing</span>")
if("processor")
if(processor)
if(processor == PP_FUNCTIONAL)
to_chat(user,"Processor: <span class ='notice'>functional</span>")
else
else if(speech_synthesizer == PP_BROKEN)
to_chat(user,"Processor: <span class ='warning'>damaged</span>")
else
to_chat(user,"Processor: <span class ='warning'>missing</span>")
if("board")
if(board)
if(board == PP_FUNCTIONAL)
to_chat(user,"Board: <span class ='notice'>functional</span>")
else
else if(speech_synthesizer == PP_BROKEN)
to_chat(user,"Board: <span class ='warning'>damaged</span>")
else
to_chat(user,"Board: <span class ='warning'>missing</span>")
if("capacitor")
if(capacitor)
if(capacitor == PP_FUNCTIONAL)
to_chat(user,"Capacitors: <span class ='notice'>functional</span>")
else
else if(speech_synthesizer == PP_BROKEN)
to_chat(user,"Capacitors: <span class ='warning'>damaged</span>")
else
to_chat(user,"Capacitors: <span class ='warning'>missing</span>")
if("projector")
if(projector)
if(projector == PP_FUNCTIONAL)
to_chat(user,"Projectors: <span class ='notice'>functional</span>")
else
else if(speech_synthesizer == PP_BROKEN)
to_chat(user,"Projectors: <span class ='warning'>damaged</span>")
else
to_chat(user,"Projectors: <span class ='warning'>missing</span>")
if("emitter")
if(emitter)
if(emitter == PP_FUNCTIONAL)
to_chat(user,"Emitters: <span class ='notice'>functional</span>")
else
else if(speech_synthesizer == PP_BROKEN)
to_chat(user,"Emitters: <span class ='warning'>damaged</span>")
if("speech synthesizer")
if(speech_synthesizer)
to_chat(user,"Speech Synthesizer: <span class ='notice'>functional</span>")
else
to_chat(user,"Emitters: <span class ='warning'>missing</span>")
if("speech synthesizer")
if(speech_synthesizer == PP_FUNCTIONAL)
to_chat(user,"Speech Synthesizer: <span class ='notice'>functional</span>")
else if(speech_synthesizer == PP_BROKEN)
to_chat(user,"Speech Synthesizer: <span class ='warning'>damaged</span>")
else
to_chat(user,"Speech Synthesizer: <span class ='warning'>missing</span>")
if(istype(I,/obj/item/paiparts/cell) && cell == PP_MISSING)
user.visible_message("<span class ='notice'>\The [user] installs \the [I] into \the [src].</span>","<span class ='notice'>You install \the [I] into \the [src].</span>")
cell = PP_FUNCTIONAL
user.drop_from_inventory(I)
qdel(I)
if(istype(I,/obj/item/paiparts/processor) && processor == PP_MISSING)
user.visible_message("<span class ='notice'>\The [user] installs \the [I] into \the [src].</span>","<span class ='notice'>You install \the [I] into \the [src].</span>")
processor = PP_FUNCTIONAL
user.drop_from_inventory(I)
qdel(I)
if(istype(I,/obj/item/paiparts/board) && board == PP_MISSING)
user.visible_message("<span class ='notice'>\The [user] installs \the [I] into \the [src].</span>","<span class ='notice'>You install \the [I] into \the [src].</span>")
board = PP_FUNCTIONAL
user.drop_from_inventory(I)
qdel(I)
if(istype(I,/obj/item/paiparts/capacitor) && capacitor == PP_MISSING)
user.visible_message("<span class ='notice'>\The [user] installs \the [I] into \the [src].</span>","<span class ='notice'>You install \the [I] into \the [src].</span>")
capacitor = PP_FUNCTIONAL
user.drop_from_inventory(I)
qdel(I)
if(istype(I,/obj/item/paiparts/projector) && projector == PP_MISSING)
user.visible_message("<span class ='notice'>\The [user] installs \the [I] into \the [src].</span>","<span class ='notice'>You install \the [I] into \the [src].</span>")
projector = PP_FUNCTIONAL
user.drop_from_inventory(I)
qdel(I)
if(istype(I,/obj/item/paiparts/emitter) && emitter == PP_MISSING)
user.visible_message("<span class ='notice'>\The [user] installs \the [I] into \the [src].</span>","<span class ='notice'>You install \the [I] into \the [src].</span>")
emitter = PP_FUNCTIONAL
user.drop_from_inventory(I)
qdel(I)
if(istype(I,/obj/item/paiparts/speech_synthesizer) && speech_synthesizer == PP_MISSING)
user.visible_message("<span class ='notice'>\The [user] installs \the [I] into \the [src].</span>","<span class ='notice'>You install \the [I] into \the [src].</span>")
speech_synthesizer = PP_FUNCTIONAL
user.drop_from_inventory(I)
qdel(I)
/obj/item/device/paicard/attack_self(mob/user)
if(!panel_open)
access_screen(user)
return
var/list/parts = list()
if(cell != PP_MISSING)
parts |= "cell"
if(processor != PP_MISSING)
parts |= "processor"
if(board != PP_MISSING)
parts |= "board"
if(capacitor != PP_MISSING)
parts |= "capacitor"
if(projector != PP_MISSING)
parts |= "projector"
if(emitter != PP_MISSING)
parts |= "emitter"
if(speech_synthesizer != PP_MISSING)
parts |= "speech synthesizer"
var/choice = tgui_input_list(user, "Which part would you like to remove?", "Remove part", parts)
switch(choice)
if("cell")
cell = FALSE
if(pai.stat != DEAD)
pai.death()
if(cell == PP_FUNCTIONAL)
new /obj/item/paiparts/capacitor(get_turf(user))
else
new /obj/item/paiparts(get_turf(user))
user.visible_message("<span class ='warning'>\The [user] removes \the [choice] from \the [src].</span>","<span class ='warning'>You remove \the [choice] from \the [src].</span>")
cell = PP_MISSING
if("processor")
processor = FALSE
if(pai.stat != DEAD)
pai.death()
if(processor == PP_FUNCTIONAL)
new /obj/item/paiparts/capacitor(get_turf(user))
else
new /obj/item/paiparts(get_turf(user))
user.visible_message("<span class ='warning'>\The [user] removes \the [choice] from \the [src].</span>","<span class ='warning'>You remove \the [choice] from \the [src].</span>")
processor = PP_MISSING
if("board")
board = FALSE
if(pai.stat != DEAD)
pai.death()
board = PP_MISSING
if(board == PP_FUNCTIONAL)
new /obj/item/paiparts/capacitor(get_turf(user))
else
new /obj/item/paiparts(get_turf(user))
user.visible_message("<span class ='warning'>\The [user] removes \the [choice] from \the [src].</span>","<span class ='warning'>You remove \the [choice] from \the [src].</span>")
if("capacitor")
capacitor = FALSE
if(pai.stat != DEAD)
pai.death()
if(capacitor == PP_FUNCTIONAL)
new /obj/item/paiparts/capacitor(get_turf(user))
else
new /obj/item/paiparts(get_turf(user))
user.visible_message("<span class ='warning'>\The [user] removes \the [choice] from \the [src].</span>","<span class ='warning'>You remove \the [choice] from \the [src].</span>")
capacitor = PP_MISSING
if("projector")
projector = FALSE
if(projector == PP_FUNCTIONAL)
new /obj/item/paiparts/capacitor(get_turf(user))
else
new /obj/item/paiparts(get_turf(user))
user.visible_message("<span class ='warning'>\The [user] removes \the [choice] from \the [src].</span>","<span class ='warning'>You remove \the [choice] from \the [src].</span>")
projector = PP_MISSING
if("emitter")
emitter = FALSE
if(emitter == PP_FUNCTIONAL)
new /obj/item/paiparts/capacitor(get_turf(user))
else
new /obj/item/paiparts(get_turf(user))
user.visible_message("<span class ='warning'>\The [user] removes \the [choice] from \the [src].</span>","<span class ='warning'>You remove \the [choice] from \the [src].</span>")
emitter = PP_MISSING
if("speech synthesizer")
speech_synthesizer = FALSE
parts -= choice
if(speech_synthesizer == PP_FUNCTIONAL)
new /obj/item/paiparts/capacitor(get_turf(user))
else
new /obj/item/paiparts(get_turf(user))
user.visible_message("<span class ='warning'>\The [user] removes \the [choice] from \the [src].</span>","<span class ='warning'>You remove \the [choice] from \the [src].</span>")
speech_synthesizer = PP_MISSING
/obj/item/device/paicard/proc/death_damage()
var/number = pick(1,4)
var/number = rand(1,4)
while(number)
switch(pick(1,4))
number --
switch(rand(1,4))
if(1)
cell = FALSE
cell = PP_BROKEN
if(2)
processor = FALSE
processor = PP_BROKEN
if(3)
board = FALSE
board = PP_BROKEN
if(4)
capacitor = FALSE
capacitor = PP_BROKEN
/obj/item/device/paicard/proc/damage_random_component(nonfatal = FALSE)
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(2, 1, src)
s.start()
if(prob(80) || nonfatal) //Way more likely to be non-fatal part damage
switch(pick(1,3))
switch(rand(1,3))
if(1)
projector = FALSE
projector = PP_BROKEN
if(2)
emitter = FALSE
emitter = PP_BROKEN
if(3)
speech_synthesizer = FALSE
speech_synthesizer = PP_BROKEN
else
switch(pick(1,4))
switch(rand(1,4))
if(1)
cell = FALSE
cell = PP_BROKEN
if(2)
processor = FALSE
processor = PP_BROKEN
if(3)
board = FALSE
board = PP_BROKEN
if(4)
capacitor = FALSE
capacitor = PP_BROKEN
/obj/item/device/paicard/proc/is_damage_critical()
if(cell != PP_FUNCTIONAL || processor != PP_FUNCTIONAL || board != PP_FUNCTIONAL || capacitor != PP_FUNCTIONAL)
return TRUE
return FALSE
/obj/item/paiparts
name = "broken pAI component"
desc = "It's broken scrap from a pAI card!"
icon = 'icons/obj/paicard.dmi'
icon_state = "broken"
/obj/item/paiparts/Initialize()
. = ..()
pixel_x = rand(-10,10)
pixel_y = rand(-10,10)
/obj/item/paiparts/cell
name = "pAI power cell"
desc = "It's very small and efficient! It powers the pAI!"
icon_state = "cell"
/obj/item/paiparts/processor
name = "pAI processor"
desc = "It's the brain of your computer friend!"
icon_state = "processor"
/obj/item/paiparts/board
name = "pAI board"
desc = "It's the thing all the other parts get attatched to!"
icon_state = "board"
/obj/item/paiparts/capacitor
name = "pAI capacitor"
desc = "It helps regulate power flow!"
icon_state = "capacitor"
/obj/item/paiparts/projector
name = "pAI projector"
desc = "It projects the pAI's form!"
icon_state = "projector"
/obj/item/paiparts/emitter
name = "pAI emitter"
desc = "It emits the fields to help the pAI get around!"
icon_state = "emitter"
/obj/item/paiparts/speech_synthesizer
name = "pAI speech synthesizer"
desc = "It's a little voice box!"
icon_state = "speech_synthesizer"