Skip to content

Commit

Permalink
more code , more fuel , more modules , more stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
MLGTASTICa committed Nov 28, 2023
1 parent 3cb524f commit e28a29a
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 34 deletions.
2 changes: 1 addition & 1 deletion code/modules/mechs/equipment/medical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
var/substract = clamp(pack.amount, 0, trauma_storage_max - trauma_charges_stored)
if(substract && pack.use(substract))
trauma_charges_stored += substract
to_chat(user, SPAN_NOTICE("You restock \the [src]'s internal medicine storage with \the [I]."))
to_chat(user, SPAN_NOTICE("You restock \the [src]'s internal medicine storage with \the [I], using [substract] charges."))


/obj/item/mech_equipment/auto_mender/installed(mob/living/exosuit/_owner, hardpoint)
Expand Down
109 changes: 91 additions & 18 deletions code/modules/mechs/equipment/utility.dm
Original file line number Diff line number Diff line change
Expand Up @@ -507,44 +507,77 @@
else
fuel_amount -= fuel_usage_per_tick

/obj/item/mech_equipment/power_generator/fueled/get_hardpoint_maptext()
return "[fuel_amount]/[fuel_max]"

/obj/item/mech_equipment/power_generator/fueled/plasma
name = "plasma powered mech-mountable power generator"
desc = "a plasma-fueled mech power generator , creates 1000 energy out of 1 sheet of plasma at a rate of 75"
generation_rate = 75
fuel_usage_per_tick = 1
// 10 sheets, enough for 10000 power
fuel_max = 133
desc = "a plasma-fueled mech power generator, creates 5 KW out of 1 sheet of plasma at a rate of 0.25 KW."
generation_rate = 250
// each sheet is 5000 watts
fuel_usage_per_tick = 50
// 1 sheet = 1000 fuel
// 35000 max power out of a fully loaded generator
fuel_max = 7000

/obj/item/mech_equipment/power_generator/fueled/plasma/attackby(obj/item/I, mob/living/user, params)
. = ..()
if(istype(I, /obj/item/stack/material/plasma))
var/obj/item/stack/material/plasma/stck = I
var/amount_to_use = round((fuel_max - fuel_amount)/13)
var/amount_to_use = round((fuel_max - fuel_amount)/1000)
amount_to_use = clamp(stck.amount, 0, amount_to_use)
if(amount_to_use && stck.use(amount_to_use))
fuel_amount += round(amount_to_use * 13)
fuel_amount += amount_to_use * 1000

/obj/item/mech_equipment/power_generator/fueled/welding
name ="welding fuel powered mech-mountable power generator"
desc = "a mech mounted generator that runs off welding fuel , each unit generates 25 charge"
generation_rate = 25
desc = "a mech mounted generator that runs off welding fuel, creates 1 KW out of 10 units of welding fuel, at a rate of 0.1 KW"
generation_rate = 100
fuel_usage_per_tick = 1
/// can generate 6250 power
fuel_max = 250
/// can generate 20000 power
fuel_max = 200
/// The "explosion" chamber , used for when the fuel is mixed with something else
var/datum/reagents/chamberReagent = null

/obj/item/mech_equipment/power_generator/fueled/welding/Initialize()
. = ..()
// max volume
create_reagents(200)
chamberReagent = new(1, src)

/obj/item/mech_equipment/power_generator/fueled/welding/attackby(obj/item/I, mob/living/user, params)
. = ..()
if(istype(I, /obj/item/stack/material/plasma))
var/obj/item/stack/material/plasma/stck = I
var/amount_to_use = round((fuel_max - fuel_amount)/13)
amount_to_use = clamp(stck.amount, 0, amount_to_use)
if(amount_to_use && stck.use(amount_to_use))
fuel_amount += round(amount_to_use * 13)
if(is_drainable(I) && I.reagents.total_volume)
I.reagents.trans_to_holder(reagents, 10, 1, FALSE)
else if(I.reagents && I.reagent_flags & REFILLABLE)
reagents.trans_to_holder(I.reagents, 10, 1 FALSE)

Check failure on line 553 in code/modules/mechs/equipment/utility.dm

View workflow job for this annotation

GitHub Actions / Run Linters

got '0', expected one of: operator, field access, ')', ','

