Corporations II: Adds corporate discounts to the traitor uplink (#10197)

* Adds corporate discounts to the traitor uplink

* Actually adds the manufacturing
This commit is contained in:
Nichlas Pihl
2020-11-01 19:13:57 +00:00
committed by GitHub
parent 21eec84e5f
commit 6e66e64e38
7 changed files with 96 additions and 16 deletions

View File

@@ -182,8 +182,9 @@ GLOBAL_LIST_EMPTY(uplinks)
continue
cat["items"] += list(list(
"name" = I.name,
"cost" = I.cost,
"cost" = I.manufacturer && user.mind.is_employee(I.manufacturer) ? CEILING(I.cost * 0.8, 1) : I.cost,
"desc" = I.desc,
"manufacturer" = I.manufacturer ? initial(I.manufacturer.name) : null,
))
data["categories"] += list(cat)
return data
@@ -219,10 +220,14 @@ GLOBAL_LIST_EMPTY(uplinks)
return
if (!user || user.incapacitated())
return
if(telecrystals < U.cost || U.limited_stock == 0)
return
telecrystals -= U.cost
if(U.manufacturer && user.mind.is_employee(U.manufacturer))
if(telecrystals < CEILING(U.cost*0.8, 1) || U.limited_stock == 0)
return
telecrystals -= CEILING(U.cost*0.8, 1)
else
if(telecrystals < U.cost || U.limited_stock == 0)
return
telecrystals -= U.cost
U.purchase(user, src)