mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
Currently there are three - PASSTABLE, PASSGLASS and PASSGRILLE. PASSTABLE - same as TABLEPASS, PASSGRILLE - can this atom pass through grilles and PASSGLASS - can this atom pass through windows, glass doors, etc. Most can_pass() procs were updated. Added checkpass atom proc to check if this atom has certain pass_flag set. - Added proc/sanitize_simple() and proc/strip_html_simple(). sanitize_simple does not html_encode the string and strip_html_simple does not sanitize it. Additionally, sanitize_simple and sanitize can take associative list of key-val chars as second argument, where key is char to searh for and val is replacement. - Added datum/gas_mixture/proc/return_volume() and datum/gas_mixture/proc/return_temperature(). - Added proc/tg_text2list() and proc/tg_list2text(). tg_list2text is slower then dd_list2text, but processes associative lists differently (it adds not the keys, but associated values). tg_text2list is somewhat faster then dd_text2list. - Added proc/listclearnulls(), proc/difflist(), proc/intersectlist() and proc/uniquemergelist(). Check the code comments for more info. - Mechs can hold 3 equipment pieces. Gygax can hold 4. - Tweaked global_iterator CRASH report. - Fixed mech pilot ejection if mecha was destroyed. - Fixed mech fabricator process() waiting for sync() to finish. - Fixed mech fabricator Topic() waiting for process_queue() to finish. - Some bugixes related to global map and random sectors. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1722 316c924e-a436-60f5-8080-3fe189b3f50e
105 lines
2.3 KiB
Plaintext
105 lines
2.3 KiB
Plaintext
#define FORWARD -1
|
|
#define BACKWARD 1
|
|
|
|
/datum/construction
|
|
var/list/steps
|
|
var/atom/holder
|
|
var/result
|
|
var/list/steps_desc
|
|
|
|
New(atom)
|
|
..()
|
|
holder = atom
|
|
if(!holder) //don't want this without a holder
|
|
spawn
|
|
del src
|
|
set_desc(steps.len)
|
|
return
|
|
|
|
proc/next_step()
|
|
steps.len--
|
|
if(!steps.len)
|
|
spawn_result()
|
|
else
|
|
set_desc(steps.len)
|
|
return
|
|
|
|
proc/action(atom/used_atom,mob/user as mob)
|
|
return
|
|
|
|
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()
|
|
return 1
|
|
return 0
|
|
|
|
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, text2path(L["key"])))
|
|
return steps.len
|
|
return 0
|
|
|
|
proc/custom_action(step, used_atom, user)
|
|
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, text2path(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()
|
|
return 1
|
|
return 0
|
|
|
|
|
|
proc/spawn_result()
|
|
if(result)
|
|
new result(get_turf(holder))
|
|
spawn()
|
|
del holder
|
|
return
|
|
|
|
proc/set_desc(index as num)
|
|
var/list/step = steps[index]
|
|
holder.desc = step["desc"]
|
|
return
|
|
|
|
/datum/construction/reversible
|
|
var/index
|
|
|
|
New(atom)
|
|
..()
|
|
index = steps.len
|
|
return
|
|
|
|
proc/update_index(diff as num)
|
|
index+=diff
|
|
if(index==0)
|
|
spawn_result()
|
|
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
|
|
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)
|
|
return 1
|
|
return 0
|
|
|
|
custom_action(index, diff, used_atom, user)
|
|
return 1 |