Files
Bubberstation/code/modules/events/wizard/greentext.dm
MrStonedOne bd6d51a0b5 Massive MC and subsystem rewrite
MC:
	No longer tracks a subsystem's cpu usage. This was basically worthless and took up space on the stat panel
	Can calculate wait down to a tenth of a decisecond to make it fps/world.ticklag agnostic
	Now allows subsystems to have a dynamic wait, that is based on a ratio of how long that subsystem has been taking to process(cost). (This system allows for upper and lower bounds, and an changeable cost delta for each subsystem)
	MC can now be told to init a zlevel

All Subsystems:
	Stats panel now allows child subsystems to pass it a message to add to its stats entry. All subsystems have been moved over to this system - This should cut down on subsystems having to copy and paste the stats proc in order to add to it
	All subsystems now properlly handle being given a zlevel in their init proc

Subsystem changes:
	Air:
		Added air to the dynamic wait subsystem. upper bound: 50, lower bound: 5, cost delta: 3 times process cost
		Air now fires 4 times faster when it can do so without lagging things up
		Pipenet has been merged into air
		Atmos machinery now processes with process_atmos(), ticked by air, not machinery.
		Hotspots (the fire object) are now object pooled
	Pipenet:
		Deleted, added to air
	Machinery:
		Moved all atmos calcualtions in all objects's process() to process_atmos().
	Lighting:
		Added Lighting to the dynamic wait subsystem. upper bound: 20, lower bound: 5, cost delta: 3 times process cost
	Ticker:
		Fixed ticker not updating the lobby panel when game start delayed
		Fixed the game start timer updating rapidly from queued fires when game start delay is removed
	Garbage/qdel:
		qdel will now limit its process time to 2ds a fire.
		qdel can now be given hints as a return to Destroy() as to what should be done with the object.
		the options are:
			queue: (default) this is the normal behavior.
			letmelive: old default to non-null/zero. does nothing with the object
			iwillgc: functionally the same as above, mainly to let people working with objects know that the object will not be queued for GC checking
			harddel: this will queue the object to be deleted without storing a soft reference, mainly to save locate() processing time.
			harddel_now: this will del() the object. To allow for a clean removal of every del() not in qdel
		All objects have been updated to the new system, harddel and iwillgc was not added to any new objects.
		Fixed some objects not GCing because they didn't properlly clear references in Destory()
		Fixed some objects getting qdel'ed preventing other objects from getting GCed because they did not null their reference to that object.
2015-04-29 02:00:25 -07:00

81 lines
2.9 KiB
Plaintext

/datum/round_event_control/wizard/greentext //Gotta have it!
name = "Greentext"
weight = 4
typepath = /datum/round_event/wizard/greentext/
max_occurrences = 1
earliest_start = 0
/datum/round_event/wizard/greentext/start()
var/list/holder_canadates = player_list.Copy()
for(var/mob/M in holder_canadates)
if(!ishuman(M))
holder_canadates -= M
if(!holder_canadates) //Very unlikely, but just in case
return 0
var/mob/living/carbon/human/H = pick(holder_canadates)
new /obj/item/weapon/greentext(H.loc)
H << "<font color='green'>The mythical greentext appear at your feet! Pick it up if you dare...</font>"
/obj/item/weapon/greentext/
name = "greentext"
desc = "No one knows what this massive tome does, but it feels <i><font color='green'>desirable</font></i> all the same..."
w_class = 4.0
icon = 'icons/obj/wizard.dmi'
icon_state = "greentext"
var/mob/living/last_holder
var/mob/living/new_holder
var/list/color_altered_mobs = list()
/obj/item/weapon/greentext/equipped(mob/living/user as mob)
user << "<font color='green'>So long as you leave this place with greentext in hand you know will be happy...</font>"
if(user.mind && user.mind.objectives.len > 0)
user << "<span class='warning'>... so long as you still perform your other objectives that is!</span>"
new_holder = user
if(!last_holder)
last_holder = user
if(!(user in color_altered_mobs))
color_altered_mobs += user
user.color = "#00FF00"
SSobj.processing |= src
..()
/obj/item/weapon/greentext/dropped(mob/living/user as mob)
if(user in color_altered_mobs)
user << "<span class='warning'>A sudden wave of failure washes over you...</span>"
user.color = "#FF0000" //ya blew it
last_holder = null
new_holder = null
SSobj.processing.Remove(src)
..()
/obj/item/weapon/greentext/process()
if(new_holder && new_holder.z == ZLEVEL_CENTCOM)//you're winner!
new_holder << "<font color='green'>At last it feels like victory is assured!</font>"
if(!(new_holder in ticker.mode.traitors))
ticker.mode.traitors += new_holder.mind
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.attack_log += "\[[time_stamp()]\] <font color='green'>Won with greentext!!!</font>"
color_altered_mobs -= new_holder
qdel(src)
if(last_holder && last_holder != new_holder) //Somehow it was swiped without ever getting dropped
last_holder << "<span class='warning'>A sudden wave of failure washes over you...</span>"
last_holder.color = "#FF0000"
last_holder = new_holder //long live the king
/obj/item/weapon/greentext/Destroy()
for(var/mob/M in mob_list)
var/message = "<span class='warning'>A dark temptation has passed from this world"
if(M in color_altered_mobs)
message += " and you're finally able to forgive yourself"
M.color = initial(M.color)
message += "...</span>"
M << message
..()