Merge pull request #5471 from Citadel-Station-13/upstream-merge-35584

[MIRROR] Greentext antag datum and OnRoundend hook.
This commit is contained in:
deathride58
2018-02-14 03:02:13 +00:00
committed by GitHub
5 changed files with 48 additions and 11 deletions
+5
View File
@@ -162,6 +162,11 @@
if(LAZYLEN(GLOB.round_end_notifiees))
send2irc("Notice", "[GLOB.round_end_notifiees.Join(", ")] the round has ended.")
for(var/I in round_end_events)
var/datum/callback/cb = I
cb.InvokeAsync()
LAZYCLEARLIST(round_end_events)
for(var/client/C in GLOB.clients)
if(!C.credits)
C.RollCredits()
+9
View File
@@ -61,6 +61,7 @@ SUBSYSTEM_DEF(ticker)
var/round_start_time = 0
var/list/round_start_events
var/list/round_end_events
var/mode_result = "undefined"
var/end_state = "undefined"
@@ -336,12 +337,20 @@ SUBSYSTEM_DEF(ticker)
send2irc("Server", "Round [GLOB.round_id ? "#[GLOB.round_id]:" : "of"] [hide_mode ? "secret":"[mode.name]"] has started[allmins.len ? ".":" with no active admins online!"]")
setup_done = TRUE
//These callbacks will fire after roundstart key transfer
/datum/controller/subsystem/ticker/proc/OnRoundstart(datum/callback/cb)
if(!HasRoundStarted())
LAZYADD(round_start_events, cb)
else
cb.InvokeAsync()
//These callbacks will fire before roundend report
/datum/controller/subsystem/ticker/proc/OnRoundend(datum/callback/cb)
if(current_state >= GAME_STATE_FINISHED)
cb.InvokeAsync()
else
LAZYADD(round_end_events, cb)
/datum/controller/subsystem/ticker/proc/station_explosion_detonation(atom/bomb)
if(bomb) //BOOM
var/turf/epi = bomb.loc
@@ -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
. = ..()
+14 -11
View File
@@ -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
+1
View File
@@ -1210,6 +1210,7 @@
#include "code\modules\antagonists\devil\true_devil\_true_devil.dm"
#include "code\modules\antagonists\devil\true_devil\inventory.dm"
#include "code\modules\antagonists\ert\ert.dm"
#include "code\modules\antagonists\greentext\greentext.dm"
#include "code\modules\antagonists\highlander\highlander.dm"
#include "code\modules\antagonists\monkey\monkey.dm"
#include "code\modules\antagonists\morph\morph.dm"