/obj/item/mech_equipment/power_generator/fueled/welding/onMechTick()
chamberReagent.clear_reagents()
reagents.trans_to_holder(chamberReagent, 1, 1, FALSE)
if(chamberReagent.has_reagent("fuel"))
var/fuel = chamberReagent.get_reagent_amount("fuel")
// for the future just add any other reagent here with + * explosion_power_multiplier
var/explosives = chamberReagent.get_reagent_amount("plasma") * 3
if(explosives > 0.5)
// if its full plasma if just fucking blows instantly
health -= maxHealth * (explosives / 3)
if(health < 1)
owner.remove_system(src, null, TRUE)
qdel(src)
return
// min needed for combustion
if(fuel > 0.25)
var/amountReturned = internal_cell?.give(round(generation_rate * fuel))
// refund if none of it gets turned into power for qol reasons
if(amountReturned == generation_rate)
chamberReagent.trans_to_holder(reagents, 1, 1, FALSE)
fuel_amount = reagents.total_volume

/obj/item/mech_equipment/towing_hook
name = "mounted towing hook"
desc = "A mech mounted towing hook, usually found in cars. Can hook to anything that isn't anchored down."
icon_state = "mech_clamp"
icon_state = "mech_tow"
restricted_hardpoints = list(HARDPOINT_BACK)
restricted_software = list(MECH_SOFTWARE_UTILITY)
origin_tech = list(TECH_MATERIAL = 2, TECH_ENGINEERING = 2)
Expand Down Expand Up @@ -587,13 +620,53 @@
/obj/item/mech_equipment/towing_hook/afterattack(atom/movable/target, mob/living/user, inrange, params)
. = ..()
if(!istype(target))
to_chat(user, SPAN_NOTICE("You cannot hook onto this!"))
return
if(!currentlyTowing)
if(target.Adjacent(src.owner) && !target.anchored)
to_chat(user, SPAN_NOTICE("You hook \the [src] onto \the [target]!"))
currentlyTowing = target
RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(onTowingMove))
RegisterSignal(target, COMSIG_ATTEMPT_PULLING, PROC_REF(onTowingPullAttempt))
else if(currentlyTowing == target)
to_chat(user, SPAN_NOTICE("You unhook \the [src] from \the [target]."))
UnregisterSignal(currentlyTowing,list(COMSIG_MOVABLE_MOVED,COMSIG_ATTEMPT_PULLING))
currentlyTowing = null
else
to_chat(user, SPAN_NOTICE("You are already towing \the [currentlyTowing]. Unhook from it first by attacking it again!"))

/obj/item/mech_equipment/mounted_system/toolkit
name = "mounted toolkit"
desc = "A automatic suite of tools suited for installation on a mech."
icon_state = "mech_tools"
holding_type = /obj/item/tool/mech_kit
restricted_hardpoints = list(HARDPOINT_LEFT_HAND, HARDPOINT_RIGHT_HAND)
restricted_software = list(MECH_SOFTWARE_UTILITY)
origin_tech = list(TECH_ENGINEERING = 5, TECH_MAGNET = 2, TECH_MATERIAL = 2)
matter = list(MATERIAL_PLASTEEL = 25, MATERIAL_PLASTIC = 10, MATERIAL_SILVER = 5)

/obj/item/tool/mech_kit
name = "mech toolkit"
desc = "A robust selection of mech-sized tools."
icon_state = "engimplant="
force = WEAPON_FORCE_DANGEROUS
worksound = WORKSOUND_DRIVER_TOOL
flags = CONDUCT
tool_qualities = list(
QUALITY_SCREW_DRIVING = 70,
QUALITY_BOLT_TURNING = 70,
QUALITY_DRILLING = 10,
QUALITY_WELDING = 100,
QUALITY_CAUTERIZING = 5,
QUALITY_PRYING = 100,
QUALITY_DIGGING = 50,
QUALITY_PULSING = 50,
QUALITY_WIRE_CUTTING = 100,
QUALITY_HAMMERING = 75)
degradation = 0
workspeed = 1
max_upgrades = 1
spawn_blacklisted = TRUE



