mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-16 01:23:41 +01:00
File standardisation (#13131)
* Adds the check components * Adds in trailing newlines * Converts all CRLF to LF * Post merge EOF * Post merge line endings * Final commit
This commit is contained in:
+320
-320
@@ -1,320 +1,320 @@
|
||||
#define BASE_LAW_TYPE /datum/ai_laws/nanotrasen
|
||||
|
||||
/datum/ai_law
|
||||
var/law = ""
|
||||
var/index = 0
|
||||
|
||||
/datum/ai_law/New(law, index)
|
||||
src.law = law
|
||||
src.index = index
|
||||
|
||||
/datum/ai_law/proc/get_index()
|
||||
return index
|
||||
|
||||
/datum/ai_law/ion/get_index()
|
||||
return ionnum()
|
||||
|
||||
/datum/ai_law/zero/get_index()
|
||||
return 0
|
||||
|
||||
/datum/ai_law/sixsixsix/get_index()
|
||||
return 666
|
||||
|
||||
|
||||
/datum/ai_laws
|
||||
var/name = "Unknown Laws"
|
||||
var/law_header = "Prime Directives"
|
||||
var/selectable = 0
|
||||
var/default = 0
|
||||
var/datum/ai_law/zero/zeroth_law = null
|
||||
var/datum/ai_law/zero/zeroth_law_borg = null
|
||||
var/list/datum/ai_law/inherent_laws = list()
|
||||
var/list/datum/ai_law/supplied_laws = list()
|
||||
var/list/datum/ai_law/ion/ion_laws = list()
|
||||
var/list/datum/ai_law/sixsixsix/devil_laws = list()
|
||||
var/list/datum/ai_law/sorted_laws = list()
|
||||
|
||||
var/state_zeroth = 0
|
||||
var/list/state_devil = list()
|
||||
var/list/state_ion = list()
|
||||
var/list/state_inherent = list()
|
||||
var/list/state_supplied = list()
|
||||
|
||||
/datum/ai_laws/New()
|
||||
..()
|
||||
sort_laws()
|
||||
|
||||
/* General ai_law functions */
|
||||
/datum/ai_laws/proc/all_laws()
|
||||
sort_laws()
|
||||
return sorted_laws
|
||||
|
||||
/datum/ai_laws/proc/laws_to_state()
|
||||
sort_laws()
|
||||
var/list/statements = new()
|
||||
for(var/datum/ai_law/law in sorted_laws)
|
||||
if(get_state_law(law))
|
||||
statements += law
|
||||
|
||||
return statements
|
||||
|
||||
/datum/ai_laws/proc/sort_laws()
|
||||
if(sorted_laws.len)
|
||||
return
|
||||
|
||||
for(var/ion_law in ion_laws)
|
||||
sorted_laws += ion_law
|
||||
|
||||
for(var/evil_law in devil_laws)
|
||||
sorted_laws += evil_law
|
||||
|
||||
if(zeroth_law)
|
||||
sorted_laws += zeroth_law
|
||||
|
||||
var/index = 1
|
||||
for(var/datum/ai_law/inherent_law in inherent_laws)
|
||||
inherent_law.index = index++
|
||||
if(supplied_laws.len < inherent_law.index || !istype(supplied_laws[inherent_law.index], /datum/ai_law))
|
||||
sorted_laws += inherent_law
|
||||
|
||||
for(var/datum/ai_law/AL in supplied_laws)
|
||||
if(istype(AL))
|
||||
sorted_laws += AL
|
||||
|
||||
/datum/ai_laws/proc/sync(var/mob/living/silicon/S, var/full_sync = 1)
|
||||
// Add directly to laws to avoid log-spam
|
||||
S.sync_zeroth(zeroth_law, zeroth_law_borg)
|
||||
|
||||
if(full_sync || ion_laws.len)
|
||||
S.laws.clear_ion_laws()
|
||||
if(full_sync || inherent_laws.len)
|
||||
S.laws.clear_inherent_laws()
|
||||
if(full_sync || supplied_laws.len)
|
||||
S.laws.clear_supplied_laws()
|
||||
|
||||
for(var/datum/ai_law/law in ion_laws)
|
||||
S.laws.add_ion_law(law.law)
|
||||
for(var/datum/ai_law/law in inherent_laws)
|
||||
S.laws.add_inherent_law(law.law)
|
||||
for(var/datum/ai_law/law in supplied_laws)
|
||||
if(law)
|
||||
S.laws.add_supplied_law(law.index, law.law)
|
||||
|
||||
|
||||
/mob/living/silicon/proc/sync_zeroth(var/datum/ai_law/zeroth_law, var/datum/ai_law/zeroth_law_borg)
|
||||
if(!is_special_character(src) || mind.original != src)
|
||||
if(zeroth_law_borg)
|
||||
laws.set_zeroth_law(zeroth_law_borg.law)
|
||||
else if(zeroth_law)
|
||||
laws.set_zeroth_law(zeroth_law.law)
|
||||
|
||||
/mob/living/silicon/ai/sync_zeroth(var/datum/ai_law/zeroth_law, var/datum/ai_law/zeroth_law_borg)
|
||||
if(zeroth_law)
|
||||
laws.set_zeroth_law(zeroth_law.law, zeroth_law_borg ? zeroth_law_borg.law : null)
|
||||
|
||||
/****************
|
||||
* Add Laws *
|
||||
****************/
|
||||
/datum/ai_laws/proc/set_zeroth_law(var/law, var/law_borg = null)
|
||||
if(!law)
|
||||
return
|
||||
|
||||
zeroth_law = new(law)
|
||||
if(law_borg) //Making it possible for slaved borgs to see a different law 0 than their AI. --NEO
|
||||
zeroth_law_borg = new(law_borg)
|
||||
else
|
||||
zeroth_law_borg = null
|
||||
sorted_laws.Cut()
|
||||
|
||||
/datum/ai_laws/proc/set_sixsixsix_law(var/law)
|
||||
if(!law)
|
||||
return
|
||||
|
||||
for(var/datum/ai_law/AL in devil_laws)
|
||||
if(AL.law == law)
|
||||
return
|
||||
|
||||
var/new_law = new/datum/ai_law/sixsixsix(law)
|
||||
devil_laws += new_law
|
||||
if(state_devil.len < devil_laws.len)
|
||||
state_devil += 1
|
||||
|
||||
sorted_laws.Cut()
|
||||
|
||||
/datum/ai_laws/proc/add_ion_law(var/law)
|
||||
if(!law)
|
||||
return
|
||||
|
||||
for(var/datum/ai_law/AL in ion_laws)
|
||||
if(AL.law == law)
|
||||
return
|
||||
|
||||
var/new_law = new/datum/ai_law/ion(law)
|
||||
ion_laws += new_law
|
||||
if(state_ion.len < ion_laws.len)
|
||||
state_ion += 1
|
||||
|
||||
sorted_laws.Cut()
|
||||
|
||||
/datum/ai_laws/proc/add_inherent_law(var/law)
|
||||
if(!law)
|
||||
return
|
||||
|
||||
for(var/datum/ai_law/AL in inherent_laws)
|
||||
if(AL.law == law)
|
||||
return
|
||||
|
||||
var/new_law = new/datum/ai_law/inherent(law)
|
||||
inherent_laws += new_law
|
||||
if(state_inherent.len < inherent_laws.len)
|
||||
state_inherent += 1
|
||||
|
||||
sorted_laws.Cut()
|
||||
|
||||
/datum/ai_laws/proc/add_supplied_law(var/number, var/law)
|
||||
if(!law)
|
||||
return
|
||||
|
||||
if(supplied_laws.len >= number)
|
||||
var/datum/ai_law/existing_law = supplied_laws[number]
|
||||
if(existing_law && existing_law.law == law)
|
||||
return
|
||||
|
||||
if(supplied_laws.len >= number && supplied_laws[number])
|
||||
delete_law(supplied_laws[number])
|
||||
|
||||
while(src.supplied_laws.len < number)
|
||||
src.supplied_laws += ""
|
||||
if(state_supplied.len < supplied_laws.len)
|
||||
state_supplied += 1
|
||||
|
||||
var/new_law = new/datum/ai_law/supplied(law, number)
|
||||
supplied_laws[number] = new_law
|
||||
if(state_supplied.len < supplied_laws.len)
|
||||
state_supplied += 1
|
||||
|
||||
sorted_laws.Cut()
|
||||
|
||||
/****************
|
||||
* Remove Laws *
|
||||
*****************/
|
||||
/datum/ai_laws/proc/delete_law(var/datum/ai_law/law)
|
||||
if(istype(law))
|
||||
law.delete_law(src)
|
||||
|
||||
/datum/ai_law/proc/delete_law(var/datum/ai_laws/laws)
|
||||
|
||||
/datum/ai_law/zero/delete_law(var/datum/ai_laws/laws)
|
||||
laws.clear_zeroth_laws()
|
||||
|
||||
/datum/ai_law/ion/delete_law(var/datum/ai_laws/laws)
|
||||
laws.internal_delete_law(laws.ion_laws, laws.state_ion, src)
|
||||
|
||||
/datum/ai_law/sixsixsix/delete_law(var/datum/ai_laws/laws)
|
||||
laws.internal_delete_law(laws.devil_laws, laws.state_devil, src)
|
||||
|
||||
/datum/ai_law/inherent/delete_law(var/datum/ai_laws/laws)
|
||||
laws.internal_delete_law(laws.inherent_laws, laws.state_inherent, src)
|
||||
|
||||
/datum/ai_law/supplied/delete_law(var/datum/ai_laws/laws)
|
||||
var/index = laws.supplied_laws.Find(src)
|
||||
if(index)
|
||||
laws.supplied_laws[index] = ""
|
||||
laws.state_supplied[index] = 1
|
||||
|
||||
/datum/ai_laws/proc/internal_delete_law(var/list/datum/ai_law/laws, var/list/state, var/list/datum/ai_law/law)
|
||||
var/index = laws.Find(law)
|
||||
if(index)
|
||||
laws -= law
|
||||
for(index, index < state.len, index++)
|
||||
state[index] = state[index+1]
|
||||
sorted_laws.Cut()
|
||||
|
||||
/****************
|
||||
* Clear Laws *
|
||||
****************/
|
||||
/datum/ai_laws/proc/clear_zeroth_laws()
|
||||
zeroth_law = null
|
||||
zeroth_law_borg = null
|
||||
|
||||
/datum/ai_laws/proc/clear_sixsixsix_laws()
|
||||
devil_laws.Cut()
|
||||
sorted_laws.Cut()
|
||||
|
||||
/datum/ai_laws/proc/clear_ion_laws()
|
||||
ion_laws.Cut()
|
||||
sorted_laws.Cut()
|
||||
|
||||
/datum/ai_laws/proc/clear_inherent_laws()
|
||||
inherent_laws.Cut()
|
||||
sorted_laws.Cut()
|
||||
|
||||
/datum/ai_laws/proc/clear_supplied_laws()
|
||||
supplied_laws.Cut()
|
||||
sorted_laws.Cut()
|
||||
|
||||
/datum/ai_laws/proc/show_laws(var/who)
|
||||
sort_laws()
|
||||
for(var/datum/ai_law/law in sorted_laws)
|
||||
if(law == zeroth_law_borg)
|
||||
continue
|
||||
if(law == zeroth_law)
|
||||
to_chat(who, "<span class='danger'>[law.get_index()]. [law.law]</span>")
|
||||
else
|
||||
to_chat(who, "[law.get_index()]. [law.law]")
|
||||
|
||||
/********************
|
||||
* Stating Laws *
|
||||
********************/
|
||||
/********
|
||||
* Get *
|
||||
********/
|
||||
/datum/ai_laws/proc/get_state_law(var/datum/ai_law/law)
|
||||
return law.get_state_law(src)
|
||||
|
||||
/datum/ai_law/proc/get_state_law(var/datum/ai_laws/laws)
|
||||
|
||||
/datum/ai_law/zero/get_state_law(var/datum/ai_laws/laws)
|
||||
if(src == laws.zeroth_law)
|
||||
return laws.state_zeroth
|
||||
|
||||
/datum/ai_law/ion/get_state_law(var/datum/ai_laws/laws)
|
||||
return laws.get_state_internal(laws.ion_laws, laws.state_ion, src)
|
||||
|
||||
/datum/ai_law/inherent/get_state_law(var/datum/ai_laws/laws)
|
||||
return laws.get_state_internal(laws.inherent_laws, laws.state_inherent, src)
|
||||
|
||||
/datum/ai_law/supplied/get_state_law(var/datum/ai_laws/laws)
|
||||
return laws.get_state_internal(laws.supplied_laws, laws.state_supplied, src)
|
||||
|
||||
/datum/ai_laws/proc/get_state_internal(var/list/datum/ai_law/laws, var/list/state, var/list/datum/ai_law/law)
|
||||
var/index = laws.Find(law)
|
||||
if(index)
|
||||
return state[index]
|
||||
return 0
|
||||
|
||||
/********
|
||||
* Set *
|
||||
********/
|
||||
/datum/ai_laws/proc/set_state_law(var/datum/ai_law/law, var/state)
|
||||
law.set_state_law(src, state)
|
||||
|
||||
/datum/ai_law/proc/set_state_law(var/datum/ai_law/law, var/state)
|
||||
|
||||
/datum/ai_law/zero/set_state_law(var/datum/ai_laws/laws, var/state)
|
||||
if(src == laws.zeroth_law)
|
||||
laws.state_zeroth = state
|
||||
|
||||
/datum/ai_law/ion/set_state_law(var/datum/ai_laws/laws, var/state)
|
||||
laws.set_state_law_internal(laws.ion_laws, laws.state_ion, src, state)
|
||||
|
||||
/datum/ai_law/inherent/set_state_law(var/datum/ai_laws/laws, var/state)
|
||||
laws.set_state_law_internal(laws.inherent_laws, laws.state_inherent, src, state)
|
||||
|
||||
/datum/ai_law/supplied/set_state_law(var/datum/ai_laws/laws, var/state)
|
||||
laws.set_state_law_internal(laws.supplied_laws, laws.state_supplied, src, state)
|
||||
|
||||
/datum/ai_laws/proc/set_state_law_internal(var/list/datum/ai_law/laws, var/list/state, var/list/datum/ai_law/law, var/do_state)
|
||||
var/index = laws.Find(law)
|
||||
if(index)
|
||||
state[index] = do_state
|
||||
#define BASE_LAW_TYPE /datum/ai_laws/nanotrasen
|
||||
|
||||
/datum/ai_law
|
||||
var/law = ""
|
||||
var/index = 0
|
||||
|
||||
/datum/ai_law/New(law, index)
|
||||
src.law = law
|
||||
src.index = index
|
||||
|
||||
/datum/ai_law/proc/get_index()
|
||||
return index
|
||||
|
||||
/datum/ai_law/ion/get_index()
|
||||
return ionnum()
|
||||
|
||||
/datum/ai_law/zero/get_index()
|
||||
return 0
|
||||
|
||||
/datum/ai_law/sixsixsix/get_index()
|
||||
return 666
|
||||
|
||||
|
||||
/datum/ai_laws
|
||||
var/name = "Unknown Laws"
|
||||
var/law_header = "Prime Directives"
|
||||
var/selectable = 0
|
||||
var/default = 0
|
||||
var/datum/ai_law/zero/zeroth_law = null
|
||||
var/datum/ai_law/zero/zeroth_law_borg = null
|
||||
var/list/datum/ai_law/inherent_laws = list()
|
||||
var/list/datum/ai_law/supplied_laws = list()
|
||||
var/list/datum/ai_law/ion/ion_laws = list()
|
||||
var/list/datum/ai_law/sixsixsix/devil_laws = list()
|
||||
var/list/datum/ai_law/sorted_laws = list()
|
||||
|
||||
var/state_zeroth = 0
|
||||
var/list/state_devil = list()
|
||||
var/list/state_ion = list()
|
||||
var/list/state_inherent = list()
|
||||
var/list/state_supplied = list()
|
||||
|
||||
/datum/ai_laws/New()
|
||||
..()
|
||||
sort_laws()
|
||||
|
||||
/* General ai_law functions */
|
||||
/datum/ai_laws/proc/all_laws()
|
||||
sort_laws()
|
||||
return sorted_laws
|
||||
|
||||
/datum/ai_laws/proc/laws_to_state()
|
||||
sort_laws()
|
||||
var/list/statements = new()
|
||||
for(var/datum/ai_law/law in sorted_laws)
|
||||
if(get_state_law(law))
|
||||
statements += law
|
||||
|
||||
return statements
|
||||
|
||||
/datum/ai_laws/proc/sort_laws()
|
||||
if(sorted_laws.len)
|
||||
return
|
||||
|
||||
for(var/ion_law in ion_laws)
|
||||
sorted_laws += ion_law
|
||||
|
||||
for(var/evil_law in devil_laws)
|
||||
sorted_laws += evil_law
|
||||
|
||||
if(zeroth_law)
|
||||
sorted_laws += zeroth_law
|
||||
|
||||
var/index = 1
|
||||
for(var/datum/ai_law/inherent_law in inherent_laws)
|
||||
inherent_law.index = index++
|
||||
if(supplied_laws.len < inherent_law.index || !istype(supplied_laws[inherent_law.index], /datum/ai_law))
|
||||
sorted_laws += inherent_law
|
||||
|
||||
for(var/datum/ai_law/AL in supplied_laws)
|
||||
if(istype(AL))
|
||||
sorted_laws += AL
|
||||
|
||||
/datum/ai_laws/proc/sync(var/mob/living/silicon/S, var/full_sync = 1)
|
||||
// Add directly to laws to avoid log-spam
|
||||
S.sync_zeroth(zeroth_law, zeroth_law_borg)
|
||||
|
||||
if(full_sync || ion_laws.len)
|
||||
S.laws.clear_ion_laws()
|
||||
if(full_sync || inherent_laws.len)
|
||||
S.laws.clear_inherent_laws()
|
||||
if(full_sync || supplied_laws.len)
|
||||
S.laws.clear_supplied_laws()
|
||||
|
||||
for(var/datum/ai_law/law in ion_laws)
|
||||
S.laws.add_ion_law(law.law)
|
||||
for(var/datum/ai_law/law in inherent_laws)
|
||||
S.laws.add_inherent_law(law.law)
|
||||
for(var/datum/ai_law/law in supplied_laws)
|
||||
if(law)
|
||||
S.laws.add_supplied_law(law.index, law.law)
|
||||
|
||||
|
||||
/mob/living/silicon/proc/sync_zeroth(var/datum/ai_law/zeroth_law, var/datum/ai_law/zeroth_law_borg)
|
||||
if(!is_special_character(src) || mind.original != src)
|
||||
if(zeroth_law_borg)
|
||||
laws.set_zeroth_law(zeroth_law_borg.law)
|
||||
else if(zeroth_law)
|
||||
laws.set_zeroth_law(zeroth_law.law)
|
||||
|
||||
/mob/living/silicon/ai/sync_zeroth(var/datum/ai_law/zeroth_law, var/datum/ai_law/zeroth_law_borg)
|
||||
if(zeroth_law)
|
||||
laws.set_zeroth_law(zeroth_law.law, zeroth_law_borg ? zeroth_law_borg.law : null)
|
||||
|
||||
/****************
|
||||
* Add Laws *
|
||||
****************/
|
||||
/datum/ai_laws/proc/set_zeroth_law(var/law, var/law_borg = null)
|
||||
if(!law)
|
||||
return
|
||||
|
||||
zeroth_law = new(law)
|
||||
if(law_borg) //Making it possible for slaved borgs to see a different law 0 than their AI. --NEO
|
||||
zeroth_law_borg = new(law_borg)
|
||||
else
|
||||
zeroth_law_borg = null
|
||||
sorted_laws.Cut()
|
||||
|
||||
/datum/ai_laws/proc/set_sixsixsix_law(var/law)
|
||||
if(!law)
|
||||
return
|
||||
|
||||
for(var/datum/ai_law/AL in devil_laws)
|
||||
if(AL.law == law)
|
||||
return
|
||||
|
||||
var/new_law = new/datum/ai_law/sixsixsix(law)
|
||||
devil_laws += new_law
|
||||
if(state_devil.len < devil_laws.len)
|
||||
state_devil += 1
|
||||
|
||||
sorted_laws.Cut()
|
||||
|
||||
/datum/ai_laws/proc/add_ion_law(var/law)
|
||||
if(!law)
|
||||
return
|
||||
|
||||
for(var/datum/ai_law/AL in ion_laws)
|
||||
if(AL.law == law)
|
||||
return
|
||||
|
||||
var/new_law = new/datum/ai_law/ion(law)
|
||||
ion_laws += new_law
|
||||
if(state_ion.len < ion_laws.len)
|
||||
state_ion += 1
|
||||
|
||||
sorted_laws.Cut()
|
||||
|
||||
/datum/ai_laws/proc/add_inherent_law(var/law)
|
||||
if(!law)
|
||||
return
|
||||
|
||||
for(var/datum/ai_law/AL in inherent_laws)
|
||||
if(AL.law == law)
|
||||
return
|
||||
|
||||
var/new_law = new/datum/ai_law/inherent(law)
|
||||
inherent_laws += new_law
|
||||
if(state_inherent.len < inherent_laws.len)
|
||||
state_inherent += 1
|
||||
|
||||
sorted_laws.Cut()
|
||||
|
||||
/datum/ai_laws/proc/add_supplied_law(var/number, var/law)
|
||||
if(!law)
|
||||
return
|
||||
|
||||
if(supplied_laws.len >= number)
|
||||
var/datum/ai_law/existing_law = supplied_laws[number]
|
||||
if(existing_law && existing_law.law == law)
|
||||
return
|
||||
|
||||
if(supplied_laws.len >= number && supplied_laws[number])
|
||||
delete_law(supplied_laws[number])
|
||||
|
||||
while(src.supplied_laws.len < number)
|
||||
src.supplied_laws += ""
|
||||
if(state_supplied.len < supplied_laws.len)
|
||||
state_supplied += 1
|
||||
|
||||
var/new_law = new/datum/ai_law/supplied(law, number)
|
||||
supplied_laws[number] = new_law
|
||||
if(state_supplied.len < supplied_laws.len)
|
||||
state_supplied += 1
|
||||
|
||||
sorted_laws.Cut()
|
||||
|
||||
/****************
|
||||
* Remove Laws *
|
||||
*****************/
|
||||
/datum/ai_laws/proc/delete_law(var/datum/ai_law/law)
|
||||
if(istype(law))
|
||||
law.delete_law(src)
|
||||
|
||||
/datum/ai_law/proc/delete_law(var/datum/ai_laws/laws)
|
||||
|
||||
/datum/ai_law/zero/delete_law(var/datum/ai_laws/laws)
|
||||
laws.clear_zeroth_laws()
|
||||
|
||||
/datum/ai_law/ion/delete_law(var/datum/ai_laws/laws)
|
||||
laws.internal_delete_law(laws.ion_laws, laws.state_ion, src)
|
||||
|
||||
/datum/ai_law/sixsixsix/delete_law(var/datum/ai_laws/laws)
|
||||
laws.internal_delete_law(laws.devil_laws, laws.state_devil, src)
|
||||
|
||||
/datum/ai_law/inherent/delete_law(var/datum/ai_laws/laws)
|
||||
laws.internal_delete_law(laws.inherent_laws, laws.state_inherent, src)
|
||||
|
||||
/datum/ai_law/supplied/delete_law(var/datum/ai_laws/laws)
|
||||
var/index = laws.supplied_laws.Find(src)
|
||||
if(index)
|
||||
laws.supplied_laws[index] = ""
|
||||
laws.state_supplied[index] = 1
|
||||
|
||||
/datum/ai_laws/proc/internal_delete_law(var/list/datum/ai_law/laws, var/list/state, var/list/datum/ai_law/law)
|
||||
var/index = laws.Find(law)
|
||||
if(index)
|
||||
laws -= law
|
||||
for(index, index < state.len, index++)
|
||||
state[index] = state[index+1]
|
||||
sorted_laws.Cut()
|
||||
|
||||
/****************
|
||||
* Clear Laws *
|
||||
****************/
|
||||
/datum/ai_laws/proc/clear_zeroth_laws()
|
||||
zeroth_law = null
|
||||
zeroth_law_borg = null
|
||||
|
||||
/datum/ai_laws/proc/clear_sixsixsix_laws()
|
||||
devil_laws.Cut()
|
||||
sorted_laws.Cut()
|
||||
|
||||
/datum/ai_laws/proc/clear_ion_laws()
|
||||
ion_laws.Cut()
|
||||
sorted_laws.Cut()
|
||||
|
||||
/datum/ai_laws/proc/clear_inherent_laws()
|
||||
inherent_laws.Cut()
|
||||
sorted_laws.Cut()
|
||||
|
||||
/datum/ai_laws/proc/clear_supplied_laws()
|
||||
supplied_laws.Cut()
|
||||
sorted_laws.Cut()
|
||||
|
||||
/datum/ai_laws/proc/show_laws(var/who)
|
||||
sort_laws()
|
||||
for(var/datum/ai_law/law in sorted_laws)
|
||||
if(law == zeroth_law_borg)
|
||||
continue
|
||||
if(law == zeroth_law)
|
||||
to_chat(who, "<span class='danger'>[law.get_index()]. [law.law]</span>")
|
||||
else
|
||||
to_chat(who, "[law.get_index()]. [law.law]")
|
||||
|
||||
/********************
|
||||
* Stating Laws *
|
||||
********************/
|
||||
/********
|
||||
* Get *
|
||||
********/
|
||||
/datum/ai_laws/proc/get_state_law(var/datum/ai_law/law)
|
||||
return law.get_state_law(src)
|
||||
|
||||
/datum/ai_law/proc/get_state_law(var/datum/ai_laws/laws)
|
||||
|
||||
/datum/ai_law/zero/get_state_law(var/datum/ai_laws/laws)
|
||||
if(src == laws.zeroth_law)
|
||||
return laws.state_zeroth
|
||||
|
||||
/datum/ai_law/ion/get_state_law(var/datum/ai_laws/laws)
|
||||
return laws.get_state_internal(laws.ion_laws, laws.state_ion, src)
|
||||
|
||||
/datum/ai_law/inherent/get_state_law(var/datum/ai_laws/laws)
|
||||
return laws.get_state_internal(laws.inherent_laws, laws.state_inherent, src)
|
||||
|
||||
/datum/ai_law/supplied/get_state_law(var/datum/ai_laws/laws)
|
||||
return laws.get_state_internal(laws.supplied_laws, laws.state_supplied, src)
|
||||
|
||||
/datum/ai_laws/proc/get_state_internal(var/list/datum/ai_law/laws, var/list/state, var/list/datum/ai_law/law)
|
||||
var/index = laws.Find(law)
|
||||
if(index)
|
||||
return state[index]
|
||||
return 0
|
||||
|
||||
/********
|
||||
* Set *
|
||||
********/
|
||||
/datum/ai_laws/proc/set_state_law(var/datum/ai_law/law, var/state)
|
||||
law.set_state_law(src, state)
|
||||
|
||||
/datum/ai_law/proc/set_state_law(var/datum/ai_law/law, var/state)
|
||||
|
||||
/datum/ai_law/zero/set_state_law(var/datum/ai_laws/laws, var/state)
|
||||
if(src == laws.zeroth_law)
|
||||
laws.state_zeroth = state
|
||||
|
||||
/datum/ai_law/ion/set_state_law(var/datum/ai_laws/laws, var/state)
|
||||
laws.set_state_law_internal(laws.ion_laws, laws.state_ion, src, state)
|
||||
|
||||
/datum/ai_law/inherent/set_state_law(var/datum/ai_laws/laws, var/state)
|
||||
laws.set_state_law_internal(laws.inherent_laws, laws.state_inherent, src, state)
|
||||
|
||||
/datum/ai_law/supplied/set_state_law(var/datum/ai_laws/laws, var/state)
|
||||
laws.set_state_law_internal(laws.supplied_laws, laws.state_supplied, src, state)
|
||||
|
||||
/datum/ai_laws/proc/set_state_law_internal(var/list/datum/ai_law/laws, var/list/state, var/list/datum/ai_law/law, var/do_state)
|
||||
var/index = laws.Find(law)
|
||||
if(index)
|
||||
state[index] = do_state
|
||||
|
||||
+1
-1
@@ -133,4 +133,4 @@
|
||||
var/datum/beam/newbeam = new(src,BeamTarget,icon,icon_state,time,maxdistance,beam_type,beam_sleep_time)
|
||||
spawn(0)
|
||||
newbeam.Start()
|
||||
return newbeam
|
||||
return newbeam
|
||||
|
||||
@@ -179,4 +179,4 @@
|
||||
if(src && src.mob)
|
||||
// to_chat(world, "[src] was [src.mob.machine], setting to null")
|
||||
src.mob.unset_machine()
|
||||
return
|
||||
return
|
||||
|
||||
Vendored
+1
-1
@@ -25,4 +25,4 @@ var/global/datum/repository/apc/apc_repository = new()
|
||||
|
||||
cache_entry.timestamp = world.time + 5 SECONDS
|
||||
cache_entry.data = apcData
|
||||
return apcData
|
||||
return apcData
|
||||
|
||||
Vendored
+1
-1
@@ -3,4 +3,4 @@
|
||||
var/list/data = list()
|
||||
|
||||
/datum/repository
|
||||
var/cache_data
|
||||
var/cache_data
|
||||
|
||||
Vendored
+1
-1
@@ -21,4 +21,4 @@ var/global/datum/repository/powermonitor/powermonitor_repository = new()
|
||||
|
||||
/datum/repository/powermonitor/proc/update_cache()
|
||||
return powermonitor_data(refresh = 1)
|
||||
|
||||
|
||||
|
||||
@@ -28,4 +28,4 @@
|
||||
return
|
||||
|
||||
/datum/click_intercept/proc/InterceptClickOn(user,params,atom/object)
|
||||
return
|
||||
return
|
||||
|
||||
@@ -310,4 +310,4 @@
|
||||
target.TakeComponent(comps)
|
||||
|
||||
/datum/component/nano_host()
|
||||
return parent
|
||||
return parent
|
||||
|
||||
@@ -56,4 +56,4 @@
|
||||
H.visible_message("<span class='danger'>[H] slides on [A]!</span>", "<span class='userdanger'>You slide on [A]!</span>")
|
||||
|
||||
cooldown = world.time
|
||||
H.Weaken(3)
|
||||
H.Weaken(3)
|
||||
|
||||
@@ -72,4 +72,4 @@
|
||||
qdel(src)
|
||||
|
||||
/datum/component/decal/proc/examine(datum/source, mob/user, var/list/examine_list)
|
||||
examine_list += description
|
||||
examine_list += description
|
||||
|
||||
@@ -398,4 +398,4 @@
|
||||
/datum/material/plastic
|
||||
name = "Plastic"
|
||||
id = MAT_PLASTIC
|
||||
sheet_type = /obj/item/stack/sheet/plastic
|
||||
sheet_type = /obj/item/stack/sheet/plastic
|
||||
|
||||
@@ -48,4 +48,4 @@
|
||||
spawned_mobs += L
|
||||
L.nest = src
|
||||
L.faction = src.faction
|
||||
P.visible_message("<span class='danger'>[L] [spawn_text] [P].</span>")
|
||||
P.visible_message("<span class='danger'>[L] [spawn_text] [P].</span>")
|
||||
|
||||
@@ -90,4 +90,4 @@
|
||||
/datum/component/squeak/proc/holder_dir_change(datum/source, old_dir, new_dir)
|
||||
//If the dir changes it means we're going through a bend in the pipes, let's pretend we bumped the wall
|
||||
if(old_dir != new_dir)
|
||||
play_squeak()
|
||||
play_squeak()
|
||||
|
||||
+652
-652
File diff suppressed because it is too large
Load Diff
@@ -66,4 +66,4 @@
|
||||
|
||||
|
||||
/datum/nothing
|
||||
// Placeholder object, used for ispath checks. Has to be defined to prevent errors, but shouldn't ever be created.
|
||||
// Placeholder object, used for ispath checks. Has to be defined to prevent errors, but shouldn't ever be created.
|
||||
|
||||
+1387
-1387
File diff suppressed because it is too large
Load Diff
@@ -48,4 +48,4 @@
|
||||
if(!D)
|
||||
name = "Reality Enhancer"
|
||||
symptoms = list(new/datum/symptom/sensory_restoration)
|
||||
..(process, D, copy)
|
||||
..(process, D, copy)
|
||||
|
||||
@@ -47,4 +47,4 @@ BONUS
|
||||
if(!(head_organ.f_style == "Dwarf Beard") && !(head_organ.f_style == "Very Long Beard"))
|
||||
head_organ.f_style = pick("Dwarf Beard", "Very Long Beard")
|
||||
H.update_fhair()
|
||||
return
|
||||
return
|
||||
|
||||
@@ -50,4 +50,4 @@ Bonus
|
||||
/datum/symptom/choking/proc/Choke(mob/living/M, datum/disease/advance/A)
|
||||
var/get_damage = sqrtor0(21+A.totalStageSpeed()*0.5)+sqrtor0(16+A.totalStealth()*5)
|
||||
M.adjustOxyLoss(get_damage)
|
||||
return 1
|
||||
return 1
|
||||
|
||||
@@ -37,4 +37,4 @@ BONUS
|
||||
var/obj/item/I = M.get_active_hand()
|
||||
if(I && I.w_class == 1)
|
||||
M.drop_item()
|
||||
return
|
||||
return
|
||||
|
||||
@@ -35,4 +35,4 @@ Bonus
|
||||
else
|
||||
to_chat(M, "<span class='userdanger'>A wave of dizziness washes over you!</span>")
|
||||
M.Dizzy(5)
|
||||
return
|
||||
return
|
||||
|
||||
@@ -38,4 +38,4 @@ Bonus
|
||||
/datum/symptom/fever/proc/Heat(mob/living/M, datum/disease/advance/A)
|
||||
var/get_heat = (sqrtor0(21+A.totalTransmittable()*2))+(sqrtor0(20+A.totalStageSpeed()*3))
|
||||
M.bodytemperature = min(M.bodytemperature + (get_heat * A.stage), BODYTEMP_HEAT_DAMAGE_LIMIT - 1)
|
||||
return 1
|
||||
return 1
|
||||
|
||||
@@ -40,4 +40,4 @@ Bonus
|
||||
/datum/symptom/flesh_eating/proc/Flesheat(mob/living/M, datum/disease/advance/A)
|
||||
var/get_damage = ((sqrtor0(16-A.totalStealth()))*5)
|
||||
M.adjustBruteLoss(get_damage)
|
||||
return 1
|
||||
return 1
|
||||
|
||||
@@ -31,4 +31,4 @@ BONUS
|
||||
if(prob(SYMPTOM_ACTIVATION_PROB))
|
||||
var/mob/living/M = A.affected_mob
|
||||
to_chat(M, "<span class='warning'>[pick("Your head hurts.", "Your head starts pounding.")]</span>")
|
||||
return
|
||||
return
|
||||
|
||||
@@ -31,4 +31,4 @@ BONUS
|
||||
if(prob(SYMPTOM_ACTIVATION_PROB))
|
||||
var/mob/living/M = A.affected_mob
|
||||
to_chat(M, "<span class='warning'>Your [pick("back", "arm", "leg", "elbow", "head")] itches.</span>")
|
||||
return
|
||||
return
|
||||
|
||||
@@ -62,4 +62,4 @@ Bonus
|
||||
M.reagents.add_reagent("oculine", 20)
|
||||
else
|
||||
if(prob(SYMPTOM_ACTIVATION_PROB * 5))
|
||||
to_chat(M, "<span class='notice'>[pick("Your eyes feel great.","You feel like your eyes can focus more clearly.", "You don't feel the need to blink.","Your ears feel great.","Your healing feels more acute.")]</span>")
|
||||
to_chat(M, "<span class='notice'>[pick("Your eyes feel great.","You feel like your eyes can focus more clearly.", "You don't feel the need to blink.","Your ears feel great.","Your healing feels more acute.")]</span>")
|
||||
|
||||
@@ -47,4 +47,4 @@ BONUS
|
||||
head_organ.h_style = "Bald"
|
||||
H.update_hair()
|
||||
H.update_fhair()
|
||||
return
|
||||
return
|
||||
|
||||
@@ -83,4 +83,4 @@ BONUS
|
||||
else
|
||||
H.visible_message("<span class='warning'>[H] looks a bit dark...</span>", "<span class='notice'>Your skin suddenly appears darker...</span>")
|
||||
|
||||
return
|
||||
return
|
||||
|
||||
@@ -36,4 +36,4 @@ Bonus
|
||||
else
|
||||
M.emote("sneeze")
|
||||
A.spread(5)
|
||||
return
|
||||
return
|
||||
|
||||
@@ -47,4 +47,4 @@ Bonus
|
||||
M.BecomeNearsighted()
|
||||
if(prob(eyes.damage - 10 + 1))
|
||||
if(M.BecomeBlind())
|
||||
to_chat(M, "<span class='userdanger'>You go blind!</span>")
|
||||
to_chat(M, "<span class='userdanger'>You go blind!</span>")
|
||||
|
||||
@@ -36,4 +36,4 @@ Bonus
|
||||
else
|
||||
to_chat(M, "<span class='warning'><i>[pick("So hungry...", "You'd kill someone for a bite of food...", "Hunger cramps seize you...")]</i></span>")
|
||||
M.overeatduration = max(M.overeatduration - 100, 0)
|
||||
M.adjust_nutrition(-100)
|
||||
M.adjust_nutrition(-100)
|
||||
|
||||
@@ -52,4 +52,4 @@ BONUS
|
||||
H.age = 21
|
||||
to_chat(H, "<span class='notice'>You feel like you can take on the world!</span>")
|
||||
|
||||
return
|
||||
return
|
||||
|
||||
@@ -52,4 +52,4 @@
|
||||
M.adjustBruteLoss(damage)
|
||||
else
|
||||
playsound(affected_mob.loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1)
|
||||
affected_mob.visible_message("<span class='danger'>[affected_mob] fails to hit [M] with [affected_mob.p_their()] thrashing!</span>")
|
||||
affected_mob.visible_message("<span class='danger'>[affected_mob] fails to hit [M] with [affected_mob.p_their()] thrashing!</span>")
|
||||
|
||||
@@ -63,4 +63,4 @@
|
||||
if(!affected_mob.resistances.Find(/datum/disease/flu))
|
||||
var/datum/disease/Flu = new /datum/disease/flu(0)
|
||||
affected_mob.ContractDisease(Flu)
|
||||
cure()
|
||||
cure()
|
||||
|
||||
@@ -133,4 +133,4 @@
|
||||
affected_mob.emote(pick("twitch", "gasp"))
|
||||
if(prob(5) && ishuman(affected_mob))
|
||||
var/mob/living/carbon/human/H = affected_mob
|
||||
H.set_heartattack(TRUE)
|
||||
H.set_heartattack(TRUE)
|
||||
|
||||
@@ -68,4 +68,4 @@
|
||||
to_chat(affected_mob, "<span class='danger'>Your stomach lurches painfully!</span>")
|
||||
affected_mob.visible_message("<span class='danger'>[affected_mob] gags and retches!</span>")
|
||||
affected_mob.Stun(rand(2,4))
|
||||
affected_mob.Weaken(rand(2,4))
|
||||
affected_mob.Weaken(rand(2,4))
|
||||
|
||||
@@ -93,4 +93,4 @@
|
||||
twisted.visible_message("<span class='danger'>[twisted] scratches at thier skin!</span>", \
|
||||
"<span class='userdanger'>You scratch your skin to try not to itch!</span>")
|
||||
twisted.adjustBruteLoss(-5)
|
||||
twisted.adjustStaminaLoss(5)
|
||||
twisted.adjustStaminaLoss(5)
|
||||
|
||||
@@ -52,4 +52,4 @@
|
||||
affected_mob.drop_r_hand()
|
||||
affected_mob.Stun(10)
|
||||
affected_mob.Weaken(10)
|
||||
affected_mob.visible_message("<span class='danger'>[affected_mob] laughs uncontrollably!</span>")
|
||||
affected_mob.visible_message("<span class='danger'>[affected_mob] laughs uncontrollably!</span>")
|
||||
|
||||
@@ -60,4 +60,4 @@
|
||||
var/iter = rand(1,3)
|
||||
for(i=0,i<iter,i++)
|
||||
step_towards(S,affected_mob)
|
||||
return
|
||||
return
|
||||
|
||||
@@ -61,4 +61,4 @@
|
||||
|
||||
if(!istype(affected_mob.wear_mask, /obj/item/clothing/mask/gas/clown_hat/nodrop))
|
||||
affected_mob.unEquip(affected_mob.wear_mask, TRUE)
|
||||
affected_mob.equip_to_slot(new /obj/item/clothing/mask/gas/clown_hat/nodrop(src), slot_wear_mask)
|
||||
affected_mob.equip_to_slot(new /obj/item/clothing/mask/gas/clown_hat/nodrop(src), slot_wear_mask)
|
||||
|
||||
@@ -80,4 +80,4 @@
|
||||
if(prob(50))
|
||||
scramble(1, affected_mob, rand(15, 45))
|
||||
else
|
||||
scramble(0, affected_mob, rand(15, 45))
|
||||
scramble(0, affected_mob, rand(15, 45))
|
||||
|
||||
@@ -199,4 +199,4 @@
|
||||
..()
|
||||
D.mutations.Add(BREATHLESS)
|
||||
D.atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0)
|
||||
D.minbodytemp = 0
|
||||
D.minbodytemp = 0
|
||||
|
||||
@@ -1,244 +1,244 @@
|
||||
#define FORWARD -1
|
||||
#define BACKWARD 1
|
||||
#define CONSTRUCTION_TOOL_BEHAVIOURS list(TOOL_CROWBAR, TOOL_SCREWDRIVER, TOOL_WELDER, TOOL_WRENCH)
|
||||
|
||||
/datum/construction
|
||||
var/list/steps
|
||||
var/atom/holder
|
||||
var/result
|
||||
var/list/steps_desc
|
||||
var/taskpath = null // Path of job objective completed.
|
||||
|
||||
/datum/construction/New(atom)
|
||||
..()
|
||||
holder = atom
|
||||
if(!holder) //don't want this without a holder
|
||||
spawn
|
||||
qdel(src)
|
||||
set_desc(steps.len)
|
||||
return
|
||||
|
||||
/datum/construction/proc/next_step(mob/user as mob)
|
||||
steps.len--
|
||||
if(!steps.len)
|
||||
spawn_result(user)
|
||||
else
|
||||
set_desc(steps.len)
|
||||
return
|
||||
|
||||
/datum/construction/proc/action(atom/used_atom,mob/user as mob)
|
||||
return
|
||||
|
||||
/datum/construction/proc/check_step(atom/used_atom,mob/user as mob) //check last step only
|
||||
var/valid_step = is_right_key(used_atom)
|
||||
if(valid_step)
|
||||
if(custom_action(valid_step, used_atom, user))
|
||||
next_step(user)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/construction/proc/is_right_key(atom/used_atom) // returns current step num if used_atom is of the right type.
|
||||
var/list/L = steps[steps.len]
|
||||
if(do_tool_or_atom_check(used_atom, L["key"]))
|
||||
return steps.len
|
||||
return 0
|
||||
|
||||
|
||||
/datum/construction/proc/custom_action(step, used_atom, user)
|
||||
if(istype(used_atom, /obj/item/stack/cable_coil))
|
||||
var/obj/item/stack/cable_coil/C = used_atom
|
||||
if(C.amount<4)
|
||||
to_chat(user, ("<span class='warning'>There's not enough cable to finish the task.</span>"))
|
||||
return 0
|
||||
else
|
||||
C.use(4)
|
||||
playsound(holder, C.usesound, 50, 1)
|
||||
else if(istype(used_atom, /obj/item/stack))
|
||||
var/obj/item/stack/S = used_atom
|
||||
if(S.amount < 5)
|
||||
to_chat(user, ("<span class='warning'>There's not enough material in this stack.</span>"))
|
||||
return 0
|
||||
else
|
||||
S.use(5)
|
||||
else if(isitem(used_atom))
|
||||
var/obj/item/I = used_atom
|
||||
if(I.tool_behaviour in CONSTRUCTION_TOOL_BEHAVIOURS)
|
||||
if(!I.use_tool(holder, user, 0, volume = I.tool_volume))
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/datum/construction/proc/check_all_steps(atom/used_atom,mob/user as mob) //check all steps, remove matching one.
|
||||
for(var/i=1;i<=steps.len;i++)
|
||||
var/list/L = steps[i];
|
||||
if(do_tool_or_atom_check(used_atom, L["key"]) && custom_action(i, used_atom, user))
|
||||
steps[i]=null;//stupid byond list from list removal...
|
||||
listclearnulls(steps);
|
||||
if(!steps.len)
|
||||
spawn_result(user)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
/datum/construction/proc/spawn_result(mob/user as mob)
|
||||
if(result)
|
||||
if(taskpath)
|
||||
var/datum/job_objective/task = user.mind.findJobTask(taskpath)
|
||||
if(istype(task))
|
||||
task.unit_completed()
|
||||
|
||||
new result(get_turf(holder))
|
||||
spawn()
|
||||
qdel(holder)
|
||||
return
|
||||
|
||||
/datum/construction/proc/set_desc(index as num)
|
||||
var/list/step = steps[index]
|
||||
holder.desc = step["desc"]
|
||||
return
|
||||
|
||||
/datum/construction/proc/try_consume(mob/user as mob, atom/used_atom, amount)
|
||||
if(amount > 0)
|
||||
// CABLES
|
||||
if(istype(used_atom,/obj/item/stack/cable_coil))
|
||||
var/obj/item/stack/cable_coil/coil=used_atom
|
||||
if(!coil.use(amount))
|
||||
to_chat(user, "<span class='warning'>You don't have enough cable! You need at least [amount] coils.</span>")
|
||||
return 0
|
||||
// TOOLS
|
||||
if(isitem(used_atom))
|
||||
var/obj/item/I = used_atom
|
||||
if(I.tool_behaviour in CONSTRUCTION_TOOL_BEHAVIOURS)
|
||||
if(!I.use(amount))
|
||||
return 0
|
||||
// STACKS
|
||||
if(istype(used_atom,/obj/item/stack))
|
||||
var/obj/item/stack/stack=used_atom
|
||||
if(stack.amount < amount)
|
||||
to_chat(user, "<span class='warning'>You don't have enough [stack]! You need at least [amount].</span>")
|
||||
return 0
|
||||
stack.use(amount)
|
||||
return 1
|
||||
|
||||
/datum/construction/proc/do_tool_or_atom_check(used_atom, thing_to_check) //Checks if an atom is either a required thing; or if it's a required tool
|
||||
if(istype(used_atom, thing_to_check))
|
||||
return TRUE
|
||||
else if(isitem(used_atom))
|
||||
var/obj/item/I = used_atom
|
||||
if(I.tool_behaviour == thing_to_check)
|
||||
return TRUE
|
||||
|
||||
/datum/construction/reversible
|
||||
var/index
|
||||
|
||||
/datum/construction/reversible/New(atom)
|
||||
..()
|
||||
index = steps.len
|
||||
return
|
||||
|
||||
/datum/construction/reversible/proc/update_index(diff as num, mob/user as mob)
|
||||
index+=diff
|
||||
if(index==0)
|
||||
spawn_result(user)
|
||||
else
|
||||
set_desc(index)
|
||||
return
|
||||
|
||||
/datum/construction/reversible/is_right_key(atom/used_atom) // returns index step
|
||||
var/list/L = steps[index]
|
||||
if(do_tool_or_atom_check(used_atom, L["key"]))
|
||||
return FORWARD //to the first step -> forward
|
||||
else if(L["backkey"] && do_tool_or_atom_check(used_atom, L["backkey"]))
|
||||
return BACKWARD //to the last step -> backwards
|
||||
return 0
|
||||
|
||||
/datum/construction/reversible/check_step(atom/used_atom,mob/user as mob)
|
||||
var/diff = is_right_key(used_atom)
|
||||
if(diff)
|
||||
if(custom_action(index, diff, used_atom, user))
|
||||
update_index(diff, user)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/construction/reversible/custom_action(index, diff, used_atom, user)
|
||||
if(!..(index,used_atom,user))
|
||||
return 0
|
||||
return 1
|
||||
|
||||
#define state_next "next"
|
||||
#define state_prev "prev"
|
||||
|
||||
/datum/construction/reversible2
|
||||
var/index
|
||||
var/base_icon = "durand"
|
||||
|
||||
/datum/construction/reversible2/New(atom)
|
||||
..()
|
||||
index = 1
|
||||
return
|
||||
|
||||
/datum/construction/reversible2/proc/update_index(diff as num, mob/user as mob)
|
||||
index-=diff
|
||||
if(index==steps.len+1)
|
||||
spawn_result(user)
|
||||
else
|
||||
set_desc(index)
|
||||
return
|
||||
|
||||
/datum/construction/reversible2/proc/update_icon()
|
||||
holder.icon_state="[base_icon]_[index]"
|
||||
|
||||
/datum/construction/reversible2/is_right_key(mob/user as mob,atom/used_atom) // returns index step
|
||||
var/list/state = steps[index]
|
||||
if(state_next in state)
|
||||
var/list/step = state[state_next]
|
||||
if(do_tool_or_atom_check(used_atom, step["key"]))
|
||||
//if(L["consume"] && !try_consume(used_atom,L["consume"]))
|
||||
// return 0
|
||||
return FORWARD //to the first step -> forward
|
||||
else if(state_prev in state)
|
||||
var/list/step = state[state_prev]
|
||||
if(do_tool_or_atom_check(used_atom, step["key"]))
|
||||
//if(L["consume"] && !try_consume(used_atom,L["consume"]))
|
||||
// return 0
|
||||
return BACKWARD //to the first step -> forward
|
||||
return 0
|
||||
|
||||
/datum/construction/reversible2/check_step(atom/used_atom,mob/user as mob)
|
||||
var/diff = is_right_key(user,used_atom)
|
||||
if(diff)
|
||||
if(custom_action(index, diff, used_atom, user))
|
||||
update_index(diff,user)
|
||||
update_icon()
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/construction/reversible2/proc/fixText(text,user)
|
||||
text = replacetext(text,"{USER}","[user]")
|
||||
text = replacetext(text,"{HOLDER}","[holder]")
|
||||
return text
|
||||
|
||||
/datum/construction/reversible2/custom_action(index, diff, used_atom, var/mob/user)
|
||||
if(!..(index,used_atom,user))
|
||||
return 0
|
||||
|
||||
var/list/step = steps[index]
|
||||
var/list/state = step[diff==FORWARD ? state_next : state_prev]
|
||||
user.visible_message(fixText(state["vis_msg"],user),fixText(state["self_msg"],user))
|
||||
|
||||
if("delete" in state)
|
||||
qdel(used_atom)
|
||||
else if("spawn" in state)
|
||||
var/spawntype=state["spawn"]
|
||||
var/atom/A = new spawntype(holder.loc)
|
||||
if("amount" in state)
|
||||
if(istype(A,/obj/item/stack/cable_coil))
|
||||
var/obj/item/stack/cable_coil/C=A
|
||||
C.amount=state["amount"]
|
||||
if(istype(A,/obj/item/stack))
|
||||
var/obj/item/stack/S=A
|
||||
S.amount=state["amount"]
|
||||
|
||||
return 1
|
||||
|
||||
/datum/construction/reversible2/action(used_atom,user)
|
||||
return check_step(used_atom,user)
|
||||
#define FORWARD -1
|
||||
#define BACKWARD 1
|
||||
#define CONSTRUCTION_TOOL_BEHAVIOURS list(TOOL_CROWBAR, TOOL_SCREWDRIVER, TOOL_WELDER, TOOL_WRENCH)
|
||||
|
||||
/datum/construction
|
||||
var/list/steps
|
||||
var/atom/holder
|
||||
var/result
|
||||
var/list/steps_desc
|
||||
var/taskpath = null // Path of job objective completed.
|
||||
|
||||
/datum/construction/New(atom)
|
||||
..()
|
||||
holder = atom
|
||||
if(!holder) //don't want this without a holder
|
||||
spawn
|
||||
qdel(src)
|
||||
set_desc(steps.len)
|
||||
return
|
||||
|
||||
/datum/construction/proc/next_step(mob/user as mob)
|
||||
steps.len--
|
||||
if(!steps.len)
|
||||
spawn_result(user)
|
||||
else
|
||||
set_desc(steps.len)
|
||||
return
|
||||
|
||||
/datum/construction/proc/action(atom/used_atom,mob/user as mob)
|
||||
return
|
||||
|
||||
/datum/construction/proc/check_step(atom/used_atom,mob/user as mob) //check last step only
|
||||
var/valid_step = is_right_key(used_atom)
|
||||
if(valid_step)
|
||||
if(custom_action(valid_step, used_atom, user))
|
||||
next_step(user)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/construction/proc/is_right_key(atom/used_atom) // returns current step num if used_atom is of the right type.
|
||||
var/list/L = steps[steps.len]
|
||||
if(do_tool_or_atom_check(used_atom, L["key"]))
|
||||
return steps.len
|
||||
return 0
|
||||
|
||||
|
||||
/datum/construction/proc/custom_action(step, used_atom, user)
|
||||
if(istype(used_atom, /obj/item/stack/cable_coil))
|
||||
var/obj/item/stack/cable_coil/C = used_atom
|
||||
if(C.amount<4)
|
||||
to_chat(user, ("<span class='warning'>There's not enough cable to finish the task.</span>"))
|
||||
return 0
|
||||
else
|
||||
C.use(4)
|
||||
playsound(holder, C.usesound, 50, 1)
|
||||
else if(istype(used_atom, /obj/item/stack))
|
||||
var/obj/item/stack/S = used_atom
|
||||
if(S.amount < 5)
|
||||
to_chat(user, ("<span class='warning'>There's not enough material in this stack.</span>"))
|
||||
return 0
|
||||
else
|
||||
S.use(5)
|
||||
else if(isitem(used_atom))
|
||||
var/obj/item/I = used_atom
|
||||
if(I.tool_behaviour in CONSTRUCTION_TOOL_BEHAVIOURS)
|
||||
if(!I.use_tool(holder, user, 0, volume = I.tool_volume))
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/datum/construction/proc/check_all_steps(atom/used_atom,mob/user as mob) //check all steps, remove matching one.
|
||||
for(var/i=1;i<=steps.len;i++)
|
||||
var/list/L = steps[i];
|
||||
if(do_tool_or_atom_check(used_atom, L["key"]) && custom_action(i, used_atom, user))
|
||||
steps[i]=null;//stupid byond list from list removal...
|
||||
listclearnulls(steps);
|
||||
if(!steps.len)
|
||||
spawn_result(user)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
/datum/construction/proc/spawn_result(mob/user as mob)
|
||||
if(result)
|
||||
if(taskpath)
|
||||
var/datum/job_objective/task = user.mind.findJobTask(taskpath)
|
||||
if(istype(task))
|
||||
task.unit_completed()
|
||||
|
||||
new result(get_turf(holder))
|
||||
spawn()
|
||||
qdel(holder)
|
||||
return
|
||||
|
||||
/datum/construction/proc/set_desc(index as num)
|
||||
var/list/step = steps[index]
|
||||
holder.desc = step["desc"]
|
||||
return
|
||||
|
||||
/datum/construction/proc/try_consume(mob/user as mob, atom/used_atom, amount)
|
||||
if(amount > 0)
|
||||
// CABLES
|
||||
if(istype(used_atom,/obj/item/stack/cable_coil))
|
||||
var/obj/item/stack/cable_coil/coil=used_atom
|
||||
if(!coil.use(amount))
|
||||
to_chat(user, "<span class='warning'>You don't have enough cable! You need at least [amount] coils.</span>")
|
||||
return 0
|
||||
// TOOLS
|
||||
if(isitem(used_atom))
|
||||
var/obj/item/I = used_atom
|
||||
if(I.tool_behaviour in CONSTRUCTION_TOOL_BEHAVIOURS)
|
||||
if(!I.use(amount))
|
||||
return 0
|
||||
// STACKS
|
||||
if(istype(used_atom,/obj/item/stack))
|
||||
var/obj/item/stack/stack=used_atom
|
||||
if(stack.amount < amount)
|
||||
to_chat(user, "<span class='warning'>You don't have enough [stack]! You need at least [amount].</span>")
|
||||
return 0
|
||||
stack.use(amount)
|
||||
return 1
|
||||
|
||||
/datum/construction/proc/do_tool_or_atom_check(used_atom, thing_to_check) //Checks if an atom is either a required thing; or if it's a required tool
|
||||
if(istype(used_atom, thing_to_check))
|
||||
return TRUE
|
||||
else if(isitem(used_atom))
|
||||
var/obj/item/I = used_atom
|
||||
if(I.tool_behaviour == thing_to_check)
|
||||
return TRUE
|
||||
|
||||
/datum/construction/reversible
|
||||
var/index
|
||||
|
||||
/datum/construction/reversible/New(atom)
|
||||
..()
|
||||
index = steps.len
|
||||
return
|
||||
|
||||
/datum/construction/reversible/proc/update_index(diff as num, mob/user as mob)
|
||||
index+=diff
|
||||
if(index==0)
|
||||
spawn_result(user)
|
||||
else
|
||||
set_desc(index)
|
||||
return
|
||||
|
||||
/datum/construction/reversible/is_right_key(atom/used_atom) // returns index step
|
||||
var/list/L = steps[index]
|
||||
if(do_tool_or_atom_check(used_atom, L["key"]))
|
||||
return FORWARD //to the first step -> forward
|
||||
else if(L["backkey"] && do_tool_or_atom_check(used_atom, L["backkey"]))
|
||||
return BACKWARD //to the last step -> backwards
|
||||
return 0
|
||||
|
||||
/datum/construction/reversible/check_step(atom/used_atom,mob/user as mob)
|
||||
var/diff = is_right_key(used_atom)
|
||||
if(diff)
|
||||
if(custom_action(index, diff, used_atom, user))
|
||||
update_index(diff, user)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/construction/reversible/custom_action(index, diff, used_atom, user)
|
||||
if(!..(index,used_atom,user))
|
||||
return 0
|
||||
return 1
|
||||
|
||||
#define state_next "next"
|
||||
#define state_prev "prev"
|
||||
|
||||
/datum/construction/reversible2
|
||||
var/index
|
||||
var/base_icon = "durand"
|
||||
|
||||
/datum/construction/reversible2/New(atom)
|
||||
..()
|
||||
index = 1
|
||||
return
|
||||
|
||||
/datum/construction/reversible2/proc/update_index(diff as num, mob/user as mob)
|
||||
index-=diff
|
||||
if(index==steps.len+1)
|
||||
spawn_result(user)
|
||||
else
|
||||
set_desc(index)
|
||||
return
|
||||
|
||||
/datum/construction/reversible2/proc/update_icon()
|
||||
holder.icon_state="[base_icon]_[index]"
|
||||
|
||||
/datum/construction/reversible2/is_right_key(mob/user as mob,atom/used_atom) // returns index step
|
||||
var/list/state = steps[index]
|
||||
if(state_next in state)
|
||||
var/list/step = state[state_next]
|
||||
if(do_tool_or_atom_check(used_atom, step["key"]))
|
||||
//if(L["consume"] && !try_consume(used_atom,L["consume"]))
|
||||
// return 0
|
||||
return FORWARD //to the first step -> forward
|
||||
else if(state_prev in state)
|
||||
var/list/step = state[state_prev]
|
||||
if(do_tool_or_atom_check(used_atom, step["key"]))
|
||||
//if(L["consume"] && !try_consume(used_atom,L["consume"]))
|
||||
// return 0
|
||||
return BACKWARD //to the first step -> forward
|
||||
return 0
|
||||
|
||||
/datum/construction/reversible2/check_step(atom/used_atom,mob/user as mob)
|
||||
var/diff = is_right_key(user,used_atom)
|
||||
if(diff)
|
||||
if(custom_action(index, diff, used_atom, user))
|
||||
update_index(diff,user)
|
||||
update_icon()
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/construction/reversible2/proc/fixText(text,user)
|
||||
text = replacetext(text,"{USER}","[user]")
|
||||
text = replacetext(text,"{HOLDER}","[holder]")
|
||||
return text
|
||||
|
||||
/datum/construction/reversible2/custom_action(index, diff, used_atom, var/mob/user)
|
||||
if(!..(index,used_atom,user))
|
||||
return 0
|
||||
|
||||
var/list/step = steps[index]
|
||||
var/list/state = step[diff==FORWARD ? state_next : state_prev]
|
||||
user.visible_message(fixText(state["vis_msg"],user),fixText(state["self_msg"],user))
|
||||
|
||||
if("delete" in state)
|
||||
qdel(used_atom)
|
||||
else if("spawn" in state)
|
||||
var/spawntype=state["spawn"]
|
||||
var/atom/A = new spawntype(holder.loc)
|
||||
if("amount" in state)
|
||||
if(istype(A,/obj/item/stack/cable_coil))
|
||||
var/obj/item/stack/cable_coil/C=A
|
||||
C.amount=state["amount"]
|
||||
if(istype(A,/obj/item/stack))
|
||||
var/obj/item/stack/S=A
|
||||
S.amount=state["amount"]
|
||||
|
||||
return 1
|
||||
|
||||
/datum/construction/reversible2/action(used_atom,user)
|
||||
return check_step(used_atom,user)
|
||||
|
||||
@@ -1,68 +1,68 @@
|
||||
/*
|
||||
* WARRANTY VOID IF CODE USED
|
||||
*/
|
||||
|
||||
|
||||
/datum/events
|
||||
var/list/events
|
||||
|
||||
/datum/events/New()
|
||||
..()
|
||||
events = new
|
||||
|
||||
/datum/events/proc/addEventType(event_type as text)
|
||||
if(!(event_type in events) || !islist(events[event_type]))
|
||||
events[event_type] = list()
|
||||
return 1
|
||||
return
|
||||
|
||||
|
||||
// Arguments: event_type as text, proc_holder as datum, proc_name as text
|
||||
// Returns: New event, null on error.
|
||||
/datum/events/proc/addEvent(event_type as text, proc_holder, proc_name as text)
|
||||
if(!event_type || !proc_holder || !proc_name)
|
||||
return
|
||||
addEventType(event_type)
|
||||
var/list/event = events[event_type]
|
||||
var/datum/event/E = new /datum/event(proc_holder,proc_name)
|
||||
event += E
|
||||
return E
|
||||
|
||||
// Arguments: event_type as text, any number of additional arguments to pass to event handler
|
||||
// Returns: null
|
||||
/datum/events/proc/fireEvent()
|
||||
//world << "Events in [args[1]] called"
|
||||
var/list/event = listgetindex(events,args[1])
|
||||
if(istype(event))
|
||||
spawn(0)
|
||||
for(var/datum/event/E in event)
|
||||
if(!E.Fire(arglist(args.Copy(2))))
|
||||
clearEvent(args[1],E)
|
||||
return
|
||||
|
||||
// Arguments: event_type as text, E as /datum/event
|
||||
// Returns: 1 if event cleared, null on error
|
||||
|
||||
/datum/events/proc/clearEvent(event_type as text, datum/event/E)
|
||||
if(!event_type || !E)
|
||||
return
|
||||
var/list/event = listgetindex(events,event_type)
|
||||
event -= E
|
||||
return 1
|
||||
|
||||
|
||||
/datum/event
|
||||
var/listener
|
||||
var/proc_name
|
||||
|
||||
/datum/event/New(tlistener,tprocname)
|
||||
listener = tlistener
|
||||
proc_name = tprocname
|
||||
return ..()
|
||||
|
||||
/datum/event/proc/Fire()
|
||||
//world << "Event fired"
|
||||
if(listener)
|
||||
call(listener,proc_name)(arglist(args))
|
||||
return 1
|
||||
return
|
||||
/*
|
||||
* WARRANTY VOID IF CODE USED
|
||||
*/
|
||||
|
||||
|
||||
/datum/events
|
||||
var/list/events
|
||||
|
||||
/datum/events/New()
|
||||
..()
|
||||
events = new
|
||||
|
||||
/datum/events/proc/addEventType(event_type as text)
|
||||
if(!(event_type in events) || !islist(events[event_type]))
|
||||
events[event_type] = list()
|
||||
return 1
|
||||
return
|
||||
|
||||
|
||||
// Arguments: event_type as text, proc_holder as datum, proc_name as text
|
||||
// Returns: New event, null on error.
|
||||
/datum/events/proc/addEvent(event_type as text, proc_holder, proc_name as text)
|
||||
if(!event_type || !proc_holder || !proc_name)
|
||||
return
|
||||
addEventType(event_type)
|
||||
var/list/event = events[event_type]
|
||||
var/datum/event/E = new /datum/event(proc_holder,proc_name)
|
||||
event += E
|
||||
return E
|
||||
|
||||
// Arguments: event_type as text, any number of additional arguments to pass to event handler
|
||||
// Returns: null
|
||||
/datum/events/proc/fireEvent()
|
||||
//world << "Events in [args[1]] called"
|
||||
var/list/event = listgetindex(events,args[1])
|
||||
if(istype(event))
|
||||
spawn(0)
|
||||
for(var/datum/event/E in event)
|
||||
if(!E.Fire(arglist(args.Copy(2))))
|
||||
clearEvent(args[1],E)
|
||||
return
|
||||
|
||||
// Arguments: event_type as text, E as /datum/event
|
||||
// Returns: 1 if event cleared, null on error
|
||||
|
||||
/datum/events/proc/clearEvent(event_type as text, datum/event/E)
|
||||
if(!event_type || !E)
|
||||
return
|
||||
var/list/event = listgetindex(events,event_type)
|
||||
event -= E
|
||||
return 1
|
||||
|
||||
|
||||
/datum/event
|
||||
var/listener
|
||||
var/proc_name
|
||||
|
||||
/datum/event/New(tlistener,tprocname)
|
||||
listener = tlistener
|
||||
proc_name = tprocname
|
||||
return ..()
|
||||
|
||||
/datum/event/proc/Fire()
|
||||
//world << "Event fired"
|
||||
if(listener)
|
||||
call(listener,proc_name)(arglist(args))
|
||||
return 1
|
||||
return
|
||||
|
||||
@@ -1,152 +1,152 @@
|
||||
/*
|
||||
README:
|
||||
|
||||
The global_iterator datum is supposed to provide a simple and robust way to
|
||||
create some constantly "looping" processes with ability to stop and restart them at will.
|
||||
Generally, the only thing you want to play with (meaning, redefine) is the process() proc.
|
||||
It must contain all the things you want done.
|
||||
|
||||
Control functions:
|
||||
new - used to create datum. First argument (optional) - var list(to use in process() proc) as list,
|
||||
second (optional) - autostart control.
|
||||
If autostart == TRUE, the loop will be started immediately after datum creation.
|
||||
|
||||
start(list/arguments) - starts the loop. Takes arguments(optional) as a list, which is then used
|
||||
by process() proc. Returns null if datum already active, 1 if loop started succesfully and 0 if there's
|
||||
an error in supplied arguments (not list or empty list).
|
||||
|
||||
stop() - stops the loop. Returns null if datum is already inactive and 1 on success.
|
||||
|
||||
set_delay(new_delay) - sets the delay between iterations. Pretty selfexplanatory.
|
||||
Returns 0 on error(new_delay is not numerical), 1 otherwise.
|
||||
|
||||
set_process_args(list/arguments) - passes the supplied arguments to the process() proc.
|
||||
|
||||
active() - Returns 1 if datum is active, 0 otherwise.
|
||||
|
||||
toggle() - toggles datum state. Returns new datum state (see active()).
|
||||
|
||||
Misc functions:
|
||||
|
||||
get_last_exec_time() - Returns the time of last iteration.
|
||||
|
||||
get_last_exec_time_as_text() - Returns the time of last iteration as text
|
||||
|
||||
|
||||
Control vars:
|
||||
|
||||
delay - delay between iterations
|
||||
|
||||
check_for_null - if equals TRUE, on each iteration the supplied arguments will be checked for nulls.
|
||||
If some varible equals null (and null only), the loop is stopped.
|
||||
Usefull, if some var unexpectedly becomes null - due to object deletion, for example.
|
||||
Of course, you can also check the variables inside process() proc to prevent runtime errors.
|
||||
|
||||
Data storage vars:
|
||||
|
||||
result - stores the value returned by process() proc
|
||||
*/
|
||||
|
||||
/datum/global_iterator
|
||||
var/control_switch = 0
|
||||
var/delay = 10
|
||||
var/list/arg_list = new
|
||||
var/last_exec = null
|
||||
var/check_for_null = 1
|
||||
var/forbid_garbage = 0
|
||||
var/result
|
||||
var/state = 0
|
||||
|
||||
/datum/global_iterator/New(list/arguments=null,autostart=1)
|
||||
delay = delay>0?(delay):1
|
||||
if(forbid_garbage) //prevents garbage collection with tag != null
|
||||
tag = "\ref[src]"
|
||||
set_process_args(arguments)
|
||||
if(autostart)
|
||||
start()
|
||||
return
|
||||
|
||||
/datum/global_iterator/proc/main()
|
||||
state = 1
|
||||
while(src && control_switch)
|
||||
last_exec = world.timeofday
|
||||
if(check_for_null && has_null_args())
|
||||
stop()
|
||||
return 0
|
||||
result = process(arglist(arg_list))
|
||||
for(var/sleep_time=delay;sleep_time>0;sleep_time--) //uhh, this is ugly. But I see no other way to terminate sleeping proc. Such disgrace.
|
||||
if(!control_switch)
|
||||
return 0
|
||||
sleep(1)
|
||||
return 0
|
||||
|
||||
/datum/global_iterator/proc/start(list/arguments=null)
|
||||
if(active())
|
||||
return
|
||||
if(arguments)
|
||||
if(!set_process_args(arguments))
|
||||
return 0
|
||||
if(!state_check()) //the main loop is sleeping, wait for it to terminate.
|
||||
return
|
||||
control_switch = 1
|
||||
spawn()
|
||||
state = main()
|
||||
return 1
|
||||
|
||||
/datum/global_iterator/proc/stop()
|
||||
if(!active())
|
||||
return
|
||||
control_switch = 0
|
||||
spawn(-1) //report termination error but don't wait for state_check().
|
||||
state_check()
|
||||
return 1
|
||||
|
||||
/datum/global_iterator/proc/state_check()
|
||||
var/lag = 0
|
||||
while(state)
|
||||
sleep(1)
|
||||
if(++lag>10)
|
||||
CRASH("The global_iterator loop \ref[src] failed to terminate in designated timeframe. This may be caused by server lagging.")
|
||||
return 1
|
||||
|
||||
/datum/global_iterator/process()
|
||||
return
|
||||
|
||||
/datum/global_iterator/proc/active()
|
||||
return control_switch
|
||||
|
||||
/datum/global_iterator/proc/has_null_args()
|
||||
if(null in arg_list)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
/datum/global_iterator/proc/set_delay(new_delay)
|
||||
if(isnum(new_delay))
|
||||
delay = max(1, round(new_delay))
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
|
||||
/datum/global_iterator/proc/get_last_exec_time()
|
||||
return (last_exec||0)
|
||||
|
||||
/datum/global_iterator/proc/get_last_exec_time_as_text()
|
||||
return (time2text(last_exec)||"Wasn't executed yet")
|
||||
|
||||
/datum/global_iterator/proc/set_process_args(list/arguments)
|
||||
if(arguments && istype(arguments, /list) && arguments.len)
|
||||
arg_list = arguments
|
||||
return 1
|
||||
else
|
||||
// to_chat(world, "<span class='warning'>Invalid arguments supplied for [src.type], ref = \ref[src]</span>")
|
||||
return 0
|
||||
|
||||
/datum/global_iterator/proc/toggle_null_checks()
|
||||
check_for_null = !check_for_null
|
||||
return check_for_null
|
||||
|
||||
/datum/global_iterator/proc/toggle()
|
||||
if(!stop())
|
||||
start()
|
||||
return active()
|
||||
/*
|
||||
README:
|
||||
|
||||
The global_iterator datum is supposed to provide a simple and robust way to
|
||||
create some constantly "looping" processes with ability to stop and restart them at will.
|
||||
Generally, the only thing you want to play with (meaning, redefine) is the process() proc.
|
||||
It must contain all the things you want done.
|
||||
|
||||
Control functions:
|
||||
new - used to create datum. First argument (optional) - var list(to use in process() proc) as list,
|
||||
second (optional) - autostart control.
|
||||
If autostart == TRUE, the loop will be started immediately after datum creation.
|
||||
|
||||
start(list/arguments) - starts the loop. Takes arguments(optional) as a list, which is then used
|
||||
by process() proc. Returns null if datum already active, 1 if loop started succesfully and 0 if there's
|
||||
an error in supplied arguments (not list or empty list).
|
||||
|
||||
stop() - stops the loop. Returns null if datum is already inactive and 1 on success.
|
||||
|
||||
set_delay(new_delay) - sets the delay between iterations. Pretty selfexplanatory.
|
||||
Returns 0 on error(new_delay is not numerical), 1 otherwise.
|
||||
|
||||
set_process_args(list/arguments) - passes the supplied arguments to the process() proc.
|
||||
|
||||
active() - Returns 1 if datum is active, 0 otherwise.
|
||||
|
||||
toggle() - toggles datum state. Returns new datum state (see active()).
|
||||
|
||||
Misc functions:
|
||||
|
||||
get_last_exec_time() - Returns the time of last iteration.
|
||||
|
||||
get_last_exec_time_as_text() - Returns the time of last iteration as text
|
||||
|
||||
|
||||
Control vars:
|
||||
|
||||
delay - delay between iterations
|
||||
|
||||
check_for_null - if equals TRUE, on each iteration the supplied arguments will be checked for nulls.
|
||||
If some varible equals null (and null only), the loop is stopped.
|
||||
Usefull, if some var unexpectedly becomes null - due to object deletion, for example.
|
||||
Of course, you can also check the variables inside process() proc to prevent runtime errors.
|
||||
|
||||
Data storage vars:
|
||||
|
||||
result - stores the value returned by process() proc
|
||||
*/
|
||||
|
||||
/datum/global_iterator
|
||||
var/control_switch = 0
|
||||
var/delay = 10
|
||||
var/list/arg_list = new
|
||||
var/last_exec = null
|
||||
var/check_for_null = 1
|
||||
var/forbid_garbage = 0
|
||||
var/result
|
||||
var/state = 0
|
||||
|
||||
/datum/global_iterator/New(list/arguments=null,autostart=1)
|
||||
delay = delay>0?(delay):1
|
||||
if(forbid_garbage) //prevents garbage collection with tag != null
|
||||
tag = "\ref[src]"
|
||||
set_process_args(arguments)
|
||||
if(autostart)
|
||||
start()
|
||||
return
|
||||
|
||||
/datum/global_iterator/proc/main()
|
||||
state = 1
|
||||
while(src && control_switch)
|
||||
last_exec = world.timeofday
|
||||
if(check_for_null && has_null_args())
|
||||
stop()
|
||||
return 0
|
||||
result = process(arglist(arg_list))
|
||||
for(var/sleep_time=delay;sleep_time>0;sleep_time--) //uhh, this is ugly. But I see no other way to terminate sleeping proc. Such disgrace.
|
||||
if(!control_switch)
|
||||
return 0
|
||||
sleep(1)
|
||||
return 0
|
||||
|
||||
/datum/global_iterator/proc/start(list/arguments=null)
|
||||
if(active())
|
||||
return
|
||||
if(arguments)
|
||||
if(!set_process_args(arguments))
|
||||
return 0
|
||||
if(!state_check()) //the main loop is sleeping, wait for it to terminate.
|
||||
return
|
||||
control_switch = 1
|
||||
spawn()
|
||||
state = main()
|
||||
return 1
|
||||
|
||||
/datum/global_iterator/proc/stop()
|
||||
if(!active())
|
||||
return
|
||||
control_switch = 0
|
||||
spawn(-1) //report termination error but don't wait for state_check().
|
||||
state_check()
|
||||
return 1
|
||||
|
||||
/datum/global_iterator/proc/state_check()
|
||||
var/lag = 0
|
||||
while(state)
|
||||
sleep(1)
|
||||
if(++lag>10)
|
||||
CRASH("The global_iterator loop \ref[src] failed to terminate in designated timeframe. This may be caused by server lagging.")
|
||||
return 1
|
||||
|
||||
/datum/global_iterator/process()
|
||||
return
|
||||
|
||||
/datum/global_iterator/proc/active()
|
||||
return control_switch
|
||||
|
||||
/datum/global_iterator/proc/has_null_args()
|
||||
if(null in arg_list)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
/datum/global_iterator/proc/set_delay(new_delay)
|
||||
if(isnum(new_delay))
|
||||
delay = max(1, round(new_delay))
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
|
||||
/datum/global_iterator/proc/get_last_exec_time()
|
||||
return (last_exec||0)
|
||||
|
||||
/datum/global_iterator/proc/get_last_exec_time_as_text()
|
||||
return (time2text(last_exec)||"Wasn't executed yet")
|
||||
|
||||
/datum/global_iterator/proc/set_process_args(list/arguments)
|
||||
if(arguments && istype(arguments, /list) && arguments.len)
|
||||
arg_list = arguments
|
||||
return 1
|
||||
else
|
||||
// to_chat(world, "<span class='warning'>Invalid arguments supplied for [src.type], ref = \ref[src]</span>")
|
||||
return 0
|
||||
|
||||
/datum/global_iterator/proc/toggle_null_checks()
|
||||
check_for_null = !check_for_null
|
||||
return check_for_null
|
||||
|
||||
/datum/global_iterator/proc/toggle()
|
||||
if(!stop())
|
||||
start()
|
||||
return active()
|
||||
|
||||
@@ -161,4 +161,4 @@
|
||||
var/datum/map_template/shuttle/S = new shuttle_type()
|
||||
|
||||
shuttle_templates[S.shuttle_id] = S
|
||||
map_templates[S.shuttle_id] = S
|
||||
map_templates[S.shuttle_id] = S
|
||||
|
||||
@@ -1,237 +1,237 @@
|
||||
//wrapper
|
||||
/proc/do_teleport(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null, bypass_area_flag=FALSE)
|
||||
var/datum/teleport/instant/science/D = new
|
||||
if(D.start(arglist(args)))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/teleport
|
||||
var/atom/movable/teleatom //atom to teleport
|
||||
var/atom/destination //destination to teleport to
|
||||
var/precision = 0 //teleport precision
|
||||
var/datum/effect_system/effectin //effect to show right before teleportation
|
||||
var/datum/effect_system/effectout //effect to show right after teleportation
|
||||
var/soundin //soundfile to play before teleportation
|
||||
var/soundout //soundfile to play after teleportation
|
||||
var/force_teleport = 1 //if false, teleport will use Move() proc (dense objects will prevent teleportation)
|
||||
var/ignore_area_flag = FALSE
|
||||
|
||||
|
||||
/datum/teleport/proc/start(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null, bypass_area_flag=FALSE)
|
||||
if(!initTeleport(arglist(args)))
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/datum/teleport/proc/initTeleport(ateleatom, adestination, aprecision, afteleport, aeffectin, aeffectout, asoundin, asoundout, bypass_area_flag=FALSE)
|
||||
if(!setTeleatom(ateleatom))
|
||||
return 0
|
||||
if(!setDestination(adestination))
|
||||
return 0
|
||||
if(!setPrecision(aprecision))
|
||||
return 0
|
||||
setEffects(aeffectin,aeffectout)
|
||||
setForceTeleport(afteleport)
|
||||
setSounds(asoundin,asoundout)
|
||||
ignore_area_flag = bypass_area_flag
|
||||
return 1
|
||||
|
||||
//must succeed
|
||||
/datum/teleport/proc/setPrecision(aprecision)
|
||||
if(isnum(aprecision))
|
||||
precision = aprecision
|
||||
return 1
|
||||
return 0
|
||||
|
||||
//must succeed
|
||||
/datum/teleport/proc/setDestination(atom/adestination)
|
||||
if(istype(adestination))
|
||||
destination = adestination
|
||||
return 1
|
||||
return 0
|
||||
|
||||
//must succeed in most cases
|
||||
/datum/teleport/proc/setTeleatom(atom/movable/ateleatom)
|
||||
if(istype(ateleatom, /obj/effect) && !istype(ateleatom, /obj/effect/dummy/chameleon))
|
||||
qdel(ateleatom)
|
||||
return 0
|
||||
if(istype(ateleatom))
|
||||
teleatom = ateleatom
|
||||
return 1
|
||||
return 0
|
||||
|
||||
//custom effects must be properly set up first for instant-type teleports
|
||||
//optional
|
||||
/datum/teleport/proc/setEffects(datum/effect_system/aeffectin=null,datum/effect_system/aeffectout=null)
|
||||
effectin = istype(aeffectin) ? aeffectin : null
|
||||
effectout = istype(aeffectout) ? aeffectout : null
|
||||
return 1
|
||||
|
||||
//optional
|
||||
/datum/teleport/proc/setForceTeleport(afteleport)
|
||||
force_teleport = afteleport
|
||||
return 1
|
||||
|
||||
//optional
|
||||
/datum/teleport/proc/setSounds(asoundin=null,asoundout=null)
|
||||
soundin = isfile(asoundin) ? asoundin : null
|
||||
soundout = isfile(asoundout) ? asoundout : null
|
||||
return 1
|
||||
|
||||
//placeholder
|
||||
/datum/teleport/proc/teleportChecks()
|
||||
return 1
|
||||
|
||||
/datum/teleport/proc/playSpecials(atom/location,datum/effect_system/effect,sound)
|
||||
if(location)
|
||||
if(effect)
|
||||
spawn(-1)
|
||||
src = null
|
||||
effect.attach(location)
|
||||
effect.start()
|
||||
if(sound)
|
||||
spawn(-1)
|
||||
src = null
|
||||
playsound(location,sound,60,1)
|
||||
return
|
||||
|
||||
//do the monkey dance
|
||||
/datum/teleport/proc/doTeleport()
|
||||
|
||||
var/turf/destturf
|
||||
var/turf/curturf = get_turf(teleatom)
|
||||
var/area/curarea = get_area(curturf)
|
||||
|
||||
if(precision)
|
||||
var/list/posturfs = list()
|
||||
var/center = get_turf(destination)
|
||||
if(!center)
|
||||
center = destination
|
||||
for(var/turf/T in range(precision,center))
|
||||
posturfs.Add(T)
|
||||
destturf = safepick(posturfs)
|
||||
else
|
||||
destturf = get_turf(destination)
|
||||
|
||||
if(!is_teleport_allowed(destturf.z) && !ignore_area_flag)
|
||||
return 0
|
||||
// Only check the destination zlevel for is_teleport_allowed. Checking origin as well breaks ERT teleporters.
|
||||
|
||||
var/area/destarea = get_area(destturf)
|
||||
|
||||
if(!ignore_area_flag)
|
||||
if(curarea.tele_proof)
|
||||
return 0
|
||||
if(destarea.tele_proof)
|
||||
return 0
|
||||
|
||||
if(!destturf || !curturf)
|
||||
return 0
|
||||
|
||||
playSpecials(curturf,effectin,soundin)
|
||||
|
||||
if(force_teleport)
|
||||
teleatom.forceMove(destturf)
|
||||
playSpecials(destturf,effectout,soundout)
|
||||
else
|
||||
if(teleatom.Move(destturf))
|
||||
playSpecials(destturf,effectout,soundout)
|
||||
|
||||
if(isliving(teleatom))
|
||||
var/mob/living/L = teleatom
|
||||
if(L.buckled)
|
||||
L.buckled.unbuckle_mob(L, force = TRUE)
|
||||
if(L.has_buckled_mobs())
|
||||
L.unbuckle_all_mobs(force = TRUE)
|
||||
|
||||
destarea.Entered(teleatom)
|
||||
|
||||
return 1
|
||||
|
||||
/datum/teleport/proc/teleport()
|
||||
if(teleportChecks())
|
||||
return doTeleport()
|
||||
return 0
|
||||
|
||||
/datum/teleport/instant //teleports when datum is created
|
||||
|
||||
start(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null)
|
||||
if(..())
|
||||
if(teleport())
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
/datum/teleport/instant/science
|
||||
|
||||
/datum/teleport/instant/science/setEffects(datum/effect_system/aeffectin,datum/effect_system/aeffectout)
|
||||
if(aeffectin==null || aeffectout==null)
|
||||
var/datum/effect_system/spark_spread/aeffect = new
|
||||
aeffect.set_up(5, 1, teleatom)
|
||||
effectin = effectin || aeffect
|
||||
effectout = effectout || aeffect
|
||||
return 1
|
||||
else
|
||||
return ..()
|
||||
|
||||
/datum/teleport/instant/science/setPrecision(aprecision)
|
||||
..()
|
||||
if(!is_admin_level(destination.z))
|
||||
if(istype(teleatom, /obj/item/storage/backpack/holding))
|
||||
precision = rand(1, 100)
|
||||
|
||||
var/list/bagholding = teleatom.search_contents_for(/obj/item/storage/backpack/holding)
|
||||
if(bagholding.len)
|
||||
precision = max(rand(1, 100)*bagholding.len, 100)
|
||||
if(istype(teleatom, /mob/living))
|
||||
var/mob/living/MM = teleatom
|
||||
to_chat(MM, "<span class='warning'>The bluespace interface on your bag of holding interferes with the teleport!</span>")
|
||||
return 1
|
||||
|
||||
// Safe location finder
|
||||
/proc/find_safe_turf(zlevel, list/zlevels, extended_safety_checks = FALSE)
|
||||
if(!zlevels)
|
||||
if(zlevel)
|
||||
zlevels = list(zlevel)
|
||||
else
|
||||
zlevels = levels_by_trait(STATION_LEVEL)
|
||||
var/cycles = 1000
|
||||
for(var/cycle in 1 to cycles)
|
||||
// DRUNK DIALLING WOOOOOOOOO
|
||||
var/x = rand(1, world.maxx)
|
||||
var/y = rand(1, world.maxy)
|
||||
var/z = pick(zlevels)
|
||||
var/random_location = locate(x,y,z)
|
||||
|
||||
if(!isfloorturf(random_location))
|
||||
continue
|
||||
var/turf/simulated/floor/F = random_location
|
||||
if(!F.air)
|
||||
continue
|
||||
|
||||
var/datum/gas_mixture/A = F.air
|
||||
|
||||
// Can most things breathe?
|
||||
if(A.trace_gases.len)
|
||||
continue
|
||||
if(A.oxygen < 16)
|
||||
continue
|
||||
if(A.toxins)
|
||||
continue
|
||||
if(A.carbon_dioxide >= 10)
|
||||
continue
|
||||
|
||||
// Aim for goldilocks temperatures and pressure
|
||||
if((A.temperature <= 270) || (A.temperature >= 360))
|
||||
continue
|
||||
var/pressure = A.return_pressure()
|
||||
if((pressure <= 20) || (pressure >= 550))
|
||||
continue
|
||||
|
||||
if(extended_safety_checks)
|
||||
if(islava(F)) //chasms aren't /floor, and so are pre-filtered
|
||||
var/turf/simulated/floor/plating/lava/L = F
|
||||
if(!L.is_safe())
|
||||
continue
|
||||
|
||||
// DING! You have passed the gauntlet, and are "probably" safe.
|
||||
return F
|
||||
//wrapper
|
||||
/proc/do_teleport(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null, bypass_area_flag=FALSE)
|
||||
var/datum/teleport/instant/science/D = new
|
||||
if(D.start(arglist(args)))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/teleport
|
||||
var/atom/movable/teleatom //atom to teleport
|
||||
var/atom/destination //destination to teleport to
|
||||
var/precision = 0 //teleport precision
|
||||
var/datum/effect_system/effectin //effect to show right before teleportation
|
||||
var/datum/effect_system/effectout //effect to show right after teleportation
|
||||
var/soundin //soundfile to play before teleportation
|
||||
var/soundout //soundfile to play after teleportation
|
||||
var/force_teleport = 1 //if false, teleport will use Move() proc (dense objects will prevent teleportation)
|
||||
var/ignore_area_flag = FALSE
|
||||
|
||||
|
||||
/datum/teleport/proc/start(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null, bypass_area_flag=FALSE)
|
||||
if(!initTeleport(arglist(args)))
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/datum/teleport/proc/initTeleport(ateleatom, adestination, aprecision, afteleport, aeffectin, aeffectout, asoundin, asoundout, bypass_area_flag=FALSE)
|
||||
if(!setTeleatom(ateleatom))
|
||||
return 0
|
||||
if(!setDestination(adestination))
|
||||
return 0
|
||||
if(!setPrecision(aprecision))
|
||||
return 0
|
||||
setEffects(aeffectin,aeffectout)
|
||||
setForceTeleport(afteleport)
|
||||
setSounds(asoundin,asoundout)
|
||||
ignore_area_flag = bypass_area_flag
|
||||
return 1
|
||||
|
||||
//must succeed
|
||||
/datum/teleport/proc/setPrecision(aprecision)
|
||||
if(isnum(aprecision))
|
||||
precision = aprecision
|
||||
return 1
|
||||
return 0
|
||||
|
||||
//must succeed
|
||||
/datum/teleport/proc/setDestination(atom/adestination)
|
||||
if(istype(adestination))
|
||||
destination = adestination
|
||||
return 1
|
||||
return 0
|
||||
|
||||
//must succeed in most cases
|
||||
/datum/teleport/proc/setTeleatom(atom/movable/ateleatom)
|
||||
if(istype(ateleatom, /obj/effect) && !istype(ateleatom, /obj/effect/dummy/chameleon))
|
||||
qdel(ateleatom)
|
||||
return 0
|
||||
if(istype(ateleatom))
|
||||
teleatom = ateleatom
|
||||
return 1
|
||||
return 0
|
||||
|
||||
//custom effects must be properly set up first for instant-type teleports
|
||||
//optional
|
||||
/datum/teleport/proc/setEffects(datum/effect_system/aeffectin=null,datum/effect_system/aeffectout=null)
|
||||
effectin = istype(aeffectin) ? aeffectin : null
|
||||
effectout = istype(aeffectout) ? aeffectout : null
|
||||
return 1
|
||||
|
||||
//optional
|
||||
/datum/teleport/proc/setForceTeleport(afteleport)
|
||||
force_teleport = afteleport
|
||||
return 1
|
||||
|
||||
//optional
|
||||
/datum/teleport/proc/setSounds(asoundin=null,asoundout=null)
|
||||
soundin = isfile(asoundin) ? asoundin : null
|
||||
soundout = isfile(asoundout) ? asoundout : null
|
||||
return 1
|
||||
|
||||
//placeholder
|
||||
/datum/teleport/proc/teleportChecks()
|
||||
return 1
|
||||
|
||||
/datum/teleport/proc/playSpecials(atom/location,datum/effect_system/effect,sound)
|
||||
if(location)
|
||||
if(effect)
|
||||
spawn(-1)
|
||||
src = null
|
||||
effect.attach(location)
|
||||
effect.start()
|
||||
if(sound)
|
||||
spawn(-1)
|
||||
src = null
|
||||
playsound(location,sound,60,1)
|
||||
return
|
||||
|
||||
//do the monkey dance
|
||||
/datum/teleport/proc/doTeleport()
|
||||
|
||||
var/turf/destturf
|
||||
var/turf/curturf = get_turf(teleatom)
|
||||
var/area/curarea = get_area(curturf)
|
||||
|
||||
if(precision)
|
||||
var/list/posturfs = list()
|
||||
var/center = get_turf(destination)
|
||||
if(!center)
|
||||
center = destination
|
||||
for(var/turf/T in range(precision,center))
|
||||
posturfs.Add(T)
|
||||
destturf = safepick(posturfs)
|
||||
else
|
||||
destturf = get_turf(destination)
|
||||
|
||||
if(!is_teleport_allowed(destturf.z) && !ignore_area_flag)
|
||||
return 0
|
||||
// Only check the destination zlevel for is_teleport_allowed. Checking origin as well breaks ERT teleporters.
|
||||
|
||||
var/area/destarea = get_area(destturf)
|
||||
|
||||
if(!ignore_area_flag)
|
||||
if(curarea.tele_proof)
|
||||
return 0
|
||||
if(destarea.tele_proof)
|
||||
return 0
|
||||
|
||||
if(!destturf || !curturf)
|
||||
return 0
|
||||
|
||||
playSpecials(curturf,effectin,soundin)
|
||||
|
||||
if(force_teleport)
|
||||
teleatom.forceMove(destturf)
|
||||
playSpecials(destturf,effectout,soundout)
|
||||
else
|
||||
if(teleatom.Move(destturf))
|
||||
playSpecials(destturf,effectout,soundout)
|
||||
|
||||
if(isliving(teleatom))
|
||||
var/mob/living/L = teleatom
|
||||
if(L.buckled)
|
||||
L.buckled.unbuckle_mob(L, force = TRUE)
|
||||
if(L.has_buckled_mobs())
|
||||
L.unbuckle_all_mobs(force = TRUE)
|
||||
|
||||
destarea.Entered(teleatom)
|
||||
|
||||
return 1
|
||||
|
||||
/datum/teleport/proc/teleport()
|
||||
if(teleportChecks())
|
||||
return doTeleport()
|
||||
return 0
|
||||
|
||||
/datum/teleport/instant //teleports when datum is created
|
||||
|
||||
start(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null)
|
||||
if(..())
|
||||
if(teleport())
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
/datum/teleport/instant/science
|
||||
|
||||
/datum/teleport/instant/science/setEffects(datum/effect_system/aeffectin,datum/effect_system/aeffectout)
|
||||
if(aeffectin==null || aeffectout==null)
|
||||
var/datum/effect_system/spark_spread/aeffect = new
|
||||
aeffect.set_up(5, 1, teleatom)
|
||||
effectin = effectin || aeffect
|
||||
effectout = effectout || aeffect
|
||||
return 1
|
||||
else
|
||||
return ..()
|
||||
|
||||
/datum/teleport/instant/science/setPrecision(aprecision)
|
||||
..()
|
||||
if(!is_admin_level(destination.z))
|
||||
if(istype(teleatom, /obj/item/storage/backpack/holding))
|
||||
precision = rand(1, 100)
|
||||
|
||||
var/list/bagholding = teleatom.search_contents_for(/obj/item/storage/backpack/holding)
|
||||
if(bagholding.len)
|
||||
precision = max(rand(1, 100)*bagholding.len, 100)
|
||||
if(istype(teleatom, /mob/living))
|
||||
var/mob/living/MM = teleatom
|
||||
to_chat(MM, "<span class='warning'>The bluespace interface on your bag of holding interferes with the teleport!</span>")
|
||||
return 1
|
||||
|
||||
// Safe location finder
|
||||
/proc/find_safe_turf(zlevel, list/zlevels, extended_safety_checks = FALSE)
|
||||
if(!zlevels)
|
||||
if(zlevel)
|
||||
zlevels = list(zlevel)
|
||||
else
|
||||
zlevels = levels_by_trait(STATION_LEVEL)
|
||||
var/cycles = 1000
|
||||
for(var/cycle in 1 to cycles)
|
||||
// DRUNK DIALLING WOOOOOOOOO
|
||||
var/x = rand(1, world.maxx)
|
||||
var/y = rand(1, world.maxy)
|
||||
var/z = pick(zlevels)
|
||||
var/random_location = locate(x,y,z)
|
||||
|
||||
if(!isfloorturf(random_location))
|
||||
continue
|
||||
var/turf/simulated/floor/F = random_location
|
||||
if(!F.air)
|
||||
continue
|
||||
|
||||
var/datum/gas_mixture/A = F.air
|
||||
|
||||
// Can most things breathe?
|
||||
if(A.trace_gases.len)
|
||||
continue
|
||||
if(A.oxygen < 16)
|
||||
continue
|
||||
if(A.toxins)
|
||||
continue
|
||||
if(A.carbon_dioxide >= 10)
|
||||
continue
|
||||
|
||||
// Aim for goldilocks temperatures and pressure
|
||||
if((A.temperature <= 270) || (A.temperature >= 360))
|
||||
continue
|
||||
var/pressure = A.return_pressure()
|
||||
if((pressure <= 20) || (pressure >= 550))
|
||||
continue
|
||||
|
||||
if(extended_safety_checks)
|
||||
if(islava(F)) //chasms aren't /floor, and so are pre-filtered
|
||||
var/turf/simulated/floor/plating/lava/L = F
|
||||
if(!L.is_safe())
|
||||
continue
|
||||
|
||||
// DING! You have passed the gauntlet, and are "probably" safe.
|
||||
return F
|
||||
|
||||
@@ -1,60 +1,60 @@
|
||||
/datum/topic_input
|
||||
var/href
|
||||
var/list/href_list
|
||||
|
||||
/datum/topic_input/New(thref,list/thref_list)
|
||||
href = thref
|
||||
href_list = thref_list.Copy()
|
||||
return
|
||||
|
||||
/datum/topic_input/proc/get(i)
|
||||
return listgetindex(href_list,i)
|
||||
|
||||
/datum/topic_input/proc/getAndLocate(i)
|
||||
var/t = get(i)
|
||||
if(t)
|
||||
t = locate(t)
|
||||
return t || null
|
||||
|
||||
/datum/topic_input/proc/getNum(i)
|
||||
var/t = get(i)
|
||||
if(t)
|
||||
t = text2num(t)
|
||||
return isnum(t) ? t : null
|
||||
|
||||
/datum/topic_input/proc/getObj(i)
|
||||
var/t = getAndLocate(i)
|
||||
return isobj(t) ? t : null
|
||||
|
||||
/datum/topic_input/proc/getMob(i)
|
||||
var/t = getAndLocate(i)
|
||||
return ismob(t) ? t : null
|
||||
|
||||
/datum/topic_input/proc/getTurf(i)
|
||||
var/t = getAndLocate(i)
|
||||
return isturf(t) ? t : null
|
||||
|
||||
/datum/topic_input/proc/getAtom(i)
|
||||
return getType(i,/atom)
|
||||
|
||||
/datum/topic_input/proc/getArea(i)
|
||||
var/t = getAndLocate(i)
|
||||
return isarea(t) ? t : null
|
||||
|
||||
/datum/topic_input/proc/getStr(i)//params should always be text, but...
|
||||
var/t = get(i)
|
||||
return istext(t) ? t : null
|
||||
|
||||
/datum/topic_input/proc/getType(i,type)
|
||||
var/t = getAndLocate(i)
|
||||
return istype(t,type) ? t : null
|
||||
|
||||
/datum/topic_input/proc/getPath(i)
|
||||
var/t = get(i)
|
||||
if(t)
|
||||
t = text2path(t)
|
||||
return ispath(t) ? t : null
|
||||
|
||||
/datum/topic_input/proc/getList(i)
|
||||
var/t = getAndLocate(i)
|
||||
return islist(t) ? t : null
|
||||
/datum/topic_input
|
||||
var/href
|
||||
var/list/href_list
|
||||
|
||||
/datum/topic_input/New(thref,list/thref_list)
|
||||
href = thref
|
||||
href_list = thref_list.Copy()
|
||||
return
|
||||
|
||||
/datum/topic_input/proc/get(i)
|
||||
return listgetindex(href_list,i)
|
||||
|
||||
/datum/topic_input/proc/getAndLocate(i)
|
||||
var/t = get(i)
|
||||
if(t)
|
||||
t = locate(t)
|
||||
return t || null
|
||||
|
||||
/datum/topic_input/proc/getNum(i)
|
||||
var/t = get(i)
|
||||
if(t)
|
||||
t = text2num(t)
|
||||
return isnum(t) ? t : null
|
||||
|
||||
/datum/topic_input/proc/getObj(i)
|
||||
var/t = getAndLocate(i)
|
||||
return isobj(t) ? t : null
|
||||
|
||||
/datum/topic_input/proc/getMob(i)
|
||||
var/t = getAndLocate(i)
|
||||
return ismob(t) ? t : null
|
||||
|
||||
/datum/topic_input/proc/getTurf(i)
|
||||
var/t = getAndLocate(i)
|
||||
return isturf(t) ? t : null
|
||||
|
||||
/datum/topic_input/proc/getAtom(i)
|
||||
return getType(i,/atom)
|
||||
|
||||
/datum/topic_input/proc/getArea(i)
|
||||
var/t = getAndLocate(i)
|
||||
return isarea(t) ? t : null
|
||||
|
||||
/datum/topic_input/proc/getStr(i)//params should always be text, but...
|
||||
var/t = get(i)
|
||||
return istext(t) ? t : null
|
||||
|
||||
/datum/topic_input/proc/getType(i,type)
|
||||
var/t = getAndLocate(i)
|
||||
return istype(t,type) ? t : null
|
||||
|
||||
/datum/topic_input/proc/getPath(i)
|
||||
var/t = get(i)
|
||||
if(t)
|
||||
t = text2path(t)
|
||||
return ispath(t) ? t : null
|
||||
|
||||
/datum/topic_input/proc/getList(i)
|
||||
var/t = getAndLocate(i)
|
||||
return islist(t) ? t : null
|
||||
|
||||
+1
-1
@@ -110,4 +110,4 @@ var/datum/atom_hud/huds = list( \
|
||||
client.screen += client.void
|
||||
|
||||
/mob/new_player/add_click_catcher()
|
||||
return
|
||||
return
|
||||
|
||||
@@ -97,4 +97,4 @@
|
||||
|
||||
/datum/looping_sound/proc/on_stop(looped)
|
||||
if(end_sound)
|
||||
play(end_sound)
|
||||
play(end_sound)
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
mid_sounds = list('sound/machines/shower/shower_mid1.ogg' = 1,'sound/machines/shower/shower_mid2.ogg' = 1,'sound/machines/shower/shower_mid3.ogg' = 1)
|
||||
mid_length = 10
|
||||
end_sound = 'sound/machines/shower/shower_end.ogg'
|
||||
volume = 20
|
||||
volume = 20
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/datum/looping_sound/thermal_drill
|
||||
mid_sounds = list('sound/items/thermal_drill.ogg' = 1)
|
||||
mid_length = 19
|
||||
volume = 30
|
||||
volume = 30
|
||||
|
||||
+1822
-1822
File diff suppressed because it is too large
Load Diff
+40
-40
@@ -1,40 +1,40 @@
|
||||
/datum/data
|
||||
var/name = "data"
|
||||
var/size = 1.0
|
||||
|
||||
|
||||
/datum/data/function
|
||||
name = "function"
|
||||
size = 2.0
|
||||
|
||||
|
||||
/datum/data/function/data_control
|
||||
name = "data control"
|
||||
|
||||
|
||||
/datum/data/function/id_changer
|
||||
name = "id changer"
|
||||
|
||||
|
||||
/datum/data/record
|
||||
name = "record"
|
||||
size = 5.0
|
||||
var/list/fields = list( )
|
||||
|
||||
/datum/data/record/Destroy()
|
||||
if(src in data_core.medical)
|
||||
data_core.medical -= src
|
||||
if(src in data_core.security)
|
||||
data_core.security -= src
|
||||
if(src in data_core.general)
|
||||
data_core.general -= src
|
||||
if(src in data_core.locked)
|
||||
data_core.locked -= src
|
||||
return ..()
|
||||
|
||||
/datum/data/text
|
||||
name = "text"
|
||||
var/data = null
|
||||
|
||||
/datum/debug
|
||||
var/list/debuglist
|
||||
/datum/data
|
||||
var/name = "data"
|
||||
var/size = 1.0
|
||||
|
||||
|
||||
/datum/data/function
|
||||
name = "function"
|
||||
size = 2.0
|
||||
|
||||
|
||||
/datum/data/function/data_control
|
||||
name = "data control"
|
||||
|
||||
|
||||
/datum/data/function/id_changer
|
||||
name = "id changer"
|
||||
|
||||
|
||||
/datum/data/record
|
||||
name = "record"
|
||||
size = 5.0
|
||||
var/list/fields = list( )
|
||||
|
||||
/datum/data/record/Destroy()
|
||||
if(src in data_core.medical)
|
||||
data_core.medical -= src
|
||||
if(src in data_core.security)
|
||||
data_core.security -= src
|
||||
if(src in data_core.general)
|
||||
data_core.general -= src
|
||||
if(src in data_core.locked)
|
||||
data_core.locked -= src
|
||||
return ..()
|
||||
|
||||
/datum/data/text
|
||||
name = "text"
|
||||
var/data = null
|
||||
|
||||
/datum/debug
|
||||
var/list/debuglist
|
||||
|
||||
@@ -23,4 +23,4 @@
|
||||
. = ..()
|
||||
alpha = 255
|
||||
opacity = 1
|
||||
transform = null
|
||||
transform = null
|
||||
|
||||
@@ -175,4 +175,4 @@
|
||||
name = "Blueshield Plasmaman"
|
||||
|
||||
head = /obj/item/clothing/head/helmet/space/plasmaman/blueshield
|
||||
uniform = /obj/item/clothing/under/plasmaman/blueshield
|
||||
uniform = /obj/item/clothing/under/plasmaman/blueshield
|
||||
|
||||
@@ -187,4 +187,4 @@
|
||||
. = ..()
|
||||
stored_access = outfit_data["stored_access"]
|
||||
vv_values = outfit_data["vv_values"]
|
||||
update_id_name = outfit_data["update_id_name"]
|
||||
update_id_name = outfit_data["update_id_name"]
|
||||
|
||||
+114
-114
@@ -1,114 +1,114 @@
|
||||
|
||||
/datum/radio_frequency
|
||||
var/frequency as num
|
||||
var/list/list/obj/devices = list()
|
||||
|
||||
/datum/radio_frequency/proc/post_signal(obj/source as obj|null, datum/signal/signal, var/filter = null as text|null, var/range = null as num|null)
|
||||
var/turf/start_point
|
||||
if(range)
|
||||
start_point = get_turf(source)
|
||||
if(!start_point)
|
||||
qdel(signal)
|
||||
return 0
|
||||
if(filter)
|
||||
send_to_filter(source, signal, filter, start_point, range)
|
||||
send_to_filter(source, signal, RADIO_DEFAULT, start_point, range)
|
||||
else
|
||||
//Broadcast the signal to everyone!
|
||||
for(var/next_filter in devices)
|
||||
send_to_filter(source, signal, next_filter, start_point, range)
|
||||
|
||||
//Sends a signal to all machines belonging to a given filter. Should be called by post_signal()
|
||||
/datum/radio_frequency/proc/send_to_filter(obj/source, datum/signal/signal, var/filter, var/turf/start_point = null, var/range = null)
|
||||
if(range && !start_point)
|
||||
return
|
||||
|
||||
for(var/obj/device in devices[filter])
|
||||
if(device == source)
|
||||
continue
|
||||
if(range)
|
||||
var/turf/end_point = get_turf(device)
|
||||
if(!end_point)
|
||||
continue
|
||||
if(start_point.z!=end_point.z || get_dist(start_point, end_point) > range)
|
||||
continue
|
||||
|
||||
device.receive_signal(signal, TRANSMISSION_RADIO, frequency)
|
||||
|
||||
/datum/radio_frequency/proc/add_listener(obj/device as obj, var/filter as text|null)
|
||||
if(!filter)
|
||||
filter = RADIO_DEFAULT
|
||||
//log_admin("add_listener(device=[device],filter=[filter]) frequency=[frequency]")
|
||||
var/list/obj/devices_line = devices[filter]
|
||||
if(!devices_line)
|
||||
devices_line = new
|
||||
devices[filter] = devices_line
|
||||
devices_line+=device
|
||||
// var/list/obj/devices_line___ = devices[filter_str]
|
||||
// var/l = devices_line___.len
|
||||
//log_admin("DEBUG: devices_line.len=[devices_line.len]")
|
||||
//log_admin("DEBUG: devices(filter_str).len=[l]")
|
||||
|
||||
/datum/radio_frequency/proc/remove_listener(obj/device)
|
||||
for(var/devices_filter in devices)
|
||||
var/list/devices_line = devices[devices_filter]
|
||||
devices_line-=device
|
||||
while(null in devices_line)
|
||||
devices_line -= null
|
||||
if(devices_line.len==0)
|
||||
devices -= devices_filter
|
||||
qdel(devices_line)
|
||||
|
||||
/datum/signal
|
||||
var/obj/source
|
||||
|
||||
var/transmission_method = 0 //unused at the moment
|
||||
//0 = wire
|
||||
//1 = radio transmission
|
||||
//2 = subspace transmission
|
||||
|
||||
var/list/data = list()
|
||||
var/encryption
|
||||
|
||||
var/frequency = 0
|
||||
|
||||
/datum/signal/proc/copy_from(datum/signal/model)
|
||||
source = model.source
|
||||
transmission_method = model.transmission_method
|
||||
data = model.data
|
||||
encryption = model.encryption
|
||||
frequency = model.frequency
|
||||
|
||||
/datum/signal/proc/debug_print()
|
||||
if(source)
|
||||
. = "signal = {source = '[source]' ([source:x],[source:y],[source:z])\n"
|
||||
else
|
||||
. = "signal = {source = '[source]' ()\n"
|
||||
for(var/i in data)
|
||||
. += "data\[\"[i]\"\] = \"[data[i]]\"\n"
|
||||
if(islist(data[i]))
|
||||
var/list/L = data[i]
|
||||
for(var/t in L)
|
||||
. += "data\[\"[i]\"\] list has: [t]"
|
||||
|
||||
/datum/signal/proc/get_race(mob/M)
|
||||
if(ishuman(M))
|
||||
var/mob/living/carbon/human/H = M
|
||||
. = H.dna.species.name
|
||||
else if(isbrain(M))
|
||||
var/mob/living/carbon/brain/B = M
|
||||
. = B.get_race()
|
||||
else if(issilicon(M))
|
||||
. = "Artificial Life"
|
||||
else if(isslime(M))
|
||||
. = "Slime"
|
||||
else if(isbot(M))
|
||||
. = "Bot"
|
||||
else if(isanimal(M))
|
||||
. = "Domestic Animal"
|
||||
else
|
||||
. = "Unidentifiable"
|
||||
|
||||
//callback used by objects to react to incoming radio signals
|
||||
/obj/proc/receive_signal(datum/signal/signal, receive_method, receive_param)
|
||||
return null
|
||||
|
||||
/datum/radio_frequency
|
||||
var/frequency as num
|
||||
var/list/list/obj/devices = list()
|
||||
|
||||
/datum/radio_frequency/proc/post_signal(obj/source as obj|null, datum/signal/signal, var/filter = null as text|null, var/range = null as num|null)
|
||||
var/turf/start_point
|
||||
if(range)
|
||||
start_point = get_turf(source)
|
||||
if(!start_point)
|
||||
qdel(signal)
|
||||
return 0
|
||||
if(filter)
|
||||
send_to_filter(source, signal, filter, start_point, range)
|
||||
send_to_filter(source, signal, RADIO_DEFAULT, start_point, range)
|
||||
else
|
||||
//Broadcast the signal to everyone!
|
||||
for(var/next_filter in devices)
|
||||
send_to_filter(source, signal, next_filter, start_point, range)
|
||||
|
||||
//Sends a signal to all machines belonging to a given filter. Should be called by post_signal()
|
||||
/datum/radio_frequency/proc/send_to_filter(obj/source, datum/signal/signal, var/filter, var/turf/start_point = null, var/range = null)
|
||||
if(range && !start_point)
|
||||
return
|
||||
|
||||
for(var/obj/device in devices[filter])
|
||||
if(device == source)
|
||||
continue
|
||||
if(range)
|
||||
var/turf/end_point = get_turf(device)
|
||||
if(!end_point)
|
||||
continue
|
||||
if(start_point.z!=end_point.z || get_dist(start_point, end_point) > range)
|
||||
continue
|
||||
|
||||
device.receive_signal(signal, TRANSMISSION_RADIO, frequency)
|
||||
|
||||
/datum/radio_frequency/proc/add_listener(obj/device as obj, var/filter as text|null)
|
||||
if(!filter)
|
||||
filter = RADIO_DEFAULT
|
||||
//log_admin("add_listener(device=[device],filter=[filter]) frequency=[frequency]")
|
||||
var/list/obj/devices_line = devices[filter]
|
||||
if(!devices_line)
|
||||
devices_line = new
|
||||
devices[filter] = devices_line
|
||||
devices_line+=device
|
||||
// var/list/obj/devices_line___ = devices[filter_str]
|
||||
// var/l = devices_line___.len
|
||||
//log_admin("DEBUG: devices_line.len=[devices_line.len]")
|
||||
//log_admin("DEBUG: devices(filter_str).len=[l]")
|
||||
|
||||
/datum/radio_frequency/proc/remove_listener(obj/device)
|
||||
for(var/devices_filter in devices)
|
||||
var/list/devices_line = devices[devices_filter]
|
||||
devices_line-=device
|
||||
while(null in devices_line)
|
||||
devices_line -= null
|
||||
if(devices_line.len==0)
|
||||
devices -= devices_filter
|
||||
qdel(devices_line)
|
||||
|
||||
/datum/signal
|
||||
var/obj/source
|
||||
|
||||
var/transmission_method = 0 //unused at the moment
|
||||
//0 = wire
|
||||
//1 = radio transmission
|
||||
//2 = subspace transmission
|
||||
|
||||
var/list/data = list()
|
||||
var/encryption
|
||||
|
||||
var/frequency = 0
|
||||
|
||||
/datum/signal/proc/copy_from(datum/signal/model)
|
||||
source = model.source
|
||||
transmission_method = model.transmission_method
|
||||
data = model.data
|
||||
encryption = model.encryption
|
||||
frequency = model.frequency
|
||||
|
||||
/datum/signal/proc/debug_print()
|
||||
if(source)
|
||||
. = "signal = {source = '[source]' ([source:x],[source:y],[source:z])\n"
|
||||
else
|
||||
. = "signal = {source = '[source]' ()\n"
|
||||
for(var/i in data)
|
||||
. += "data\[\"[i]\"\] = \"[data[i]]\"\n"
|
||||
if(islist(data[i]))
|
||||
var/list/L = data[i]
|
||||
for(var/t in L)
|
||||
. += "data\[\"[i]\"\] list has: [t]"
|
||||
|
||||
/datum/signal/proc/get_race(mob/M)
|
||||
if(ishuman(M))
|
||||
var/mob/living/carbon/human/H = M
|
||||
. = H.dna.species.name
|
||||
else if(isbrain(M))
|
||||
var/mob/living/carbon/brain/B = M
|
||||
. = B.get_race()
|
||||
else if(issilicon(M))
|
||||
. = "Artificial Life"
|
||||
else if(isslime(M))
|
||||
. = "Slime"
|
||||
else if(isbot(M))
|
||||
. = "Bot"
|
||||
else if(isanimal(M))
|
||||
. = "Domestic Animal"
|
||||
else
|
||||
. = "Unidentifiable"
|
||||
|
||||
//callback used by objects to react to incoming radio signals
|
||||
/obj/proc/receive_signal(datum/signal/signal, receive_method, receive_param)
|
||||
return null
|
||||
|
||||
+131
-131
@@ -1,131 +1,131 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* /datum/recipe by rastaf0 13 apr 2011 *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* This is powerful and flexible recipe system.
|
||||
* It exists not only for food.
|
||||
* supports both reagents and objects as prerequisites.
|
||||
* In order to use this system you have to define a deriative from /datum/recipe
|
||||
* * reagents are reagents. Acid, milc, booze, etc.
|
||||
* * items are objects. Fruits, tools, circuit boards.
|
||||
* * result is type to create as new object
|
||||
* * time is optional parameter, you shall use in in your machine,
|
||||
default /datum/recipe/ procs does not rely on this parameter.
|
||||
*
|
||||
* Functions you need:
|
||||
* /datum/recipe/proc/make(var/obj/container as obj)
|
||||
* Creates result inside container,
|
||||
* deletes prerequisite reagents,
|
||||
* transfers reagents from prerequisite objects,
|
||||
* deletes all prerequisite objects (even not needed for recipe at the moment).
|
||||
*
|
||||
* /proc/select_recipe(list/datum/recipe/avaiable_recipes, obj/obj as obj, exact = 1)
|
||||
* Wonderful function that select suitable recipe for you.
|
||||
* obj is a machine (or magik hat) with prerequisites,
|
||||
* exact = 0 forces algorithm to ignore superfluous stuff.
|
||||
*
|
||||
*
|
||||
* Functions you do not need to call directly but could:
|
||||
* /datum/recipe/proc/check_reagents(var/datum/reagents/avail_reagents)
|
||||
* //1=precisely, 0=insufficiently, -1=superfluous
|
||||
*
|
||||
* /datum/recipe/proc/check_items(var/obj/container as obj)
|
||||
* //1=precisely, 0=insufficiently, -1=superfluous
|
||||
*
|
||||
* */
|
||||
|
||||
/datum/recipe
|
||||
var/list/reagents // example: = list("berryjuice" = 5) // do not list same reagent twice
|
||||
var/list/items // example: =list(/obj/item/crowbar, /obj/item/welder) // place /foo/bar before /foo
|
||||
var/result //example: = /obj/item/reagent_containers/food/snacks/donut
|
||||
var/time = 100 // 1/10 part of second
|
||||
var/byproduct // example: = /obj/item/kitchen/mould // byproduct to return, such as a mould or trash
|
||||
|
||||
/datum/recipe/proc/check_reagents(datum/reagents/avail_reagents) //1=precisely, 0=insufficiently, -1=superfluous
|
||||
. = 1
|
||||
for(var/r_r in reagents)
|
||||
var/aval_r_amnt = avail_reagents.get_reagent_amount(r_r)
|
||||
if(!(abs(aval_r_amnt - reagents[r_r])<0.5)) //if NOT equals
|
||||
if(aval_r_amnt>reagents[r_r])
|
||||
. = -1
|
||||
else
|
||||
return 0
|
||||
if((reagents?(reagents.len):(0)) < avail_reagents.reagent_list.len)
|
||||
return -1
|
||||
return .
|
||||
|
||||
/datum/recipe/proc/check_items(obj/container, list/ignored_items = null) //1=precisely, 0=insufficiently, -1=superfluous
|
||||
. = 1
|
||||
var/list/checklist = items ? items.Copy() : list()
|
||||
for(var/obj/O in container)
|
||||
if(ignored_items && is_type_in_list(O, ignored_items)) //skip if this is something we are ignoring
|
||||
continue
|
||||
if(!items)
|
||||
return -1
|
||||
var/found = 0
|
||||
for(var/type in checklist)
|
||||
if(istype(O,type))
|
||||
checklist -= type
|
||||
found = 1
|
||||
break
|
||||
if(!found)
|
||||
. = -1
|
||||
if(checklist.len)
|
||||
return 0
|
||||
return .
|
||||
|
||||
//general version
|
||||
/datum/recipe/proc/make(obj/container)
|
||||
var/obj/result_obj = new result(container)
|
||||
for(var/obj/O in (container.contents-result_obj))
|
||||
O.reagents.trans_to(result_obj, O.reagents.total_volume)
|
||||
qdel(O)
|
||||
container.reagents.clear_reagents()
|
||||
return result_obj
|
||||
|
||||
// food-related
|
||||
/datum/recipe/proc/make_food(obj/container)
|
||||
var/obj/result_obj = new result(container)
|
||||
for(var/obj/O in (container.contents-result_obj))
|
||||
if(O.reagents)
|
||||
O.reagents.del_reagent("nutriment")
|
||||
O.reagents.update_total()
|
||||
O.reagents.trans_to(result_obj, O.reagents.total_volume)
|
||||
qdel(O)
|
||||
container.reagents.clear_reagents()
|
||||
return result_obj
|
||||
|
||||
/proc/select_recipe(list/datum/recipe/available_recipes, obj/obj, exact = 1 as num, list/ignored_items = null)
|
||||
if(!exact)
|
||||
exact = -1
|
||||
var/list/datum/recipe/possible_recipes = new
|
||||
for(var/datum/recipe/recipe in available_recipes)
|
||||
if(recipe.check_reagents(obj.reagents) == exact && recipe.check_items(obj, ignored_items) == exact)
|
||||
possible_recipes += recipe
|
||||
if(possible_recipes.len == 0)
|
||||
return null
|
||||
else if(possible_recipes.len == 1)
|
||||
return possible_recipes[1]
|
||||
else //okay, let's select the most complicated recipe
|
||||
var/r_count = 0
|
||||
var/i_count = 0
|
||||
. = possible_recipes[1]
|
||||
for(var/datum/recipe/recipe in possible_recipes)
|
||||
var/N_i = (recipe.items)?(recipe.items.len):0
|
||||
var/N_r = (recipe.reagents)?(recipe.reagents.len):0
|
||||
if(N_i > i_count || (N_i== i_count && N_r > r_count ))
|
||||
r_count = N_r
|
||||
i_count = N_i
|
||||
. = recipe
|
||||
return .
|
||||
|
||||
/datum/recipe/proc/get_byproduct()
|
||||
if(byproduct)
|
||||
return byproduct
|
||||
else
|
||||
return null
|
||||
|
||||
/datum/recipe/proc/count_n_items()
|
||||
var/count = 0
|
||||
if(items && items.len)
|
||||
count += items.len
|
||||
return count
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* /datum/recipe by rastaf0 13 apr 2011 *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* This is powerful and flexible recipe system.
|
||||
* It exists not only for food.
|
||||
* supports both reagents and objects as prerequisites.
|
||||
* In order to use this system you have to define a deriative from /datum/recipe
|
||||
* * reagents are reagents. Acid, milc, booze, etc.
|
||||
* * items are objects. Fruits, tools, circuit boards.
|
||||
* * result is type to create as new object
|
||||
* * time is optional parameter, you shall use in in your machine,
|
||||
default /datum/recipe/ procs does not rely on this parameter.
|
||||
*
|
||||
* Functions you need:
|
||||
* /datum/recipe/proc/make(var/obj/container as obj)
|
||||
* Creates result inside container,
|
||||
* deletes prerequisite reagents,
|
||||
* transfers reagents from prerequisite objects,
|
||||
* deletes all prerequisite objects (even not needed for recipe at the moment).
|
||||
*
|
||||
* /proc/select_recipe(list/datum/recipe/avaiable_recipes, obj/obj as obj, exact = 1)
|
||||
* Wonderful function that select suitable recipe for you.
|
||||
* obj is a machine (or magik hat) with prerequisites,
|
||||
* exact = 0 forces algorithm to ignore superfluous stuff.
|
||||
*
|
||||
*
|
||||
* Functions you do not need to call directly but could:
|
||||
* /datum/recipe/proc/check_reagents(var/datum/reagents/avail_reagents)
|
||||
* //1=precisely, 0=insufficiently, -1=superfluous
|
||||
*
|
||||
* /datum/recipe/proc/check_items(var/obj/container as obj)
|
||||
* //1=precisely, 0=insufficiently, -1=superfluous
|
||||
*
|
||||
* */
|
||||
|
||||
/datum/recipe
|
||||
var/list/reagents // example: = list("berryjuice" = 5) // do not list same reagent twice
|
||||
var/list/items // example: =list(/obj/item/crowbar, /obj/item/welder) // place /foo/bar before /foo
|
||||
var/result //example: = /obj/item/reagent_containers/food/snacks/donut
|
||||
var/time = 100 // 1/10 part of second
|
||||
var/byproduct // example: = /obj/item/kitchen/mould // byproduct to return, such as a mould or trash
|
||||
|
||||
/datum/recipe/proc/check_reagents(datum/reagents/avail_reagents) //1=precisely, 0=insufficiently, -1=superfluous
|
||||
. = 1
|
||||
for(var/r_r in reagents)
|
||||
var/aval_r_amnt = avail_reagents.get_reagent_amount(r_r)
|
||||
if(!(abs(aval_r_amnt - reagents[r_r])<0.5)) //if NOT equals
|
||||
if(aval_r_amnt>reagents[r_r])
|
||||
. = -1
|
||||
else
|
||||
return 0
|
||||
if((reagents?(reagents.len):(0)) < avail_reagents.reagent_list.len)
|
||||
return -1
|
||||
return .
|
||||
|
||||
/datum/recipe/proc/check_items(obj/container, list/ignored_items = null) //1=precisely, 0=insufficiently, -1=superfluous
|
||||
. = 1
|
||||
var/list/checklist = items ? items.Copy() : list()
|
||||
for(var/obj/O in container)
|
||||
if(ignored_items && is_type_in_list(O, ignored_items)) //skip if this is something we are ignoring
|
||||
continue
|
||||
if(!items)
|
||||
return -1
|
||||
var/found = 0
|
||||
for(var/type in checklist)
|
||||
if(istype(O,type))
|
||||
checklist -= type
|
||||
found = 1
|
||||
break
|
||||
if(!found)
|
||||
. = -1
|
||||
if(checklist.len)
|
||||
return 0
|
||||
return .
|
||||
|
||||
//general version
|
||||
/datum/recipe/proc/make(obj/container)
|
||||
var/obj/result_obj = new result(container)
|
||||
for(var/obj/O in (container.contents-result_obj))
|
||||
O.reagents.trans_to(result_obj, O.reagents.total_volume)
|
||||
qdel(O)
|
||||
container.reagents.clear_reagents()
|
||||
return result_obj
|
||||
|
||||
// food-related
|
||||
/datum/recipe/proc/make_food(obj/container)
|
||||
var/obj/result_obj = new result(container)
|
||||
for(var/obj/O in (container.contents-result_obj))
|
||||
if(O.reagents)
|
||||
O.reagents.del_reagent("nutriment")
|
||||
O.reagents.update_total()
|
||||
O.reagents.trans_to(result_obj, O.reagents.total_volume)
|
||||
qdel(O)
|
||||
container.reagents.clear_reagents()
|
||||
return result_obj
|
||||
|
||||
/proc/select_recipe(list/datum/recipe/available_recipes, obj/obj, exact = 1 as num, list/ignored_items = null)
|
||||
if(!exact)
|
||||
exact = -1
|
||||
var/list/datum/recipe/possible_recipes = new
|
||||
for(var/datum/recipe/recipe in available_recipes)
|
||||
if(recipe.check_reagents(obj.reagents) == exact && recipe.check_items(obj, ignored_items) == exact)
|
||||
possible_recipes += recipe
|
||||
if(possible_recipes.len == 0)
|
||||
return null
|
||||
else if(possible_recipes.len == 1)
|
||||
return possible_recipes[1]
|
||||
else //okay, let's select the most complicated recipe
|
||||
var/r_count = 0
|
||||
var/i_count = 0
|
||||
. = possible_recipes[1]
|
||||
for(var/datum/recipe/recipe in possible_recipes)
|
||||
var/N_i = (recipe.items)?(recipe.items.len):0
|
||||
var/N_r = (recipe.reagents)?(recipe.reagents.len):0
|
||||
if(N_i > i_count || (N_i== i_count && N_r > r_count ))
|
||||
r_count = N_r
|
||||
i_count = N_i
|
||||
. = recipe
|
||||
return .
|
||||
|
||||
/datum/recipe/proc/get_byproduct()
|
||||
if(byproduct)
|
||||
return byproduct
|
||||
else
|
||||
return null
|
||||
|
||||
/datum/recipe/proc/count_n_items()
|
||||
var/count = 0
|
||||
if(items && items.len)
|
||||
count += items.len
|
||||
return count
|
||||
|
||||
@@ -217,4 +217,4 @@ datum/map_template/ruin/lavaland/ash_walker
|
||||
id = "puzzle"
|
||||
description = "Mystery to be solved."
|
||||
suffix = "lavaland_surface_puzzle.dmm"
|
||||
cost = 5
|
||||
cost = 5
|
||||
|
||||
+499
-499
@@ -1,499 +1,499 @@
|
||||
#define TARGET_CLOSEST 1
|
||||
#define TARGET_RANDOM 2
|
||||
|
||||
/obj/effect/proc_holder
|
||||
var/panel = "Debug"//What panel the proc holder needs to go on.
|
||||
var/active = FALSE //Used by toggle based abilities.
|
||||
var/ranged_mousepointer
|
||||
var/mob/living/ranged_ability_user
|
||||
|
||||
/obj/effect/proc_holder/singularity_act()
|
||||
return
|
||||
|
||||
/obj/effect/proc_holder/singularity_pull()
|
||||
return
|
||||
|
||||
var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin verb for now
|
||||
|
||||
/obj/effect/proc_holder/proc/InterceptClickOn(mob/living/user, params, atom/A)
|
||||
if(user.ranged_ability != src)
|
||||
to_chat(user, "<span class='warning'><b>[user.ranged_ability.name]</b> has been disabled.")
|
||||
user.ranged_ability.remove_ranged_ability(user)
|
||||
return TRUE //TRUE for failed, FALSE for passed.
|
||||
user.changeNext_click(CLICK_CD_CLICK_ABILITY)
|
||||
user.face_atom(A)
|
||||
return FALSE
|
||||
|
||||
/obj/effect/proc_holder/proc/add_ranged_ability(mob/living/user, var/msg)
|
||||
if(!user || !user.client)
|
||||
return
|
||||
if(user.ranged_ability && user.ranged_ability != src)
|
||||
to_chat(user, "<span class='warning'><b>[user.ranged_ability.name]</b> has been replaced by <b>[name]</b>.")
|
||||
user.ranged_ability.remove_ranged_ability(user)
|
||||
user.ranged_ability = src
|
||||
ranged_ability_user = user
|
||||
user.client.click_intercept = user.ranged_ability
|
||||
add_mousepointer(user.client)
|
||||
active = TRUE
|
||||
if(msg)
|
||||
to_chat(user, msg)
|
||||
update_icon()
|
||||
|
||||
/obj/effect/proc_holder/proc/add_mousepointer(client/C)
|
||||
if(C && ranged_mousepointer && C.mouse_pointer_icon == initial(C.mouse_pointer_icon))
|
||||
C.mouse_pointer_icon = ranged_mousepointer
|
||||
|
||||
/obj/effect/proc_holder/proc/remove_mousepointer(client/C)
|
||||
if(C && ranged_mousepointer && C.mouse_pointer_icon == ranged_mousepointer)
|
||||
C.mouse_pointer_icon = initial(C.mouse_pointer_icon)
|
||||
|
||||
/obj/effect/proc_holder/proc/remove_ranged_ability(mob/living/user, var/msg)
|
||||
if(!user || !user.client || (user.ranged_ability && user.ranged_ability != src)) //To avoid removing the wrong ability
|
||||
return
|
||||
user.ranged_ability = null
|
||||
ranged_ability_user = null
|
||||
user.client.click_intercept = null
|
||||
remove_mousepointer(user.client)
|
||||
active = FALSE
|
||||
if(msg)
|
||||
to_chat(user, msg)
|
||||
update_icon()
|
||||
|
||||
/obj/effect/proc_holder/spell
|
||||
name = "Spell"
|
||||
desc = "A wizard spell"
|
||||
panel = "Spells"//What panel the proc holder needs to go on.
|
||||
density = 0
|
||||
opacity = 0
|
||||
|
||||
var/school = "evocation" //not relevant at now, but may be important later if there are changes to how spells work. the ones I used for now will probably be changed... maybe spell presets? lacking flexibility but with some other benefit?
|
||||
|
||||
var/charge_type = "recharge" //can be recharge or charges, see charge_max and charge_counter descriptions; can also be based on the holder's vars now, use "holder_var" for that
|
||||
|
||||
var/charge_max = 100 //recharge time in deciseconds if charge_type = "recharge" or starting charges if charge_type = "charges"
|
||||
var/starts_charged = TRUE //Does this spell start ready to go?
|
||||
var/charge_counter = 0 //can only cast spells if it equals recharge, ++ each decisecond if charge_type = "recharge" or -- each cast if charge_type = "charges"
|
||||
var/still_recharging_msg = "<span class='notice'>The spell is still recharging.</span>"
|
||||
|
||||
var/holder_var_type = "bruteloss" //only used if charge_type equals to "holder_var"
|
||||
var/holder_var_amount = 20 //same. The amount adjusted with the mob's var when the spell is used
|
||||
|
||||
var/ghost = 0 // Skip life check.
|
||||
var/clothes_req = 1 //see if it requires clothes
|
||||
var/human_req = 0 //spell can only be cast by humans
|
||||
var/nonabstract_req = 0 //spell can only be cast by mobs that are physical entities
|
||||
var/stat_allowed = 0 //see if it requires being conscious/alive, need to set to 1 for ghostpells
|
||||
var/invocation = "HURP DURP" //what is uttered when the wizard casts the spell
|
||||
var/invocation_emote_self = null
|
||||
var/invocation_type = "none" //can be none, whisper and shout
|
||||
var/range = 7 //the range of the spell; outer radius for aoe spells
|
||||
var/message = "" //whatever it says to the guy affected by it
|
||||
var/selection_type = "view" //can be "range" or "view"
|
||||
var/spell_level = 0 //if a spell can be taken multiple times, this raises
|
||||
var/level_max = 4 //The max possible level_max is 4
|
||||
var/cooldown_min = 0 //This defines what spell quickened four timeshas as a cooldown. Make sure to set this for every spell
|
||||
|
||||
var/overlay = 0
|
||||
var/overlay_icon = 'icons/obj/wizard.dmi'
|
||||
var/overlay_icon_state = "spell"
|
||||
var/overlay_lifespan = 0
|
||||
|
||||
var/sparks_spread = 0
|
||||
var/sparks_amt = 0 //cropped at 10
|
||||
var/smoke_spread = 0 //1 - harmless, 2 - harmful
|
||||
var/smoke_amt = 0 //cropped at 10
|
||||
|
||||
var/critfailchance = 0
|
||||
var/centcom_cancast = 1 //Whether or not the spell should be allowed on z2
|
||||
|
||||
var/datum/action/spell_action/action = null
|
||||
var/action_icon = 'icons/mob/actions/actions.dmi'
|
||||
var/action_icon_state = "spell_default"
|
||||
var/action_background_icon_state = "bg_spell"
|
||||
var/special_availability_check = 0//Whether the spell needs to bypass the action button's IsAvailable()
|
||||
|
||||
var/sound = null //The sound the spell makes when it is cast
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/cast_check(skipcharge = 0, mob/living/user = usr) //checks if the spell can be cast based on its settings; skipcharge is used when an additional cast_check is called inside the spell
|
||||
if(((!user.mind) || !(src in user.mind.spell_list)) && !(src in user.mob_spell_list))
|
||||
to_chat(user, "<span class='warning'>You shouldn't have this spell! Something's wrong.</span>")
|
||||
return 0
|
||||
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/caster = user
|
||||
if(caster.remoteview_target)
|
||||
caster.remoteview_target = null
|
||||
caster.reset_perspective(0)
|
||||
return 0
|
||||
|
||||
if(is_admin_level(user.z) && !centcom_cancast) //Certain spells are not allowed on the centcom zlevel
|
||||
return 0
|
||||
|
||||
if(!skipcharge)
|
||||
switch(charge_type)
|
||||
if("recharge")
|
||||
if(charge_counter < charge_max)
|
||||
to_chat(user, still_recharging_msg)
|
||||
return 0
|
||||
if("charges")
|
||||
if(!charge_counter)
|
||||
to_chat(user, "<span class='notice'>[name] has no charges left.</span>")
|
||||
return 0
|
||||
|
||||
if(!ghost)
|
||||
if(user.stat && !stat_allowed)
|
||||
to_chat(user, "<span class='notice'>You can't cast this spell while incapacitated.</span>")
|
||||
return 0
|
||||
if(ishuman(user) && (invocation_type == "whisper" || invocation_type == "shout") && user.is_muzzled())
|
||||
to_chat(user, "Mmmf mrrfff!")
|
||||
return 0
|
||||
|
||||
var/obj/effect/proc_holder/spell/noclothes/clothes_spell = locate() in (user.mob_spell_list | (user.mind ? user.mind.spell_list : list()))
|
||||
if((ishuman(user) && clothes_req) && !istype(clothes_spell))//clothes check
|
||||
var/mob/living/carbon/human/H = user
|
||||
var/obj/item/clothing/robe = H.wear_suit
|
||||
var/obj/item/clothing/hat = H.head
|
||||
var/obj/item/clothing/shoes = H.shoes
|
||||
if(!robe || !hat || !shoes)
|
||||
to_chat(user, "<span class='notice'>Your outfit isn't complete, you should put on your robe and wizard hat, as well as sandals.</span>")
|
||||
return 0
|
||||
if(!robe.magical || !hat.magical || !shoes.magical)
|
||||
to_chat(user, "<span class='notice'>Your outfit isn't magical enough, you should put on your robe and wizard hat, as well as your sandals.</span>")
|
||||
return 0
|
||||
else if(!ishuman(user))
|
||||
if(clothes_req || human_req)
|
||||
to_chat(user, "<span class='notice'>This spell can only be cast by humans!</span>")
|
||||
return 0
|
||||
if(nonabstract_req && (isbrain(user) || ispAI(user)))
|
||||
to_chat(user, "<span class='notice'>This spell can only be cast by physical beings!</span>")
|
||||
return 0
|
||||
|
||||
if(!skipcharge)
|
||||
switch(charge_type)
|
||||
if("recharge")
|
||||
charge_counter = 0 //doesn't start recharging until the targets selecting ends
|
||||
if("charges")
|
||||
charge_counter-- //returns the charge if the targets selecting fails
|
||||
if("holdervar")
|
||||
adjust_var(user, holder_var_type, holder_var_amount)
|
||||
|
||||
if(action)
|
||||
action.UpdateButtonIcon()
|
||||
return 1
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/invocation(mob/user = usr) //spelling the spell out and setting it on recharge/reducing charges amount
|
||||
switch(invocation_type)
|
||||
if("shout")
|
||||
if(!user.IsVocal())
|
||||
user.custom_emote(1, "makes frantic gestures!")
|
||||
else
|
||||
if(prob(50))//Auto-mute? Fuck that noise
|
||||
user.say(invocation)
|
||||
else
|
||||
user.say(replacetext(invocation," ","`"))
|
||||
if("whisper")
|
||||
if(prob(50))
|
||||
user.whisper(invocation)
|
||||
else
|
||||
user.whisper(replacetext(invocation," ","`"))
|
||||
if("emote")
|
||||
user.visible_message(invocation, invocation_emote_self) //same style as in mob/living/emote.dm
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/playMagSound()
|
||||
playsound(get_turf(usr), sound,50,1)
|
||||
|
||||
/obj/effect/proc_holder/spell/New()
|
||||
..()
|
||||
action = new(src)
|
||||
still_recharging_msg = "<span class='notice'>[name] is still recharging.</span>"
|
||||
if(starts_charged)
|
||||
charge_counter = charge_max
|
||||
else
|
||||
start_recharge()
|
||||
|
||||
/obj/effect/proc_holder/spell/Destroy()
|
||||
QDEL_NULL(action)
|
||||
return ..()
|
||||
|
||||
/obj/effect/proc_holder/spell/Click()
|
||||
if(cast_check())
|
||||
choose_targets()
|
||||
return 1
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/choose_targets(mob/user = usr) //depends on subtype - /targeted or /aoe_turf
|
||||
return
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/start_recharge()
|
||||
if(action)
|
||||
action.UpdateButtonIcon()
|
||||
START_PROCESSING(SSfastprocess, src)
|
||||
|
||||
/obj/effect/proc_holder/spell/process()
|
||||
charge_counter += 2
|
||||
if(charge_counter < charge_max)
|
||||
return
|
||||
STOP_PROCESSING(SSfastprocess, src)
|
||||
charge_counter = charge_max
|
||||
if(action)
|
||||
action.UpdateButtonIcon()
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/perform(list/targets, recharge = 1, mob/user = usr) //if recharge is started is important for the trigger spells
|
||||
before_cast(targets)
|
||||
invocation()
|
||||
if(user && user.ckey)
|
||||
user.create_attack_log("<font color='red'>[key_name(user)] cast the spell [name].</font>")
|
||||
spawn(0)
|
||||
if(charge_type == "recharge" && recharge)
|
||||
start_recharge()
|
||||
|
||||
if(sound)
|
||||
playMagSound()
|
||||
|
||||
if(prob(critfailchance))
|
||||
critfail(targets)
|
||||
else
|
||||
cast(targets, user = user)
|
||||
after_cast(targets)
|
||||
if(action)
|
||||
action.UpdateButtonIcon()
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/before_cast(list/targets)
|
||||
if(overlay)
|
||||
for(var/atom/target in targets)
|
||||
var/location
|
||||
if(istype(target,/mob/living))
|
||||
location = target.loc
|
||||
else if(istype(target,/turf))
|
||||
location = target
|
||||
var/obj/effect/overlay/spell = new /obj/effect/overlay(location)
|
||||
spell.icon = overlay_icon
|
||||
spell.icon_state = overlay_icon_state
|
||||
spell.anchored = 1
|
||||
spell.density = 0
|
||||
spawn(overlay_lifespan)
|
||||
qdel(spell)
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/after_cast(list/targets)
|
||||
for(var/atom/target in targets)
|
||||
var/location
|
||||
if(istype(target,/mob/living))
|
||||
location = target.loc
|
||||
else if(istype(target,/turf))
|
||||
location = target
|
||||
if(istype(target,/mob/living) && message)
|
||||
to_chat(target, text("[message]"))
|
||||
if(sparks_spread)
|
||||
do_sparks(sparks_amt, 0, location)
|
||||
if(smoke_spread)
|
||||
if(smoke_spread == 1)
|
||||
var/datum/effect_system/smoke_spread/smoke = new
|
||||
smoke.set_up(smoke_amt, 0, location) //no idea what the 0 is
|
||||
smoke.start()
|
||||
else if(smoke_spread == 2)
|
||||
var/datum/effect_system/smoke_spread/bad/smoke = new
|
||||
smoke.set_up(smoke_amt, 0, location) //no idea what the 0 is
|
||||
smoke.start()
|
||||
else if(smoke_spread == 3)
|
||||
var/datum/effect_system/smoke_spread/sleeping/smoke = new
|
||||
smoke.set_up(smoke_amt, 0, location) // same here
|
||||
smoke.start()
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/cast(list/targets, mob/user = usr)
|
||||
return
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/critfail(list/targets)
|
||||
return
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/revert_cast(mob/user = usr) //resets recharge or readds a charge
|
||||
switch(charge_type)
|
||||
if("recharge")
|
||||
charge_counter = charge_max
|
||||
if("charges")
|
||||
charge_counter++
|
||||
if("holdervar")
|
||||
adjust_var(user, holder_var_type, -holder_var_amount)
|
||||
if(action)
|
||||
action.UpdateButtonIcon()
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/updateButtonIcon()
|
||||
if(action)
|
||||
action.UpdateButtonIcon()
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/adjust_var(mob/living/target = usr, type, amount) //handles the adjustment of the var when the spell is used. has some hardcoded types
|
||||
switch(type)
|
||||
if("bruteloss")
|
||||
target.adjustBruteLoss(amount)
|
||||
if("fireloss")
|
||||
target.adjustFireLoss(amount)
|
||||
if("toxloss")
|
||||
target.adjustToxLoss(amount)
|
||||
if("oxyloss")
|
||||
target.adjustOxyLoss(amount)
|
||||
if("stunned")
|
||||
target.AdjustStunned(amount)
|
||||
if("weakened")
|
||||
target.AdjustWeakened(amount)
|
||||
if("paralysis")
|
||||
target.AdjustParalysis(amount)
|
||||
else
|
||||
target.vars[type] += amount //I bear no responsibility for the runtimes that'll happen if you try to adjust non-numeric or even non-existant vars
|
||||
return
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted //can mean aoe for mobs (limited/unlimited number) or one target mob
|
||||
var/max_targets = 1 //leave 0 for unlimited targets in range, 1 for one selectable target in range, more for limited number of casts (can all target one guy, depends on target_ignore_prev) in range
|
||||
var/target_ignore_prev = 1 //only important if max_targets > 1, affects if the spell can be cast multiple times at one person from one cast
|
||||
var/include_user = 0 //if it includes usr in the target list
|
||||
var/random_target = 0 // chooses random viable target instead of asking the caster
|
||||
var/random_target_priority = TARGET_CLOSEST // if random_target is enabled how it will pick the target
|
||||
var/humans_only = 0 //for avoiding simple animals and only doing "human" mobs, 0 = all mobs, 1 = humans only
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf //affects all turfs in view or range (depends)
|
||||
var/inner_radius = -1 //for all your ring spell needs
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/choose_targets(mob/user = usr)
|
||||
var/list/targets = list()
|
||||
|
||||
switch(max_targets)
|
||||
if(0) //unlimited
|
||||
|
||||
if(!humans_only)
|
||||
for(var/mob/living/target in view_or_range(range, user, selection_type))
|
||||
targets += target
|
||||
else
|
||||
for(var/mob/living/carbon/human/target in view_or_range(range, user, selection_type))
|
||||
targets += target
|
||||
|
||||
if(1) //single target can be picked
|
||||
if(range < 0)
|
||||
targets += user
|
||||
else
|
||||
var/possible_targets = list()
|
||||
|
||||
if(!humans_only)
|
||||
for(var/mob/living/M in view_or_range(range, user, selection_type))
|
||||
if(!include_user && user == M)
|
||||
continue
|
||||
possible_targets += M
|
||||
else
|
||||
for(var/mob/living/carbon/human/M in view_or_range(range, user, selection_type))
|
||||
if(!include_user && user == M)
|
||||
continue
|
||||
possible_targets += M
|
||||
|
||||
//targets += input("Choose the target for the spell.", "Targeting") as mob in possible_targets
|
||||
//Adds a safety check post-input to make sure those targets are actually in range.
|
||||
var/mob/M
|
||||
if(!random_target)
|
||||
M = input("Choose the target for the spell.", "Targeting") as mob in possible_targets
|
||||
else
|
||||
switch(random_target_priority)
|
||||
if(TARGET_RANDOM)
|
||||
M = pick(possible_targets)
|
||||
if(TARGET_CLOSEST)
|
||||
for(var/mob/living/L in possible_targets)
|
||||
if(M)
|
||||
if(get_dist(user,L) < get_dist(user,M))
|
||||
if(los_check(user,L))
|
||||
M = L
|
||||
else
|
||||
if(los_check(user,L))
|
||||
M = L
|
||||
if(M in view_or_range(range, user, selection_type)) targets += M
|
||||
|
||||
else
|
||||
var/list/possible_targets = list()
|
||||
if(!humans_only)
|
||||
for(var/mob/living/target in view_or_range(range, user, selection_type))
|
||||
possible_targets += target
|
||||
else
|
||||
for(var/mob/living/carbon/human/target in view_or_range(range, user, selection_type))
|
||||
possible_targets += target
|
||||
for(var/i=1,i<=max_targets,i++)
|
||||
if(!possible_targets.len)
|
||||
break
|
||||
if(target_ignore_prev)
|
||||
var/target = pick(possible_targets)
|
||||
possible_targets -= target
|
||||
targets += target
|
||||
else
|
||||
targets += pick(possible_targets)
|
||||
|
||||
if(!include_user && (user in targets))
|
||||
targets -= user
|
||||
|
||||
if(!targets.len) //doesn't waste the spell
|
||||
revert_cast(user)
|
||||
return
|
||||
|
||||
perform(targets, user=user)
|
||||
|
||||
return
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/choose_targets(mob/user = usr)
|
||||
var/list/targets = list()
|
||||
|
||||
for(var/turf/target in view_or_range(range,user,selection_type))
|
||||
if(!(target in view_or_range(inner_radius,user,selection_type)))
|
||||
targets += target
|
||||
|
||||
if(!targets.len) //doesn't waste the spell
|
||||
revert_cast()
|
||||
return
|
||||
|
||||
perform(targets, user=user)
|
||||
|
||||
return
|
||||
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/proc/los_check(mob/A,mob/B)
|
||||
//Checks for obstacles from A to B
|
||||
var/obj/dummy = new(A.loc)
|
||||
dummy.pass_flags |= PASSTABLE
|
||||
for(var/turf/turf in getline(A,B))
|
||||
for(var/atom/movable/AM in turf)
|
||||
if(!AM.CanPass(dummy,turf,1))
|
||||
qdel(dummy)
|
||||
return 0
|
||||
qdel(dummy)
|
||||
return 1
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/can_cast(mob/user = usr)
|
||||
if(((!user.mind) || !(src in user.mind.spell_list)) && !(src in user.mob_spell_list))
|
||||
return 0
|
||||
|
||||
if(is_admin_level(user.z) && !centcom_cancast) //Certain spells are not allowed on the centcom zlevel
|
||||
return 0
|
||||
|
||||
switch(charge_type)
|
||||
if("recharge")
|
||||
if(charge_counter < charge_max)
|
||||
return 0
|
||||
if("charges")
|
||||
if(!charge_counter)
|
||||
return 0
|
||||
|
||||
if(user.stat && !stat_allowed)
|
||||
return 0
|
||||
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/H = user
|
||||
|
||||
if((invocation_type == "whisper" || invocation_type == "shout") && H.is_muzzled())
|
||||
return 0
|
||||
|
||||
var/clothcheck = locate(/obj/effect/proc_holder/spell/noclothes) in user.mob_spell_list
|
||||
var/clothcheck2 = user.mind && (locate(/obj/effect/proc_holder/spell/noclothes) in user.mind.spell_list)
|
||||
if(clothes_req && !clothcheck && !clothcheck2) //clothes check
|
||||
var/obj/item/clothing/robe = H.wear_suit
|
||||
var/obj/item/clothing/hat = H.head
|
||||
var/obj/item/clothing/shoes = H.shoes
|
||||
if(!robe || !hat || !shoes)
|
||||
return 0
|
||||
if(!robe.magical || !hat.magical || !shoes.magical)
|
||||
return 0
|
||||
else
|
||||
if(clothes_req || human_req)
|
||||
return 0
|
||||
if(nonabstract_req && (isbrain(user) || ispAI(user)))
|
||||
return 0
|
||||
return 1
|
||||
#define TARGET_CLOSEST 1
|
||||
#define TARGET_RANDOM 2
|
||||
|
||||
/obj/effect/proc_holder
|
||||
var/panel = "Debug"//What panel the proc holder needs to go on.
|
||||
var/active = FALSE //Used by toggle based abilities.
|
||||
var/ranged_mousepointer
|
||||
var/mob/living/ranged_ability_user
|
||||
|
||||
/obj/effect/proc_holder/singularity_act()
|
||||
return
|
||||
|
||||
/obj/effect/proc_holder/singularity_pull()
|
||||
return
|
||||
|
||||
var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin verb for now
|
||||
|
||||
/obj/effect/proc_holder/proc/InterceptClickOn(mob/living/user, params, atom/A)
|
||||
if(user.ranged_ability != src)
|
||||
to_chat(user, "<span class='warning'><b>[user.ranged_ability.name]</b> has been disabled.")
|
||||
user.ranged_ability.remove_ranged_ability(user)
|
||||
return TRUE //TRUE for failed, FALSE for passed.
|
||||
user.changeNext_click(CLICK_CD_CLICK_ABILITY)
|
||||
user.face_atom(A)
|
||||
return FALSE
|
||||
|
||||
/obj/effect/proc_holder/proc/add_ranged_ability(mob/living/user, var/msg)
|
||||
if(!user || !user.client)
|
||||
return
|
||||
if(user.ranged_ability && user.ranged_ability != src)
|
||||
to_chat(user, "<span class='warning'><b>[user.ranged_ability.name]</b> has been replaced by <b>[name]</b>.")
|
||||
user.ranged_ability.remove_ranged_ability(user)
|
||||
user.ranged_ability = src
|
||||
ranged_ability_user = user
|
||||
user.client.click_intercept = user.ranged_ability
|
||||
add_mousepointer(user.client)
|
||||
active = TRUE
|
||||
if(msg)
|
||||
to_chat(user, msg)
|
||||
update_icon()
|
||||
|
||||
/obj/effect/proc_holder/proc/add_mousepointer(client/C)
|
||||
if(C && ranged_mousepointer && C.mouse_pointer_icon == initial(C.mouse_pointer_icon))
|
||||
C.mouse_pointer_icon = ranged_mousepointer
|
||||
|
||||
/obj/effect/proc_holder/proc/remove_mousepointer(client/C)
|
||||
if(C && ranged_mousepointer && C.mouse_pointer_icon == ranged_mousepointer)
|
||||
C.mouse_pointer_icon = initial(C.mouse_pointer_icon)
|
||||
|
||||
/obj/effect/proc_holder/proc/remove_ranged_ability(mob/living/user, var/msg)
|
||||
if(!user || !user.client || (user.ranged_ability && user.ranged_ability != src)) //To avoid removing the wrong ability
|
||||
return
|
||||
user.ranged_ability = null
|
||||
ranged_ability_user = null
|
||||
user.client.click_intercept = null
|
||||
remove_mousepointer(user.client)
|
||||
active = FALSE
|
||||
if(msg)
|
||||
to_chat(user, msg)
|
||||
update_icon()
|
||||
|
||||
/obj/effect/proc_holder/spell
|
||||
name = "Spell"
|
||||
desc = "A wizard spell"
|
||||
panel = "Spells"//What panel the proc holder needs to go on.
|
||||
density = 0
|
||||
opacity = 0
|
||||
|
||||
var/school = "evocation" //not relevant at now, but may be important later if there are changes to how spells work. the ones I used for now will probably be changed... maybe spell presets? lacking flexibility but with some other benefit?
|
||||
|
||||
var/charge_type = "recharge" //can be recharge or charges, see charge_max and charge_counter descriptions; can also be based on the holder's vars now, use "holder_var" for that
|
||||
|
||||
var/charge_max = 100 //recharge time in deciseconds if charge_type = "recharge" or starting charges if charge_type = "charges"
|
||||
var/starts_charged = TRUE //Does this spell start ready to go?
|
||||
var/charge_counter = 0 //can only cast spells if it equals recharge, ++ each decisecond if charge_type = "recharge" or -- each cast if charge_type = "charges"
|
||||
var/still_recharging_msg = "<span class='notice'>The spell is still recharging.</span>"
|
||||
|
||||
var/holder_var_type = "bruteloss" //only used if charge_type equals to "holder_var"
|
||||
var/holder_var_amount = 20 //same. The amount adjusted with the mob's var when the spell is used
|
||||
|
||||
var/ghost = 0 // Skip life check.
|
||||
var/clothes_req = 1 //see if it requires clothes
|
||||
var/human_req = 0 //spell can only be cast by humans
|
||||
var/nonabstract_req = 0 //spell can only be cast by mobs that are physical entities
|
||||
var/stat_allowed = 0 //see if it requires being conscious/alive, need to set to 1 for ghostpells
|
||||
var/invocation = "HURP DURP" //what is uttered when the wizard casts the spell
|
||||
var/invocation_emote_self = null
|
||||
var/invocation_type = "none" //can be none, whisper and shout
|
||||
var/range = 7 //the range of the spell; outer radius for aoe spells
|
||||
var/message = "" //whatever it says to the guy affected by it
|
||||
var/selection_type = "view" //can be "range" or "view"
|
||||
var/spell_level = 0 //if a spell can be taken multiple times, this raises
|
||||
var/level_max = 4 //The max possible level_max is 4
|
||||
var/cooldown_min = 0 //This defines what spell quickened four timeshas as a cooldown. Make sure to set this for every spell
|
||||
|
||||
var/overlay = 0
|
||||
var/overlay_icon = 'icons/obj/wizard.dmi'
|
||||
var/overlay_icon_state = "spell"
|
||||
var/overlay_lifespan = 0
|
||||
|
||||
var/sparks_spread = 0
|
||||
var/sparks_amt = 0 //cropped at 10
|
||||
var/smoke_spread = 0 //1 - harmless, 2 - harmful
|
||||
var/smoke_amt = 0 //cropped at 10
|
||||
|
||||
var/critfailchance = 0
|
||||
var/centcom_cancast = 1 //Whether or not the spell should be allowed on z2
|
||||
|
||||
var/datum/action/spell_action/action = null
|
||||
var/action_icon = 'icons/mob/actions/actions.dmi'
|
||||
var/action_icon_state = "spell_default"
|
||||
var/action_background_icon_state = "bg_spell"
|
||||
var/special_availability_check = 0//Whether the spell needs to bypass the action button's IsAvailable()
|
||||
|
||||
var/sound = null //The sound the spell makes when it is cast
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/cast_check(skipcharge = 0, mob/living/user = usr) //checks if the spell can be cast based on its settings; skipcharge is used when an additional cast_check is called inside the spell
|
||||
if(((!user.mind) || !(src in user.mind.spell_list)) && !(src in user.mob_spell_list))
|
||||
to_chat(user, "<span class='warning'>You shouldn't have this spell! Something's wrong.</span>")
|
||||
return 0
|
||||
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/caster = user
|
||||
if(caster.remoteview_target)
|
||||
caster.remoteview_target = null
|
||||
caster.reset_perspective(0)
|
||||
return 0
|
||||
|
||||
if(is_admin_level(user.z) && !centcom_cancast) //Certain spells are not allowed on the centcom zlevel
|
||||
return 0
|
||||
|
||||
if(!skipcharge)
|
||||
switch(charge_type)
|
||||
if("recharge")
|
||||
if(charge_counter < charge_max)
|
||||
to_chat(user, still_recharging_msg)
|
||||
return 0
|
||||
if("charges")
|
||||
if(!charge_counter)
|
||||
to_chat(user, "<span class='notice'>[name] has no charges left.</span>")
|
||||
return 0
|
||||
|
||||
if(!ghost)
|
||||
if(user.stat && !stat_allowed)
|
||||
to_chat(user, "<span class='notice'>You can't cast this spell while incapacitated.</span>")
|
||||
return 0
|
||||
if(ishuman(user) && (invocation_type == "whisper" || invocation_type == "shout") && user.is_muzzled())
|
||||
to_chat(user, "Mmmf mrrfff!")
|
||||
return 0
|
||||
|
||||
var/obj/effect/proc_holder/spell/noclothes/clothes_spell = locate() in (user.mob_spell_list | (user.mind ? user.mind.spell_list : list()))
|
||||
if((ishuman(user) && clothes_req) && !istype(clothes_spell))//clothes check
|
||||
var/mob/living/carbon/human/H = user
|
||||
var/obj/item/clothing/robe = H.wear_suit
|
||||
var/obj/item/clothing/hat = H.head
|
||||
var/obj/item/clothing/shoes = H.shoes
|
||||
if(!robe || !hat || !shoes)
|
||||
to_chat(user, "<span class='notice'>Your outfit isn't complete, you should put on your robe and wizard hat, as well as sandals.</span>")
|
||||
return 0
|
||||
if(!robe.magical || !hat.magical || !shoes.magical)
|
||||
to_chat(user, "<span class='notice'>Your outfit isn't magical enough, you should put on your robe and wizard hat, as well as your sandals.</span>")
|
||||
return 0
|
||||
else if(!ishuman(user))
|
||||
if(clothes_req || human_req)
|
||||
to_chat(user, "<span class='notice'>This spell can only be cast by humans!</span>")
|
||||
return 0
|
||||
if(nonabstract_req && (isbrain(user) || ispAI(user)))
|
||||
to_chat(user, "<span class='notice'>This spell can only be cast by physical beings!</span>")
|
||||
return 0
|
||||
|
||||
if(!skipcharge)
|
||||
switch(charge_type)
|
||||
if("recharge")
|
||||
charge_counter = 0 //doesn't start recharging until the targets selecting ends
|
||||
if("charges")
|
||||
charge_counter-- //returns the charge if the targets selecting fails
|
||||
if("holdervar")
|
||||
adjust_var(user, holder_var_type, holder_var_amount)
|
||||
|
||||
if(action)
|
||||
action.UpdateButtonIcon()
|
||||
return 1
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/invocation(mob/user = usr) //spelling the spell out and setting it on recharge/reducing charges amount
|
||||
switch(invocation_type)
|
||||
if("shout")
|
||||
if(!user.IsVocal())
|
||||
user.custom_emote(1, "makes frantic gestures!")
|
||||
else
|
||||
if(prob(50))//Auto-mute? Fuck that noise
|
||||
user.say(invocation)
|
||||
else
|
||||
user.say(replacetext(invocation," ","`"))
|
||||
if("whisper")
|
||||
if(prob(50))
|
||||
user.whisper(invocation)
|
||||
else
|
||||
user.whisper(replacetext(invocation," ","`"))
|
||||
if("emote")
|
||||
user.visible_message(invocation, invocation_emote_self) //same style as in mob/living/emote.dm
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/playMagSound()
|
||||
playsound(get_turf(usr), sound,50,1)
|
||||
|
||||
/obj/effect/proc_holder/spell/New()
|
||||
..()
|
||||
action = new(src)
|
||||
still_recharging_msg = "<span class='notice'>[name] is still recharging.</span>"
|
||||
if(starts_charged)
|
||||
charge_counter = charge_max
|
||||
else
|
||||
start_recharge()
|
||||
|
||||
/obj/effect/proc_holder/spell/Destroy()
|
||||
QDEL_NULL(action)
|
||||
return ..()
|
||||
|
||||
/obj/effect/proc_holder/spell/Click()
|
||||
if(cast_check())
|
||||
choose_targets()
|
||||
return 1
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/choose_targets(mob/user = usr) //depends on subtype - /targeted or /aoe_turf
|
||||
return
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/start_recharge()
|
||||
if(action)
|
||||
action.UpdateButtonIcon()
|
||||
START_PROCESSING(SSfastprocess, src)
|
||||
|
||||
/obj/effect/proc_holder/spell/process()
|
||||
charge_counter += 2
|
||||
if(charge_counter < charge_max)
|
||||
return
|
||||
STOP_PROCESSING(SSfastprocess, src)
|
||||
charge_counter = charge_max
|
||||
if(action)
|
||||
action.UpdateButtonIcon()
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/perform(list/targets, recharge = 1, mob/user = usr) //if recharge is started is important for the trigger spells
|
||||
before_cast(targets)
|
||||
invocation()
|
||||
if(user && user.ckey)
|
||||
user.create_attack_log("<font color='red'>[key_name(user)] cast the spell [name].</font>")
|
||||
spawn(0)
|
||||
if(charge_type == "recharge" && recharge)
|
||||
start_recharge()
|
||||
|
||||
if(sound)
|
||||
playMagSound()
|
||||
|
||||
if(prob(critfailchance))
|
||||
critfail(targets)
|
||||
else
|
||||
cast(targets, user = user)
|
||||
after_cast(targets)
|
||||
if(action)
|
||||
action.UpdateButtonIcon()
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/before_cast(list/targets)
|
||||
if(overlay)
|
||||
for(var/atom/target in targets)
|
||||
var/location
|
||||
if(istype(target,/mob/living))
|
||||
location = target.loc
|
||||
else if(istype(target,/turf))
|
||||
location = target
|
||||
var/obj/effect/overlay/spell = new /obj/effect/overlay(location)
|
||||
spell.icon = overlay_icon
|
||||
spell.icon_state = overlay_icon_state
|
||||
spell.anchored = 1
|
||||
spell.density = 0
|
||||
spawn(overlay_lifespan)
|
||||
qdel(spell)
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/after_cast(list/targets)
|
||||
for(var/atom/target in targets)
|
||||
var/location
|
||||
if(istype(target,/mob/living))
|
||||
location = target.loc
|
||||
else if(istype(target,/turf))
|
||||
location = target
|
||||
if(istype(target,/mob/living) && message)
|
||||
to_chat(target, text("[message]"))
|
||||
if(sparks_spread)
|
||||
do_sparks(sparks_amt, 0, location)
|
||||
if(smoke_spread)
|
||||
if(smoke_spread == 1)
|
||||
var/datum/effect_system/smoke_spread/smoke = new
|
||||
smoke.set_up(smoke_amt, 0, location) //no idea what the 0 is
|
||||
smoke.start()
|
||||
else if(smoke_spread == 2)
|
||||
var/datum/effect_system/smoke_spread/bad/smoke = new
|
||||
smoke.set_up(smoke_amt, 0, location) //no idea what the 0 is
|
||||
smoke.start()
|
||||
else if(smoke_spread == 3)
|
||||
var/datum/effect_system/smoke_spread/sleeping/smoke = new
|
||||
smoke.set_up(smoke_amt, 0, location) // same here
|
||||
smoke.start()
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/cast(list/targets, mob/user = usr)
|
||||
return
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/critfail(list/targets)
|
||||
return
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/revert_cast(mob/user = usr) //resets recharge or readds a charge
|
||||
switch(charge_type)
|
||||
if("recharge")
|
||||
charge_counter = charge_max
|
||||
if("charges")
|
||||
charge_counter++
|
||||
if("holdervar")
|
||||
adjust_var(user, holder_var_type, -holder_var_amount)
|
||||
if(action)
|
||||
action.UpdateButtonIcon()
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/updateButtonIcon()
|
||||
if(action)
|
||||
action.UpdateButtonIcon()
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/adjust_var(mob/living/target = usr, type, amount) //handles the adjustment of the var when the spell is used. has some hardcoded types
|
||||
switch(type)
|
||||
if("bruteloss")
|
||||
target.adjustBruteLoss(amount)
|
||||
if("fireloss")
|
||||
target.adjustFireLoss(amount)
|
||||
if("toxloss")
|
||||
target.adjustToxLoss(amount)
|
||||
if("oxyloss")
|
||||
target.adjustOxyLoss(amount)
|
||||
if("stunned")
|
||||
target.AdjustStunned(amount)
|
||||
if("weakened")
|
||||
target.AdjustWeakened(amount)
|
||||
if("paralysis")
|
||||
target.AdjustParalysis(amount)
|
||||
else
|
||||
target.vars[type] += amount //I bear no responsibility for the runtimes that'll happen if you try to adjust non-numeric or even non-existant vars
|
||||
return
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted //can mean aoe for mobs (limited/unlimited number) or one target mob
|
||||
var/max_targets = 1 //leave 0 for unlimited targets in range, 1 for one selectable target in range, more for limited number of casts (can all target one guy, depends on target_ignore_prev) in range
|
||||
var/target_ignore_prev = 1 //only important if max_targets > 1, affects if the spell can be cast multiple times at one person from one cast
|
||||
var/include_user = 0 //if it includes usr in the target list
|
||||
var/random_target = 0 // chooses random viable target instead of asking the caster
|
||||
var/random_target_priority = TARGET_CLOSEST // if random_target is enabled how it will pick the target
|
||||
var/humans_only = 0 //for avoiding simple animals and only doing "human" mobs, 0 = all mobs, 1 = humans only
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf //affects all turfs in view or range (depends)
|
||||
var/inner_radius = -1 //for all your ring spell needs
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/choose_targets(mob/user = usr)
|
||||
var/list/targets = list()
|
||||
|
||||
switch(max_targets)
|
||||
if(0) //unlimited
|
||||
|
||||
if(!humans_only)
|
||||
for(var/mob/living/target in view_or_range(range, user, selection_type))
|
||||
targets += target
|
||||
else
|
||||
for(var/mob/living/carbon/human/target in view_or_range(range, user, selection_type))
|
||||
targets += target
|
||||
|
||||
if(1) //single target can be picked
|
||||
if(range < 0)
|
||||
targets += user
|
||||
else
|
||||
var/possible_targets = list()
|
||||
|
||||
if(!humans_only)
|
||||
for(var/mob/living/M in view_or_range(range, user, selection_type))
|
||||
if(!include_user && user == M)
|
||||
continue
|
||||
possible_targets += M
|
||||
else
|
||||
for(var/mob/living/carbon/human/M in view_or_range(range, user, selection_type))
|
||||
if(!include_user && user == M)
|
||||
continue
|
||||
possible_targets += M
|
||||
|
||||
//targets += input("Choose the target for the spell.", "Targeting") as mob in possible_targets
|
||||
//Adds a safety check post-input to make sure those targets are actually in range.
|
||||
var/mob/M
|
||||
if(!random_target)
|
||||
M = input("Choose the target for the spell.", "Targeting") as mob in possible_targets
|
||||
else
|
||||
switch(random_target_priority)
|
||||
if(TARGET_RANDOM)
|
||||
M = pick(possible_targets)
|
||||
if(TARGET_CLOSEST)
|
||||
for(var/mob/living/L in possible_targets)
|
||||
if(M)
|
||||
if(get_dist(user,L) < get_dist(user,M))
|
||||
if(los_check(user,L))
|
||||
M = L
|
||||
else
|
||||
if(los_check(user,L))
|
||||
M = L
|
||||
if(M in view_or_range(range, user, selection_type)) targets += M
|
||||
|
||||
else
|
||||
var/list/possible_targets = list()
|
||||
if(!humans_only)
|
||||
for(var/mob/living/target in view_or_range(range, user, selection_type))
|
||||
possible_targets += target
|
||||
else
|
||||
for(var/mob/living/carbon/human/target in view_or_range(range, user, selection_type))
|
||||
possible_targets += target
|
||||
for(var/i=1,i<=max_targets,i++)
|
||||
if(!possible_targets.len)
|
||||
break
|
||||
if(target_ignore_prev)
|
||||
var/target = pick(possible_targets)
|
||||
possible_targets -= target
|
||||
targets += target
|
||||
else
|
||||
targets += pick(possible_targets)
|
||||
|
||||
if(!include_user && (user in targets))
|
||||
targets -= user
|
||||
|
||||
if(!targets.len) //doesn't waste the spell
|
||||
revert_cast(user)
|
||||
return
|
||||
|
||||
perform(targets, user=user)
|
||||
|
||||
return
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/choose_targets(mob/user = usr)
|
||||
var/list/targets = list()
|
||||
|
||||
for(var/turf/target in view_or_range(range,user,selection_type))
|
||||
if(!(target in view_or_range(inner_radius,user,selection_type)))
|
||||
targets += target
|
||||
|
||||
if(!targets.len) //doesn't waste the spell
|
||||
revert_cast()
|
||||
return
|
||||
|
||||
perform(targets, user=user)
|
||||
|
||||
return
|
||||
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/proc/los_check(mob/A,mob/B)
|
||||
//Checks for obstacles from A to B
|
||||
var/obj/dummy = new(A.loc)
|
||||
dummy.pass_flags |= PASSTABLE
|
||||
for(var/turf/turf in getline(A,B))
|
||||
for(var/atom/movable/AM in turf)
|
||||
if(!AM.CanPass(dummy,turf,1))
|
||||
qdel(dummy)
|
||||
return 0
|
||||
qdel(dummy)
|
||||
return 1
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/can_cast(mob/user = usr)
|
||||
if(((!user.mind) || !(src in user.mind.spell_list)) && !(src in user.mob_spell_list))
|
||||
return 0
|
||||
|
||||
if(is_admin_level(user.z) && !centcom_cancast) //Certain spells are not allowed on the centcom zlevel
|
||||
return 0
|
||||
|
||||
switch(charge_type)
|
||||
if("recharge")
|
||||
if(charge_counter < charge_max)
|
||||
return 0
|
||||
if("charges")
|
||||
if(!charge_counter)
|
||||
return 0
|
||||
|
||||
if(user.stat && !stat_allowed)
|
||||
return 0
|
||||
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/H = user
|
||||
|
||||
if((invocation_type == "whisper" || invocation_type == "shout") && H.is_muzzled())
|
||||
return 0
|
||||
|
||||
var/clothcheck = locate(/obj/effect/proc_holder/spell/noclothes) in user.mob_spell_list
|
||||
var/clothcheck2 = user.mind && (locate(/obj/effect/proc_holder/spell/noclothes) in user.mind.spell_list)
|
||||
if(clothes_req && !clothcheck && !clothcheck2) //clothes check
|
||||
var/obj/item/clothing/robe = H.wear_suit
|
||||
var/obj/item/clothing/hat = H.head
|
||||
var/obj/item/clothing/shoes = H.shoes
|
||||
if(!robe || !hat || !shoes)
|
||||
return 0
|
||||
if(!robe.magical || !hat.magical || !shoes.magical)
|
||||
return 0
|
||||
else
|
||||
if(clothes_req || human_req)
|
||||
return 0
|
||||
if(nonabstract_req && (isbrain(user) || ispAI(user)))
|
||||
return 0
|
||||
return 1
|
||||
|
||||
@@ -1,98 +1,98 @@
|
||||
/obj/effect/proc_holder/spell/targeted/area_teleport
|
||||
name = "Area teleport"
|
||||
desc = "This spell teleports you to a type of area of your selection."
|
||||
nonabstract_req = 1
|
||||
|
||||
var/randomise_selection = 0 //if it lets the usr choose the teleport loc or picks it from the list
|
||||
var/invocation_area = 1 //if the invocation appends the selected area
|
||||
|
||||
var/sound1 = 'sound/weapons/zapbang.ogg'
|
||||
var/sound2 = 'sound/weapons/zapbang.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/area_teleport/perform(list/targets, recharge = 1, mob/living/user = usr)
|
||||
var/thearea = before_cast(targets)
|
||||
if(!thearea || !cast_check(1))
|
||||
revert_cast()
|
||||
return
|
||||
invocation(thearea)
|
||||
spawn(0)
|
||||
if(charge_type == "recharge" && recharge)
|
||||
start_recharge()
|
||||
cast(targets,thearea)
|
||||
after_cast(targets)
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/area_teleport/before_cast(list/targets)
|
||||
var/A = null
|
||||
|
||||
if(!randomise_selection)
|
||||
A = input("Area to teleport to", "Teleport", A) as null|anything in teleportlocs
|
||||
else
|
||||
A = pick(teleportlocs)
|
||||
|
||||
if(!A)
|
||||
return
|
||||
|
||||
var/area/thearea = teleportlocs[A]
|
||||
|
||||
if(thearea.tele_proof && !istype(thearea, /area/wizard_station))
|
||||
to_chat(usr, "A mysterious force disrupts your arcane spell matrix, and you remain where you are.")
|
||||
return
|
||||
|
||||
return thearea
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/area_teleport/cast(list/targets,area/thearea,mob/living/user = usr)
|
||||
playsound(get_turf(user), sound1, 50,1)
|
||||
for(var/mob/living/target in targets)
|
||||
var/list/L = list()
|
||||
for(var/turf/T in get_area_turfs(thearea.type))
|
||||
if(!T.density)
|
||||
var/clear = 1
|
||||
for(var/obj/O in T)
|
||||
if(O.density)
|
||||
clear = 0
|
||||
break
|
||||
if(clear)
|
||||
L+=T
|
||||
|
||||
if(!L.len)
|
||||
to_chat(usr, "The spell matrix was unable to locate a suitable teleport destination for an unknown reason. Sorry.")
|
||||
return
|
||||
|
||||
if(target && target.buckled)
|
||||
target.buckled.unbuckle_mob(target, force = TRUE)
|
||||
|
||||
if(target && target.has_buckled_mobs())
|
||||
target.unbuckle_all_mobs(force = TRUE)
|
||||
|
||||
var/list/tempL = L
|
||||
var/attempt = null
|
||||
var/success = 0
|
||||
while(tempL.len)
|
||||
attempt = pick(tempL)
|
||||
success = target.Move(attempt)
|
||||
if(!success)
|
||||
tempL.Remove(attempt)
|
||||
else
|
||||
break
|
||||
|
||||
if(!success)
|
||||
target.forceMove(pick(L))
|
||||
playsound(get_turf(user), sound2, 50,1)
|
||||
|
||||
return
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/area_teleport/invocation(area/chosenarea = null)
|
||||
if(!invocation_area || !chosenarea)
|
||||
..()
|
||||
else
|
||||
switch(invocation_type)
|
||||
if("shout")
|
||||
usr.say("[invocation] [uppertext(chosenarea.name)]")
|
||||
if(usr.gender==MALE)
|
||||
playsound(usr.loc, pick('sound/misc/null.ogg','sound/misc/null.ogg'), 100, 1)
|
||||
else
|
||||
playsound(usr.loc, pick('sound/misc/null.ogg','sound/misc/null.ogg'), 100, 1)
|
||||
if("whisper")
|
||||
usr.whisper("[invocation] [uppertext(chosenarea.name)]")
|
||||
|
||||
return
|
||||
/obj/effect/proc_holder/spell/targeted/area_teleport
|
||||
name = "Area teleport"
|
||||
desc = "This spell teleports you to a type of area of your selection."
|
||||
nonabstract_req = 1
|
||||
|
||||
var/randomise_selection = 0 //if it lets the usr choose the teleport loc or picks it from the list
|
||||
var/invocation_area = 1 //if the invocation appends the selected area
|
||||
|
||||
var/sound1 = 'sound/weapons/zapbang.ogg'
|
||||
var/sound2 = 'sound/weapons/zapbang.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/area_teleport/perform(list/targets, recharge = 1, mob/living/user = usr)
|
||||
var/thearea = before_cast(targets)
|
||||
if(!thearea || !cast_check(1))
|
||||
revert_cast()
|
||||
return
|
||||
invocation(thearea)
|
||||
spawn(0)
|
||||
if(charge_type == "recharge" && recharge)
|
||||
start_recharge()
|
||||
cast(targets,thearea)
|
||||
after_cast(targets)
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/area_teleport/before_cast(list/targets)
|
||||
var/A = null
|
||||
|
||||
if(!randomise_selection)
|
||||
A = input("Area to teleport to", "Teleport", A) as null|anything in teleportlocs
|
||||
else
|
||||
A = pick(teleportlocs)
|
||||
|
||||
if(!A)
|
||||
return
|
||||
|
||||
var/area/thearea = teleportlocs[A]
|
||||
|
||||
if(thearea.tele_proof && !istype(thearea, /area/wizard_station))
|
||||
to_chat(usr, "A mysterious force disrupts your arcane spell matrix, and you remain where you are.")
|
||||
return
|
||||
|
||||
return thearea
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/area_teleport/cast(list/targets,area/thearea,mob/living/user = usr)
|
||||
playsound(get_turf(user), sound1, 50,1)
|
||||
for(var/mob/living/target in targets)
|
||||
var/list/L = list()
|
||||
for(var/turf/T in get_area_turfs(thearea.type))
|
||||
if(!T.density)
|
||||
var/clear = 1
|
||||
for(var/obj/O in T)
|
||||
if(O.density)
|
||||
clear = 0
|
||||
break
|
||||
if(clear)
|
||||
L+=T
|
||||
|
||||
if(!L.len)
|
||||
to_chat(usr, "The spell matrix was unable to locate a suitable teleport destination for an unknown reason. Sorry.")
|
||||
return
|
||||
|
||||
if(target && target.buckled)
|
||||
target.buckled.unbuckle_mob(target, force = TRUE)
|
||||
|
||||
if(target && target.has_buckled_mobs())
|
||||
target.unbuckle_all_mobs(force = TRUE)
|
||||
|
||||
var/list/tempL = L
|
||||
var/attempt = null
|
||||
var/success = 0
|
||||
while(tempL.len)
|
||||
attempt = pick(tempL)
|
||||
success = target.Move(attempt)
|
||||
if(!success)
|
||||
tempL.Remove(attempt)
|
||||
else
|
||||
break
|
||||
|
||||
if(!success)
|
||||
target.forceMove(pick(L))
|
||||
playsound(get_turf(user), sound2, 50,1)
|
||||
|
||||
return
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/area_teleport/invocation(area/chosenarea = null)
|
||||
if(!invocation_area || !chosenarea)
|
||||
..()
|
||||
else
|
||||
switch(invocation_type)
|
||||
if("shout")
|
||||
usr.say("[invocation] [uppertext(chosenarea.name)]")
|
||||
if(usr.gender==MALE)
|
||||
playsound(usr.loc, pick('sound/misc/null.ogg','sound/misc/null.ogg'), 100, 1)
|
||||
else
|
||||
playsound(usr.loc, pick('sound/misc/null.ogg','sound/misc/null.ogg'), 100, 1)
|
||||
if("whisper")
|
||||
usr.whisper("[invocation] [uppertext(chosenarea.name)]")
|
||||
|
||||
return
|
||||
|
||||
@@ -61,4 +61,4 @@
|
||||
genemutcheck(src, COMICBLOCK, null, MUTCHK_FORCED)
|
||||
if(!(iswizard(src) || (mind && mind.special_role == SPECIAL_ROLE_WIZARD_APPRENTICE))) //Mutations are permanent on non-wizards. Can still be removed by genetics fuckery but not mutadone.
|
||||
dna.default_blocks.Add(CLUMSYBLOCK)
|
||||
dna.default_blocks.Add(COMICBLOCK)
|
||||
dna.default_blocks.Add(COMICBLOCK)
|
||||
|
||||
@@ -1,70 +1,70 @@
|
||||
/obj/effect/proc_holder/spell/aoe_turf/conjure
|
||||
name = "Conjure"
|
||||
desc = "This spell conjures objs of the specified types in range."
|
||||
|
||||
var/list/summon_type = list() //determines what exactly will be summoned
|
||||
//should be text, like list("/mob/simple_animal/bot/ed209")
|
||||
|
||||
var/summon_lifespan = 0 // 0=permanent, any other time in deciseconds
|
||||
var/summon_amt = 1 //amount of objects summoned
|
||||
var/summon_ignore_density = 0 //if set to 1, adds dense tiles to possible spawn places
|
||||
var/summon_ignore_prev_spawn_points = 0 //if set to 1, each new object is summoned on a new spawn point
|
||||
|
||||
var/list/newVars = list() //vars of the summoned objects will be replaced with those where they meet
|
||||
//should have format of list("emagged" = 1,"name" = "Wizard's Justicebot"), for example
|
||||
var/delay = 1//Go Go Gadget Inheritance
|
||||
|
||||
var/cast_sound = 'sound/items/welder.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/conjure/cast(list/targets,mob/living/user = usr)
|
||||
playsound(get_turf(user), cast_sound, 50,1)
|
||||
for(var/turf/T in targets)
|
||||
if(T.density && !summon_ignore_density)
|
||||
targets -= T
|
||||
playsound(get_turf(src), cast_sound, 50, 1)
|
||||
|
||||
if(do_after(user, delay, target = user))
|
||||
for(var/i=0,i<summon_amt,i++)
|
||||
if(!targets.len)
|
||||
break
|
||||
var/summoned_object_type = pick(summon_type)
|
||||
var/spawn_place = pick(targets)
|
||||
if(summon_ignore_prev_spawn_points)
|
||||
targets -= spawn_place
|
||||
if(ispath(summoned_object_type,/turf))
|
||||
if(istype(get_turf(user),/turf/simulated/shuttle))
|
||||
to_chat(user, "<span class='warning'>You can't build things on shuttles!</span>")
|
||||
break
|
||||
var/turf/O = spawn_place
|
||||
var/N = summoned_object_type
|
||||
O.ChangeTurf(N)
|
||||
else
|
||||
var/atom/summoned_object = new summoned_object_type(spawn_place)
|
||||
|
||||
for(var/varName in newVars)
|
||||
if(varName in summoned_object.vars)
|
||||
summoned_object.vars[varName] = newVars[varName]
|
||||
summoned_object.admin_spawned = TRUE
|
||||
|
||||
if(summon_lifespan)
|
||||
spawn(summon_lifespan)
|
||||
if(summoned_object)
|
||||
qdel(summoned_object)
|
||||
else
|
||||
switch(charge_type)
|
||||
if("recharge")
|
||||
charge_counter = charge_max - 5//So you don't lose charge for a failed spell(Also prevents most over-fill)
|
||||
if("charges")
|
||||
charge_counter++//Ditto, just for different spell types
|
||||
|
||||
|
||||
return
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/conjure/summonEdSwarm //test purposes
|
||||
name = "Dispense Wizard Justice"
|
||||
desc = "This spell dispenses wizard justice."
|
||||
|
||||
summon_type = list(/mob/living/simple_animal/bot/ed209)
|
||||
summon_amt = 10
|
||||
range = 3
|
||||
newVars = list("emagged" = 1,"name" = "Wizard's Justicebot")
|
||||
/obj/effect/proc_holder/spell/aoe_turf/conjure
|
||||
name = "Conjure"
|
||||
desc = "This spell conjures objs of the specified types in range."
|
||||
|
||||
var/list/summon_type = list() //determines what exactly will be summoned
|
||||
//should be text, like list("/mob/simple_animal/bot/ed209")
|
||||
|
||||
var/summon_lifespan = 0 // 0=permanent, any other time in deciseconds
|
||||
var/summon_amt = 1 //amount of objects summoned
|
||||
var/summon_ignore_density = 0 //if set to 1, adds dense tiles to possible spawn places
|
||||
var/summon_ignore_prev_spawn_points = 0 //if set to 1, each new object is summoned on a new spawn point
|
||||
|
||||
var/list/newVars = list() //vars of the summoned objects will be replaced with those where they meet
|
||||
//should have format of list("emagged" = 1,"name" = "Wizard's Justicebot"), for example
|
||||
var/delay = 1//Go Go Gadget Inheritance
|
||||
|
||||
var/cast_sound = 'sound/items/welder.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/conjure/cast(list/targets,mob/living/user = usr)
|
||||
playsound(get_turf(user), cast_sound, 50,1)
|
||||
for(var/turf/T in targets)
|
||||
if(T.density && !summon_ignore_density)
|
||||
targets -= T
|
||||
playsound(get_turf(src), cast_sound, 50, 1)
|
||||
|
||||
if(do_after(user, delay, target = user))
|
||||
for(var/i=0,i<summon_amt,i++)
|
||||
if(!targets.len)
|
||||
break
|
||||
var/summoned_object_type = pick(summon_type)
|
||||
var/spawn_place = pick(targets)
|
||||
if(summon_ignore_prev_spawn_points)
|
||||
targets -= spawn_place
|
||||
if(ispath(summoned_object_type,/turf))
|
||||
if(istype(get_turf(user),/turf/simulated/shuttle))
|
||||
to_chat(user, "<span class='warning'>You can't build things on shuttles!</span>")
|
||||
break
|
||||
var/turf/O = spawn_place
|
||||
var/N = summoned_object_type
|
||||
O.ChangeTurf(N)
|
||||
else
|
||||
var/atom/summoned_object = new summoned_object_type(spawn_place)
|
||||
|
||||
for(var/varName in newVars)
|
||||
if(varName in summoned_object.vars)
|
||||
summoned_object.vars[varName] = newVars[varName]
|
||||
summoned_object.admin_spawned = TRUE
|
||||
|
||||
if(summon_lifespan)
|
||||
spawn(summon_lifespan)
|
||||
if(summoned_object)
|
||||
qdel(summoned_object)
|
||||
else
|
||||
switch(charge_type)
|
||||
if("recharge")
|
||||
charge_counter = charge_max - 5//So you don't lose charge for a failed spell(Also prevents most over-fill)
|
||||
if("charges")
|
||||
charge_counter++//Ditto, just for different spell types
|
||||
|
||||
|
||||
return
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/conjure/summonEdSwarm //test purposes
|
||||
name = "Dispense Wizard Justice"
|
||||
desc = "This spell dispenses wizard justice."
|
||||
|
||||
summon_type = list(/mob/living/simple_animal/bot/ed209)
|
||||
summon_amt = 10
|
||||
range = 3
|
||||
newVars = list("emagged" = 1,"name" = "Wizard's Justicebot")
|
||||
|
||||
@@ -1,84 +1,84 @@
|
||||
/obj/effect/proc_holder/spell/dumbfire
|
||||
|
||||
var/projectile_type = ""
|
||||
var/activate_on_collision = 1
|
||||
|
||||
var/proj_icon = 'icons/obj/projectiles.dmi'
|
||||
var/proj_icon_state = "spell"
|
||||
var/proj_name = "a spell projectile"
|
||||
|
||||
var/proj_trail = 0 //if it leaves a trail
|
||||
var/proj_trail_lifespan = 0 //deciseconds
|
||||
var/proj_trail_icon = 'icons/obj/wizard.dmi'
|
||||
var/proj_trail_icon_state = "trail"
|
||||
|
||||
var/proj_type = /obj/effect/proc_holder/spell //IMPORTANT use only subtypes of this
|
||||
|
||||
var/proj_insubstantial = 0 //if it can pass through dense objects or not
|
||||
var/proj_trigger_range = 1 //the range from target at which the projectile triggers cast(target)
|
||||
|
||||
var/proj_lifespan = 100 //in deciseconds * proj_step_delay
|
||||
var/proj_step_delay = 1 //lower = faster
|
||||
|
||||
/obj/effect/proc_holder/spell/dumbfire/choose_targets(mob/user = usr)
|
||||
|
||||
var/turf/T = get_turf(usr)
|
||||
for(var/i = 1; i < range; i++)
|
||||
var/turf/new_turf = get_step(T, usr.dir)
|
||||
if(new_turf.density)
|
||||
break
|
||||
T = new_turf
|
||||
perform(list(T), user = user)
|
||||
|
||||
/obj/effect/proc_holder/spell/dumbfire/cast(list/targets, mob/user = usr)
|
||||
|
||||
for(var/turf/target in targets)
|
||||
spawn(0)
|
||||
var/obj/effect/proc_holder/spell/targeted/projectile
|
||||
projectile = new proj_type(user)
|
||||
projectile.icon = proj_icon
|
||||
projectile.icon_state = proj_icon_state
|
||||
projectile.dir = get_dir(projectile, target)
|
||||
projectile.name = proj_name
|
||||
|
||||
var/current_loc = user.loc
|
||||
|
||||
projectile.loc = current_loc
|
||||
|
||||
for(var/i = 0,i < proj_lifespan,i++)
|
||||
if(!projectile)
|
||||
break
|
||||
|
||||
if(proj_insubstantial)
|
||||
projectile.loc = get_step(projectile, projectile.dir)
|
||||
else
|
||||
step(projectile, projectile.dir)
|
||||
|
||||
if(projectile.loc == current_loc || i == proj_lifespan)
|
||||
projectile.cast(current_loc)
|
||||
break
|
||||
|
||||
var/mob/living/L = locate(/mob/living) in range(projectile, proj_trigger_range) - user
|
||||
if(L && L.stat != DEAD)
|
||||
projectile.cast(L.loc)
|
||||
break
|
||||
|
||||
if(proj_trail && projectile)
|
||||
spawn(0)
|
||||
if(projectile)
|
||||
var/obj/effect/overlay/trail = new /obj/effect/overlay(projectile.loc)
|
||||
trail.icon = proj_trail_icon
|
||||
trail.icon_state = proj_trail_icon_state
|
||||
trail.density = 0
|
||||
spawn(proj_trail_lifespan)
|
||||
qdel(trail)
|
||||
|
||||
current_loc = projectile.loc
|
||||
var/matrix/M = new
|
||||
M.Turn(dir2angle(projectile.dir))
|
||||
projectile.transform = M
|
||||
|
||||
sleep(proj_step_delay)
|
||||
|
||||
if(projectile)
|
||||
qdel(projectile)
|
||||
/obj/effect/proc_holder/spell/dumbfire
|
||||
|
||||
var/projectile_type = ""
|
||||
var/activate_on_collision = 1
|
||||
|
||||
var/proj_icon = 'icons/obj/projectiles.dmi'
|
||||
var/proj_icon_state = "spell"
|
||||
var/proj_name = "a spell projectile"
|
||||
|
||||
var/proj_trail = 0 //if it leaves a trail
|
||||
var/proj_trail_lifespan = 0 //deciseconds
|
||||
var/proj_trail_icon = 'icons/obj/wizard.dmi'
|
||||
var/proj_trail_icon_state = "trail"
|
||||
|
||||
var/proj_type = /obj/effect/proc_holder/spell //IMPORTANT use only subtypes of this
|
||||
|
||||
var/proj_insubstantial = 0 //if it can pass through dense objects or not
|
||||
var/proj_trigger_range = 1 //the range from target at which the projectile triggers cast(target)
|
||||
|
||||
var/proj_lifespan = 100 //in deciseconds * proj_step_delay
|
||||
var/proj_step_delay = 1 //lower = faster
|
||||
|
||||
/obj/effect/proc_holder/spell/dumbfire/choose_targets(mob/user = usr)
|
||||
|
||||
var/turf/T = get_turf(usr)
|
||||
for(var/i = 1; i < range; i++)
|
||||
var/turf/new_turf = get_step(T, usr.dir)
|
||||
if(new_turf.density)
|
||||
break
|
||||
T = new_turf
|
||||
perform(list(T), user = user)
|
||||
|
||||
/obj/effect/proc_holder/spell/dumbfire/cast(list/targets, mob/user = usr)
|
||||
|
||||
for(var/turf/target in targets)
|
||||
spawn(0)
|
||||
var/obj/effect/proc_holder/spell/targeted/projectile
|
||||
projectile = new proj_type(user)
|
||||
projectile.icon = proj_icon
|
||||
projectile.icon_state = proj_icon_state
|
||||
projectile.dir = get_dir(projectile, target)
|
||||
projectile.name = proj_name
|
||||
|
||||
var/current_loc = user.loc
|
||||
|
||||
projectile.loc = current_loc
|
||||
|
||||
for(var/i = 0,i < proj_lifespan,i++)
|
||||
if(!projectile)
|
||||
break
|
||||
|
||||
if(proj_insubstantial)
|
||||
projectile.loc = get_step(projectile, projectile.dir)
|
||||
else
|
||||
step(projectile, projectile.dir)
|
||||
|
||||
if(projectile.loc == current_loc || i == proj_lifespan)
|
||||
projectile.cast(current_loc)
|
||||
break
|
||||
|
||||
var/mob/living/L = locate(/mob/living) in range(projectile, proj_trigger_range) - user
|
||||
if(L && L.stat != DEAD)
|
||||
projectile.cast(L.loc)
|
||||
break
|
||||
|
||||
if(proj_trail && projectile)
|
||||
spawn(0)
|
||||
if(projectile)
|
||||
var/obj/effect/overlay/trail = new /obj/effect/overlay(projectile.loc)
|
||||
trail.icon = proj_trail_icon
|
||||
trail.icon_state = proj_trail_icon_state
|
||||
trail.density = 0
|
||||
spawn(proj_trail_lifespan)
|
||||
qdel(trail)
|
||||
|
||||
current_loc = projectile.loc
|
||||
var/matrix/M = new
|
||||
M.Turn(dir2angle(projectile.dir))
|
||||
projectile.transform = M
|
||||
|
||||
sleep(proj_step_delay)
|
||||
|
||||
if(projectile)
|
||||
qdel(projectile)
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/obj/effect/proc_holder/spell/targeted/emplosion
|
||||
name = "Emplosion"
|
||||
desc = "This spell emplodes an area."
|
||||
|
||||
var/emp_heavy = 2
|
||||
var/emp_light = 3
|
||||
|
||||
action_icon_state = "emp"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/emplosion/cast(list/targets, mob/user = usr)
|
||||
|
||||
for(var/mob/living/target in targets)
|
||||
empulse(target.loc, emp_heavy, emp_light, 1)
|
||||
|
||||
return
|
||||
/obj/effect/proc_holder/spell/targeted/emplosion
|
||||
name = "Emplosion"
|
||||
desc = "This spell emplodes an area."
|
||||
|
||||
var/emp_heavy = 2
|
||||
var/emp_light = 3
|
||||
|
||||
action_icon_state = "emp"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/emplosion/cast(list/targets, mob/user = usr)
|
||||
|
||||
for(var/mob/living/target in targets)
|
||||
empulse(target.loc, emp_heavy, emp_light, 1)
|
||||
|
||||
return
|
||||
|
||||
@@ -1,104 +1,104 @@
|
||||
/obj/effect/proc_holder/spell/targeted/ethereal_jaunt
|
||||
name = "Ethereal Jaunt"
|
||||
desc = "This spell creates your ethereal form, temporarily making you invisible and able to pass through walls."
|
||||
|
||||
school = "transmutation"
|
||||
charge_max = 300
|
||||
clothes_req = 1
|
||||
invocation = "none"
|
||||
invocation_type = "none"
|
||||
range = -1
|
||||
cooldown_min = 100 //50 deciseconds reduction per rank
|
||||
include_user = 1
|
||||
nonabstract_req = 1
|
||||
centcom_cancast = 0 //Prevent people from getting to centcom
|
||||
|
||||
var/jaunt_duration = 50 //in deciseconds
|
||||
var/jaunt_in_time = 5
|
||||
var/jaunt_in_type = /obj/effect/temp_visual/wizard
|
||||
var/jaunt_out_type = /obj/effect/temp_visual/wizard/out
|
||||
|
||||
action_icon_state = "jaunt"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/ethereal_jaunt/cast(list/targets, mob/user = usr) //magnets, so mostly hardcoded
|
||||
playsound(get_turf(user), 'sound/magic/ethereal_enter.ogg', 50, 1, -1)
|
||||
for(var/mob/living/target in targets)
|
||||
if(!target.can_safely_leave_loc()) // No more brainmobs hopping out of their brains
|
||||
to_chat(target, "<span class='warning'>You are somehow too bound to your current location to abandon it.</span>")
|
||||
continue
|
||||
INVOKE_ASYNC(src, .proc/do_jaunt, target)
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/ethereal_jaunt/proc/do_jaunt(mob/living/target)
|
||||
target.notransform = 1
|
||||
var/turf/mobloc = get_turf(target)
|
||||
var/obj/effect/dummy/spell_jaunt/holder = new /obj/effect/dummy/spell_jaunt(mobloc)
|
||||
new jaunt_out_type(mobloc, target.dir)
|
||||
target.ExtinguishMob()
|
||||
target.forceMove(holder)
|
||||
target.reset_perspective(holder)
|
||||
target.notransform = 0 //mob is safely inside holder now, no need for protection.
|
||||
jaunt_steam(mobloc)
|
||||
|
||||
sleep(jaunt_duration)
|
||||
|
||||
if(target.loc != holder) //mob warped out of the warp
|
||||
qdel(holder)
|
||||
return
|
||||
mobloc = get_turf(target.loc)
|
||||
jaunt_steam(mobloc)
|
||||
target.canmove = 0
|
||||
holder.reappearing = 1
|
||||
playsound(get_turf(target), 'sound/magic/ethereal_exit.ogg', 50, 1, -1)
|
||||
sleep(25 - jaunt_in_time)
|
||||
new jaunt_in_type(mobloc, holder.dir)
|
||||
target.setDir(holder.dir)
|
||||
sleep(jaunt_in_time)
|
||||
qdel(holder)
|
||||
if(!QDELETED(target))
|
||||
if(mobloc.density)
|
||||
for(var/direction in alldirs)
|
||||
var/turf/T = get_step(mobloc, direction)
|
||||
if(T)
|
||||
if(target.Move(T))
|
||||
break
|
||||
target.canmove = 1
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/ethereal_jaunt/proc/jaunt_steam(mobloc)
|
||||
var/datum/effect_system/steam_spread/steam = new /datum/effect_system/steam_spread()
|
||||
steam.set_up(10, 0, mobloc)
|
||||
steam.start()
|
||||
|
||||
/obj/effect/dummy/spell_jaunt
|
||||
name = "water"
|
||||
icon = 'icons/effects/effects.dmi'
|
||||
icon_state = "nothing"
|
||||
var/reappearing = 0
|
||||
var/movedelay = 0
|
||||
var/movespeed = 2
|
||||
density = 0
|
||||
anchored = 1
|
||||
invisibility = 60
|
||||
resistance_flags = LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
|
||||
|
||||
/obj/effect/dummy/spell_jaunt/Destroy()
|
||||
// Eject contents if deleted somehow
|
||||
for(var/atom/movable/AM in src)
|
||||
AM.forceMove(get_turf(src))
|
||||
return ..()
|
||||
|
||||
/obj/effect/dummy/spell_jaunt/relaymove(mob/user, direction)
|
||||
if((movedelay > world.time) || reappearing || !direction)
|
||||
return
|
||||
var/turf/newLoc = get_step(src,direction)
|
||||
setDir(direction)
|
||||
if(!(newLoc.flags & NOJAUNT))
|
||||
forceMove(newLoc)
|
||||
else
|
||||
to_chat(user, "<span class='warning'>Some strange aura is blocking the way!</span>")
|
||||
movedelay = world.time + movespeed
|
||||
|
||||
/obj/effect/dummy/spell_jaunt/ex_act(blah)
|
||||
return
|
||||
|
||||
/obj/effect/dummy/spell_jaunt/bullet_act(blah)
|
||||
return
|
||||
/obj/effect/proc_holder/spell/targeted/ethereal_jaunt
|
||||
name = "Ethereal Jaunt"
|
||||
desc = "This spell creates your ethereal form, temporarily making you invisible and able to pass through walls."
|
||||
|
||||
school = "transmutation"
|
||||
charge_max = 300
|
||||
clothes_req = 1
|
||||
invocation = "none"
|
||||
invocation_type = "none"
|
||||
range = -1
|
||||
cooldown_min = 100 //50 deciseconds reduction per rank
|
||||
include_user = 1
|
||||
nonabstract_req = 1
|
||||
centcom_cancast = 0 //Prevent people from getting to centcom
|
||||
|
||||
var/jaunt_duration = 50 //in deciseconds
|
||||
var/jaunt_in_time = 5
|
||||
var/jaunt_in_type = /obj/effect/temp_visual/wizard
|
||||
var/jaunt_out_type = /obj/effect/temp_visual/wizard/out
|
||||
|
||||
action_icon_state = "jaunt"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/ethereal_jaunt/cast(list/targets, mob/user = usr) //magnets, so mostly hardcoded
|
||||
playsound(get_turf(user), 'sound/magic/ethereal_enter.ogg', 50, 1, -1)
|
||||
for(var/mob/living/target in targets)
|
||||
if(!target.can_safely_leave_loc()) // No more brainmobs hopping out of their brains
|
||||
to_chat(target, "<span class='warning'>You are somehow too bound to your current location to abandon it.</span>")
|
||||
continue
|
||||
INVOKE_ASYNC(src, .proc/do_jaunt, target)
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/ethereal_jaunt/proc/do_jaunt(mob/living/target)
|
||||
target.notransform = 1
|
||||
var/turf/mobloc = get_turf(target)
|
||||
var/obj/effect/dummy/spell_jaunt/holder = new /obj/effect/dummy/spell_jaunt(mobloc)
|
||||
new jaunt_out_type(mobloc, target.dir)
|
||||
target.ExtinguishMob()
|
||||
target.forceMove(holder)
|
||||
target.reset_perspective(holder)
|
||||
target.notransform = 0 //mob is safely inside holder now, no need for protection.
|
||||
jaunt_steam(mobloc)
|
||||
|
||||
sleep(jaunt_duration)
|
||||
|
||||
if(target.loc != holder) //mob warped out of the warp
|
||||
qdel(holder)
|
||||
return
|
||||
mobloc = get_turf(target.loc)
|
||||
jaunt_steam(mobloc)
|
||||
target.canmove = 0
|
||||
holder.reappearing = 1
|
||||
playsound(get_turf(target), 'sound/magic/ethereal_exit.ogg', 50, 1, -1)
|
||||
sleep(25 - jaunt_in_time)
|
||||
new jaunt_in_type(mobloc, holder.dir)
|
||||
target.setDir(holder.dir)
|
||||
sleep(jaunt_in_time)
|
||||
qdel(holder)
|
||||
if(!QDELETED(target))
|
||||
if(mobloc.density)
|
||||
for(var/direction in alldirs)
|
||||
var/turf/T = get_step(mobloc, direction)
|
||||
if(T)
|
||||
if(target.Move(T))
|
||||
break
|
||||
target.canmove = 1
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/ethereal_jaunt/proc/jaunt_steam(mobloc)
|
||||
var/datum/effect_system/steam_spread/steam = new /datum/effect_system/steam_spread()
|
||||
steam.set_up(10, 0, mobloc)
|
||||
steam.start()
|
||||
|
||||
/obj/effect/dummy/spell_jaunt
|
||||
name = "water"
|
||||
icon = 'icons/effects/effects.dmi'
|
||||
icon_state = "nothing"
|
||||
var/reappearing = 0
|
||||
var/movedelay = 0
|
||||
var/movespeed = 2
|
||||
density = 0
|
||||
anchored = 1
|
||||
invisibility = 60
|
||||
resistance_flags = LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
|
||||
|
||||
/obj/effect/dummy/spell_jaunt/Destroy()
|
||||
// Eject contents if deleted somehow
|
||||
for(var/atom/movable/AM in src)
|
||||
AM.forceMove(get_turf(src))
|
||||
return ..()
|
||||
|
||||
/obj/effect/dummy/spell_jaunt/relaymove(mob/user, direction)
|
||||
if((movedelay > world.time) || reappearing || !direction)
|
||||
return
|
||||
var/turf/newLoc = get_step(src,direction)
|
||||
setDir(direction)
|
||||
if(!(newLoc.flags & NOJAUNT))
|
||||
forceMove(newLoc)
|
||||
else
|
||||
to_chat(user, "<span class='warning'>Some strange aura is blocking the way!</span>")
|
||||
movedelay = world.time + movespeed
|
||||
|
||||
/obj/effect/dummy/spell_jaunt/ex_act(blah)
|
||||
return
|
||||
|
||||
/obj/effect/dummy/spell_jaunt/bullet_act(blah)
|
||||
return
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/obj/effect/proc_holder/spell/targeted/explosion
|
||||
name = "Explosion"
|
||||
desc = "This spell explodes an area."
|
||||
|
||||
var/ex_severe = 1
|
||||
var/ex_heavy = 2
|
||||
var/ex_light = 3
|
||||
var/ex_flash = 4
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/explosion/cast(list/targets, mob/user = usr)
|
||||
|
||||
for(var/mob/living/target in targets)
|
||||
explosion(target.loc,ex_severe,ex_heavy,ex_light,ex_flash)
|
||||
|
||||
return
|
||||
/obj/effect/proc_holder/spell/targeted/explosion
|
||||
name = "Explosion"
|
||||
desc = "This spell explodes an area."
|
||||
|
||||
var/ex_severe = 1
|
||||
var/ex_heavy = 2
|
||||
var/ex_light = 3
|
||||
var/ex_flash = 4
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/explosion/cast(list/targets, mob/user = usr)
|
||||
|
||||
for(var/mob/living/target in targets)
|
||||
explosion(target.loc,ex_severe,ex_heavy,ex_light,ex_flash)
|
||||
|
||||
return
|
||||
|
||||
@@ -8,4 +8,4 @@
|
||||
clothes_req = 0
|
||||
cooldown_min = 200 //100 deciseconds reduction per rank
|
||||
|
||||
action_icon_state = "gib"
|
||||
action_icon_state = "gib"
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
/obj/effect/proc_holder/spell/targeted/genetic
|
||||
name = "Genetic"
|
||||
desc = "This spell inflicts a set of mutations and disabilities upon the target."
|
||||
|
||||
var/disabilities = 0 //bits
|
||||
var/list/mutations = list() //mutation strings
|
||||
var/duration = 100 //deciseconds
|
||||
/*
|
||||
Disabilities
|
||||
1st bit - ?
|
||||
2nd bit - ?
|
||||
3rd bit - ?
|
||||
4th bit - ?
|
||||
5th bit - ?
|
||||
6th bit - ?
|
||||
*/
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/genetic/cast(list/targets, mob/user = usr)
|
||||
|
||||
for(var/mob/living/target in targets)
|
||||
for(var/x in mutations)
|
||||
target.mutations.Add(x)
|
||||
/* if(x == HULK && ishuman(target))
|
||||
target:hulk_time=world.time + duration */
|
||||
target.disabilities |= disabilities
|
||||
target.update_mutations() //update target's mutation overlays
|
||||
var/mob/living/carbon/human/H = target
|
||||
if(ishuman(target))
|
||||
H.update_body()
|
||||
spawn(duration)
|
||||
target.mutations.Remove(mutations)
|
||||
target.disabilities &= ~disabilities
|
||||
target.update_mutations()
|
||||
if(ishuman(target))
|
||||
H.update_body()
|
||||
|
||||
return
|
||||
/obj/effect/proc_holder/spell/targeted/genetic
|
||||
name = "Genetic"
|
||||
desc = "This spell inflicts a set of mutations and disabilities upon the target."
|
||||
|
||||
var/disabilities = 0 //bits
|
||||
var/list/mutations = list() //mutation strings
|
||||
var/duration = 100 //deciseconds
|
||||
/*
|
||||
Disabilities
|
||||
1st bit - ?
|
||||
2nd bit - ?
|
||||
3rd bit - ?
|
||||
4th bit - ?
|
||||
5th bit - ?
|
||||
6th bit - ?
|
||||
*/
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/genetic/cast(list/targets, mob/user = usr)
|
||||
|
||||
for(var/mob/living/target in targets)
|
||||
for(var/x in mutations)
|
||||
target.mutations.Add(x)
|
||||
/* if(x == HULK && ishuman(target))
|
||||
target:hulk_time=world.time + duration */
|
||||
target.disabilities |= disabilities
|
||||
target.update_mutations() //update target's mutation overlays
|
||||
var/mob/living/carbon/human/H = target
|
||||
if(ishuman(target))
|
||||
H.update_body()
|
||||
spawn(duration)
|
||||
target.mutations.Remove(mutations)
|
||||
target.disabilities &= ~disabilities
|
||||
target.update_mutations()
|
||||
if(ishuman(target))
|
||||
H.update_body()
|
||||
|
||||
return
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
/obj/effect/proc_holder/spell/targeted/horsemask
|
||||
name = "Curse of the Horseman"
|
||||
desc = "This spell triggers a curse on a target, causing them to wield an unremovable horse head mask. They will speak like a horse! Any masks they are wearing will be disintegrated. This spell does not require robes."
|
||||
school = "transmutation"
|
||||
charge_type = "recharge"
|
||||
charge_max = 150
|
||||
charge_counter = 0
|
||||
clothes_req = 0
|
||||
stat_allowed = 0
|
||||
invocation = "KN'A FTAGHU, PUCK 'BTHNK!"
|
||||
invocation_type = "shout"
|
||||
range = 7
|
||||
cooldown_min = 30 //30 deciseconds reduction per rank
|
||||
selection_type = "range"
|
||||
|
||||
action_icon_state = "barn"
|
||||
sound = 'sound/magic/HorseHead_curse.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/horsemask/cast(list/targets, mob/user = usr)
|
||||
if(!targets.len)
|
||||
to_chat(user, "<span class='notice'>No target found in range.</span>")
|
||||
return
|
||||
|
||||
var/mob/living/carbon/target = targets[1]
|
||||
|
||||
if(!target)
|
||||
return
|
||||
|
||||
|
||||
if(!ishuman(target))
|
||||
to_chat(user, "<span class='notice'>It'd be stupid to curse [target] with a horse's head!</span>")
|
||||
return
|
||||
|
||||
if(!(target in oview(range)))//If they are not in overview after selection.
|
||||
to_chat(user, "<span class='notice'>They are too far away!</span>")
|
||||
return
|
||||
|
||||
var/obj/item/clothing/mask/horsehead/magichead = new /obj/item/clothing/mask/horsehead
|
||||
magichead.flags |= NODROP | DROPDEL //curses!
|
||||
magichead.flags_inv = null //so you can still see their face
|
||||
magichead.voicechange = 1 //NEEEEIIGHH
|
||||
target.visible_message( "<span class='danger'>[target]'s face lights up in fire, and after the event a horse's head takes its place!</span>", \
|
||||
"<span class='danger'>Your face burns up, and shortly after the fire you realise you have the face of a horse!</span>")
|
||||
if(!target.unEquip(target.wear_mask))
|
||||
qdel(target.wear_mask)
|
||||
target.equip_to_slot_if_possible(magichead, slot_wear_mask, 1, 1)
|
||||
|
||||
target.flash_eyes()
|
||||
/obj/effect/proc_holder/spell/targeted/horsemask
|
||||
name = "Curse of the Horseman"
|
||||
desc = "This spell triggers a curse on a target, causing them to wield an unremovable horse head mask. They will speak like a horse! Any masks they are wearing will be disintegrated. This spell does not require robes."
|
||||
school = "transmutation"
|
||||
charge_type = "recharge"
|
||||
charge_max = 150
|
||||
charge_counter = 0
|
||||
clothes_req = 0
|
||||
stat_allowed = 0
|
||||
invocation = "KN'A FTAGHU, PUCK 'BTHNK!"
|
||||
invocation_type = "shout"
|
||||
range = 7
|
||||
cooldown_min = 30 //30 deciseconds reduction per rank
|
||||
selection_type = "range"
|
||||
|
||||
action_icon_state = "barn"
|
||||
sound = 'sound/magic/HorseHead_curse.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/horsemask/cast(list/targets, mob/user = usr)
|
||||
if(!targets.len)
|
||||
to_chat(user, "<span class='notice'>No target found in range.</span>")
|
||||
return
|
||||
|
||||
var/mob/living/carbon/target = targets[1]
|
||||
|
||||
if(!target)
|
||||
return
|
||||
|
||||
|
||||
if(!ishuman(target))
|
||||
to_chat(user, "<span class='notice'>It'd be stupid to curse [target] with a horse's head!</span>")
|
||||
return
|
||||
|
||||
if(!(target in oview(range)))//If they are not in overview after selection.
|
||||
to_chat(user, "<span class='notice'>They are too far away!</span>")
|
||||
return
|
||||
|
||||
var/obj/item/clothing/mask/horsehead/magichead = new /obj/item/clothing/mask/horsehead
|
||||
magichead.flags |= NODROP | DROPDEL //curses!
|
||||
magichead.flags_inv = null //so you can still see their face
|
||||
magichead.voicechange = 1 //NEEEEIIGHH
|
||||
target.visible_message( "<span class='danger'>[target]'s face lights up in fire, and after the event a horse's head takes its place!</span>", \
|
||||
"<span class='danger'>Your face burns up, and shortly after the fire you realise you have the face of a horse!</span>")
|
||||
if(!target.unEquip(target.wear_mask))
|
||||
qdel(target.wear_mask)
|
||||
target.equip_to_slot_if_possible(magichead, slot_wear_mask, 1, 1)
|
||||
|
||||
target.flash_eyes()
|
||||
|
||||
@@ -1,57 +1,57 @@
|
||||
/obj/effect/proc_holder/spell/targeted/inflict_handler
|
||||
name = "Inflict Handler"
|
||||
desc = "This spell blinds and/or destroys/damages/heals and/or weakens/stuns the target."
|
||||
|
||||
var/amt_weakened = 0
|
||||
var/amt_paralysis = 0
|
||||
var/amt_stunned = 0
|
||||
|
||||
//set to negatives for healing
|
||||
var/amt_dam_fire = 0
|
||||
var/amt_dam_brute = 0
|
||||
var/amt_dam_oxy = 0
|
||||
var/amt_dam_tox = 0
|
||||
|
||||
var/amt_eye_blind = 0
|
||||
var/amt_eye_blurry = 0
|
||||
|
||||
var/destroys = "none" //can be "none", "gib" or "disintegrate"
|
||||
|
||||
var/summon_type = null //this will put an obj at the target's location
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/inflict_handler/cast(list/targets, mob/user = usr)
|
||||
|
||||
for(var/mob/living/target in targets)
|
||||
switch(destroys)
|
||||
if("gib")
|
||||
target.gib()
|
||||
if("disintegrate")
|
||||
target.dust()
|
||||
|
||||
if(!target)
|
||||
continue
|
||||
//damage
|
||||
if(amt_dam_brute > 0)
|
||||
if(amt_dam_fire >= 0)
|
||||
target.take_overall_damage(amt_dam_brute,amt_dam_fire)
|
||||
else if(amt_dam_fire < 0)
|
||||
target.take_overall_damage(amt_dam_brute,0)
|
||||
target.heal_overall_damage(0,amt_dam_fire)
|
||||
else if(amt_dam_brute < 0)
|
||||
if(amt_dam_fire > 0)
|
||||
target.take_overall_damage(0,amt_dam_fire)
|
||||
target.heal_overall_damage(amt_dam_brute,0)
|
||||
else if(amt_dam_fire <= 0)
|
||||
target.heal_overall_damage(amt_dam_brute,amt_dam_fire)
|
||||
target.adjustToxLoss(amt_dam_tox)
|
||||
target.adjustOxyLoss(amt_dam_oxy)
|
||||
//disabling
|
||||
target.Weaken(amt_weakened)
|
||||
target.Paralyse(amt_paralysis)
|
||||
target.Stun(amt_stunned)
|
||||
|
||||
target.AdjustEyeBlind(amt_eye_blind)
|
||||
target.AdjustEyeBlurry(amt_eye_blurry)
|
||||
//summoning
|
||||
if(summon_type)
|
||||
new summon_type(target.loc, target)
|
||||
/obj/effect/proc_holder/spell/targeted/inflict_handler
|
||||
name = "Inflict Handler"
|
||||
desc = "This spell blinds and/or destroys/damages/heals and/or weakens/stuns the target."
|
||||
|
||||
var/amt_weakened = 0
|
||||
var/amt_paralysis = 0
|
||||
var/amt_stunned = 0
|
||||
|
||||
//set to negatives for healing
|
||||
var/amt_dam_fire = 0
|
||||
var/amt_dam_brute = 0
|
||||
var/amt_dam_oxy = 0
|
||||
var/amt_dam_tox = 0
|
||||
|
||||
var/amt_eye_blind = 0
|
||||
var/amt_eye_blurry = 0
|
||||
|
||||
var/destroys = "none" //can be "none", "gib" or "disintegrate"
|
||||
|
||||
var/summon_type = null //this will put an obj at the target's location
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/inflict_handler/cast(list/targets, mob/user = usr)
|
||||
|
||||
for(var/mob/living/target in targets)
|
||||
switch(destroys)
|
||||
if("gib")
|
||||
target.gib()
|
||||
if("disintegrate")
|
||||
target.dust()
|
||||
|
||||
if(!target)
|
||||
continue
|
||||
//damage
|
||||
if(amt_dam_brute > 0)
|
||||
if(amt_dam_fire >= 0)
|
||||
target.take_overall_damage(amt_dam_brute,amt_dam_fire)
|
||||
else if(amt_dam_fire < 0)
|
||||
target.take_overall_damage(amt_dam_brute,0)
|
||||
target.heal_overall_damage(0,amt_dam_fire)
|
||||
else if(amt_dam_brute < 0)
|
||||
if(amt_dam_fire > 0)
|
||||
target.take_overall_damage(0,amt_dam_fire)
|
||||
target.heal_overall_damage(amt_dam_brute,0)
|
||||
else if(amt_dam_fire <= 0)
|
||||
target.heal_overall_damage(amt_dam_brute,amt_dam_fire)
|
||||
target.adjustToxLoss(amt_dam_tox)
|
||||
target.adjustOxyLoss(amt_dam_oxy)
|
||||
//disabling
|
||||
target.Weaken(amt_weakened)
|
||||
target.Paralyse(amt_paralysis)
|
||||
target.Stun(amt_stunned)
|
||||
|
||||
target.AdjustEyeBlind(amt_eye_blind)
|
||||
target.AdjustEyeBlurry(amt_eye_blurry)
|
||||
//summoning
|
||||
if(summon_type)
|
||||
new summon_type(target.loc, target)
|
||||
|
||||
+57
-57
@@ -1,57 +1,57 @@
|
||||
/obj/effect/proc_holder/spell/aoe_turf/knock
|
||||
name = "Knock"
|
||||
desc = "This spell opens nearby doors and does not require wizard garb."
|
||||
|
||||
school = "transmutation"
|
||||
charge_max = 100
|
||||
clothes_req = 0
|
||||
invocation = "AULIE OXIN FIERA"
|
||||
invocation_type = "whisper"
|
||||
range = 3
|
||||
cooldown_min = 20 //20 deciseconds reduction per rank
|
||||
|
||||
action_icon_state = "knock"
|
||||
sound = 'sound/magic/knock.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/knock/cast(list/targets, mob/user = usr)
|
||||
for(var/turf/T in targets)
|
||||
for(var/obj/machinery/door/door in T.contents)
|
||||
spawn(1)
|
||||
if(istype(door,/obj/machinery/door/airlock/hatch/gamma))
|
||||
return
|
||||
if(istype(door,/obj/machinery/door/airlock))
|
||||
var/obj/machinery/door/airlock/A = door
|
||||
A.unlock(1) //forced because it's magic!
|
||||
door.open()
|
||||
for(var/obj/structure/closet/C in T.contents)
|
||||
spawn(1)
|
||||
if(istype(C, /obj/structure/closet/secure_closet))
|
||||
var/obj/structure/closet/secure_closet/SC = C
|
||||
SC.locked = 0
|
||||
C.open()
|
||||
|
||||
return
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/knock/greater
|
||||
name = "Greater Knock"
|
||||
desc = "On first cast, will remove access restrictions on all airlocks on the station, and announce this spell's use to the station. On any further cast, will open all doors in sight. Cannot be refunded once bought!"
|
||||
|
||||
charge_max = 200
|
||||
invocation = "MAIOR OXIN FIERA"
|
||||
invocation_type = "shout"
|
||||
range = 7
|
||||
level_max = 0 //Cannot be improved, quality of life since can't be refunded
|
||||
cooldown_min = 200
|
||||
var/used = FALSE
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/knock/greater/cast(list/targets, mob/user = usr)
|
||||
if(!used)
|
||||
used = TRUE
|
||||
for(var/obj/machinery/door/airlock/A in GLOB.airlocks)
|
||||
if(is_station_level(A.z))
|
||||
A.req_access = list()
|
||||
A.req_one_access = list()
|
||||
command_announcement.Announce("We have removed all access requirements on your station's airlocks. You can thank us later!", "Greetings!", 'sound/misc/notice2.ogg', , , "Space Wizard Federation Message")
|
||||
else
|
||||
..()
|
||||
return
|
||||
/obj/effect/proc_holder/spell/aoe_turf/knock
|
||||
name = "Knock"
|
||||
desc = "This spell opens nearby doors and does not require wizard garb."
|
||||
|
||||
school = "transmutation"
|
||||
charge_max = 100
|
||||
clothes_req = 0
|
||||
invocation = "AULIE OXIN FIERA"
|
||||
invocation_type = "whisper"
|
||||
range = 3
|
||||
cooldown_min = 20 //20 deciseconds reduction per rank
|
||||
|
||||
action_icon_state = "knock"
|
||||
sound = 'sound/magic/knock.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/knock/cast(list/targets, mob/user = usr)
|
||||
for(var/turf/T in targets)
|
||||
for(var/obj/machinery/door/door in T.contents)
|
||||
spawn(1)
|
||||
if(istype(door,/obj/machinery/door/airlock/hatch/gamma))
|
||||
return
|
||||
if(istype(door,/obj/machinery/door/airlock))
|
||||
var/obj/machinery/door/airlock/A = door
|
||||
A.unlock(1) //forced because it's magic!
|
||||
door.open()
|
||||
for(var/obj/structure/closet/C in T.contents)
|
||||
spawn(1)
|
||||
if(istype(C, /obj/structure/closet/secure_closet))
|
||||
var/obj/structure/closet/secure_closet/SC = C
|
||||
SC.locked = 0
|
||||
C.open()
|
||||
|
||||
return
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/knock/greater
|
||||
name = "Greater Knock"
|
||||
desc = "On first cast, will remove access restrictions on all airlocks on the station, and announce this spell's use to the station. On any further cast, will open all doors in sight. Cannot be refunded once bought!"
|
||||
|
||||
charge_max = 200
|
||||
invocation = "MAIOR OXIN FIERA"
|
||||
invocation_type = "shout"
|
||||
range = 7
|
||||
level_max = 0 //Cannot be improved, quality of life since can't be refunded
|
||||
cooldown_min = 200
|
||||
var/used = FALSE
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/knock/greater/cast(list/targets, mob/user = usr)
|
||||
if(!used)
|
||||
used = TRUE
|
||||
for(var/obj/machinery/door/airlock/A in GLOB.airlocks)
|
||||
if(is_station_level(A.z))
|
||||
A.req_access = list()
|
||||
A.req_one_access = list()
|
||||
command_announcement.Announce("We have removed all access requirements on your station's airlocks. You can thank us later!", "Greetings!", 'sound/misc/notice2.ogg', , , "Space Wizard Federation Message")
|
||||
else
|
||||
..()
|
||||
return
|
||||
|
||||
@@ -130,4 +130,4 @@
|
||||
H.equip_to_slot_or_del(new /obj/item/clothing/suit/wizrobe/black(H), slot_wear_suit)
|
||||
H.equip_to_slot_or_del(new /obj/item/clothing/head/wizard/black(H), slot_head)
|
||||
H.equip_to_slot_or_del(new /obj/item/clothing/shoes/sandal(H), slot_shoes)
|
||||
H.equip_to_slot_or_del(new /obj/item/clothing/under/color/black(H), slot_w_uniform)
|
||||
H.equip_to_slot_or_del(new /obj/item/clothing/under/color/black(H), slot_w_uniform)
|
||||
|
||||
@@ -117,4 +117,4 @@ obj/effect/proc_holder/spell/targeted/lightning/proc/Reset(mob/user = usr)
|
||||
return
|
||||
var/mob/living/next = pick(possible_targets)
|
||||
if(next)
|
||||
Bolt(current,next,bolt_energy,bounces-1,user) // 5 max bounces
|
||||
Bolt(current,next,bolt_energy,bounces-1,user) // 5 max bounces
|
||||
|
||||
@@ -122,4 +122,4 @@ obj/effect/proc_holder/spell/targeted/magnet/proc/Reset(mob/user = usr)
|
||||
return
|
||||
var/mob/living/next = pick(possible_targets)
|
||||
if(next)
|
||||
Bolt(current,next,bolt_energy,bounces-1,user) // 5 max bounces
|
||||
Bolt(current,next,bolt_energy,bounces-1,user) // 5 max bounces
|
||||
|
||||
@@ -164,4 +164,4 @@
|
||||
/obj/item/spellbook/oneuse/mime/greaterwall
|
||||
spell = /obj/effect/proc_holder/spell/targeted/forcewall/mime
|
||||
spellname = "Invisible Greater Wall"
|
||||
desc = "It contains illustrations of the great walls of human history."
|
||||
desc = "It contains illustrations of the great walls of human history."
|
||||
|
||||
@@ -51,4 +51,4 @@
|
||||
equip_to_slot_if_possible(new /obj/item/clothing/suit/suspenders/nodrop, slot_wear_suit, TRUE, TRUE)
|
||||
dna.SetSEState(MUTEBLOCK , TRUE, TRUE)
|
||||
genemutcheck(src, MUTEBLOCK , null, MUTCHK_FORCED)
|
||||
dna.default_blocks.Add(MUTEBLOCK)
|
||||
dna.default_blocks.Add(MUTEBLOCK)
|
||||
|
||||
@@ -1,82 +1,82 @@
|
||||
/obj/effect/proc_holder/spell/targeted/mind_transfer
|
||||
name = "Mind Transfer"
|
||||
desc = "This spell allows the user to switch bodies with a target."
|
||||
|
||||
school = "transmutation"
|
||||
charge_max = 600
|
||||
clothes_req = 0
|
||||
invocation = "GIN'YU CAPAN"
|
||||
invocation_type = "whisper"
|
||||
range = 1
|
||||
cooldown_min = 200 //100 deciseconds reduction per rank
|
||||
var/list/protected_roles = list("Wizard","Changeling","Cultist") //which roles are immune to the spell
|
||||
var/paralysis_amount_caster = 20 //how much the caster is paralysed for after the spell
|
||||
var/paralysis_amount_victim = 20 //how much the victim is paralysed for after the spell
|
||||
action_icon_state = "mindswap"
|
||||
|
||||
/*
|
||||
Urist: I don't feel like figuring out how you store object spells so I'm leaving this for you to do.
|
||||
Make sure spells that are removed from spell_list are actually removed and deleted when mind transfering.
|
||||
Also, you never added distance checking after target is selected. I've went ahead and did that.
|
||||
*/
|
||||
/obj/effect/proc_holder/spell/targeted/mind_transfer/cast(list/targets, mob/user = usr, distanceoverride)
|
||||
|
||||
var/mob/living/target = targets[range]
|
||||
|
||||
if(!(target in oview(range)) && !distanceoverride)//If they are not in overview after selection. Do note that !() is necessary for in to work because ! takes precedence over it.
|
||||
to_chat(user, "They are too far away!")
|
||||
return
|
||||
|
||||
if(target.stat == DEAD)
|
||||
to_chat(user, "You don't particularly want to be dead.")
|
||||
return
|
||||
|
||||
if(!target.key || !target.mind)
|
||||
to_chat(user, "[target.p_they(TRUE)] appear[target.p_s()] to be catatonic. Not even magic can affect [target.p_their()] vacant mind.")
|
||||
return
|
||||
|
||||
if(user.suiciding)
|
||||
to_chat(user, "<span class='warning'>You're killing yourself! You can't concentrate enough to do this!</span>")
|
||||
return
|
||||
|
||||
if(target.mind.special_role in protected_roles)
|
||||
to_chat(user, "Their mind is resisting your spell.")
|
||||
return
|
||||
|
||||
if(istype(target, /mob/living/silicon))
|
||||
to_chat(user, "You feel this enslaved being is just as dead as its cold, hard exoskeleton.")
|
||||
return
|
||||
|
||||
var/mob/living/victim = target//The target of the spell whos body will be transferred to.
|
||||
var/mob/caster = user//The wizard/whomever doing the body transferring.
|
||||
|
||||
//MIND TRANSFER BEGIN
|
||||
if(caster.mind.special_verbs.len)//If the caster had any special verbs, remove them from the mob verb list.
|
||||
for(var/V in caster.mind.special_verbs)//Since the caster is using an object spell system, this is mostly moot.
|
||||
caster.verbs -= V//But a safety nontheless.
|
||||
|
||||
if(victim.mind.special_verbs.len)//Now remove all of the victim's verbs.
|
||||
for(var/V in victim.mind.special_verbs)
|
||||
victim.verbs -= V
|
||||
|
||||
var/mob/dead/observer/ghost = victim.ghostize(0)
|
||||
caster.mind.transfer_to(victim)
|
||||
|
||||
if(victim.mind.special_verbs.len)//To add all the special verbs for the original caster.
|
||||
for(var/V in caster.mind.special_verbs)//Not too important but could come into play.
|
||||
caster.verbs += V
|
||||
|
||||
ghost.mind.transfer_to(caster)
|
||||
if(ghost.key)
|
||||
GLOB.non_respawnable_keys -= ghost.ckey //ghostizing with an argument of 0 will make them unable to respawn forever, which is bad
|
||||
caster.key = ghost.key //have to transfer the key since the mind was not active
|
||||
qdel(ghost)
|
||||
|
||||
if(caster.mind.special_verbs.len)//If they had any special verbs, we add them here.
|
||||
for(var/V in caster.mind.special_verbs)
|
||||
caster.verbs += V
|
||||
//MIND TRANSFER END
|
||||
|
||||
//Here we paralyze both mobs and knock them out for a time.
|
||||
caster.Paralyse(paralysis_amount_caster)
|
||||
victim.Paralyse(paralysis_amount_victim)
|
||||
/obj/effect/proc_holder/spell/targeted/mind_transfer
|
||||
name = "Mind Transfer"
|
||||
desc = "This spell allows the user to switch bodies with a target."
|
||||
|
||||
school = "transmutation"
|
||||
charge_max = 600
|
||||
clothes_req = 0
|
||||
invocation = "GIN'YU CAPAN"
|
||||
invocation_type = "whisper"
|
||||
range = 1
|
||||
cooldown_min = 200 //100 deciseconds reduction per rank
|
||||
var/list/protected_roles = list("Wizard","Changeling","Cultist") //which roles are immune to the spell
|
||||
var/paralysis_amount_caster = 20 //how much the caster is paralysed for after the spell
|
||||
var/paralysis_amount_victim = 20 //how much the victim is paralysed for after the spell
|
||||
action_icon_state = "mindswap"
|
||||
|
||||
/*
|
||||
Urist: I don't feel like figuring out how you store object spells so I'm leaving this for you to do.
|
||||
Make sure spells that are removed from spell_list are actually removed and deleted when mind transfering.
|
||||
Also, you never added distance checking after target is selected. I've went ahead and did that.
|
||||
*/
|
||||
/obj/effect/proc_holder/spell/targeted/mind_transfer/cast(list/targets, mob/user = usr, distanceoverride)
|
||||
|
||||
var/mob/living/target = targets[range]
|
||||
|
||||
if(!(target in oview(range)) && !distanceoverride)//If they are not in overview after selection. Do note that !() is necessary for in to work because ! takes precedence over it.
|
||||
to_chat(user, "They are too far away!")
|
||||
return
|
||||
|
||||
if(target.stat == DEAD)
|
||||
to_chat(user, "You don't particularly want to be dead.")
|
||||
return
|
||||
|
||||
if(!target.key || !target.mind)
|
||||
to_chat(user, "[target.p_they(TRUE)] appear[target.p_s()] to be catatonic. Not even magic can affect [target.p_their()] vacant mind.")
|
||||
return
|
||||
|
||||
if(user.suiciding)
|
||||
to_chat(user, "<span class='warning'>You're killing yourself! You can't concentrate enough to do this!</span>")
|
||||
return
|
||||
|
||||
if(target.mind.special_role in protected_roles)
|
||||
to_chat(user, "Their mind is resisting your spell.")
|
||||
return
|
||||
|
||||
if(istype(target, /mob/living/silicon))
|
||||
to_chat(user, "You feel this enslaved being is just as dead as its cold, hard exoskeleton.")
|
||||
return
|
||||
|
||||
var/mob/living/victim = target//The target of the spell whos body will be transferred to.
|
||||
var/mob/caster = user//The wizard/whomever doing the body transferring.
|
||||
|
||||
//MIND TRANSFER BEGIN
|
||||
if(caster.mind.special_verbs.len)//If the caster had any special verbs, remove them from the mob verb list.
|
||||
for(var/V in caster.mind.special_verbs)//Since the caster is using an object spell system, this is mostly moot.
|
||||
caster.verbs -= V//But a safety nontheless.
|
||||
|
||||
if(victim.mind.special_verbs.len)//Now remove all of the victim's verbs.
|
||||
for(var/V in victim.mind.special_verbs)
|
||||
victim.verbs -= V
|
||||
|
||||
var/mob/dead/observer/ghost = victim.ghostize(0)
|
||||
caster.mind.transfer_to(victim)
|
||||
|
||||
if(victim.mind.special_verbs.len)//To add all the special verbs for the original caster.
|
||||
for(var/V in caster.mind.special_verbs)//Not too important but could come into play.
|
||||
caster.verbs += V
|
||||
|
||||
ghost.mind.transfer_to(caster)
|
||||
if(ghost.key)
|
||||
GLOB.non_respawnable_keys -= ghost.ckey //ghostizing with an argument of 0 will make them unable to respawn forever, which is bad
|
||||
caster.key = ghost.key //have to transfer the key since the mind was not active
|
||||
qdel(ghost)
|
||||
|
||||
if(caster.mind.special_verbs.len)//If they had any special verbs, we add them here.
|
||||
for(var/V in caster.mind.special_verbs)
|
||||
caster.verbs += V
|
||||
//MIND TRANSFER END
|
||||
|
||||
//Here we paralyze both mobs and knock them out for a time.
|
||||
caster.Paralyse(paralysis_amount_caster)
|
||||
victim.Paralyse(paralysis_amount_victim)
|
||||
|
||||
@@ -1,86 +1,86 @@
|
||||
/obj/effect/proc_holder/spell/targeted/projectile
|
||||
name = "Projectile"
|
||||
desc = "This spell summons projectiles which try to hit the targets."
|
||||
|
||||
var/proj_icon = 'icons/obj/projectiles.dmi'
|
||||
var/proj_icon_state = "spell"
|
||||
var/proj_name = "a spell projectile"
|
||||
|
||||
var/proj_trail = 0 //if it leaves a trail
|
||||
var/proj_trail_lifespan = 0 //deciseconds
|
||||
var/proj_trail_icon = 'icons/obj/wizard.dmi'
|
||||
var/proj_trail_icon_state = "trail"
|
||||
|
||||
var/proj_type = "/obj/effect/proc_holder/spell/targeted" //IMPORTANT use only subtypes of this
|
||||
|
||||
var/proj_lingering = 0 //if it lingers or disappears upon hitting an obstacle
|
||||
var/proj_homing = 1 //if it follows the target
|
||||
var/proj_insubstantial = 0 //if it can pass through dense objects or not
|
||||
var/proj_trigger_range = 0 //the range from target at which the projectile triggers cast(target)
|
||||
|
||||
var/proj_lifespan = 15 //in deciseconds * proj_step_delay
|
||||
var/proj_step_delay = 1 //lower = faster
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/projectile/cast(list/targets, mob/user = usr)
|
||||
|
||||
for(var/mob/living/target in targets)
|
||||
spawn(0)
|
||||
var/obj/effect/proc_holder/spell/targeted/projectile
|
||||
if(istext(proj_type))
|
||||
var/projectile_type = text2path(proj_type)
|
||||
projectile = new projectile_type(user)
|
||||
if(istype(proj_type,/obj/effect/proc_holder/spell))
|
||||
projectile = new /obj/effect/proc_holder/spell/targeted/trigger(user)
|
||||
projectile:linked_spells += proj_type
|
||||
projectile.icon = proj_icon
|
||||
projectile.icon_state = proj_icon_state
|
||||
projectile.dir = get_dir(target,projectile)
|
||||
projectile.name = proj_name
|
||||
|
||||
var/current_loc = user.loc
|
||||
|
||||
projectile.loc = current_loc
|
||||
|
||||
for(var/i = 0,i < proj_lifespan,i++)
|
||||
if(!projectile)
|
||||
break
|
||||
|
||||
if(proj_homing)
|
||||
if(proj_insubstantial)
|
||||
projectile.dir = get_dir(projectile,target)
|
||||
projectile.loc = get_step_to(projectile,target)
|
||||
else
|
||||
step_to(projectile,target)
|
||||
else
|
||||
if(proj_insubstantial)
|
||||
projectile.loc = get_step(projectile,dir)
|
||||
else
|
||||
step(projectile,dir)
|
||||
|
||||
if(!projectile) // step and step_to sleeps so we'll have to check again.
|
||||
break
|
||||
|
||||
if(!proj_lingering && projectile.loc == current_loc) //if it didn't move since last time
|
||||
qdel(projectile)
|
||||
break
|
||||
|
||||
if(proj_trail && projectile)
|
||||
spawn(0)
|
||||
if(projectile)
|
||||
var/obj/effect/overlay/trail = new /obj/effect/overlay(projectile.loc)
|
||||
trail.icon = proj_trail_icon
|
||||
trail.icon_state = proj_trail_icon_state
|
||||
trail.density = 0
|
||||
spawn(proj_trail_lifespan)
|
||||
qdel(trail)
|
||||
|
||||
if(projectile.loc in range(target.loc,proj_trigger_range))
|
||||
projectile.perform(list(target), user = user)
|
||||
break
|
||||
|
||||
current_loc = projectile.loc
|
||||
|
||||
sleep(proj_step_delay)
|
||||
|
||||
if(projectile)
|
||||
qdel(projectile)
|
||||
/obj/effect/proc_holder/spell/targeted/projectile
|
||||
name = "Projectile"
|
||||
desc = "This spell summons projectiles which try to hit the targets."
|
||||
|
||||
var/proj_icon = 'icons/obj/projectiles.dmi'
|
||||
var/proj_icon_state = "spell"
|
||||
var/proj_name = "a spell projectile"
|
||||
|
||||
var/proj_trail = 0 //if it leaves a trail
|
||||
var/proj_trail_lifespan = 0 //deciseconds
|
||||
var/proj_trail_icon = 'icons/obj/wizard.dmi'
|
||||
var/proj_trail_icon_state = "trail"
|
||||
|
||||
var/proj_type = "/obj/effect/proc_holder/spell/targeted" //IMPORTANT use only subtypes of this
|
||||
|
||||
var/proj_lingering = 0 //if it lingers or disappears upon hitting an obstacle
|
||||
var/proj_homing = 1 //if it follows the target
|
||||
var/proj_insubstantial = 0 //if it can pass through dense objects or not
|
||||
var/proj_trigger_range = 0 //the range from target at which the projectile triggers cast(target)
|
||||
|
||||
var/proj_lifespan = 15 //in deciseconds * proj_step_delay
|
||||
var/proj_step_delay = 1 //lower = faster
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/projectile/cast(list/targets, mob/user = usr)
|
||||
|
||||
for(var/mob/living/target in targets)
|
||||
spawn(0)
|
||||
var/obj/effect/proc_holder/spell/targeted/projectile
|
||||
if(istext(proj_type))
|
||||
var/projectile_type = text2path(proj_type)
|
||||
projectile = new projectile_type(user)
|
||||
if(istype(proj_type,/obj/effect/proc_holder/spell))
|
||||
projectile = new /obj/effect/proc_holder/spell/targeted/trigger(user)
|
||||
projectile:linked_spells += proj_type
|
||||
projectile.icon = proj_icon
|
||||
projectile.icon_state = proj_icon_state
|
||||
projectile.dir = get_dir(target,projectile)
|
||||
projectile.name = proj_name
|
||||
|
||||
var/current_loc = user.loc
|
||||
|
||||
projectile.loc = current_loc
|
||||
|
||||
for(var/i = 0,i < proj_lifespan,i++)
|
||||
if(!projectile)
|
||||
break
|
||||
|
||||
if(proj_homing)
|
||||
if(proj_insubstantial)
|
||||
projectile.dir = get_dir(projectile,target)
|
||||
projectile.loc = get_step_to(projectile,target)
|
||||
else
|
||||
step_to(projectile,target)
|
||||
else
|
||||
if(proj_insubstantial)
|
||||
projectile.loc = get_step(projectile,dir)
|
||||
else
|
||||
step(projectile,dir)
|
||||
|
||||
if(!projectile) // step and step_to sleeps so we'll have to check again.
|
||||
break
|
||||
|
||||
if(!proj_lingering && projectile.loc == current_loc) //if it didn't move since last time
|
||||
qdel(projectile)
|
||||
break
|
||||
|
||||
if(proj_trail && projectile)
|
||||
spawn(0)
|
||||
if(projectile)
|
||||
var/obj/effect/overlay/trail = new /obj/effect/overlay(projectile.loc)
|
||||
trail.icon = proj_trail_icon
|
||||
trail.icon_state = proj_trail_icon_state
|
||||
trail.density = 0
|
||||
spawn(proj_trail_lifespan)
|
||||
qdel(trail)
|
||||
|
||||
if(projectile.loc in range(target.loc,proj_trigger_range))
|
||||
projectile.perform(list(target), user = user)
|
||||
break
|
||||
|
||||
current_loc = projectile.loc
|
||||
|
||||
sleep(proj_step_delay)
|
||||
|
||||
if(projectile)
|
||||
qdel(projectile)
|
||||
|
||||
@@ -111,4 +111,4 @@
|
||||
shapeshift_type = /mob/living/simple_animal/hostile/hellhound/greater
|
||||
current_shapes = list(/mob/living/simple_animal/hostile/hellhound/greater)
|
||||
current_casters = list()
|
||||
possible_shapes = list(/mob/living/simple_animal/hostile/hellhound/greater)
|
||||
possible_shapes = list(/mob/living/simple_animal/hostile/hellhound/greater)
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
/obj/effect/proc_holder/spell/targeted/trigger
|
||||
name = "Trigger"
|
||||
desc = "This spell triggers another spell or a few."
|
||||
|
||||
var/list/linked_spells = list() //those are just referenced by the trigger spell and are unaffected by it directly
|
||||
var/list/starting_spells = list() //those are added on New() to contents from default spells and are deleted when the trigger spell is deleted to prevent memory leaks
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/trigger/New()
|
||||
..()
|
||||
|
||||
for(var/spell in starting_spells)
|
||||
var/spell_to_add = text2path(spell)
|
||||
new spell_to_add(src) //should result in adding to contents, needs testing
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/trigger/Destroy()
|
||||
for(var/spell in contents)
|
||||
qdel(spell)
|
||||
linked_spells = null
|
||||
starting_spells = null
|
||||
return ..()
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/trigger/cast(list/targets, mob/user = usr)
|
||||
for(var/mob/living/target in targets)
|
||||
for(var/obj/effect/proc_holder/spell/spell in contents)
|
||||
spell.perform(list(target), 0, user = user)
|
||||
for(var/obj/effect/proc_holder/spell/spell in linked_spells)
|
||||
spell.perform(list(target), 0, user = user)
|
||||
|
||||
return
|
||||
/obj/effect/proc_holder/spell/targeted/trigger
|
||||
name = "Trigger"
|
||||
desc = "This spell triggers another spell or a few."
|
||||
|
||||
var/list/linked_spells = list() //those are just referenced by the trigger spell and are unaffected by it directly
|
||||
var/list/starting_spells = list() //those are added on New() to contents from default spells and are deleted when the trigger spell is deleted to prevent memory leaks
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/trigger/New()
|
||||
..()
|
||||
|
||||
for(var/spell in starting_spells)
|
||||
var/spell_to_add = text2path(spell)
|
||||
new spell_to_add(src) //should result in adding to contents, needs testing
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/trigger/Destroy()
|
||||
for(var/spell in contents)
|
||||
qdel(spell)
|
||||
linked_spells = null
|
||||
starting_spells = null
|
||||
return ..()
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/trigger/cast(list/targets, mob/user = usr)
|
||||
for(var/mob/living/target in targets)
|
||||
for(var/obj/effect/proc_holder/spell/spell in contents)
|
||||
spell.perform(list(target), 0, user = user)
|
||||
for(var/obj/effect/proc_holder/spell/spell in linked_spells)
|
||||
spell.perform(list(target), 0, user = user)
|
||||
|
||||
return
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
/obj/effect/proc_holder/spell/targeted/turf_teleport
|
||||
name = "Turf Teleport"
|
||||
desc = "This spell teleports the target to the turf in range."
|
||||
nonabstract_req = 1
|
||||
|
||||
var/inner_tele_radius = 1
|
||||
var/outer_tele_radius = 2
|
||||
|
||||
var/include_space = 0 //whether it includes space tiles in possible teleport locations
|
||||
var/include_dense = 0 //whether it includes dense tiles in possible teleport locations
|
||||
|
||||
var/sound1 = 'sound/weapons/zapbang.ogg'
|
||||
var/sound2 = 'sound/weapons/zapbang.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/turf_teleport/cast(list/targets,mob/living/user = usr)
|
||||
playsound(get_turf(user), sound1, 50,1)
|
||||
for(var/mob/living/target in targets)
|
||||
var/list/turfs = new/list()
|
||||
for(var/turf/T in range(target,outer_tele_radius))
|
||||
if(T in range(target,inner_tele_radius)) continue
|
||||
if(istype(T,/turf/space) && !include_space) continue
|
||||
if(T.density && !include_dense) continue
|
||||
if(T.x>world.maxx-outer_tele_radius || T.x<outer_tele_radius) continue //putting them at the edge is dumb
|
||||
if(T.y>world.maxy-outer_tele_radius || T.y<outer_tele_radius) continue
|
||||
turfs += T
|
||||
|
||||
if(!turfs.len)
|
||||
var/list/turfs_to_pick_from = list()
|
||||
for(var/turf/T in orange(target,outer_tele_radius))
|
||||
if(!(T in orange(target,inner_tele_radius)))
|
||||
turfs_to_pick_from += T
|
||||
turfs += pick(/turf in turfs_to_pick_from)
|
||||
|
||||
var/turf/picked = pick(turfs)
|
||||
|
||||
if(!picked || !isturf(picked))
|
||||
return
|
||||
|
||||
target.forceMove(picked)
|
||||
playsound(get_turf(user), sound2, 50,1)
|
||||
/obj/effect/proc_holder/spell/targeted/turf_teleport
|
||||
name = "Turf Teleport"
|
||||
desc = "This spell teleports the target to the turf in range."
|
||||
nonabstract_req = 1
|
||||
|
||||
var/inner_tele_radius = 1
|
||||
var/outer_tele_radius = 2
|
||||
|
||||
var/include_space = 0 //whether it includes space tiles in possible teleport locations
|
||||
var/include_dense = 0 //whether it includes dense tiles in possible teleport locations
|
||||
|
||||
var/sound1 = 'sound/weapons/zapbang.ogg'
|
||||
var/sound2 = 'sound/weapons/zapbang.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/turf_teleport/cast(list/targets,mob/living/user = usr)
|
||||
playsound(get_turf(user), sound1, 50,1)
|
||||
for(var/mob/living/target in targets)
|
||||
var/list/turfs = new/list()
|
||||
for(var/turf/T in range(target,outer_tele_radius))
|
||||
if(T in range(target,inner_tele_radius)) continue
|
||||
if(istype(T,/turf/space) && !include_space) continue
|
||||
if(T.density && !include_dense) continue
|
||||
if(T.x>world.maxx-outer_tele_radius || T.x<outer_tele_radius) continue //putting them at the edge is dumb
|
||||
if(T.y>world.maxy-outer_tele_radius || T.y<outer_tele_radius) continue
|
||||
turfs += T
|
||||
|
||||
if(!turfs.len)
|
||||
var/list/turfs_to_pick_from = list()
|
||||
for(var/turf/T in orange(target,outer_tele_radius))
|
||||
if(!(T in orange(target,inner_tele_radius)))
|
||||
turfs_to_pick_from += T
|
||||
turfs += pick(/turf in turfs_to_pick_from)
|
||||
|
||||
var/turf/picked = pick(turfs)
|
||||
|
||||
if(!picked || !isturf(picked))
|
||||
return
|
||||
|
||||
target.forceMove(picked)
|
||||
playsound(get_turf(user), sound2, 50,1)
|
||||
|
||||
+447
-447
@@ -1,447 +1,447 @@
|
||||
/obj/effect/proc_holder/spell/targeted/projectile/magic_missile
|
||||
name = "Magic Missile"
|
||||
desc = "This spell fires several, slow moving, magic projectiles at nearby targets."
|
||||
|
||||
school = "evocation"
|
||||
charge_max = 200
|
||||
clothes_req = 1
|
||||
invocation = "FORTI GY AMA"
|
||||
invocation_type = "shout"
|
||||
range = 7
|
||||
cooldown_min = 60 //35 deciseconds reduction per rank
|
||||
|
||||
max_targets = 0
|
||||
|
||||
proj_icon_state = "magicm"
|
||||
proj_name = "a magic missile"
|
||||
proj_lingering = 1
|
||||
proj_type = "/obj/effect/proc_holder/spell/targeted/inflict_handler/magic_missile"
|
||||
|
||||
proj_lifespan = 20
|
||||
proj_step_delay = 5
|
||||
|
||||
proj_trail = 1
|
||||
proj_trail_lifespan = 5
|
||||
proj_trail_icon_state = "magicmd"
|
||||
|
||||
action_icon_state = "magicm"
|
||||
|
||||
sound = 'sound/magic/magic_missile.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/inflict_handler/magic_missile
|
||||
amt_weakened = 3
|
||||
sound = 'sound/magic/mm_hit.ogg'
|
||||
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/projectile/honk_missile
|
||||
name = "Honk Missile"
|
||||
desc = "This spell fires several, slow moving, magic bikehorns at nearby targets."
|
||||
|
||||
school = "evocation"
|
||||
charge_max = 60
|
||||
clothes_req = 0
|
||||
invocation = "HONK GY AMA"
|
||||
invocation_type = "shout"
|
||||
range = 7
|
||||
cooldown_min = 60 //35 deciseconds reduction per rank
|
||||
|
||||
max_targets = 0
|
||||
|
||||
proj_icon = 'icons/obj/items.dmi'
|
||||
proj_icon_state = "bike_horn"
|
||||
proj_name = "A bike horn"
|
||||
proj_lingering = 1
|
||||
proj_type = "/obj/effect/proc_holder/spell/targeted/inflict_handler/honk_missile"
|
||||
|
||||
proj_lifespan = 20
|
||||
proj_step_delay = 5
|
||||
|
||||
proj_trail_icon = 'icons/obj/items.dmi'
|
||||
proj_trail = 1
|
||||
proj_trail_lifespan = 5
|
||||
proj_trail_icon_state = "bike_horn"
|
||||
|
||||
action_icon_state = "magicm"
|
||||
|
||||
sound = 'sound/items/bikehorn.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/inflict_handler/honk_missile
|
||||
amt_weakened = 3
|
||||
sound = 'sound/items/bikehorn.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/noclothes
|
||||
name = "No Clothes"
|
||||
desc = "This always-on spell allows you to cast magic without your garments."
|
||||
action_icon_state = "no_clothes"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/genetic/mutate
|
||||
name = "Mutate"
|
||||
desc = "This spell causes you to turn into a hulk and gain laser vision for a short while."
|
||||
|
||||
school = "transmutation"
|
||||
charge_max = 400
|
||||
clothes_req = 1
|
||||
invocation = "BIRUZ BENNAR"
|
||||
invocation_type = "shout"
|
||||
message = "<span class='notice'>You feel strong! You feel a pressure building behind your eyes!</span>"
|
||||
range = -1
|
||||
include_user = 1
|
||||
centcom_cancast = 0
|
||||
|
||||
mutations = list(LASER, HULK)
|
||||
duration = 300
|
||||
cooldown_min = 300 //25 deciseconds reduction per rank
|
||||
|
||||
action_icon_state = "mutate"
|
||||
sound = 'sound/magic/mutate.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/genetic/mutate/cast(list/targets, mob/user = usr)
|
||||
for(var/mob/living/target in targets)
|
||||
target.dna.SetSEState(HULKBLOCK, 1)
|
||||
genemutcheck(target, HULKBLOCK, null, MUTCHK_FORCED)
|
||||
spawn(duration)
|
||||
target.dna.SetSEState(HULKBLOCK, 0)
|
||||
genemutcheck(target, HULKBLOCK, null, MUTCHK_FORCED)
|
||||
..()
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/smoke
|
||||
name = "Smoke"
|
||||
desc = "This spell spawns a cloud of choking smoke at your location and does not require wizard garb."
|
||||
|
||||
school = "conjuration"
|
||||
charge_max = 120
|
||||
clothes_req = 0
|
||||
invocation = "none"
|
||||
invocation_type = "none"
|
||||
range = -1
|
||||
include_user = 1
|
||||
cooldown_min = 20 //25 deciseconds reduction per rank
|
||||
|
||||
smoke_spread = 2
|
||||
smoke_amt = 10
|
||||
|
||||
action_icon_state = "smoke"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/emplosion/disable_tech
|
||||
name = "Disable Tech"
|
||||
desc = "This spell disables all weapons, cameras and most other technology in range."
|
||||
charge_max = 400
|
||||
clothes_req = 1
|
||||
invocation = "NEC CANTIO"
|
||||
invocation_type = "shout"
|
||||
range = -1
|
||||
include_user = 1
|
||||
cooldown_min = 200 //50 deciseconds reduction per rank
|
||||
|
||||
emp_heavy = 6
|
||||
emp_light = 10
|
||||
|
||||
sound = 'sound/magic/disable_tech.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/turf_teleport/blink
|
||||
name = "Blink"
|
||||
desc = "This spell randomly teleports you a short distance."
|
||||
|
||||
school = "abjuration"
|
||||
charge_max = 20
|
||||
clothes_req = 1
|
||||
invocation = "none"
|
||||
invocation_type = "none"
|
||||
range = -1
|
||||
include_user = 1
|
||||
cooldown_min = 5 //4 deciseconds reduction per rank
|
||||
|
||||
|
||||
smoke_spread = 1
|
||||
smoke_amt = 1
|
||||
|
||||
inner_tele_radius = 0
|
||||
outer_tele_radius = 6
|
||||
|
||||
centcom_cancast = 0 //prevent people from getting to centcom
|
||||
|
||||
action_icon_state = "blink"
|
||||
|
||||
sound1 = 'sound/magic/blink.ogg'
|
||||
sound2 = 'sound/magic/blink.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/area_teleport/teleport
|
||||
name = "Teleport"
|
||||
desc = "This spell teleports you to a type of area of your selection."
|
||||
|
||||
school = "abjuration"
|
||||
charge_max = 600
|
||||
clothes_req = 1
|
||||
invocation = "SCYAR NILA"
|
||||
invocation_type = "shout"
|
||||
range = -1
|
||||
include_user = 1
|
||||
cooldown_min = 200 //100 deciseconds reduction per rank
|
||||
|
||||
smoke_spread = 1
|
||||
smoke_amt = 5
|
||||
|
||||
action_icon_state = "spell_teleport"
|
||||
|
||||
sound1 = 'sound/magic/teleport_diss.ogg'
|
||||
sound2 = 'sound/magic/teleport_app.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/forcewall
|
||||
name = "Force Wall"
|
||||
desc = "This spell creates a small unbreakable wall that only you can pass through, and does not need wizard garb. Lasts 30 seconds."
|
||||
|
||||
school = "transmutation"
|
||||
charge_max = 100
|
||||
clothes_req = FALSE
|
||||
invocation = "TARCOL MINTI ZHERI"
|
||||
invocation_type = "whisper"
|
||||
sound = 'sound/magic/forcewall.ogg'
|
||||
action_icon_state = "shield"
|
||||
range = -1
|
||||
include_user = TRUE
|
||||
cooldown_min = 50 //12 deciseconds reduction per rank
|
||||
var/wall_type = /obj/effect/forcefield/wizard
|
||||
var/large = FALSE
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/forcewall/cast(list/targets, mob/user = usr)
|
||||
new wall_type(get_turf(user), user)
|
||||
if(large) //Extra THICK
|
||||
if(user.dir == SOUTH || user.dir == NORTH)
|
||||
new wall_type(get_step(user, EAST), user)
|
||||
new wall_type(get_step(user, WEST), user)
|
||||
else
|
||||
new wall_type(get_step(user, NORTH), user)
|
||||
new wall_type(get_step(user, SOUTH), user)
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/forcewall/greater
|
||||
name = "Greater Force Wall"
|
||||
desc = "Create a larger magical barrier that only you can pass through, but requires wizard garb. Lasts 30 seconds."
|
||||
|
||||
clothes_req = TRUE
|
||||
invocation = "TARCOL GRANDI ZHERI"
|
||||
invocation_type = "shout"
|
||||
large = TRUE
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/conjure/timestop
|
||||
name = "Stop Time"
|
||||
desc = "This spell stops time for everyone except for you, allowing you to move freely while your enemies and even projectiles are frozen."
|
||||
charge_max = 500
|
||||
clothes_req = 1
|
||||
invocation = "TOKI WO TOMARE"
|
||||
invocation_type = "shout"
|
||||
range = 0
|
||||
cooldown_min = 100
|
||||
summon_amt = 1
|
||||
action_icon_state = "time"
|
||||
|
||||
summon_type = list(/obj/effect/timestop/wizard)
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/conjure/carp
|
||||
name = "Summon Carp"
|
||||
desc = "This spell conjures a simple carp."
|
||||
|
||||
school = "conjuration"
|
||||
charge_max = 1200
|
||||
clothes_req = 1
|
||||
invocation = "NOUK FHUNMM SACP RISSKA"
|
||||
invocation_type = "shout"
|
||||
range = 1
|
||||
|
||||
summon_type = list(/mob/living/simple_animal/hostile/carp)
|
||||
|
||||
cast_sound = 'sound/magic/summon_karp.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/conjure/construct
|
||||
name = "Artificer"
|
||||
desc = "This spell conjures a construct which may be controlled by Shades"
|
||||
|
||||
school = "conjuration"
|
||||
charge_max = 600
|
||||
clothes_req = 0
|
||||
invocation = "none"
|
||||
invocation_type = "none"
|
||||
range = 0
|
||||
|
||||
summon_type = list(/obj/structure/constructshell)
|
||||
|
||||
action_icon_state = "artificer"
|
||||
cast_sound = 'sound/magic/summonitems_generic.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/conjure/creature
|
||||
name = "Summon Creature Swarm"
|
||||
desc = "This spell tears the fabric of reality, allowing horrific daemons to spill forth"
|
||||
|
||||
school = "conjuration"
|
||||
charge_max = 1200
|
||||
clothes_req = 0
|
||||
invocation = "IA IA"
|
||||
invocation_type = "shout"
|
||||
summon_amt = 10
|
||||
range = 3
|
||||
|
||||
summon_type = list(/mob/living/simple_animal/hostile/creature)
|
||||
cast_sound = 'sound/magic/summonitems_generic.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/trigger/blind
|
||||
name = "Blind"
|
||||
desc = "This spell temporarily blinds a single person and does not require wizard garb."
|
||||
|
||||
school = "transmutation"
|
||||
charge_max = 300
|
||||
clothes_req = 0
|
||||
invocation = "STI KALY"
|
||||
invocation_type = "whisper"
|
||||
message = "<span class='notice'>Your eyes cry out in pain!</span>"
|
||||
cooldown_min = 50 //12 deciseconds reduction per rank
|
||||
|
||||
starting_spells = list("/obj/effect/proc_holder/spell/targeted/inflict_handler/blind","/obj/effect/proc_holder/spell/targeted/genetic/blind")
|
||||
|
||||
action_icon_state = "blind"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/inflict_handler/blind
|
||||
amt_eye_blind = 10
|
||||
amt_eye_blurry = 20
|
||||
sound = 'sound/magic/blind.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/genetic/blind
|
||||
disabilities = BLIND
|
||||
duration = 300
|
||||
sound = 'sound/magic/blind.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/fireball
|
||||
name = "Fireball"
|
||||
desc = "This spell fires a fireball at a target and does not require wizard garb."
|
||||
|
||||
school = "evocation"
|
||||
charge_max = 60
|
||||
clothes_req = 0
|
||||
invocation = "ONI SOMA"
|
||||
invocation_type = "shout"
|
||||
range = 20
|
||||
cooldown_min = 20 //10 deciseconds reduction per rank
|
||||
var/fireball_type = /obj/item/projectile/magic/fireball
|
||||
action_icon_state = "fireball0"
|
||||
sound = 'sound/magic/fireball.ogg'
|
||||
|
||||
active = FALSE
|
||||
|
||||
/obj/effect/proc_holder/spell/fireball/Click()
|
||||
var/mob/living/user = usr
|
||||
if(!istype(user))
|
||||
return
|
||||
|
||||
var/msg
|
||||
|
||||
if(!can_cast(user))
|
||||
msg = "<span class='warning'>You can no longer cast Fireball.</span>"
|
||||
remove_ranged_ability(user, msg)
|
||||
return
|
||||
|
||||
if(active)
|
||||
msg = "<span class='notice'>You extinguish your fireball...for now.</span>"
|
||||
remove_ranged_ability(user, msg)
|
||||
else
|
||||
msg = "<span class='notice'>Your prepare to cast your fireball spell! <B>Left-click to cast at a target!</B></span>"
|
||||
add_ranged_ability(user, msg)
|
||||
|
||||
/obj/effect/proc_holder/spell/fireball/update_icon()
|
||||
if(!action)
|
||||
return
|
||||
action.button_icon_state = "fireball[active]"
|
||||
action.UpdateButtonIcon()
|
||||
|
||||
/obj/effect/proc_holder/spell/fireball/InterceptClickOn(mob/living/user, params, atom/target)
|
||||
if(..())
|
||||
return FALSE
|
||||
|
||||
if(!cast_check(0, user))
|
||||
remove_ranged_ability(user)
|
||||
return FALSE
|
||||
|
||||
var/list/targets = list(target)
|
||||
perform(targets, user = user)
|
||||
|
||||
return TRUE
|
||||
|
||||
/obj/effect/proc_holder/spell/fireball/cast(list/targets, mob/living/user = usr)
|
||||
var/target = targets[1] //There is only ever one target for fireball
|
||||
var/turf/T = user.loc
|
||||
var/turf/U = get_step(user, user.dir) // Get the tile infront of the move, based on their direction
|
||||
if(!isturf(U) || !isturf(T))
|
||||
return 0
|
||||
|
||||
var/obj/item/projectile/magic/fireball/FB = new fireball_type(user.loc)
|
||||
FB.current = get_turf(user)
|
||||
FB.preparePixelProjectile(target, get_turf(target), user)
|
||||
FB.fire()
|
||||
user.newtonian_move(get_dir(U, T))
|
||||
remove_ranged_ability(user)
|
||||
|
||||
return 1
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/repulse
|
||||
name = "Repulse"
|
||||
desc = "This spell throws everything around the user away."
|
||||
charge_max = 400
|
||||
clothes_req = TRUE
|
||||
invocation = "GITTAH WEIGH"
|
||||
invocation_type = "shout"
|
||||
range = 5
|
||||
cooldown_min = 150
|
||||
selection_type = "view"
|
||||
sound = 'sound/magic/repulse.ogg'
|
||||
var/maxthrow = 5
|
||||
var/sparkle_path = /obj/effect/temp_visual/gravpush
|
||||
action_icon_state = "repulse"
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/repulse/cast(list/targets, mob/user = usr, stun_amt = 2)
|
||||
var/list/thrownatoms = list()
|
||||
var/atom/throwtarget
|
||||
var/distfromcaster
|
||||
playMagSound()
|
||||
for(var/turf/T in targets) //Done this way so things don't get thrown all around hilariously.
|
||||
for(var/atom/movable/AM in T)
|
||||
thrownatoms += AM
|
||||
|
||||
for(var/am in thrownatoms)
|
||||
var/atom/movable/AM = am
|
||||
if(AM == user || AM.anchored)
|
||||
continue
|
||||
|
||||
throwtarget = get_edge_target_turf(user, get_dir(user, get_step_away(AM, user)))
|
||||
distfromcaster = get_dist(user, AM)
|
||||
if(distfromcaster == 0)
|
||||
if(isliving(AM))
|
||||
var/mob/living/M = AM
|
||||
M.Weaken(5)
|
||||
M.adjustBruteLoss(5)
|
||||
to_chat(M, "<span class='userdanger'>You're slammed into the floor by a mystical force!</span>")
|
||||
else
|
||||
new sparkle_path(get_turf(AM), get_dir(user, AM)) //created sparkles will disappear on their own
|
||||
if(isliving(AM))
|
||||
var/mob/living/M = AM
|
||||
M.Weaken(stun_amt)
|
||||
to_chat(M, "<span class='userdanger'>You're thrown back by a mystical force!</span>")
|
||||
spawn(0)
|
||||
AM.throw_at(throwtarget, ((Clamp((maxthrow - (Clamp(distfromcaster - 2, 0, distfromcaster))), 3, maxthrow))), 1)//So stuff gets tossed around at the same time.
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/sacred_flame
|
||||
name = "Sacred Flame"
|
||||
desc = "Makes everyone around you more flammable, and lights yourself on fire."
|
||||
charge_max = 60
|
||||
clothes_req = 0
|
||||
invocation = "FI'RAN DADISKO"
|
||||
invocation_type = "shout"
|
||||
max_targets = 0
|
||||
range = 6
|
||||
include_user = 1
|
||||
selection_type = "view"
|
||||
action_icon_state = "sacredflame"
|
||||
sound = 'sound/magic/fireball.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/sacred_flame/cast(list/targets, mob/user = usr)
|
||||
for(var/mob/living/L in targets)
|
||||
L.adjust_fire_stacks(20)
|
||||
if(isliving(user))
|
||||
var/mob/living/U = user
|
||||
U.IgniteMob()
|
||||
/obj/effect/proc_holder/spell/targeted/projectile/magic_missile
|
||||
name = "Magic Missile"
|
||||
desc = "This spell fires several, slow moving, magic projectiles at nearby targets."
|
||||
|
||||
school = "evocation"
|
||||
charge_max = 200
|
||||
clothes_req = 1
|
||||
invocation = "FORTI GY AMA"
|
||||
invocation_type = "shout"
|
||||
range = 7
|
||||
cooldown_min = 60 //35 deciseconds reduction per rank
|
||||
|
||||
max_targets = 0
|
||||
|
||||
proj_icon_state = "magicm"
|
||||
proj_name = "a magic missile"
|
||||
proj_lingering = 1
|
||||
proj_type = "/obj/effect/proc_holder/spell/targeted/inflict_handler/magic_missile"
|
||||
|
||||
proj_lifespan = 20
|
||||
proj_step_delay = 5
|
||||
|
||||
proj_trail = 1
|
||||
proj_trail_lifespan = 5
|
||||
proj_trail_icon_state = "magicmd"
|
||||
|
||||
action_icon_state = "magicm"
|
||||
|
||||
sound = 'sound/magic/magic_missile.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/inflict_handler/magic_missile
|
||||
amt_weakened = 3
|
||||
sound = 'sound/magic/mm_hit.ogg'
|
||||
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/projectile/honk_missile
|
||||
name = "Honk Missile"
|
||||
desc = "This spell fires several, slow moving, magic bikehorns at nearby targets."
|
||||
|
||||
school = "evocation"
|
||||
charge_max = 60
|
||||
clothes_req = 0
|
||||
invocation = "HONK GY AMA"
|
||||
invocation_type = "shout"
|
||||
range = 7
|
||||
cooldown_min = 60 //35 deciseconds reduction per rank
|
||||
|
||||
max_targets = 0
|
||||
|
||||
proj_icon = 'icons/obj/items.dmi'
|
||||
proj_icon_state = "bike_horn"
|
||||
proj_name = "A bike horn"
|
||||
proj_lingering = 1
|
||||
proj_type = "/obj/effect/proc_holder/spell/targeted/inflict_handler/honk_missile"
|
||||
|
||||
proj_lifespan = 20
|
||||
proj_step_delay = 5
|
||||
|
||||
proj_trail_icon = 'icons/obj/items.dmi'
|
||||
proj_trail = 1
|
||||
proj_trail_lifespan = 5
|
||||
proj_trail_icon_state = "bike_horn"
|
||||
|
||||
action_icon_state = "magicm"
|
||||
|
||||
sound = 'sound/items/bikehorn.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/inflict_handler/honk_missile
|
||||
amt_weakened = 3
|
||||
sound = 'sound/items/bikehorn.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/noclothes
|
||||
name = "No Clothes"
|
||||
desc = "This always-on spell allows you to cast magic without your garments."
|
||||
action_icon_state = "no_clothes"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/genetic/mutate
|
||||
name = "Mutate"
|
||||
desc = "This spell causes you to turn into a hulk and gain laser vision for a short while."
|
||||
|
||||
school = "transmutation"
|
||||
charge_max = 400
|
||||
clothes_req = 1
|
||||
invocation = "BIRUZ BENNAR"
|
||||
invocation_type = "shout"
|
||||
message = "<span class='notice'>You feel strong! You feel a pressure building behind your eyes!</span>"
|
||||
range = -1
|
||||
include_user = 1
|
||||
centcom_cancast = 0
|
||||
|
||||
mutations = list(LASER, HULK)
|
||||
duration = 300
|
||||
cooldown_min = 300 //25 deciseconds reduction per rank
|
||||
|
||||
action_icon_state = "mutate"
|
||||
sound = 'sound/magic/mutate.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/genetic/mutate/cast(list/targets, mob/user = usr)
|
||||
for(var/mob/living/target in targets)
|
||||
target.dna.SetSEState(HULKBLOCK, 1)
|
||||
genemutcheck(target, HULKBLOCK, null, MUTCHK_FORCED)
|
||||
spawn(duration)
|
||||
target.dna.SetSEState(HULKBLOCK, 0)
|
||||
genemutcheck(target, HULKBLOCK, null, MUTCHK_FORCED)
|
||||
..()
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/smoke
|
||||
name = "Smoke"
|
||||
desc = "This spell spawns a cloud of choking smoke at your location and does not require wizard garb."
|
||||
|
||||
school = "conjuration"
|
||||
charge_max = 120
|
||||
clothes_req = 0
|
||||
invocation = "none"
|
||||
invocation_type = "none"
|
||||
range = -1
|
||||
include_user = 1
|
||||
cooldown_min = 20 //25 deciseconds reduction per rank
|
||||
|
||||
smoke_spread = 2
|
||||
smoke_amt = 10
|
||||
|
||||
action_icon_state = "smoke"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/emplosion/disable_tech
|
||||
name = "Disable Tech"
|
||||
desc = "This spell disables all weapons, cameras and most other technology in range."
|
||||
charge_max = 400
|
||||
clothes_req = 1
|
||||
invocation = "NEC CANTIO"
|
||||
invocation_type = "shout"
|
||||
range = -1
|
||||
include_user = 1
|
||||
cooldown_min = 200 //50 deciseconds reduction per rank
|
||||
|
||||
emp_heavy = 6
|
||||
emp_light = 10
|
||||
|
||||
sound = 'sound/magic/disable_tech.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/turf_teleport/blink
|
||||
name = "Blink"
|
||||
desc = "This spell randomly teleports you a short distance."
|
||||
|
||||
school = "abjuration"
|
||||
charge_max = 20
|
||||
clothes_req = 1
|
||||
invocation = "none"
|
||||
invocation_type = "none"
|
||||
range = -1
|
||||
include_user = 1
|
||||
cooldown_min = 5 //4 deciseconds reduction per rank
|
||||
|
||||
|
||||
smoke_spread = 1
|
||||
smoke_amt = 1
|
||||
|
||||
inner_tele_radius = 0
|
||||
outer_tele_radius = 6
|
||||
|
||||
centcom_cancast = 0 //prevent people from getting to centcom
|
||||
|
||||
action_icon_state = "blink"
|
||||
|
||||
sound1 = 'sound/magic/blink.ogg'
|
||||
sound2 = 'sound/magic/blink.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/area_teleport/teleport
|
||||
name = "Teleport"
|
||||
desc = "This spell teleports you to a type of area of your selection."
|
||||
|
||||
school = "abjuration"
|
||||
charge_max = 600
|
||||
clothes_req = 1
|
||||
invocation = "SCYAR NILA"
|
||||
invocation_type = "shout"
|
||||
range = -1
|
||||
include_user = 1
|
||||
cooldown_min = 200 //100 deciseconds reduction per rank
|
||||
|
||||
smoke_spread = 1
|
||||
smoke_amt = 5
|
||||
|
||||
action_icon_state = "spell_teleport"
|
||||
|
||||
sound1 = 'sound/magic/teleport_diss.ogg'
|
||||
sound2 = 'sound/magic/teleport_app.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/forcewall
|
||||
name = "Force Wall"
|
||||
desc = "This spell creates a small unbreakable wall that only you can pass through, and does not need wizard garb. Lasts 30 seconds."
|
||||
|
||||
school = "transmutation"
|
||||
charge_max = 100
|
||||
clothes_req = FALSE
|
||||
invocation = "TARCOL MINTI ZHERI"
|
||||
invocation_type = "whisper"
|
||||
sound = 'sound/magic/forcewall.ogg'
|
||||
action_icon_state = "shield"
|
||||
range = -1
|
||||
include_user = TRUE
|
||||
cooldown_min = 50 //12 deciseconds reduction per rank
|
||||
var/wall_type = /obj/effect/forcefield/wizard
|
||||
var/large = FALSE
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/forcewall/cast(list/targets, mob/user = usr)
|
||||
new wall_type(get_turf(user), user)
|
||||
if(large) //Extra THICK
|
||||
if(user.dir == SOUTH || user.dir == NORTH)
|
||||
new wall_type(get_step(user, EAST), user)
|
||||
new wall_type(get_step(user, WEST), user)
|
||||
else
|
||||
new wall_type(get_step(user, NORTH), user)
|
||||
new wall_type(get_step(user, SOUTH), user)
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/forcewall/greater
|
||||
name = "Greater Force Wall"
|
||||
desc = "Create a larger magical barrier that only you can pass through, but requires wizard garb. Lasts 30 seconds."
|
||||
|
||||
clothes_req = TRUE
|
||||
invocation = "TARCOL GRANDI ZHERI"
|
||||
invocation_type = "shout"
|
||||
large = TRUE
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/conjure/timestop
|
||||
name = "Stop Time"
|
||||
desc = "This spell stops time for everyone except for you, allowing you to move freely while your enemies and even projectiles are frozen."
|
||||
charge_max = 500
|
||||
clothes_req = 1
|
||||
invocation = "TOKI WO TOMARE"
|
||||
invocation_type = "shout"
|
||||
range = 0
|
||||
cooldown_min = 100
|
||||
summon_amt = 1
|
||||
action_icon_state = "time"
|
||||
|
||||
summon_type = list(/obj/effect/timestop/wizard)
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/conjure/carp
|
||||
name = "Summon Carp"
|
||||
desc = "This spell conjures a simple carp."
|
||||
|
||||
school = "conjuration"
|
||||
charge_max = 1200
|
||||
clothes_req = 1
|
||||
invocation = "NOUK FHUNMM SACP RISSKA"
|
||||
invocation_type = "shout"
|
||||
range = 1
|
||||
|
||||
summon_type = list(/mob/living/simple_animal/hostile/carp)
|
||||
|
||||
cast_sound = 'sound/magic/summon_karp.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/conjure/construct
|
||||
name = "Artificer"
|
||||
desc = "This spell conjures a construct which may be controlled by Shades"
|
||||
|
||||
school = "conjuration"
|
||||
charge_max = 600
|
||||
clothes_req = 0
|
||||
invocation = "none"
|
||||
invocation_type = "none"
|
||||
range = 0
|
||||
|
||||
summon_type = list(/obj/structure/constructshell)
|
||||
|
||||
action_icon_state = "artificer"
|
||||
cast_sound = 'sound/magic/summonitems_generic.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/conjure/creature
|
||||
name = "Summon Creature Swarm"
|
||||
desc = "This spell tears the fabric of reality, allowing horrific daemons to spill forth"
|
||||
|
||||
school = "conjuration"
|
||||
charge_max = 1200
|
||||
clothes_req = 0
|
||||
invocation = "IA IA"
|
||||
invocation_type = "shout"
|
||||
summon_amt = 10
|
||||
range = 3
|
||||
|
||||
summon_type = list(/mob/living/simple_animal/hostile/creature)
|
||||
cast_sound = 'sound/magic/summonitems_generic.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/trigger/blind
|
||||
name = "Blind"
|
||||
desc = "This spell temporarily blinds a single person and does not require wizard garb."
|
||||
|
||||
school = "transmutation"
|
||||
charge_max = 300
|
||||
clothes_req = 0
|
||||
invocation = "STI KALY"
|
||||
invocation_type = "whisper"
|
||||
message = "<span class='notice'>Your eyes cry out in pain!</span>"
|
||||
cooldown_min = 50 //12 deciseconds reduction per rank
|
||||
|
||||
starting_spells = list("/obj/effect/proc_holder/spell/targeted/inflict_handler/blind","/obj/effect/proc_holder/spell/targeted/genetic/blind")
|
||||
|
||||
action_icon_state = "blind"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/inflict_handler/blind
|
||||
amt_eye_blind = 10
|
||||
amt_eye_blurry = 20
|
||||
sound = 'sound/magic/blind.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/genetic/blind
|
||||
disabilities = BLIND
|
||||
duration = 300
|
||||
sound = 'sound/magic/blind.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/fireball
|
||||
name = "Fireball"
|
||||
desc = "This spell fires a fireball at a target and does not require wizard garb."
|
||||
|
||||
school = "evocation"
|
||||
charge_max = 60
|
||||
clothes_req = 0
|
||||
invocation = "ONI SOMA"
|
||||
invocation_type = "shout"
|
||||
range = 20
|
||||
cooldown_min = 20 //10 deciseconds reduction per rank
|
||||
var/fireball_type = /obj/item/projectile/magic/fireball
|
||||
action_icon_state = "fireball0"
|
||||
sound = 'sound/magic/fireball.ogg'
|
||||
|
||||
active = FALSE
|
||||
|
||||
/obj/effect/proc_holder/spell/fireball/Click()
|
||||
var/mob/living/user = usr
|
||||
if(!istype(user))
|
||||
return
|
||||
|
||||
var/msg
|
||||
|
||||
if(!can_cast(user))
|
||||
msg = "<span class='warning'>You can no longer cast Fireball.</span>"
|
||||
remove_ranged_ability(user, msg)
|
||||
return
|
||||
|
||||
if(active)
|
||||
msg = "<span class='notice'>You extinguish your fireball...for now.</span>"
|
||||
remove_ranged_ability(user, msg)
|
||||
else
|
||||
msg = "<span class='notice'>Your prepare to cast your fireball spell! <B>Left-click to cast at a target!</B></span>"
|
||||
add_ranged_ability(user, msg)
|
||||
|
||||
/obj/effect/proc_holder/spell/fireball/update_icon()
|
||||
if(!action)
|
||||
return
|
||||
action.button_icon_state = "fireball[active]"
|
||||
action.UpdateButtonIcon()
|
||||
|
||||
/obj/effect/proc_holder/spell/fireball/InterceptClickOn(mob/living/user, params, atom/target)
|
||||
if(..())
|
||||
return FALSE
|
||||
|
||||
if(!cast_check(0, user))
|
||||
remove_ranged_ability(user)
|
||||
return FALSE
|
||||
|
||||
var/list/targets = list(target)
|
||||
perform(targets, user = user)
|
||||
|
||||
return TRUE
|
||||
|
||||
/obj/effect/proc_holder/spell/fireball/cast(list/targets, mob/living/user = usr)
|
||||
var/target = targets[1] //There is only ever one target for fireball
|
||||
var/turf/T = user.loc
|
||||
var/turf/U = get_step(user, user.dir) // Get the tile infront of the move, based on their direction
|
||||
if(!isturf(U) || !isturf(T))
|
||||
return 0
|
||||
|
||||
var/obj/item/projectile/magic/fireball/FB = new fireball_type(user.loc)
|
||||
FB.current = get_turf(user)
|
||||
FB.preparePixelProjectile(target, get_turf(target), user)
|
||||
FB.fire()
|
||||
user.newtonian_move(get_dir(U, T))
|
||||
remove_ranged_ability(user)
|
||||
|
||||
return 1
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/repulse
|
||||
name = "Repulse"
|
||||
desc = "This spell throws everything around the user away."
|
||||
charge_max = 400
|
||||
clothes_req = TRUE
|
||||
invocation = "GITTAH WEIGH"
|
||||
invocation_type = "shout"
|
||||
range = 5
|
||||
cooldown_min = 150
|
||||
selection_type = "view"
|
||||
sound = 'sound/magic/repulse.ogg'
|
||||
var/maxthrow = 5
|
||||
var/sparkle_path = /obj/effect/temp_visual/gravpush
|
||||
action_icon_state = "repulse"
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/repulse/cast(list/targets, mob/user = usr, stun_amt = 2)
|
||||
var/list/thrownatoms = list()
|
||||
var/atom/throwtarget
|
||||
var/distfromcaster
|
||||
playMagSound()
|
||||
for(var/turf/T in targets) //Done this way so things don't get thrown all around hilariously.
|
||||
for(var/atom/movable/AM in T)
|
||||
thrownatoms += AM
|
||||
|
||||
for(var/am in thrownatoms)
|
||||
var/atom/movable/AM = am
|
||||
if(AM == user || AM.anchored)
|
||||
continue
|
||||
|
||||
throwtarget = get_edge_target_turf(user, get_dir(user, get_step_away(AM, user)))
|
||||
distfromcaster = get_dist(user, AM)
|
||||
if(distfromcaster == 0)
|
||||
if(isliving(AM))
|
||||
var/mob/living/M = AM
|
||||
M.Weaken(5)
|
||||
M.adjustBruteLoss(5)
|
||||
to_chat(M, "<span class='userdanger'>You're slammed into the floor by a mystical force!</span>")
|
||||
else
|
||||
new sparkle_path(get_turf(AM), get_dir(user, AM)) //created sparkles will disappear on their own
|
||||
if(isliving(AM))
|
||||
var/mob/living/M = AM
|
||||
M.Weaken(stun_amt)
|
||||
to_chat(M, "<span class='userdanger'>You're thrown back by a mystical force!</span>")
|
||||
spawn(0)
|
||||
AM.throw_at(throwtarget, ((Clamp((maxthrow - (Clamp(distfromcaster - 2, 0, distfromcaster))), 3, maxthrow))), 1)//So stuff gets tossed around at the same time.
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/sacred_flame
|
||||
name = "Sacred Flame"
|
||||
desc = "Makes everyone around you more flammable, and lights yourself on fire."
|
||||
charge_max = 60
|
||||
clothes_req = 0
|
||||
invocation = "FI'RAN DADISKO"
|
||||
invocation_type = "shout"
|
||||
max_targets = 0
|
||||
range = 6
|
||||
include_user = 1
|
||||
selection_type = "view"
|
||||
action_icon_state = "sacredflame"
|
||||
sound = 'sound/magic/fireball.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/sacred_flame/cast(list/targets, mob/user = usr)
|
||||
for(var/mob/living/L in targets)
|
||||
L.adjust_fire_stacks(20)
|
||||
if(isliving(user))
|
||||
var/mob/living/U = user
|
||||
U.IgniteMob()
|
||||
|
||||
@@ -30,4 +30,4 @@ INITIALIZE_IMMEDIATE(/obj/effect/statclick)
|
||||
class = "unknown"
|
||||
|
||||
usr.client.debug_variables(target)
|
||||
message_admins("Admin [key_name_admin(usr)] is debugging the [target] [class].")
|
||||
message_admins("Admin [key_name_admin(usr)] is debugging the [target] [class].")
|
||||
|
||||
@@ -229,4 +229,4 @@
|
||||
return TRUE
|
||||
|
||||
/datum/status_effect/regenerative_core/on_remove()
|
||||
owner.status_flags &= ~IGNORESLOWDOWN
|
||||
owner.status_flags &= ~IGNORESLOWDOWN
|
||||
|
||||
@@ -112,4 +112,4 @@
|
||||
playsound(T, "desceration", 200, 1, -1)
|
||||
owner.adjustBruteLoss(bleed_damage)
|
||||
else
|
||||
new /obj/effect/temp_visual/bleed(get_turf(owner))
|
||||
new /obj/effect/temp_visual/bleed(get_turf(owner))
|
||||
|
||||
@@ -43,4 +43,4 @@
|
||||
|
||||
/datum/status_effect/freon/watcher
|
||||
duration = 8
|
||||
can_melt = FALSE
|
||||
can_melt = FALSE
|
||||
|
||||
@@ -44,4 +44,4 @@
|
||||
alert_type = null
|
||||
|
||||
/datum/status_effect/high_five/on_remove()
|
||||
owner.visible_message("[owner] was left hanging....")
|
||||
owner.visible_message("[owner] was left hanging....")
|
||||
|
||||
@@ -234,4 +234,4 @@
|
||||
owner.cut_overlay(status_overlay)
|
||||
owner.underlays -= status_underlay
|
||||
QDEL_NULL(status_overlay)
|
||||
return ..()
|
||||
return ..()
|
||||
|
||||
@@ -105,4 +105,4 @@
|
||||
|
||||
aesthetic = TRUE
|
||||
|
||||
probability = 10
|
||||
probability = 10
|
||||
|
||||
@@ -61,4 +61,4 @@
|
||||
post_status("alert", "radiation")
|
||||
else
|
||||
post_status("blank")
|
||||
post_status("shuttle")
|
||||
post_status("shuttle")
|
||||
|
||||
@@ -91,4 +91,4 @@
|
||||
else
|
||||
if(A.aidisabled == 1)
|
||||
A.aidisabled = 0
|
||||
..()
|
||||
..()
|
||||
|
||||
@@ -71,4 +71,4 @@
|
||||
/datum/wires/autolathe/proc/updateUIs()
|
||||
SSnanoui.update_uis(src)
|
||||
if(holder)
|
||||
SSnanoui.update_uis(holder)
|
||||
SSnanoui.update_uis(holder)
|
||||
|
||||
@@ -58,4 +58,4 @@
|
||||
if(IsIndexCut(CAMERA_WIRE_POWER) && IsIndexCut(CAMERA_WIRE_FOCUS))
|
||||
return TRUE
|
||||
else
|
||||
return FALSE
|
||||
return FALSE
|
||||
|
||||
@@ -87,4 +87,4 @@
|
||||
return !(wires_status & MULEBOT_WIRE_REMOTE_RX)
|
||||
|
||||
/datum/wires/mulebot/proc/BeaconRX()
|
||||
return !(wires_status & MULEBOT_WIRE_BEACON_RX)
|
||||
return !(wires_status & MULEBOT_WIRE_BEACON_RX)
|
||||
|
||||
@@ -79,4 +79,4 @@
|
||||
/datum/wires/nuclearbomb/proc/updateUIs()
|
||||
SSnanoui.update_uis(src)
|
||||
if(holder)
|
||||
SSnanoui.update_uis(holder)
|
||||
SSnanoui.update_uis(holder)
|
||||
|
||||
@@ -64,4 +64,4 @@
|
||||
C.strength_upper_limit = (mended ? 2 : 3)
|
||||
if(C.strength_upper_limit < C.strength)
|
||||
C.remove_strength()
|
||||
..()
|
||||
..()
|
||||
|
||||
@@ -103,4 +103,4 @@
|
||||
return wires_status & BORG_WIRE_LAWCHECK
|
||||
|
||||
/datum/wires/robot/proc/AIHasControl()
|
||||
return wires_status & BORG_WIRE_AI_CONTROL
|
||||
return wires_status & BORG_WIRE_AI_CONTROL
|
||||
|
||||
@@ -66,4 +66,4 @@ datum/wires/suitstorage/UpdatePulsed(index)
|
||||
A.shocked = FALSE
|
||||
if(SSU_WIRE_UV)
|
||||
A.uv_super = !A.uv_super
|
||||
..()
|
||||
..()
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user