mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 04:26:03 +01:00
[READY]Arconomy: Sales Taggers, split profits on barcoded, sold items! (#49111)
* Startwork * "Arcane: Everything works up until the export datum bullshit" * I got up to "Split Profit" in "sell object" * This is when I switched over to components and it STILL doesn't work * alright stopwork for the 'night' * So this is the version that crashes * One step further in my descent to madness. * Alright, this should be working (Minus maybe profit_split) * Alright splitting up custom sales splits is broken right now. * Profit split works now. * Alright what the hell is going on here. * Revert "Alright what the hell is going on here." This reverts commit 6cb3b6eb56ea45ede3496bbe219ca18302c806e2. * Oh wait, I can do commit messages through VSC? * Adds a quick little box with all the shipping supplies you'll ever want, unwrapping signal * Added shipping box to all maps and the service/cargo lathes. * Fuck you mapmerge hook you ain't shit * Alright, yet another take of making it get rid of the pricetag * [3:43 PM] oranges: anturk is smart (This is true) * Tested, cleaned up component procs, and limits signals sent a bit. * Whoops * Other comments from Ninja over discord * Left in a comment line. * Fixes the issue with ind. barcodes, adds examine. * Well thank GOD the children wern't there to see it * Adds a do_after to prevent accidents. * Fixes merge conflicts * Fixes merge conflict. Twice in one day. * Fixes merge conflict. * one tiny bit of documentation * Travis play nice.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/datum/component/pricetag
|
||||
var/datum/bank_account/owner
|
||||
var/profit_ratio = 1
|
||||
|
||||
/datum/component/pricetag/Initialize(_owner,_profit_ratio)
|
||||
if(!isobj(parent)) //Has to account for both objects and sellable structures like crates.
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
owner = _owner
|
||||
if(_profit_ratio)
|
||||
profit_ratio = _profit_ratio
|
||||
RegisterSignal(parent, COMSIG_ITEM_SOLD, .proc/split_profit)
|
||||
RegisterSignal(parent, COMSIG_STRUCTURE_UNWRAPPED, .proc/Unwrapped)
|
||||
RegisterSignal(parent, COMSIG_ITEM_UNWRAPPED, .proc/Unwrapped)
|
||||
RegisterSignal(parent, COMSIG_ITEM_SPLIT_PROFIT, .proc/return_ratio)
|
||||
|
||||
/datum/component/pricetag/proc/Unwrapped()
|
||||
qdel(src) //Once it leaves it's wrapped container, the object in question should lose it's pricetag component.
|
||||
|
||||
/datum/component/pricetag/proc/split_profit(var/item_value)
|
||||
var/price = item_value
|
||||
if(price)
|
||||
var/adjusted_value = price*(profit_ratio/100)
|
||||
owner.adjust_money(adjusted_value)
|
||||
owner.bank_card_talk("Sale recorded. [adjusted_value] credits added to account.")
|
||||
return TRUE
|
||||
|
||||
/datum/component/pricetag/proc/return_ratio()
|
||||
return profit_ratio
|
||||
Reference in New Issue
Block a user