-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
184 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
code/modules/admin/game_master/game_master_submenu/infest.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#define DEFAULT_SPAWN_HIVE_STRING XENO_HIVE_NORMAL | ||
|
||
/datum/game_master_submenu/infest | ||
tgui_menu_name = "GameMasterSubmenuInfest" | ||
tgui_menu_title = "Infest Control" | ||
|
||
/// Current selected hive for the embryo | ||
var/selected_hive = DEFAULT_SPAWN_HIVE_STRING | ||
|
||
/// Target growth stage for the embryo | ||
var/embryo_stage = 0 | ||
|
||
/datum/game_master_submenu/infest/ui_data(mob/user) | ||
. = ..() | ||
|
||
var/list/data = list() | ||
|
||
data["selected_hive"] = selected_hive | ||
data["embryo_stage"] = embryo_stage | ||
|
||
return data | ||
|
||
/datum/game_master_submenu/infest/ui_static_data(mob/user) | ||
. = ..() | ||
|
||
var/list/data = list() | ||
|
||
data["selectable_hives"] = ALL_XENO_HIVES | ||
|
||
return data | ||
|
||
/datum/game_master_submenu/infest/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) | ||
. = ..() | ||
|
||
switch(action) | ||
if("set_selected_hive") | ||
selected_hive = params["new_hive"] | ||
return TRUE | ||
|
||
if("set_embryo_stage") | ||
embryo_stage = params["stage"] | ||
return TRUE | ||
|
||
if("infest") | ||
setup_embryo() | ||
return TRUE | ||
|
||
if("clear_infest") | ||
remove_embryo() | ||
return TRUE | ||
|
||
if("burst") | ||
force_burst() | ||
return TRUE | ||
|
||
/datum/game_master_submenu/infest/proc/setup_embryo() | ||
var/obj/item/alien_embryo/infesting_embryo | ||
for(var/obj/item/alien_embryo/embryo in referenced_atom) //if this hive's embryo already exists, convert to larva and use it | ||
if(embryo.hivenumber == selected_hive) | ||
infesting_embryo = embryo | ||
else | ||
qdel(embryo) | ||
|
||
if(!infesting_embryo) //else, make a new one | ||
infesting_embryo = new /obj/item/alien_embryo(referenced_atom) | ||
infesting_embryo.hivenumber = selected_hive | ||
|
||
var/mob/living/carbon/human/infested_host = referenced_atom | ||
infested_host.species?.larva_impregnated(infesting_embryo) //Yautja handling | ||
|
||
infesting_embryo.stage = embryo_stage | ||
|
||
/datum/game_master_submenu/infest/proc/remove_embryo() | ||
for(var/obj/item/alien_embryo/embryo in referenced_atom) | ||
qdel(embryo) | ||
|
||
/datum/game_master_submenu/infest/proc/force_burst() | ||
var/mob/living/carbon/xenomorph/larva/infesting_larva = locate() in referenced_atom //if a larva already exists, use it | ||
if(infesting_larva) | ||
infesting_larva.chest_burst(referenced_atom) | ||
return | ||
|
||
for(var/obj/item/alien_embryo/embryo in referenced_atom) //else if this hive's embryo already exists, convert to larva and use it | ||
if(embryo.hivenumber == selected_hive) | ||
embryo.become_larva() | ||
infesting_larva = locate() in referenced_atom | ||
break | ||
if(infesting_larva) | ||
infesting_larva.chest_burst(referenced_atom) | ||
return | ||
|
||
infesting_larva = new /mob/living/carbon/xenomorph/larva(referenced_atom, null, selected_hive) //else, make a new larva | ||
var/mob/living/carbon/human/infested_host = referenced_atom | ||
infesting_larva.ckey = infested_host.ckey | ||
infesting_larva.chest_burst(referenced_atom) | ||
|
||
#undef DEFAULT_SPAWN_HIVE_STRING |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import { useBackend } from '../backend'; | ||
import { Stack, Dropdown, Button, Section, Slider } from '../components'; | ||
import { Window } from '../layouts'; | ||
|
||
export const GameMasterSubmenuInfest = (props, context) => { | ||
const { data, act } = useBackend(context); | ||
|
||
return ( | ||
<Window width={400} height={400}> | ||
<Window.Content scrollable> | ||
<Stack direction="column" vertical> | ||
<GameMasterSubmenuInfestInfestingPanel /> | ||
</Stack> | ||
</Window.Content> | ||
</Window> | ||
); | ||
}; | ||
|
||
export const GameMasterSubmenuInfestInfestingPanel = (props, context) => { | ||
const { data, act } = useBackend(context); | ||
|
||
return ( | ||
<Section title="Infesting"> | ||
<Stack direction="column" vertical> | ||
<Stack.Item> | ||
<Stack> | ||
<Stack.Item> | ||
<Dropdown | ||
options={data.selectable_hives} | ||
selected={data.selected_hive} | ||
width="15rem" | ||
onSelected={(new_hive) => { | ||
act('set_selected_hive', { new_hive }); | ||
}} | ||
/> | ||
</Stack.Item> | ||
</Stack> | ||
</Stack.Item> | ||
<Stack.Item mt={1}>Embryo Stage</Stack.Item> | ||
<Stack.Item> | ||
<Slider | ||
maxValue={5} | ||
minValue={0} | ||
stepPixelSize={40} | ||
value={data.embryo_stage} | ||
onChange={(e, stage) => { | ||
act('set_embryo_stage', { stage }); | ||
}} | ||
/> | ||
</Stack.Item> | ||
<Stack.Item> | ||
<Stack> | ||
<Stack.Item> | ||
<Button | ||
middle | ||
content="Set" | ||
onClick={() => { | ||
act('infest'); | ||
}} | ||
/> | ||
</Stack.Item> | ||
<Stack.Item> | ||
<Button | ||
middle | ||
content="Clear" | ||
onClick={() => { | ||
act('clear_infest'); | ||
}} | ||
/> | ||
</Stack.Item> | ||
</Stack> | ||
</Stack.Item> | ||
<Stack.Item> | ||
<Button | ||
middle | ||
content="Burst Now" | ||
onClick={() => { | ||
act('burst'); | ||
}} | ||
/> | ||
</Stack.Item> | ||
</Stack> | ||
</Section> | ||
); | ||
}; |