Rick's MLC Pay & Pump
О материале
«Rick's MLC Pay & Pump» — материал мастерской Project Zomboid. Карты, транспорт, оружие и моды для выживания. Данные Steam, описание автора и ссылка для установки через подписку. Совместимость редакцией не проверена.
Описание автора
"No dough, no go." - Quote from the Secure-Gas-And-Go Payments Processing Company
Gas pumps throughout the country have been updated to the finest level of secure payment possible. To use a gas pump you will require either a Credit Card with a non-zero balance, or cash Money. Each time you pick up a blank Credit Card an amount will be displayed in its description in your inventory. When you use the gas pump it will draw down any Credit Cards and then Money in your primary inventory. To aid in budgeting, any Credit Cards and Money in your backpacks or other packs will not be consumed.
There are sandbox options to all you to customise the cost of various fuels, and to set auto search for money in your bags.
This mod is @Nightscale's fault; many thanks for the idea and the specification. Many thanks to @Khontac for assistance and advice in designing the payments handling from the inventory.
Include the RicksMLC_PayAtThePump3rdPartyPatch if you use Treads and/or FuelAPI. This patch fixes a compatibility issue between Pay At The Pump and Treads and FuelAPI mods.
-----------------------------------------
-- Note for modders: To add mod support for your fuel TimedAction handling there are three API methods to call:
-- RicksMLC_PayAtPumpAPI.initPurchaseFuel(this)
-- Call in :new().
-- Checks the source is a fuel pump and initialise the pay amounts.
-- RicksMLC_PayAtPumpAPI.updateFuelPurchase(self, self.tankStart, self.tankTarget)
-- Call in :update().
-- Checks the funds balance and reduce any credit card funds by the delta fuel amount.
-- Note that the :perform() is not needed as the funds balance checking and reducing is handled in updateFuelPurchase.
-- RicksMLC_PayAtPumpAPI.handleEmergencyStop(self)
-- Call in :stop() and :complete().
-- Handles the take fuel action abort state by finishing the payment of the final amount.
--
-- You can see this implemented in the RicksMLC_PayAtPumpAPI.lua file:
-- \Workshop Files\Contents\mods\RicksMLC_PayAtThePump\common\media\lua\shared\RicksMLC_PayAtThePump.lua
--
-- Example: you have a mod that adds a new TimedAction called "ISTakeFuelModExample" which is similar to the vanilla ISTakeFuel.
-- You would add the following .lua module to your mod (with ISTakeFuelModExample replaced with your TimedAction name):
---------------------------------------------------------------------
-- ISTakeFuelModExample_RicksMLC_PayAtThePumpModCompatibility.lua
if not getActivatedMods():contains("RicksMLC_PayAtThePump") then return end
require "ISTakeFuelModExample"
require "RicksMLC_PayAtThePump"
local overrideISTakeFuelNew = ISTakeFuelModExample.new
function ISTakeFuelModExample:new(character, fuelStation, petrolCan, time)
local this = overrideISTakeFuelNew(self, character, fuelStation, petrolCan, time)
this.fuelType = "Gasoline"
-- Set the fuelType if needed.
-- Default is "Gasoline" if not set or set to none of the valid fuel types.
-- Valid Fuel types are:
-- "Gasoline"
-- "Diesel"
-- "LPG"
-- "Propane"
RicksMLC_PayAtPumpAPI.initPurchaseFuel(this)
return this
end
local overrideTakeFuelUpdate = ISTakeFuelModExample.update
function ISTakeFuelModExample.update(self)
overrideTakeFuelUpdate(self)
RicksMLC_PayAtPumpAPI.updateFuelPurchase(self, self.itemStart, self.itemTarget)
end
local overrideISTakeFuelStop = ISTakeFuelModExample.stop
function ISTakeFuelModExample.stop(self)
RicksMLC_PayAtPumpAPI.handleEmergencyStop(self)
overrideISTakeFuelStop(self)
end
local overrideISTakeFuelComplete = ISTakeFuelModExample.complete
function ISTakeFuelModExample.complete(self)
RicksMLC_PayAtPumpAPI.handleEmergencyStop(self)
overrideISTakeFuelComplete(self)
end
-------------------------------------------------------------
-- For mods which do not use the TimedAction approach the API can still be used to reduce funds
-- by calling RicksMLC_PayAtPumpAPI.payForFuel(fuelLitres, character, pricePerLitre)
-- eg:
local newTankAmount = gasTank:getContainerContentAmount() + fuelExtracted
local fuelUnpurchased, isOutOfMoney = RicksMLC_PayAtPumpAPI.payForFuel(fuelExtracted, character, pricePerLitre)
if isOutOfMoney then
-- remove the fuelUnpurchased from the new amount
newTankAmount = newTankAmount - fuelUnpurchased
shouldStop = true
end
gasTank:setContainerContentAmount(newTankAmount)
vehicle:transmitPartModData(gasTank)
------------------------------------------
Workshop ID: 3194049112 Mod ID: RicksMLC_PayAtThePump Mod ID: RicksMLC_PayAtThePump3rdPartyPatch
Как установить и запустить
Откройте оригинальную страницу в Steam Workshop, проверьте версию игры, зависимости и порядок загрузки в описании автора. Нажмите «Подписаться» и дождитесь загрузки Steam. Включите материал в меню модификаций или контента игры, если это требуется. Совместимость и запуск редакцией не проверены.