Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DNM]Vehicle fuel framework + ATVs use fuel now #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions code/modules/reagents/chemistry/reagents/other_reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1743,3 +1743,8 @@
M.adjustToxLoss(0.5*REM, 0)
. = 1
..()

/datum/reagent/fuel/biodiesel
name = "biodiesel"
id = "biodiesel"
description = "A measure of liquid biodiesel, good for running vehicles such as ATVs."
8 changes: 8 additions & 0 deletions code/modules/research/designs/biogenerator_designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,11 @@
materials = list(MAT_BIOMASS = 5)
build_path = /obj/item/stack/tile/carpet
category = list("initial","Misc")

/datum/design/biodiesel
name = "Biodiesel"
id = "biodiesel"
build_type = BIOGENERATOR
materials = list(MAT_BIOMASS = 100)
make_reagents = list("biodiesel" = 10)
category = list("initial","Misc")
11 changes: 11 additions & 0 deletions code/modules/vehicles/_vehicle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@
var/list/autogrant_actions_controller //assoc list "[bitflag]" = list(typepaths)
var/list/mob/occupant_actions //assoc list mob = list(type = action datum assigned to mob)
var/obj/vehicle/trailer
var/fueltype //what fuel do we use if we use fuel. if we don't use fuel this is null.
var/fueluse //how much fuel is consumed on a move proc
var/tanksize //size of the fuel tank

/obj/vehicle/Initialize(mapload)
. = ..()
if(fueltype && fueluse && tanksize)
create_reagents(tanksize) //fuel tank
occupants = list()
autogrant_actions_passenger = list()
autogrant_actions_controller = list()
Expand Down Expand Up @@ -106,9 +111,15 @@
return FALSE
if(!default_driver_move)
return
if(fueltype && fueluse)
if(reagents.get_reagent_amount(fueltype) < fueluse)
to_chat(user, "<span class='warning'>[src]'s engine sputters!</span>")
return
vehicle_move(direction)

/obj/vehicle/proc/vehicle_move(direction)
if(fueltype && fueluse)
reagents.remove_reagent("fueltype", fueluse)
if(lastmove + movedelay > world.time)
return FALSE
lastmove = world.time
Expand Down
3 changes: 3 additions & 0 deletions code/modules/vehicles/atv.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
icon_state = "atv"
key_type = /obj/item/key
var/static/mutable_appearance/atvcover
fueltype = "biodiesel"
fueluse = 0.25
tanksize = 100 //400 tiles movement on a single tank. 1k biomass needed to fill the tank.

/obj/vehicle/ridden/atv/Initialize()
. = ..()
Expand Down