diff --git a/code/game/gamemodes/nations/nations.dm b/code/game/gamemodes/nations/nations.dm index 7369fc38cbf..8788604c64f 100644 --- a/code/game/gamemodes/nations/nations.dm +++ b/code/game/gamemodes/nations/nations.dm @@ -181,6 +181,7 @@ datum/game_mode/nations var/mob/living/carbon/human/H = N.current_leader H.verbs += /datum/game_mode/nations/proc/set_nation_name H.verbs += /datum/game_mode/nations/proc/set_ranks + H.verbs += /datum/game_mode/nations/proc/choose_heir N.update_nation_id() /** diff --git a/code/game/gamemodes/nations/nationsdatums.dm b/code/game/gamemodes/nations/nationsdatums.dm index 8526cf78b45..0e94ac28e8a 100644 --- a/code/game/gamemodes/nations/nationsdatums.dm +++ b/code/game/gamemodes/nations/nationsdatums.dm @@ -6,6 +6,7 @@ var/list/membership = list() var/leader_rank = "Leader" var/member_rank = "Member" + var/heir /datum/nations/atmosia default_name = "Atmosia" diff --git a/code/game/gamemodes/nations/nationsprocs.dm b/code/game/gamemodes/nations/nationsprocs.dm index b18a9443e17..020d05f8480 100644 --- a/code/game/gamemodes/nations/nationsprocs.dm +++ b/code/game/gamemodes/nations/nationsprocs.dm @@ -41,6 +41,55 @@ H << "You changed the [type] rank of your nation to [input]." return 1 +/datum/game_mode/nations/proc/choose_heir() + set name = "Choose Heir" + set category = "Nations" + set desc = "Click to pick a Heir. Note that the Heir has the ability to take over your role at ANY TIME. Choose carefully." + + if(!kickoff) return 1 + + if(ishuman(usr)) + var/mob/living/carbon/human/H = usr + if(H.mind && H.mind.nation && H.mind.nation.current_leader == H) + var/heir = input(H, "Who do you wish to make your heir?", "Choose Heir", "") as null|anything in H.mind.nation.membership + if(heir) + if(H.mind.nation.heir) + var/mob/living/carbon/human/oldheir = H.mind.nation.heir + oldheir << "You are no longer the heir to your nation!" + oldheir.verbs -= /datum/game_mode/nations/proc/takeover + var/mob/living/carbon/human/newheir = heir + H.mind.nation.heir = newheir + newheir.verbs += /datum/game_mode/nations/proc/takeover + newheir << "You have been selected to be the heir to your nation's leadership!" + H << "You have selected [heir] to be your heir!" + + +/datum/game_mode/nations/proc/takeover() + set name = "Become Leader" + set category = "Nations" + set desc = "Click to replace your current nation's leader with yourself." + + if(!kickoff) return 1 + + if(ishuman(usr)) + var/mob/living/carbon/human/H = usr + if(H.mind && H.mind.nation && H.mind.nation.heir == H) + var/confirmation = input(H, "Are you sure you want to take over leadership?", "Become Leader", "") as null|anything in list("Yes", "No") + if(confirmation == "Yes") + var/mob/living/carbon/human/oldleader = H.mind.nation.current_leader + oldleader << "You have been replaced by [H.name] as the leader of [H.mind.nation.current_name]!" + oldleader.verbs -= /datum/game_mode/nations/proc/set_nation_name + oldleader.verbs -= /datum/game_mode/nations/proc/set_ranks + oldleader.verbs -= /datum/game_mode/nations/proc/choose_heir + H.mind.nation.current_leader = H + H.mind.nation.heir = null + H.verbs -= /datum/game_mode/nations/proc/takeover + H.verbs += /datum/game_mode/nations/proc/set_nation_name + H.verbs += /datum/game_mode/nations/proc/set_ranks + H.verbs += /datum/game_mode/nations/proc/choose_heir + H << "You have replaced [oldleader.name] as the leader of [H.mind.nation.current_name]!" + H.mind.nation.update_nation_id() + /datum/nations/proc/update_nation_id() for(var/mob/living/carbon/human/M in membership) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index a04d048aff3..c6f1f7e3e38 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -280,8 +280,9 @@ stat("Absorbed DNA", mind.changeling.absorbedcount) if(mind.nation) - stat("Nation Name", mind.nation.current_name) - stat("Nation Leader", mind.nation.current_leader) + stat("Nation Name", "[mind.nation.current_name ? "[mind.nation.current_name]" : "mind.nation.default_name"]") + stat("Nation Leader", "[mind.nation.current_leader ? "[mind.nation.current_leader]" : "None"]") + stat("Nation Heir", "[mind.nation.heir ? "[mind.nation.heir]" : "None"]") if(istype(loc, /obj/spacepod)) // Spacdpods!