Merge pull request #5471 from Citadel-Station-13/upstream-merge-35584
[MIRROR] Greentext antag datum and OnRoundend hook.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
/datum/antagonist/greentext
|
||||
name = "winner"
|
||||
show_in_antagpanel = FALSE
|
||||
show_name_in_check_antagonists = TRUE //Not that it will be there for long
|
||||
|
||||
/datum/antagonist/greentext/proc/forge_objectives()
|
||||
var/datum/objective/O = new /datum/objective("Succeed")
|
||||
O.completed = TRUE //YES!
|
||||
O.owner = owner
|
||||
objectives += O
|
||||
owner.objectives += objectives
|
||||
|
||||
/datum/antagonist/greentext/on_gain()
|
||||
forge_objectives()
|
||||
. = ..()
|
||||
|
||||
/datum/antagonist/greentext/on_removal()
|
||||
owner.objectives -= objectives
|
||||
. = ..()
|
||||
@@ -28,12 +28,15 @@
|
||||
var/mob/living/last_holder
|
||||
var/mob/living/new_holder
|
||||
var/list/color_altered_mobs = list()
|
||||
var/datum/callback/roundend_callback
|
||||
resistance_flags = FIRE_PROOF | ACID_PROOF
|
||||
var/quiet = FALSE
|
||||
|
||||
/obj/item/greentext/New()
|
||||
..()
|
||||
/obj/item/greentext/Initialize(mapload)
|
||||
. = ..()
|
||||
GLOB.poi_list |= src
|
||||
roundend_callback = CALLBACK(src,.proc/check_winner)
|
||||
SSticker.OnRoundend(roundend_callback)
|
||||
|
||||
/obj/item/greentext/equipped(mob/living/user as mob)
|
||||
to_chat(user, "<font color='green'>So long as you leave this place with greentext in hand you know will be happy...</font>")
|
||||
@@ -57,20 +60,19 @@
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
..()
|
||||
|
||||
/obj/item/greentext/process()
|
||||
if(new_holder && is_centcom_level(new_holder.z))//you're winner!
|
||||
/obj/item/greentext/proc/check_winner()
|
||||
if(!new_holder)
|
||||
return
|
||||
|
||||
if(is_centcom_level(new_holder.z))//you're winner!
|
||||
to_chat(new_holder, "<font color='green'>At last it feels like victory is assured!</font>")
|
||||
new_holder.mind.special_role = "winner"
|
||||
var/datum/objective/O = new /datum/objective("Succeed")
|
||||
O.completed = 1 //YES!
|
||||
O.owner = new_holder.mind
|
||||
new_holder.mind.objectives += O
|
||||
new_holder.mind.add_antag_datum(/datum/antagonist/auto_custom)
|
||||
new_holder.mind.add_antag_datum(/datum/antagonist/greentext)
|
||||
new_holder.log_message("<font color='green'>Won with greentext!!!</font>", INDIVIDUAL_ATTACK_LOG)
|
||||
color_altered_mobs -= new_holder
|
||||
resistance_flags |= ON_FIRE
|
||||
qdel(src)
|
||||
|
||||
/obj/item/greentext/process()
|
||||
if(last_holder && last_holder != new_holder) //Somehow it was swiped without ever getting dropped
|
||||
to_chat(last_holder, "<span class='warning'>A sudden wave of failure washes over you...</span>")
|
||||
last_holder.add_atom_colour("#FF0000", ADMIN_COLOUR_PRIORITY)
|
||||
@@ -80,7 +82,7 @@
|
||||
if(!(resistance_flags & ON_FIRE) && !force)
|
||||
return QDEL_HINT_LETMELIVE
|
||||
|
||||
. = ..()
|
||||
SSticker.round_end_events -= roundend_callback
|
||||
GLOB.poi_list.Remove(src)
|
||||
for(var/i in GLOB.player_list)
|
||||
var/mob/M = i
|
||||
@@ -93,6 +95,7 @@
|
||||
// can't skip the mob check as it also does the decolouring
|
||||
if(!quiet)
|
||||
to_chat(M, message)
|
||||
. = ..()
|
||||
|
||||
/obj/item/greentext/quiet
|
||||
quiet = TRUE
|
||||
|
||||
Reference in New Issue
Block a user