mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-29 11:31:38 +00:00
Hardsuit Construction Improvements (#12093)
The descriptions of hardsuit assemblies and their constructions have been overhauled.
Examining a hardsuit assembly will now provide a description and tell you at which step its at, what to do to go forward, and what to do to go back.
Holding shift and hovering over a hardsuit assembly when you are near it will provide a tooltip providing the step its at and how to continue.
This commit is contained in:
@@ -6,115 +6,113 @@
|
||||
var/atom/holder
|
||||
var/result
|
||||
var/list/steps_desc
|
||||
var/current_desc = null
|
||||
|
||||
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)
|
||||
|
||||
/datum/construction/proc/next_step()
|
||||
steps.len--
|
||||
if(!steps.len)
|
||||
spawn_result()
|
||||
else
|
||||
set_desc(steps.len)
|
||||
return
|
||||
|
||||
proc/next_step()
|
||||
steps.len--
|
||||
if(!steps.len)
|
||||
spawn_result()
|
||||
else
|
||||
set_desc(steps.len)
|
||||
return
|
||||
/datum/construction/proc/action(atom/used_atom, mob/user)
|
||||
return
|
||||
|
||||
proc/action(atom/used_atom,mob/user as mob)
|
||||
return
|
||||
/datum/construction/proc/check_step(atom/used_atom, mob/user) //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 TRUE
|
||||
return FALSE
|
||||
|
||||
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
|
||||
/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(isobj(used_atom))
|
||||
var/return_value = check_tool_quality(used_atom, L["key"], steps.len)
|
||||
if(return_value)
|
||||
return return_value
|
||||
if(istype(used_atom, L["key"]))
|
||||
return steps.len
|
||||
return FALSE
|
||||
|
||||
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(isobj(used_atom))
|
||||
var/return_value = check_tool_quality(used_atom, L["key"], steps.len)
|
||||
if(return_value)
|
||||
return return_value
|
||||
/datum/construction/proc/custom_action(step, used_atom, user)
|
||||
return TRUE
|
||||
|
||||
/datum/construction/proc/check_all_steps(atom/used_atom, mob/user) //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
|
||||
|
||||
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, 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
|
||||
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()
|
||||
qdel(holder)
|
||||
return
|
||||
/datum/construction/proc/spawn_result()
|
||||
if(result)
|
||||
new result(get_turf(holder))
|
||||
spawn()
|
||||
qdel(holder)
|
||||
|
||||
proc/set_desc(index as num)
|
||||
var/list/step = steps[index]
|
||||
holder.desc = step["desc"]
|
||||
return
|
||||
/datum/construction/proc/set_desc(index as num)
|
||||
var/list/step = steps[index]
|
||||
current_desc = step["desc"]
|
||||
|
||||
/datum/construction/proc/get_desc()
|
||||
return SPAN_NOTICE(current_desc)
|
||||
|
||||
/datum/construction/reversible
|
||||
var/index
|
||||
|
||||
New(atom)
|
||||
..()
|
||||
index = steps.len
|
||||
return
|
||||
/datum/construction/reversible/New(atom)
|
||||
..()
|
||||
index = steps.len
|
||||
|
||||
proc/update_index(diff as num)
|
||||
index+=diff
|
||||
if(index==0)
|
||||
spawn_result()
|
||||
else
|
||||
set_desc(index)
|
||||
return
|
||||
/datum/construction/reversible/proc/update_index(diff as num)
|
||||
index+=diff
|
||||
if(index==0)
|
||||
spawn_result()
|
||||
else
|
||||
set_desc(index)
|
||||
|
||||
is_right_key(atom/used_atom) // returns index step
|
||||
var/list/L = steps[index]
|
||||
var/is_obj = FALSE
|
||||
if(isobj(used_atom))
|
||||
var/return_value = check_tool_quality(used_atom, L["key"], FORWARD)
|
||||
/datum/construction/reversible/is_right_key(atom/used_atom) // returns index step
|
||||
var/list/L = steps[index]
|
||||
var/is_obj = FALSE
|
||||
if(isobj(used_atom))
|
||||
var/return_value = check_tool_quality(used_atom, L["key"], FORWARD)
|
||||
if(return_value)
|
||||
return return_value
|
||||
is_obj = TRUE
|
||||
if(istype(used_atom, L["key"]))
|
||||
return FORWARD //to the first step -> forward
|
||||
else if(L["backkey"])
|
||||
if(is_obj)
|
||||
var/return_value = check_tool_quality(used_atom, L["backkey"], BACKWARD)
|
||||
if(return_value)
|
||||
return return_value
|
||||
is_obj = TRUE
|
||||
if(istype(used_atom, L["key"]))
|
||||
return FORWARD //to the first step -> forward
|
||||
else if(L["backkey"])
|
||||
if(is_obj)
|
||||
var/return_value = check_tool_quality(used_atom, L["backkey"], BACKWARD)
|
||||
if(return_value)
|
||||
return return_value
|
||||
if(istype(used_atom, L["backkey"]))
|
||||
return BACKWARD //to the last step -> backwards
|
||||
return 0
|
||||
if(istype(used_atom, L["backkey"]))
|
||||
return BACKWARD //to the last step -> backwards
|
||||
return FALSE
|
||||
|
||||
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
|
||||
/datum/construction/reversible/check_step(atom/used_atom, mob/user)
|
||||
var/diff = is_right_key(used_atom)
|
||||
if(diff)
|
||||
if(custom_action(index, diff, used_atom, user))
|
||||
update_index(diff)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
custom_action(index, diff, used_atom, user)
|
||||
return 1
|
||||
/datum/construction/reversible/custom_action(index, diff, used_atom, user)
|
||||
return TRUE
|
||||
Reference in New Issue
Block a user