Expand Down
4 changes: 3 additions & 1 deletion code/modules/mechs/interface/screen_objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@
var/modifiers = params2list(params)
if(modifiers["ctrl"])
if(owner.hardpoints_locked) to_chat(usr, SPAN_WARNING("Hardpoint ejection system is locked."))
else if(owner.remove_system(hardpoint_tag)) to_chat(usr, SPAN_NOTICE("You disengage and discard the system mounted to your [hardpoint_tag] hardpoint."))
else if(owner.remove_system(hardpoint_tag))
icon_state = "hardpoint"
to_chat(usr, SPAN_NOTICE("You disengage and discard the system mounted to your [hardpoint_tag] hardpoint."))
else to_chat(usr, SPAN_DANGER("You fail to remove the system mounted to your [hardpoint_tag] hardpoint."))
else if(modifiers["shift"] && holding) holding.attack_self(usr)
else if(owner.selected_hardpoint == hardpoint_tag)
Expand Down
3 changes: 1 addition & 2 deletions code/modules/mechs/mech_construction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@
user.visible_message(SPAN_NOTICE("\The [user] begins trying to remove \the [system] from \the [src]."))
if(!do_after(user, delay, src) || hardpoints[system_hardpoint] != system) return 0

hardpoints[system_hardpoint] = null

if(system_hardpoint == selected_hardpoint) clear_selected_hardpoint()
hardpoints[system_hardpoint] = null

var/obj/item/mech_equipment/ME = system
if(istype(ME)) ME.uninstalled()
Expand Down
44 changes: 32 additions & 12 deletions code/modules/mechs/mech_interaction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -285,21 +285,41 @@
chosen = loadable_guns[chosen]
else
chosen = loadable_guns[loadable_guns[1]]
switch(chosen.loadMagazine(I,user))
if(-1)
to_chat(user, SPAN_NOTICE("\The [chosen] does not accept this type of magazine."))
if(0)
to_chat(user, SPAN_NOTICE("\The [chosen] has no slots left in its ammunition storage."))
if(1)
to_chat(user, SPAN_NOTICE("You load \the [I] into \the [chosen]."))
if(2)
to_chat(user, SPAN_NOTICE("You partially reload one of the existing ammo magazines inside of \the [chosen]."))

else if(user.a_intent != I_HURT)
if(chosen)
switch(chosen.loadMagazine(I,user))
if(-1)
to_chat(user, SPAN_NOTICE("\The [chosen] does not accept this type of magazine."))
if(0)
to_chat(user, SPAN_NOTICE("\The [chosen] has no slots left in its ammunition storage."))
if(1)
to_chat(user, SPAN_NOTICE("You load \the [I] into \the [chosen]."))
if(2)
to_chat(user, SPAN_NOTICE("You partially reload one of the existing ammo magazines inside of \the [chosen]."))

if(istype(I, /obj/item/stack/medical/advanced/bruise_pack))
var/list/choices = list()
for(var/hardpoint in hardpoints)
if(istype(hardpoints[hardpoint], /obj/item/mech_equipment/auto_mender))
var/obj/item/mech_equipment/auto_mender/mend = hardpoints[hardpoint]
choices["[hardpoin] - [mend.trauma_charges_stored]/[mend.trauma_storage_max] charges"] = mend

Check failure on line 304 in code/modules/mechs/mech_interaction.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined var: "hardpoin"
var/obj/item/mech_equipment/auto_mender/choice = null
if(!length(choices))
return
if(length(choices) == 1)
choice = choices[choices[1]]
else
var/chosenMender = input("Select mech mender to refill") as null|anything in choices
if(chosenMender)
choice = choices[chosenMender]
if(choice)
choice.attackby(I, user)
return

else if(user.a_intent != I_HELP)
if(attack_tool(I, user))
return
// we use BP_CHEST cause we dont need to convert targeted organ to mech format def zoning
else if(user.a_intent == I_HURT && !hatch_closed && get_dir(user, src) == reverse_dir[dir] && get_mob() && !(user in pilots) && user.targeted_organ == BP_CHEST)
else if(user.a_intent != I_HELP && !hatch_closed && get_dir(user, src) == reverse_dir[dir] && get_mob() && !(user in pilots) && user.targeted_organ == BP_CHEST)
var/mob/living/target = get_mob()
target.attackby(I, user)
return
Expand Down

0 comments on commit e28a29a

Please sign in to comment.