Solarmoth Code Addition

Adds the Solarmoth to the game finally. Adds code for the Solargrub to also track an how much power it has arbitrarily drained. Can possibly be used for other things as well. A global variable has been added in the Solarmoth code that the Solargrub keeps track of to see how many Solarmoths there has been in the world. Only up to two moths can ever be spawned in the world before the rest of the grubs decide to no longer evolve.
This commit is contained in:
Razgriz
2019-03-20 17:01:17 -07:00
committed by GitHub
parent 36f30cd250
commit 3f5a8a8c8c
2 changed files with 155 additions and 7 deletions
@@ -17,11 +17,11 @@ List of things solar grubs should be able to do:
icon_state = "solargrub"
icon_living = "solargrub"
icon_dead = "solargrub-dead"
var/charge = null //CHOMPEDIT The amount of power we sucked off, in K as in THOUSANDS.
var/can_evolve = 1 //CHOMPEDIT VAR to decide whether this subspecies is allowed to become a queen
var/adult_form = null //CHOMPEDIT VAR that decides what mob the queen form is. ex /mob/living/simple_animal/retaliate/solarmoth
var/adult_form = "/mob/living/simple_animal/retaliate/solarmoth" //CHOMPEDIT VAR that decides what mob the queen form is. ex /mob/living/simple_animal/retaliate/solarmoth
faction = "grubs"
maxHealth = 50 //grubs can take a lot of harm
health = 50
@@ -61,7 +61,8 @@ List of things solar grubs should be able to do:
//VARS that were previously in LIFE but why tho, im porting all comments the original coder did too.
var/apc_drain_rate = 750 //Going to see if grubs are better as a minimal bother. previous value : 4000
var/powerdraw = 100000 // previous value 150000
/mob/living/simple_animal/retaliate/solargrub/PunchTarget()
if(target_mob&& prob(emp_chance))
target_mob.emp_act(4) //The weakest strength of EMP
@@ -71,7 +72,6 @@ List of things solar grubs should be able to do:
/mob/living/simple_animal/retaliate/solargrub/Life()
. = ..()
if(!. || ai_inactive) return
if(stance == STANCE_IDLE)
//first, check for potential cables nearby to powersink
var/turf/S = loc
@@ -86,7 +86,7 @@ List of things solar grubs should be able to do:
anchored = 1
PN = attached.powernet
PN.draw_power(powerdraw)
charge = charge + powerdraw/1000 //This adds raw powerdraw to charge(Charge is in Ks as in 1 = 1000)
charge = charge + (powerdraw/1000) //This adds raw powerdraw to charge(Charge is in Ks as in 1 = 1000)
for(var/obj/machinery/power/terminal/T in PN.nodes)
if(istype(T.master, /obj/machinery/power/apc))
var/obj/machinery/power/apc/A = T.master
@@ -98,6 +98,18 @@ List of things solar grubs should be able to do:
anchored = 0
PN = null
if(prob(2) && charge >= 16000 && can_evolve == 1 && moth_amount.len <= 2) //it's reading from the moth_amount global list to determine if it can evolve.
anchored = 0
PN = attached.powernet
death_star()
/mob/living/simple_animal/retaliate/solargrub/proc/death_star()
visible_message("<span class='warning'>\The [src]'s shell rips open and evolves!</span>")
new adult_form(get_turf(src))
qdel(src)
/mob/living/simple_animal/retaliate/solargrub //active noms
vore_bump_chance = 50
vore_bump_emote = "applies minimal effort to try and slurp up"
@@ -124,4 +136,4 @@ List of things solar grubs should be able to do:
. = ..()
if(. == 0 && !is_dead())
set_light(2.5, 1, COLOR_YELLOW)
return 1
return 1
@@ -0,0 +1,136 @@
/mob/living/simple_animal/retaliate/solarmoth
name = "solarmoth"
desc = "A majestic sparkling solarmoth. Also a slight engineering hazard."
icon = 'icons/mob/solarmoth.dmi' //all of these are placeholders
icon_state = "solarmoth"
icon_living = "solarmoth"
icon_dead = "solarmoth-dead"
faction = "grubs"
maxHealth = 500
health = 500
move_to_delay = 5
melee_damage_lower = 1
melee_damage_upper = 5
speak_chance = 1
emote_see = list("flutters")
speed = 3
meat_type = /obj/item/weapon/reagent_containers/food/snacks/meat/grubmeat
response_help = "pokes"
response_disarm = "pushes"
response_harm = "roughly pushes"
// solar moths are not affected by atmos
min_oxy = 0
max_oxy = 0
min_tox = 0
max_tox = 0
min_co2 = 0
max_co2 = 0
min_n2 = 0
max_n2 = 0
minbodytemp = 0
heat_damage_per_tick = 0 //Even if the atmos stuff doesn't work, at least it won't take any damage.
armor = list(
"melee" = 50,
"bullet" = 90,
"laser" = 100,
"energy" = 100,
"bomb" = 100,
"bio" = 100,
"rad" = 100)
var/set_temperature = T0C + 10000 //Sets the target point of 10k degrees celsius
var/heating_power = 100000 //This controls the strength at which it heats the environment.
var/emp_heavy = 2
var/emp_med = 4
var/emp_light = 7
var/emp_long = 10
var/poison_per_bite = 5 //grubs cause a shock when they bite someone
var/poison_type = "shockchem"
var/poison_chance = 50
var/emp_chance = 20 // Beware synths
isEdible = 0 //You can look, but you can't lick.
/mob/living/simple_animal/retaliate/solarmoth/PunchTarget()
if(target_mob&& prob(emp_chance))
target_mob.emp_act(4) //The weakest strength of EMP
visible_message("<span class='danger'>The moth releases a powerful shock!</span>")
..()
/mob/living/simple_animal/retaliate/solarmoth/PunchTarget()
. = ..()
if(isliving(.))
var/mob/living/L = .
if(L.reagents)
if(prob(poison_chance))
L << "<span class='warning'>You feel a shock rushing through your veins.</span>"
L.reagents.add_reagent(poison_type, poison_per_bite)
/mob/living/simple_animal/retaliate/solarmoth/Life()
. = ..()
if(icon_state != icon_dead)
var/datum/gas_mixture/env = loc.return_air() //Gets all the information on the local air.
var/transfer_moles = 0.25 * env.total_moles //The bigger the room, the harder it is to heat the room.
var/datum/gas_mixture/removed = env.remove(transfer_moles)
var/heat_transfer = removed.get_thermal_energy_change(set_temperature)
if(heat_transfer > 0 && env.temperature < T0C + 200) //This should start heating the room at a moderate pace up to 200 degrees celsius.
heat_transfer = min(heat_transfer , heating_power) //limit by the power rating of the heater
removed.add_thermal_energy(heat_transfer)
else if(heat_transfer > 0 && env.temperature < set_temperature) //Set temperature is 10,000 degrees celsius. So this thing will start cooking crazy hot between the temperatures of 200C and 10,000C.
heating_power = 9999999999999 //FLAME ON! This will make the moth heat up the room at an incredible rate.
heat_transfer = min(heat_transfer , heating_power) //limit by the power rating of the heater. Except it's hot, so yeah.
removed.add_thermal_energy(heat_transfer)
else
return
env.merge(removed)
var/global/list/moth_amount = list() //global moth list for the solargrub to read. Maybe want to transfer this to global variables file??
/mob/living/simple_animal/retaliate/solarmoth/New()
moth_amount += src //when this thing is created, it adds itself to the global list
. = ..()
/mob/living/simple_animal/retaliate/solarmoth/proc/explode()
src.anchored = 0
set_light(0)
if(empulse(src, emp_heavy, emp_med, emp_light, emp_long))
qdel(src)
return
/mob/living/simple_animal/retaliate/solarmoth/death()
explode()
..()
/mob/living/simple_animal/retaliate/solarmoth/gib() //This baby will explode no matter what you do to it.
explode()
..()
/mob/living/simple_animal/retaliate/solarmoth/handle_light()
. = ..()
if(. == 0 && !is_dead())
set_light(9.5, 1, COLOR_BLUE) //9.5 makes the brightness range super huge.
return 1
/mob/living/simple_animal/retaliate/solarmoth //active noms
vore_bump_chance = 50
vore_bump_emote = "applies minimal effort to try and slurp up"
vore_active = 1
vore_capacity = 1
vore_pounce_chance = 0 //moths only eat incapacitated targets. It's too lazy burning you to a crisp to try to pounce you
vore_default_mode = DM_DIGEST