surgery_step
Vars | |
accept_any_item | Does the surgery step accept any item? If true, ignores implements. Compatible with accept_hand. |
---|---|
accept_hand | does the surgery step require an open hand? If true, ignores implements. Compatible with accept_any_item. |
allowed_tools | Type path of tools that can be used to complete this step. Format is path = probability of success .
If the tool has a specific surgery tooltype, you can use that as a key as well. |
blood_level | How much blood this step can get on surgeon. See SURGERY_BLOODSPREAD_* defines |
can_infect | Whether this surgery step can cause an infection. |
chems_needed | List of chems needed in the mob to complete the step. Even on success, this step will have no effect if the required chems aren't in the mob. |
failure_sound | Sound played if the step fails. Single value only |
implement_type | The current type of implement from allowed_tools in use. This has to be stored, as the typepath of the tool might not match the list type (such as if we're using tool behavior) |
preop_sound | Sound played when the step is started. Lists or single value can be used for this var as well as tool defines |
repeatable | Is this step repeatable by using the same tool again after it's finished? Make sure it isn't the last step, or it's used in a cancellable surgery. Otherwise, you might get stuck in a loop! |
require_all_chems | Do we require any of the needed chems, or all of them? |
silicons_ignore_prob | Whether silicons ignore any probabilities (and are therefore "perfect" surgeons) |
success_sound | Sound played if the step succeeded. Single value only |
time | duration of the step |
times_repeated | How many times this step has been automatically repeated. |
Procs | |
can_repeat | Determines whether or not this surgery step can repeat if its end/fail steps returned SURGERY_STEP_RETRY. |
chem_check | Check that the target contains the chems we expect them to. |
deal_pain | Try to inflict pain during a surgery, a surgeon's dream come true. This will wake up the user if they're voluntarily sleeping. |
end_step | Finish a surgery step, performing anything that runs on the tail-end of a successful surgery. This runs if the surgery step passes the probability check, and therefore is a success. |
fail_step | Play out the failure state of a surgery step. This runs if the surgery step fails the probability check, the right chems weren't present, or if the user deliberately failed the surgery. |
get_step_information | Get the action that will be performed during this surgery step, in context of the surgery it is a part of. |
initiate | Initiate and really perform the surgery itself. This includes the main do-after and the checking of probabilities for successful surgeries. If try_to_fail is TRUE, then this surgery will be deliberately failed out of. |
is_valid_tool | Whether or not the tool being used is usable for the surgery. Checks both the tool itself as well as any tool behaviors defined in allowed_tools. Arguments: |
slowdown_immune | Check for mobs that would be immune to surgery slowdowns/speedups. |
spread_germs_by_incision | Spread germs directly from a tool. |
spread_germs_to_organ | Spread some nasty germs to an organ. |
tool_check | Get whether the tool should be usable in its current state. Useful for checks to see if a welder is on, for example. |
try_op | Try to perform an operation on a user. Arguments: |
Var Details
accept_any_item
Does the surgery step accept any item? If true, ignores implements. Compatible with accept_hand.
accept_hand
does the surgery step require an open hand? If true, ignores implements. Compatible with accept_any_item.
allowed_tools
Type path of tools that can be used to complete this step. Format is path = probability of success
.
If the tool has a specific surgery tooltype, you can use that as a key as well.
blood_level
How much blood this step can get on surgeon. See SURGERY_BLOODSPREAD_* defines
can_infect
Whether this surgery step can cause an infection.
chems_needed
List of chems needed in the mob to complete the step. Even on success, this step will have no effect if the required chems aren't in the mob.
failure_sound
Sound played if the step fails. Single value only
implement_type
The current type of implement from allowed_tools in use. This has to be stored, as the typepath of the tool might not match the list type (such as if we're using tool behavior)
preop_sound
Sound played when the step is started. Lists or single value can be used for this var as well as tool defines
repeatable
Is this step repeatable by using the same tool again after it's finished? Make sure it isn't the last step, or it's used in a cancellable surgery. Otherwise, you might get stuck in a loop!
require_all_chems
Do we require any of the needed chems, or all of them?
silicons_ignore_prob
Whether silicons ignore any probabilities (and are therefore "perfect" surgeons)
success_sound
Sound played if the step succeeded. Single value only
time
duration of the step
times_repeated
How many times this step has been automatically repeated.
Proc Details
can_repeat
Determines whether or not this surgery step can repeat if its end/fail steps returned SURGERY_STEP_RETRY.
Arguments:
- user - mob performing the surgery
- target - mob the surgery is being performed on
- target_zone - body zone of the surgery
- tool - tool used for the surgery
- surgery - the operation this surgery step is a part of
If this returns TRUE, the step will automatically retry. If not, the user will have to manually start the step again.
chem_check
Check that the target contains the chems we expect them to.
deal_pain
Try to inflict pain during a surgery, a surgeon's dream come true. This will wake up the user if they're voluntarily sleeping.
Returns the success rate that the user's amount of pain would deal, while also handling extra pain behavior.
end_step
Finish a surgery step, performing anything that runs on the tail-end of a successful surgery. This runs if the surgery step passes the probability check, and therefore is a success.
Should return SURGERY_STEP_CONTINUE to advance the surgery, though may return SURGERY_STEP_INCOMPLETE to keep the surgery step from advancing.
fail_step
Play out the failure state of a surgery step. This runs if the surgery step fails the probability check, the right chems weren't present, or if the user deliberately failed the surgery.
Should return SURGERY_STEP_INCOMPLETE to prevent the surgery step from advancing, though may return SURGERY_STEP_CONTINUE to advance to the next step regardless.
get_step_information
Get the action that will be performed during this surgery step, in context of the surgery it is a part of.
- surgery - A surgery in progress.
initiate
Initiate and really perform the surgery itself. This includes the main do-after and the checking of probabilities for successful surgeries. If try_to_fail is TRUE, then this surgery will be deliberately failed out of.
Returns TRUE if the surgery should proceed to the next step, or FALSE otherwise.
is_valid_tool
Whether or not the tool being used is usable for the surgery. Checks both the tool itself as well as any tool behaviors defined in allowed_tools. Arguments:
- user - User handling the tool.
- tool - The tool (or item) being used in this surgery step. Returns TRUE if the tool can be used, or FALSE otherwise
slowdown_immune
Check for mobs that would be immune to surgery slowdowns/speedups.
spread_germs_by_incision
Spread germs directly from a tool.
- E - An external organ being operated on.
- tool - The tool performing the operation.
spread_germs_to_organ
Spread some nasty germs to an organ.
- target_organ - The organ to try spreading germs to.
- user - The user who's manipulating the organ.
- tool - The tool the user is using to mess with the organ.
tool_check
Get whether the tool should be usable in its current state. Useful for checks to see if a welder is on, for example.
Arguments:
- user - The user using the tool.
- tool - The tool in use.
try_op
Try to perform an operation on a user. Arguments:
- user - The user performing the surgery.
- target - The user on whom the surgery is being performed.
- target_zone - the zone the user is targeting for the surgery.
- tool - The object that the user is using to perform the surgery (optional)
- surgery - The surgery being performed. Returns TRUE if the step was a success, or FALSE if the step can't be performed for some reason.