Open jpcsupplies opened 8 years ago
Another less CPU heavy approach is designate certain ores as "junk ore" in NPC markets, and have them "gradually" drain away back into credits.
Eg, NPC market has 200 million stone ore? have the plugin convert a few hundred each tick back into NPC credits and remove them from the market stock until the amount is under half a million or whatever our overstock threshold is. This keeps money supply liquid, and we retain the players selling junk behaviour instead of them tossing out an airlock and messing up our sim speed with floaties.
For non junk ores we can implement an auto-sliding price scale that reduces the buy/sell prices to the point nobody would sell them anymore.. but just might buy some to sell to another trade station where they have a shortage and the price has risen..
If we have ambient traders too they could move overstocked ores to understocked markets as well.
See also #87 and #98 for similar type markup topics
Simplified ambient trade logic: When NPC market exists, and an item is substantially overstocked - check if the overstocked item is "junk ore" if so generate a random fake "sell" of that ore and covert it back to NPC funds and remove the sale qty from the market.
If it is not a "junk ore" check if other NPC markets exist, and if any are short of that item. If so randomly pick one of those NPC markets and spawn a trade ship in the overstocked trade region with velocity and vector set towards the understocked market. Randomly deduct a qty of that item from source market and add it to the transport ship temp zone.
Trade ship logic: a: its a temp portable trade zone - the transported qty of items is available for sale to anyone who comes near the ship while it is traveling. Prices should be set based on either origin or destination market. Whatever the best prices are. The temp tradezone should extend beyond 1000 metres (outside gun range) eg 1100 metres.
b: can we load a fraction of the transported item into a crate on the ship? (to allow/promote pirating)
c: if the temp portable tradezone overlaps the region of the understocked destination market it stops for 1 minute, the transported(and unsold) qty of items in the portable tradezone is added to the destination market stock, and then despawns and removes the temp portable tradezone ship.
d: there should be a limit of 1 transport ship at a time (For performance reasons)
e: the temp trade zone could be persistent and recycled for each delivery (linked to the ship)
f: if the transport is attacked it triggers a 50km mayday beacon message
g: if the crate with the fraction of items is compromised, (damaged, destroyed or ownership change) disable the temp trade zone. Stop ship, start a 5 minute timer. After 5 minutes despawn whatever is left of the ship and trigger a large warhead explosion event at its location after despawn. This explosion event follows the last location of the ship (so if it is towed watch out) the explosion can only be stopped if all owned blocks are changed to someone else. (so we need an npc owner to check for)
h: needless to say if the ship never arrives at its destination, the shipment never arrives.
i: probably need additional damage checks etc.. if the ship takes too long to arrive or gets stopped by crashing into something etc.
Alternate logic: admins can designate a ship as a transport.. instead of spawning/despawning it, it simply returns to its "home" market. Designation should probably involve targeting a crate and ship must have a beacon. (for the maydays)
I thought we had an issue logged for this already. Must have been a discussion on another issue.
Ambient Trader ships - Wishlist of Basic Logic - Spawn outside of player visual range near trade stations flagged for NPC restocking. They fly by the trade stations if they get there unmolested they restock/trade with the market at random. (be nice if you could designate landing points too but thats code heavy) They buy overstocked items, and restock understocked items. If they are attacked but still escape to fly by the station they may still buy or sell but at reduced quantities. If damaged they buy components (like they are making repairs) if not damaged they buy whatever has too much stock. When attacked they trigger a mayday message. If possible message triggers as chat message with a GPS point ? Can we limit this to a given faction or range ? If captured or destroyed no stock arrives at the trade station. If auto price scaling is in use, that base prices go up. When outside of player visual range auto despawn until next stock cycle. (Or if in visual range fake a jump and remove ship. to prevent pirates following them to next base) If more than one station is flagged for restocking it appears at the next one in the list (based on distance maybe?)
Random: if attacked too many times they start spawning with escorts?