mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-19 10:06:56 +01:00
Fix
This commit is contained in:
@@ -8,168 +8,168 @@
|
||||
var/list/steps_desc
|
||||
var/taskpath = null // Path of job objective completed.
|
||||
|
||||
New(atom)
|
||||
..()
|
||||
holder = atom
|
||||
if(!holder) //don't want this without a holder
|
||||
spawn
|
||||
qdel(src)
|
||||
/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
|
||||
return
|
||||
|
||||
proc/next_step(mob/user as mob)
|
||||
steps.len--
|
||||
if(!steps.len)
|
||||
spawn_result(user)
|
||||
/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(istype(used_atom, L["key"]))
|
||||
return steps.len
|
||||
return 0
|
||||
|
||||
/datum/construction/proc/custom_action(step, used_atom, user)
|
||||
if(istype(used_atom, /obj/item/weldingtool))
|
||||
var/obj/item/weldingtool/W = used_atom
|
||||
if(W.remove_fuel(0, user))
|
||||
playsound(holder, W.usesound, 50, 1)
|
||||
else
|
||||
set_desc(steps.len)
|
||||
return
|
||||
return 0
|
||||
else if(istype(used_atom, /obj/item/wrench))
|
||||
var/obj/item/wrench/W = used_atom
|
||||
playsound(holder, W.usesound, 50, 1)
|
||||
|
||||
proc/action(atom/used_atom,mob/user as mob)
|
||||
return
|
||||
else if(istype(used_atom, /obj/item/screwdriver))
|
||||
var/obj/item/screwdriver/S = used_atom
|
||||
playsound(holder, S.usesound, 50, 1)
|
||||
|
||||
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
|
||||
else if(istype(used_atom, /obj/item/wirecutters))
|
||||
var/obj/item/wirecutters/W = used_atom
|
||||
playsound(holder, W.usesound, 50, 1)
|
||||
|
||||
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]
|
||||
else 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)
|
||||
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(istype(used_atom, L["key"]))
|
||||
return steps.len
|
||||
return 0
|
||||
if(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
|
||||
|
||||
proc/custom_action(step, used_atom, user)
|
||||
if(istype(used_atom, /obj/item/weldingtool))
|
||||
var/obj/item/weldingtool/W = used_atom
|
||||
if(W.remove_fuel(0, user))
|
||||
playsound(holder, W.usesound, 50, 1)
|
||||
else
|
||||
|
||||
/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
|
||||
else if(istype(used_atom, /obj/item/wrench))
|
||||
var/obj/item/wrench/W = used_atom
|
||||
playsound(holder, W.usesound, 50, 1)
|
||||
|
||||
else if(istype(used_atom, /obj/item/screwdriver))
|
||||
var/obj/item/screwdriver/S = used_atom
|
||||
playsound(holder, S.usesound, 50, 1)
|
||||
|
||||
else if(istype(used_atom, /obj/item/wirecutters))
|
||||
var/obj/item/wirecutters/W = used_atom
|
||||
playsound(holder, W.usesound, 50, 1)
|
||||
|
||||
else 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>"))
|
||||
// WELDER
|
||||
if(istype(used_atom,/obj/item/weldingtool))
|
||||
var/obj/item/weldingtool/welder=used_atom
|
||||
if(!welder.isOn())
|
||||
to_chat(user, "<span class='notice'>You tap the [src] with your unlit welder. [pick("Ding","Dong")].</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>"))
|
||||
if(!welder.remove_fuel(amount,user))
|
||||
to_chat(user, "<span class='warning'>You don't have enough fuel!</span>")
|
||||
return 0
|
||||
else
|
||||
S.use(5)
|
||||
return 1
|
||||
|
||||
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(istype(used_atom, L["key"]))
|
||||
if(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
|
||||
|
||||
|
||||
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
|
||||
|
||||
proc/set_desc(index as num)
|
||||
var/list/step = steps[index]
|
||||
holder.desc = step["desc"]
|
||||
return
|
||||
|
||||
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
|
||||
// WELDER
|
||||
if(istype(used_atom,/obj/item/weldingtool))
|
||||
var/obj/item/weldingtool/welder=used_atom
|
||||
if(!welder.isOn())
|
||||
to_chat(user, "<span class='notice'>You tap the [src] with your unlit welder. [pick("Ding","Dong")].</span>")
|
||||
return 0
|
||||
if(!welder.remove_fuel(amount,user))
|
||||
to_chat(user, "<span class='warning'>You don't have enough fuel!</span>")
|
||||
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
|
||||
// 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/reversible
|
||||
var/index
|
||||
|
||||
New(atom)
|
||||
..()
|
||||
index = steps.len
|
||||
return
|
||||
/datum/construction/reversible/New(atom)
|
||||
..()
|
||||
index = steps.len
|
||||
return
|
||||
|
||||
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/proc/update_index(diff as num, mob/user as mob)
|
||||
index+=diff
|
||||
if(index==0)
|
||||
spawn_result(user)
|
||||
else
|
||||
set_desc(index)
|
||||
return
|
||||
|
||||
is_right_key(atom/used_atom) // returns index step
|
||||
var/list/L = steps[index]
|
||||
if(istype(used_atom, L["key"]))
|
||||
return FORWARD //to the first step -> forward
|
||||
else if(L["backkey"] && istype(used_atom, L["backkey"]))
|
||||
return BACKWARD //to the last step -> backwards
|
||||
/datum/construction/reversible/is_right_key(atom/used_atom) // returns index step
|
||||
var/list/L = steps[index]
|
||||
if(istype(used_atom, L["key"]))
|
||||
return FORWARD //to the first step -> forward
|
||||
else if(L["backkey"] && istype(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
|
||||
|
||||
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
|
||||
|
||||
custom_action(index, diff, used_atom, user)
|
||||
if(!..(index,used_atom,user))
|
||||
return 0
|
||||
return 1
|
||||
return 1
|
||||
|
||||
#define state_next "next"
|
||||
#define state_prev "prev"
|
||||
@@ -178,73 +178,74 @@
|
||||
var/index
|
||||
var/base_icon = "durand"
|
||||
|
||||
New(atom)
|
||||
..()
|
||||
index = 1
|
||||
return
|
||||
/datum/construction/reversible2/New(atom)
|
||||
..()
|
||||
index = 1
|
||||
return
|
||||
|
||||
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_index(diff as num, mob/user as mob)
|
||||
index-=diff
|
||||
if(index==steps.len+1)
|
||||
spawn_result(user)
|
||||
else
|
||||
set_desc(index)
|
||||
return
|
||||
|
||||
proc/update_icon()
|
||||
holder.icon_state="[base_icon]_[index]"
|
||||
/datum/construction/reversible2/proc/update_icon()
|
||||
holder.icon_state="[base_icon]_[index]"
|
||||
|
||||
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(istype(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(istype(used_atom, step["key"]))
|
||||
//if(L["consume"] && !try_consume(used_atom,L["consume"]))
|
||||
// return 0
|
||||
return BACKWARD //to the first step -> forward
|
||||
/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(istype(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(istype(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
|
||||
|
||||
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
|
||||
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))
|
||||
|
||||
proc/fixText(text,user)
|
||||
text = replacetext(text,"{USER}","[user]")
|
||||
text = replacetext(text,"{HOLDER}","[holder]")
|
||||
return text
|
||||
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"]
|
||||
|
||||
custom_action(index, diff, used_atom, var/mob/user)
|
||||
if(!..(index,used_atom,user))
|
||||
return 0
|
||||
return 1
|
||||
|
||||
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
|
||||
action(used_atom,user)
|
||||
return check_step(used_atom,user)
|
||||
/datum/construction/reversible2/action(used_atom,user)
|
||||
return check_step(used_atom,user)
|
||||
|
||||
@@ -57,98 +57,96 @@ Data storage vars:
|
||||
var/result
|
||||
var/state = 0
|
||||
|
||||
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/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
|
||||
|
||||
proc/main()
|
||||
state = 1
|
||||
while(src && control_switch)
|
||||
last_exec = world.timeofday
|
||||
if(check_for_null && has_null_args())
|
||||
stop()
|
||||
/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
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
proc/stop()
|
||||
if(!active())
|
||||
return
|
||||
control_switch = 0
|
||||
spawn(-1) //report termination error but don't wait for state_check().
|
||||
state_check()
|
||||
return 1
|
||||
|
||||
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
|
||||
return 0
|
||||
|
||||
proc/process()
|
||||
/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
|
||||
|
||||
proc/active()
|
||||
return control_switch
|
||||
/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
|
||||
|
||||
proc/has_null_args()
|
||||
if(null in arg_list)
|
||||
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/proc/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)
|
||||
|
||||
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_as_text()
|
||||
return (time2text(last_exec)||"Wasn't executed yet")
|
||||
|
||||
proc/get_last_exec_time()
|
||||
return (last_exec||0)
|
||||
|
||||
proc/get_last_exec_time_as_text()
|
||||
return (time2text(last_exec)||"Wasn't executed yet")
|
||||
|
||||
proc/set_process_args(list/arguments)
|
||||
if(arguments && istype(arguments, /list) && arguments.len)
|
||||
arg_list = arguments
|
||||
return 1
|
||||
else
|
||||
/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
|
||||
|
||||
proc/toggle_null_checks()
|
||||
check_for_null = !check_for_null
|
||||
return check_for_null
|
||||
|
||||
proc/toggle()
|
||||
if(!stop())
|
||||
start()
|
||||
return active()
|
||||
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()
|
||||
|
||||
@@ -2,59 +2,59 @@
|
||||
var/href
|
||||
var/list/href_list
|
||||
|
||||
New(thref,list/thref_list)
|
||||
href = thref
|
||||
href_list = thref_list.Copy()
|
||||
return
|
||||
/datum/topic_input/New(thref,list/thref_list)
|
||||
href = thref
|
||||
href_list = thref_list.Copy()
|
||||
return
|
||||
|
||||
proc/get(i)
|
||||
return listgetindex(href_list,i)
|
||||
/datum/topic_input/proc/get(i)
|
||||
return listgetindex(href_list,i)
|
||||
|
||||
proc/getAndLocate(i)
|
||||
var/t = get(i)
|
||||
if(t)
|
||||
t = locate(t)
|
||||
return t || null
|
||||
/datum/topic_input/proc/getAndLocate(i)
|
||||
var/t = get(i)
|
||||
if(t)
|
||||
t = locate(t)
|
||||
return t || null
|
||||
|
||||
proc/getNum(i)
|
||||
var/t = get(i)
|
||||
if(t)
|
||||
t = text2num(t)
|
||||
return isnum(t) ? t : null
|
||||
/datum/topic_input/proc/getNum(i)
|
||||
var/t = get(i)
|
||||
if(t)
|
||||
t = text2num(t)
|
||||
return isnum(t) ? t : null
|
||||
|
||||
proc/getObj(i)
|
||||
var/t = getAndLocate(i)
|
||||
return isobj(t) ? t : null
|
||||
/datum/topic_input/proc/getObj(i)
|
||||
var/t = getAndLocate(i)
|
||||
return isobj(t) ? t : null
|
||||
|
||||
proc/getMob(i)
|
||||
var/t = getAndLocate(i)
|
||||
return ismob(t) ? t : null
|
||||
/datum/topic_input/proc/getMob(i)
|
||||
var/t = getAndLocate(i)
|
||||
return ismob(t) ? t : null
|
||||
|
||||
proc/getTurf(i)
|
||||
var/t = getAndLocate(i)
|
||||
return isturf(t) ? t : null
|
||||
/datum/topic_input/proc/getTurf(i)
|
||||
var/t = getAndLocate(i)
|
||||
return isturf(t) ? t : null
|
||||
|
||||
proc/getAtom(i)
|
||||
return getType(i,/atom)
|
||||
/datum/topic_input/proc/getAtom(i)
|
||||
return getType(i,/atom)
|
||||
|
||||
proc/getArea(i)
|
||||
var/t = getAndLocate(i)
|
||||
return isarea(t) ? t : null
|
||||
/datum/topic_input/proc/getArea(i)
|
||||
var/t = getAndLocate(i)
|
||||
return isarea(t) ? t : null
|
||||
|
||||
proc/getStr(i)//params should always be text, but...
|
||||
var/t = get(i)
|
||||
return istext(t) ? t : null
|
||||
/datum/topic_input/proc/getStr(i)//params should always be text, but...
|
||||
var/t = get(i)
|
||||
return istext(t) ? t : null
|
||||
|
||||
proc/getType(i,type)
|
||||
var/t = getAndLocate(i)
|
||||
return istype(t,type) ? t : null
|
||||
/datum/topic_input/proc/getType(i,type)
|
||||
var/t = getAndLocate(i)
|
||||
return istype(t,type) ? t : null
|
||||
|
||||
proc/getPath(i)
|
||||
var/t = get(i)
|
||||
if(t)
|
||||
t = text2path(t)
|
||||
return ispath(t) ? t : null
|
||||
/datum/topic_input/proc/getPath(i)
|
||||
var/t = get(i)
|
||||
if(t)
|
||||
t = text2path(t)
|
||||
return ispath(t) ? t : null
|
||||
|
||||
proc/getList(i)
|
||||
var/t = getAndLocate(i)
|
||||
return islist(t) ? t : null
|
||||
/datum/topic_input/proc/getList(i)
|
||||
var/t = getAndLocate(i)
|
||||
return islist(t) ? t : null
|
||||
|
||||
@@ -220,6 +220,16 @@ GLOBAL_LIST_INIT(uplink_items, subtypesof(/datum/uplink_item))
|
||||
cost = 5
|
||||
job = list("Chief Medical Officer", "Medical Doctor", "Geneticist", "Psychiatrist", "Chemist", "Paramedic", "Coroner", "Virologist")
|
||||
|
||||
//Virology
|
||||
|
||||
/datum/uplink_item/jobspecific/viral_injector
|
||||
name = "Viral Injector"
|
||||
desc = "A modified hypospray disguised as a functional pipette. The pipette can infect victims with viruses upon injection."
|
||||
reference = "VI"
|
||||
item = /obj/item/reagent_containers/dropper/precision/viral_injector
|
||||
cost = 3
|
||||
job = list("Virologist")
|
||||
|
||||
/datum/uplink_item/jobspecific/cat_grenade
|
||||
name = "Feral Cat Delivery Grenade"
|
||||
desc = "The feral cat delivery grenade contains 8 dehydrated feral cats in a similar manner to dehydrated monkeys, which, upon detonation, will be rehydrated by a small reservoir of water contained within the grenade. These cats will then attack anything in sight."
|
||||
|
||||
Reference in New Issue
Block a user