mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-11 08:06:33 +01:00
d25c6201f4
## About The Pull Request Converts almost all non-constant, non-tgui usages of all variantions of "credit" and "cr" Everything seems in order, tested most the currencies. <img width="905" height="119" alt="image" src="https://github.com/user-attachments/assets/3fa005a7-a114-426c-9646-b81f68bc2dec" /> <img width="255" height="128" alt="image" src="https://github.com/user-attachments/assets/14c83b54-4fd9-4bee-838f-5b1c03939d9a" /> ## Why It's Good For The Game Same justification as https://github.com/tgstation/tgstation/pull/94128 Just easier to mantain/adjust the grammer/names of our money ## Changelog 🆑 spellcheck: minor cleanup on some usecases of "credits" /🆑
55 lines
1.9 KiB
Plaintext
55 lines
1.9 KiB
Plaintext
/**
|
|
* Component that makes basic mobs' melee attacks steal money from the target's ID card.
|
|
* Plundered money is stored and dropped on death or removal of the component.
|
|
*/
|
|
/datum/component/plundering_attacks
|
|
/// How many credits do we steal per attack?
|
|
var/plunder_amount = 25
|
|
/// How much plunder do we have stored?
|
|
var/plunder_stored = 0
|
|
|
|
|
|
/datum/component/plundering_attacks/Initialize(
|
|
plunder_amount = 25,
|
|
)
|
|
. = ..()
|
|
if(!isbasicmob(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
|
|
src.plunder_amount = plunder_amount
|
|
|
|
/datum/component/plundering_attacks/RegisterWithParent()
|
|
. = ..()
|
|
RegisterSignal(parent, COMSIG_HOSTILE_POST_ATTACKINGTARGET, PROC_REF(attempt_plunder))
|
|
RegisterSignal(parent, COMSIG_LIVING_DEATH, PROC_REF(drop_plunder))
|
|
|
|
/datum/component/plundering_attacks/UnregisterFromParent()
|
|
. = ..()
|
|
UnregisterSignal(parent, list(COMSIG_HOSTILE_POST_ATTACKINGTARGET, COMSIG_LIVING_DEATH))
|
|
drop_plunder()
|
|
|
|
/datum/component/plundering_attacks/proc/attempt_plunder(mob/living/attacker, mob/living/carbon/human/target, success)
|
|
SIGNAL_HANDLER
|
|
if(!istype(target) || !success)
|
|
return
|
|
var/obj/item/card/id/id_card = target.wear_id?.GetID()
|
|
if(isnull(id_card))
|
|
return
|
|
var/datum/bank_account/account_to_rob = id_card.registered_account
|
|
if(isnull(account_to_rob) || account_to_rob.account_balance == 0)
|
|
return
|
|
|
|
var/amount_to_steal = plunder_amount
|
|
if(account_to_rob.account_balance < plunder_amount) //If there isn't enough, just take what's left
|
|
amount_to_steal = account_to_rob.account_balance
|
|
plunder_stored += amount_to_steal
|
|
account_to_rob.adjust_money(-amount_to_steal)
|
|
account_to_rob.bank_card_talk("Transaction confirmed! Transferred [amount_to_steal] [MONEY_NAME] to \<NULL_ACCOUNT\>!")
|
|
|
|
/datum/component/plundering_attacks/proc/drop_plunder()
|
|
SIGNAL_HANDLER
|
|
if(plunder_stored == 0)
|
|
return
|
|
new /obj/item/holochip(get_turf(parent), plunder_stored)
|
|
plunder_stored = 0
|