jpcsupplies / Economy_mod

Basic Economy System for Space Engineers
13 stars 12 forks source link

ENH: financial bailout mode and/or savings/loans #74

Open jpcsupplies opened 8 years ago

jpcsupplies commented 8 years ago

As an extension to the Anti-Grief implications of the economy mod -

If a player joins, has no owned blocks, no faction, and a bank balance of zero; or less than the price of a drill, then grant them another 100 credits, or enough to buy a single drill. Alternately we could simply "grant" a player matching this criteria a drill, and touch nothing else financially.

This is obviously only needed in the case that spawning without tools or ships has been enabled in the dedicated server, and for whatever reason no supply of tools is otherwise available.

It should only be attached to an on server join or similar equivalent event to minimize abuse.

As such this represents a fairly low priority enhancement. - Particularly as on such a server they are probably out of drills for sale anyway - and we would also have to add a cheat to buying drills that allowed a player to buy a drill even if none are available if they are flagged as a player getting financial bail out. (ALTHOUGH the grant idea is probably a safer compromise)

jpcsupplies commented 8 years ago

Actually... scrap all that.. how hard would it be to record a players inventory so if they disconnect, the items they were carrying can be reclaimed back like offline trades? That means if a server is using economy as an anti-grief measure, losing all your money doesn't mean losing your tools on a crash.

Only tricky part is detecting if a player is in a cryo so as to prevent items duplicating when they reconnect and /claim what the cryo already puts back in their inventory.already.

midspace commented 8 years ago

It's a great idea (to put into Admin mod). Except we need a hook in SE to tell us when a player disconnects, when we can snapshot their inventory. That API doesn't exist curently, and has been asked about quite a few times.

jpcsupplies commented 8 years ago

for economy the items could be recorded during our data file save cycles, for admin mod setup a timer to save out inventory.. one or the other, since we cant have both doing it. Timer means worst case scenario an inventory timewarps on a crash.

If you want to do it admin mod side how about -

For detecting connects/disconnects just count the number of connected players, and their steam ids, compare to the previous check of connected players and their steam ids.. if it changes we know they/who disconnected. Only issue i see here is by the time we notice they disconnected we no longer have an inventory to backup, which takes back to periodic saves anyway?

A lesser evil is recording all players inventories, (maybe in the lcd refresh cycle of econ or your lcd stuff in admin) to memory. Combine that with the connected player count checks, if we detect a player left - save their last recorded inventory.

jpcsupplies commented 8 years ago

Loans? In the context of this mod we could also take another page from TTDLX and add a loan system ? Available funds to loan set by a rough evaluation of items owned by that player, divided by 4 or similar?

jpcsupplies commented 8 years ago

Loans logic outline: Conditions:

jpcsupplies commented 8 years ago

We could also have a smaller system for "free agent" miners or members of the default npc faction. Say a 5000 to 10,000 limit, + 10% of value of owned ships/stations.