--
-- a service station
--

function node_service_ctor (self)

   self.name = "Service"
   self.price = math.floor (RN () * 30 + 60)
end

node_service = class (node, node_service_ctor)

function node_service:action (Action)

   -- service station has a few actions
   local T = ""

   if (not Action) then

      T = "You drive up to the pump and turn the car off. You can see a sweaty man in a tank top, half-asleep at this hour behind the counter.//"
         .. "The prices of gas here is " .. self.price .. " cents per litre"

   elseif ("fill" == Action) then

      T = "The greasy man fills your tank for you://"
         .. "``Listen, you look pretty bad. Gas is on me, OK?''//"
         .. "You can't believe you were just given free gasoline."
      cur_play.fuel_l = cur_play.car.max_fuel_l
      cur_play:experience ("freefuel")

   elseif ("leave" == Action) then

      T = "You pull out of the service station."
      local Roadstream = roadstream ()
      Roadstream:copy (cur_play.roadstream)
      cur_adventure:leave (Roadstream)

   end

   return T
end

function node_service:menu ()

   local T = "The greasy attendant comes comes to your car window, wiping his forehead on his kerchief://"
      .. "``Well, what'll it be?''"

   local M = {

      { "fill", "Fill 'er up" },
      { "leave", "Get outta here" },
   }

   return T, M
end
