mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-18 03:21:13 +01:00
Baystation12 merchant port (#3155)
Port of the merchant mechanics from baystation12. All of the trader, prices and most essential system are done, as well the job datum and the like. Mapping the shuttle, the base and a new dock will be done in a later pr. Also adds phazon construction and several other items used in this pr. The chance of the merchant slow being open at round start can be changed via the config, it is 20% by default.
This commit is contained in:
@@ -270,6 +270,8 @@ var/list/gamemode_cache = list()
|
||||
var/sun_accuracy = 8
|
||||
var/sun_target_z = 7
|
||||
|
||||
var/merchant_chance = 20 //Chance, in percentage, of the merchant job slot being open at round start
|
||||
|
||||
/datum/configuration/New()
|
||||
var/list/L = typesof(/datum/game_mode) - /datum/game_mode
|
||||
for (var/T in L)
|
||||
@@ -833,6 +835,9 @@ var/list/gamemode_cache = list()
|
||||
fastboot = TRUE
|
||||
world.log << "Fastboot is ENABLED."
|
||||
|
||||
if("merchant_chance")
|
||||
config.merchant_chance = text2num(value)
|
||||
|
||||
else
|
||||
log_misc("Unknown setting in configuration: '[name]'")
|
||||
|
||||
|
||||
@@ -66,6 +66,12 @@
|
||||
if (J.title == rank)
|
||||
return J
|
||||
|
||||
/datum/controller/subsystem/jobs/proc/ShouldCreateRecords(var/rank)
|
||||
if(!rank) return 0
|
||||
var/datum/job/job = GetJob(rank)
|
||||
if(!job) return 0
|
||||
return job.create_record
|
||||
|
||||
/datum/controller/subsystem/jobs/proc/GetPlayerAltTitle(mob/new_player/player, rank)
|
||||
. = player.client.prefs.GetPlayerAltTitle(GetJob(rank))
|
||||
|
||||
@@ -313,7 +319,7 @@
|
||||
|
||||
var/datum/job/job = GetJob(rank)
|
||||
var/list/spawn_in_storage = list()
|
||||
|
||||
|
||||
if(job)
|
||||
var/list/custom_equip_slots = list() //If more than one item takes the same slot, all after the first one spawn in storage.
|
||||
var/list/custom_equip_leftovers = list()
|
||||
@@ -676,7 +682,7 @@
|
||||
Debug("LS/([H]): Entry; rank=[rank]")
|
||||
|
||||
var/datum/spawnpoint/spawnpos
|
||||
|
||||
|
||||
if(H.client.prefs.spawnpoint)
|
||||
spawnpos = spawntypes[H.client.prefs.spawnpoint]
|
||||
|
||||
@@ -790,7 +796,7 @@
|
||||
else if (storage)
|
||||
storage += thing
|
||||
Debug("EC/([H]): Unable to equip [thing]; sending to storage.")
|
||||
|
||||
|
||||
Debug("EC/([H]): Complete.")
|
||||
return TRUE
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/var/global/datum/controller/subsystem/trade/SStrade
|
||||
|
||||
/datum/controller/subsystem/trade
|
||||
name = "Trade"
|
||||
wait = 1 MINUTE
|
||||
flags = SS_NO_TICK_CHECK
|
||||
var/list/traders = list() //List of all nearby traders
|
||||
|
||||
/datum/controller/subsystem/trade/New()
|
||||
NEW_SS_GLOBAL(SStrade)
|
||||
|
||||
/datum/controller/subsystem/trade/Initialize()
|
||||
for(var/i in 1 to rand(1,3))
|
||||
generateTrader(1)
|
||||
..()
|
||||
|
||||
/datum/controller/subsystem/trade/Recover()
|
||||
traders = SStrade.traders
|
||||
|
||||
/datum/controller/subsystem/trade/fire()
|
||||
for(var/a in traders)
|
||||
var/datum/trader/T = a
|
||||
if(!T.tick())
|
||||
traders -= T
|
||||
qdel(T)
|
||||
if(prob(100-traders.len*10))
|
||||
generateTrader()
|
||||
|
||||
/datum/controller/subsystem/trade/proc/generateTrader(var/stations = 0)
|
||||
var/list/possible = list()
|
||||
if(stations)
|
||||
possible += subtypesof(/datum/trader) - typesof(/datum/trader/ship)
|
||||
else
|
||||
if(prob(5))
|
||||
possible += subtypesof(/datum/trader/ship/unique)
|
||||
else
|
||||
possible += subtypesof(/datum/trader/ship) - typesof(/datum/trader/ship/unique)
|
||||
|
||||
for(var/i in 1 to 10)
|
||||
var/type = pick(possible)
|
||||
var/bad = 0
|
||||
for(var/trader in traders)
|
||||
if(istype(trader,type))
|
||||
bad = 1
|
||||
break
|
||||
if(bad)
|
||||
continue
|
||||
traders += new type
|
||||
return
|
||||
Reference in New Issue
Block a user