|
|
|
@@ -247,61 +247,94 @@ Class Procs:
|
|
|
|
|
|
|
|
|
|
/obj/machinery/proc/auto_use_power()
|
|
|
|
|
if(!powered(power_channel))
|
|
|
|
|
return 0
|
|
|
|
|
return FALSE
|
|
|
|
|
if(use_power == 1)
|
|
|
|
|
use_power(idle_power_usage,power_channel)
|
|
|
|
|
else if(use_power >= 2)
|
|
|
|
|
use_power(active_power_usage,power_channel)
|
|
|
|
|
return 1
|
|
|
|
|
return TRUE
|
|
|
|
|
|
|
|
|
|
/obj/machinery/proc/is_operational()
|
|
|
|
|
return !(stat & (NOPOWER|BROKEN|MAINT))
|
|
|
|
|
|
|
|
|
|
/obj/machinery/can_interact(mob/user)
|
|
|
|
|
var/silicon = hasSiliconAccessInArea(user) || IsAdminGhost(user)
|
|
|
|
|
if((stat & (NOPOWER|BROKEN)) && !(interaction_flags_machine & INTERACT_MACHINE_OFFLINE))
|
|
|
|
|
if((stat & (NOPOWER|BROKEN)) && !(interaction_flags_machine & INTERACT_MACHINE_OFFLINE)) // Check if the machine is broken, and if we can still interact with it if so
|
|
|
|
|
return FALSE
|
|
|
|
|
if(panel_open && !(interaction_flags_machine & INTERACT_MACHINE_OPEN))
|
|
|
|
|
if(!silicon || !(interaction_flags_machine & INTERACT_MACHINE_OPEN_SILICON))
|
|
|
|
|
return FALSE
|
|
|
|
|
|
|
|
|
|
if(silicon)
|
|
|
|
|
if(IsAdminGhost(user))
|
|
|
|
|
return TRUE //if you're an admin, you probably know what you're doing (or at least have permission to do what you're doing)
|
|
|
|
|
|
|
|
|
|
if(!isliving(user))
|
|
|
|
|
return FALSE //no ghosts in the machine allowed, sorry
|
|
|
|
|
|
|
|
|
|
// if(SEND_SIGNAL(user, COMSIG_TRY_USE_MACHINE, src) & COMPONENT_CANT_USE_MACHINE_INTERACT)
|
|
|
|
|
// return FALSE
|
|
|
|
|
|
|
|
|
|
var/mob/living/living_user = user
|
|
|
|
|
|
|
|
|
|
var/is_dextrous = FALSE
|
|
|
|
|
if(isanimal(user))
|
|
|
|
|
var/mob/living/simple_animal/user_as_animal = user
|
|
|
|
|
if (user_as_animal.dextrous)
|
|
|
|
|
is_dextrous = TRUE
|
|
|
|
|
|
|
|
|
|
if(!issilicon(user) && !is_dextrous && !user.can_hold_items())
|
|
|
|
|
return FALSE //spiders gtfo
|
|
|
|
|
|
|
|
|
|
if(issilicon(user)) // If we are a silicon, make sure the machine allows silicons to interact with it
|
|
|
|
|
if(!(interaction_flags_machine & INTERACT_MACHINE_ALLOW_SILICON))
|
|
|
|
|
return FALSE
|
|
|
|
|
else
|
|
|
|
|
if(interaction_flags_machine & INTERACT_MACHINE_REQUIRES_SILICON)
|
|
|
|
|
|
|
|
|
|
if(panel_open && !(interaction_flags_machine & INTERACT_MACHINE_OPEN) && !(interaction_flags_machine & INTERACT_MACHINE_OPEN_SILICON))
|
|
|
|
|
return FALSE
|
|
|
|
|
if(!Adjacent(user))
|
|
|
|
|
var/mob/living/carbon/H = user
|
|
|
|
|
if(!(istype(H) && H.has_dna() && H.dna.check_mutation(TK)))
|
|
|
|
|
return FALSE
|
|
|
|
|
return TRUE
|
|
|
|
|
|
|
|
|
|
return TRUE //silicons don't care about petty mortal concerns like needing to be next to a machine to use it
|
|
|
|
|
|
|
|
|
|
if(living_user.incapacitated()) //idk why silicons aren't supposed to care about incapacitation when interacting with machines, but it was apparently like this before
|
|
|
|
|
return FALSE
|
|
|
|
|
|
|
|
|
|
// TODO: nerf blind people
|
|
|
|
|
// if((interaction_flags_machine & INTERACT_MACHINE_REQUIRES_SIGHT) && user.is_blind())
|
|
|
|
|
// to_chat(user, span_warning("This machine requires sight to use."))
|
|
|
|
|
// return FALSE
|
|
|
|
|
|
|
|
|
|
if(panel_open && !(interaction_flags_machine & INTERACT_MACHINE_OPEN))
|
|
|
|
|
return FALSE
|
|
|
|
|
|
|
|
|
|
if(interaction_flags_machine & INTERACT_MACHINE_REQUIRES_SILICON) //if the user was a silicon, we'd have returned out earlier, so the user must not be a silicon
|
|
|
|
|
return FALSE
|
|
|
|
|
|
|
|
|
|
if(!Adjacent(user)) // Next make sure we are next to the machine unless we have telekinesis
|
|
|
|
|
var/mob/living/carbon/carbon_user = living_user
|
|
|
|
|
if(!istype(carbon_user) || !carbon_user.has_dna() || !carbon_user.dna.check_mutation(TK))
|
|
|
|
|
return FALSE
|
|
|
|
|
|
|
|
|
|
return TRUE // If we passed all of those checks, woohoo! We can interact with this machine.
|
|
|
|
|
|
|
|
|
|
/obj/machinery/proc/check_nap_violations()
|
|
|
|
|
if(!SSeconomy.full_ancap)
|
|
|
|
|
return TRUE
|
|
|
|
|
if(occupant && !state_open)
|
|
|
|
|
if(ishuman(occupant))
|
|
|
|
|
var/mob/living/carbon/human/H = occupant
|
|
|
|
|
var/obj/item/card/id/I = H.get_idcard()
|
|
|
|
|
if(I)
|
|
|
|
|
var/datum/bank_account/insurance = I.registered_account
|
|
|
|
|
if(!insurance)
|
|
|
|
|
say("[market_verb] NAP Violation: No bank account found.")
|
|
|
|
|
nap_violation()
|
|
|
|
|
return FALSE
|
|
|
|
|
else
|
|
|
|
|
if(!insurance.adjust_money(-fair_market_price))
|
|
|
|
|
say("[market_verb] NAP Violation: Unable to pay.")
|
|
|
|
|
nap_violation()
|
|
|
|
|
return FALSE
|
|
|
|
|
var/datum/bank_account/D = SSeconomy.get_dep_account(payment_department)
|
|
|
|
|
if(D)
|
|
|
|
|
D.adjust_money(fair_market_price)
|
|
|
|
|
else
|
|
|
|
|
say("[market_verb] NAP Violation: No ID card found.")
|
|
|
|
|
nap_violation()
|
|
|
|
|
var/mob/living/L = occupant
|
|
|
|
|
var/obj/item/card/id/I = L.get_idcard(TRUE)
|
|
|
|
|
if(I)
|
|
|
|
|
var/datum/bank_account/insurance = I.registered_account
|
|
|
|
|
if(!insurance)
|
|
|
|
|
say("[market_verb] NAP Violation: No bank account found.")
|
|
|
|
|
nap_violation(L)
|
|
|
|
|
return FALSE
|
|
|
|
|
else
|
|
|
|
|
if(!insurance.adjust_money(-fair_market_price))
|
|
|
|
|
say("[market_verb] NAP Violation: Unable to pay.")
|
|
|
|
|
nap_violation(L)
|
|
|
|
|
return FALSE
|
|
|
|
|
var/datum/bank_account/D = SSeconomy.get_dep_account(payment_department)
|
|
|
|
|
if(D)
|
|
|
|
|
D.adjust_money(fair_market_price)
|
|
|
|
|
else
|
|
|
|
|
say("[market_verb] NAP Violation: No ID card found.")
|
|
|
|
|
nap_violation(L)
|
|
|
|
|
return FALSE
|
|
|
|
|
return TRUE
|
|
|
|
|
|
|
|
|
|
/obj/machinery/proc/nap_violation(mob/violator)
|
|
|
|
@@ -322,11 +355,11 @@ Class Procs:
|
|
|
|
|
/obj/machinery/Topic(href, href_list)
|
|
|
|
|
..()
|
|
|
|
|
if(!can_interact(usr))
|
|
|
|
|
return 1
|
|
|
|
|
return TRUE
|
|
|
|
|
if(!usr.canUseTopic(src))
|
|
|
|
|
return 1
|
|
|
|
|
return TRUE
|
|
|
|
|
add_fingerprint(usr)
|
|
|
|
|
return 0
|
|
|
|
|
return FALSE
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|